User Tools

Site Tools


wiki:sandbox

This is an old revision of the document!


OPNFV Sandbox

The OPNFV SandBox is intended to be a laptop compatible dev environment. The SandBox is currently under development. Get involved, download it and help evaluate, debug and improve! https://github.com/Aricg/PackStackSandBox

SandBox currently exists as a template for further sandbox work with packstack, it brings up two nodes on a machine with at least 8GB of memory. One controller and One Compute/Networking node. It is intended to be easy to modify to meet our/your needs. The nodes can be reached after vagrant up with vagrant ssh controller vagrant ssh compute

SandBox getting started

Set up your machine

You will need the right tools to get the SandBox up and running, the following are the key items needed to bring up the SandBox using vagrant and VirtualBox.

Get VirtualBox https://www.virtualbox.org/wiki/Downloads

Get Vagrant https://www.vagrantup.com/downloads.html

Install Ruby https://www.ruby-lang.org/en/installation

$: ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]  

Install vagrant-vbguest

vagrant plugin install vagrant-vbguest

Enable bridged mode on your local machine

$ brctl show
bridge name     bridge id               STP enabled     interfaces
docker0         8000.28d244719f30       no              enp0s25

Get the SandBox repo

  git clone https://github.com/Aricg/PackStackSandBox.git && cd PackStackSandBox

Setting up the SandBox

Once you have the right pieces in place you need to set up the SandBox configuration to match your local environment. This is done by configuring the Vagrantfile.yml file with the environment parameters will use for your SandBox environment.

Vagrantfile.yml

Modify Vagrantfile.yml to reflect the network avaliable to you. Note that the default configuration is based on having a /22 avaliable on my home network, you will need to reserve a /24 section of whatever network you are on so that we can create a route to the neutron router we later create. eg:

route add -net 192.168.x.0 netmask 255.255.255.0 gw 192.168.x.1 

Without this, you will not be able to route to your VMs. (Outbound traffic will still work)

Default working config:

bridge: docker0  
netmask: 255.255.252.0 
gateway: 192.168.0.1
neutron_router_start: 192.168.3.1
neutron_router_end: 192.168.3.128
controller:
  bridged_ip: 192.168.1.91
  private_ip: 192.168.22.92
compute:
  bridged_ip: 192.168.1.93
  private_ip: 192.168.22.94

Vagrantfile.yml Explanation

bridge: name of your bridge interface ($ brctl show )

netmask: netmask of your private subnet, probably given to you via dhcp. you can see this with ifconfig, however on osx if will be in the unreadble format, something like 0xffffff00 Refer here for a table that human can read. http://www.pawprint.net/designresources/netmask-converter.php Most home networks only give out a /24 you will need to log into your router and change your range to at least a /23 so that we an properly route to the router that neutron creates.

gateway: Your workstations gateway to the internet (your routers ip, this is also the ip you go to to increase your network size ) you can check this with ip r on linux or netstat -nr on osx

neutron_router_start: This will be the start of your openstack dhcp, I also use this to guess your neutron router gateway. Make it something that is routable but that none of your computers are using. eg: If my workstation and gateway(router) were in the 192.168.0.0/24 range I could make the neutron range inside 192.168.1.0/24 eg: 192.168.1.1-192.168.1.254

neutron_router_end: the end of the range explained above

controller:

bridged_ip: this interface should be given an ip on the same /24 as your workstation.

private_ip: this interface can have any ip you want, virtualbox deals with the routing.

compute:

bridged_ip: same rules as the controller bridged_ip but unique

private_ip: same rules as controller: private_ip but unique

Start the SandBox

Bring up the SandBox by launching the VM's through vagrant.

$ vagrant up

Set up your control node:

ssh into the vagrant controller (password is vagrant)

$ vagrant ssh controller

Once you have connected to the controller VM you will need run packstack, the environment variables you have prepared in the Vagrantfile.yml will be carried forward by Vagrant and used in the packstack scripts.

[vagrant@controller]# cd /vagrant
[vagrant@compute]# sudo bash
[root@compute]# packstack  --answer-file=ans.txt && cp /root/keystonerc_admin /vagrant

Set up your Network node

To setup networking, and launch the cirros minimal VM you must wait for the above operations to complete. (packstack and copying the keystonerc_admin) Once those are done, vagrant ssh into the networking (compute node):

$ vagrant ssh compute
[vagrant@compute]# sudo bash
[root@compute ]# cd /vagrant && ./SetupComputeNode

Trouble-shooting

Vagrant fails to execute when running vagrant up

Vagrant may exit with a syntax error

Message: undefined method `[]' for nil:NilClass

Try running the included ./testyaml you may need to install the ruby yaml library. On OSX this has not yet been solved and the workaround is to enter the configuration parameters in the Vagrantfile.yaml directly into the declarations at the start of the Vagrantfile.

Vagrant Can't download the box on OSX

If you see this error when running vagrant up the first time.

==> controller: Importing base box 'controller'...
Progress: 90%/Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:259:in `initialize': Permission denied - /PackStackSandBox/.vagrant/machines/controller/virtualbox/id (Errno::EACCES)

This has something (not sure what) to do with write authority on OSX, the workaround is to manually add the box using vagrant…

vagrant box add --name controller https://build.opnfv.org/downloads/controller.box 
vagrant init controller

Vagrant is unable to bring up the VM's

You may see this error when running vagrant up: (noticed on OSX)

PackStackSandBox$ vagrant up
Bringing machine 'controller' up with 'virtualbox' provider...
Bringing machine 'compute' up with 'virtualbox' provider...
/Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:295:in `unlink': Permission denied - /PackStackSandBox/.vagrant/machines/controller/virtualbox/id (Errno::EACCES)

In this case you can get around the problem by running as root:

PackStackSandBox$ sudo vagrant up

non-sudo-vagrant-user-fails

Neutron switch is unresponsive after restart

When restarting networking, the neutron switch become unresponsive, you'll need to restart various neutron components

service network restart
for i in dhcp-agent l3-agent metadata-agent openvswitch-agent; \
do service neutron-$i restart; done
neutron agent-list
#takes me 38 seconds before I can ping a the router

Caveats

Vagrant reconfigures the network device eth1 on boot. even tho I have managed set to false. You will need to run /vagrant/SetupComputeNodeAfterReboot each time the compute node is rebooted.

wiki/sandbox.1417199651.txt.gz · Last modified: 2014/11/28 18:34 by Aric Gardner