epcim
3/26/2015 - 11:35 PM

contrail-all-in-one-in-vm

contrail-all-in-one-in-vm

Following steps are needed in a VM environment for contrail all-in-one (assuming trusty r201)
sudo apt-get –y install curl
prep right hostname without this fab get_all_time fails
echo "127.0.0.1 $(hostname)" >>  /etc/hosts
prep keys WARNING do not do this if there is already id_rsa key.
ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
point to repo and install fabric
curl -L http://www.opencontrail.org/ubuntu-repo/repo_key | sudo apt-key add -
curl -L http://www.opencontrail.org/ubuntu-repo/add-apt-and-update | sudo OPENSTACK=icehouse CONTRAIL=r201 DISTRO=ubuntu1404 sh
curl -L http://www.opencontrail.org/ubuntu-repo/install-tools-key-and-prep | sudo sh
prep testbed file
cp /opt/contrail/utils/fabfile/testbeds/testbed_singlebox_example.py /opt/contrail/utils/fabfile/testbeds/testbed.py
sed -i 's/1.1.1.1/127.0.0.1/g' /opt/contrail/utils/fabfile/testbeds/testbed.py
sed -i "s/host1 = 'root@127.0.0.1'/&\nhost1_compute = 'root@<ip>'/" /opt/contrail/utils/fabfile/testbeds/testbed.py

< REPLACE with ip of eth0 or eth1 as case may be >

sed -i "s/    'compute': \[host1\],/    'compute': \[host1_compute\],/" /opt/contrail/utils/fabfile/testbeds/testbed.py
contrail-webui needs specific version of nodejs
apt-get install nodejs=0.8.15-1contrail1
install packages
cd /opt/contrail/utils && fab install_contrail
set workers to 1 to reduce load on all-in-one
sed -i 's/40$/1/' /opt/contrail/bin/nova-server-setup.sh
provision
cd /opt/contrail/utils && fab setup_all:reboot='False'

< REMOVE /etc/network/interfaces.d/.cfg where physintf is eth0 or eth1 as case may be >

pre fab-setup fixups
# fab setup_all seems to be starting neutron before setting port
# causing conflict with haproxy. so set port here itself
openstack-config --set /etc/neutron/neutron.conf DEFAULT bind_port 9697
fab does its thing
fab setup_all:reboot='False'

< VERIFY /etc/network/interfaces that vhost0 config is ok >

fetch the firstboot file to fixup vhost0's ip and agent config and add it to rc.local
curl -L https://raw.githubusercontent.com/ajayhn/userdata-scripts/master/raw/firstboot_compute.sh > /etc/contrail/firstboot.sh
echo "reboot" >> /etc/contrail/firstboot.sh
chmod a+x /etc/contrail/firstboot.sh
sed -i 's#^exit 0#\(/etc/contrail/firstboot.sh)\n&#' /etc/rc.local
disable cloud-init networking
sed -i 's/dowait .*/#&/' /etc/init/cloud-init-nonet.conf
disable cloud-init
for x in $(ls /etc/init/cloud*.conf); do echo manual >> $(echo $x | sed 's/\.conf/\.override/'); done
finally reboot. firstboot will fixup and do one more reboot and then everything should be up.
reboot