diff options
3 files changed, 56 insertions, 23 deletions
diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp b/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp index bace585..5a1fa66 100644 --- a/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp +++ b/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp @@ -40,7 +40,7 @@ class opnfv::odl_docker source => '/etc/puppet/modules/opnfv/scripts/stage_odl.sh', mode => 750, } - file { '/opt/opnfv/odl/config_net.sh': + file { '/opt/opnfv/odl/config_net_odl.sh': ensure => present, source => '/etc/puppet/modules/opnfv/scripts/config_net_odl.sh', mode => 750, diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh index 4a9dd43..145da80 100755 --- a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh +++ b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh @@ -6,24 +6,25 @@ # # Usage - Set / pass CONTROL_HOST to your needs # -CONTROL_HOST=172.30.9.70 +### SET THIS VALUE TO MATCH YOUR SYSTEM +CONTROL_HOST=192.168.0.2 +BR_EX_IP=172.30.9.70 # ENV source ~/openrc - # VARS ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini MODE=0 # FUNCTIONS - # Update ml2_conf.ini function update_ml2conf { echo "Backing up and modifying ml2_conf.ini" cp $ML2_CONF $ML2_CONF.bak sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF sed -i -e 's/tenant_network_types = flat,vlan,gre,vxlan/tenant_network_types = vxlan/g' $ML2_CONF + sed -i -e 's/bridge_mappings=physnet2:br-prv/bridge_mappings=physnet1:br-ex/g' $ML2_CONF echo "[ml2_odl]" >> $ML2_CONF echo "password = admin" >> $ML2_CONF echo "username = admin" >> $ML2_CONF @@ -56,6 +57,12 @@ function stop_neutron { fi } +function disable_agent { + echo "Disabling Neutron Plugin Agents from running" + service neutron-plugin-openvswitch-agent stop + echo 'manual' > /etc/init/neutron-plugin-openvswitch-agent.override +} + function verify_ML2_working { @@ -88,52 +95,73 @@ function stop_ovs { } +function start_ovs { + echo "Starting OVS" + service openvswitch-vswitch start + ovs-vsctl show +} + + function control_setup { echo "Modifying Controller" stop_neutron stop_ovs + disable_agent rm -rf /var/log/openvswitch/* mkdir -p /opt/opnfv/odl/ovs_back mv /etc/openvswitch/conf.db /opt/opnfv/odl/ovs_back/. mv /etc/openvswitch/.conf*lock* /opt/opnfv/odl/ovs_back/. + rm -rf /etc/openvswitch/conf.db + rm -rf /etc/openvswitch/.conf* service openvswitch-switch start - ovs-vsctl set-manager tcp:172.30.9.70:6640 - ovs-vsctl add-br br-eth0 ovs-vsctl add-br br-ex - ovs-vsctl add-port br-eth0 eth0 - ovs-vsctl add-port br-eth0 br-eth0--br-ex - ovs-vsctl add-port br-ex br-ex--br-eth0 - ovs-vsctl set interface br-ex--br-eth0 type=patch - ovs-vsctl set interface br-eth0--br-ex type=patch - ovs-vsctl set interface br-ex--br-eth0 options:peer=br-eth0--br-ex - ovs-vsctl set interface br-eth0--br-ex options:peer=br-ex--br-eth0 + ovs-vsctl add-port br-ex eth0 + ovs-vsctl set interface br-ex type=external ifconfig br-ex 172.30.9.70/24 up service neutron-server restart echo "setting up networks" ip link add link eth1 name br-mgmt type vlan id 300 + ifconfig br-mgmt `grep address /etc/network/interfaces.d/ifcfg-br-mgmt | awk -F" " '{print $2}'`/24 up arp ip link add link eth1 name br-storage type vlan id 301 - /etc/init.d/networking restart + ip link add link eth1 name br-prv type vlan id 1000 + ifconfig br-storage `grep address /etc/network/interfaces.d/ifcfg-br-storage | awk -F" " '{print $2}'`/24 up arp + ifconfig eth1 `grep address /etc/network/interfaces.d/ifcfg-br-fw-admin | awk -F" " '{print $2}'`/24 up arp + echo "Setting ODL Manager IP" + ovs-vsctl set-manager tcp:192.168.0.2:6640 - echo "Reset Neutron DB" - #reset_neutrondb - echo "Restarting Neutron Components" - #restart_neutron echo "Verifying ODL ML2 plugin is working" verify_ML2_working + # BAD HACK - Should be parameterized - this is to catch up + route add default gw 172.30.9.1 + +} + +function clean_ovs { + echo "cleaning OVS DB" + stop_ovs + rm -rf /var/log/openvswitch/* + mkdir -p /opt/opnfv/odl/ovs_back + cp -pr /etc/openvswitch/* /opt/opnfv/odl/ovs_back/. + rm -rf /etc/openvswitch/conf.db + echo "restarting OVS - you should see Nothing there" + start_ovs } function compute_setup { - echo "do compute stuff here" - echo "stopping neutron openvswitch plugin" + echo "Modifying Compute" + echo "Disabling neutron openvswitch plugin" stop_neutron + disable_agent ip link add link eth1 name br-mgmt type vlan id 300 - ifconfig br-mgmt `grep address /etc/network/interfaces.d/ifcfg-br-mgmt | awk -F" " '{print $2}'`/24 + ifconfig br-mgmt `grep address /etc/network/interfaces.d/ifcfg-br-mgmt | awk -F" " '{print $2}'`/24 up arp ip link add link eth1 name br-storage type vlan id 301 - ifconfig br-storage `grep address /etc/network/interfaces.d/ifcfg-br-storage | awk -F" " '{print $2}'`/24 - ifconfig eth1 `grep address /etc/network/interfaces.d/ifcfg-br-fw-admin | awk -F" " '{print $2}'`/24 + ip link add link eth1 name br-prv type vlan id 1000 + ifconfig br-storage `grep address /etc/network/interfaces.d/ifcfg-br-storage | awk -F" " '{print $2}'`/24 up arp + ifconfig eth1 `grep address /etc/network/interfaces.d/ifcfg-br-fw-admin | awk -F" " '{print $2}'`/24 up arp + echo "set manager, and route for ODL controller" ovs-vsctl set-manager tcp:192.168.0.2:6640 route add 172.17.0.1 gw 192.168.0.2 diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh index a7613c3..fa14b47 100755 --- a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh +++ b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh @@ -15,6 +15,7 @@ DNS=8.8.8.8 HOST_IP=`ifconfig br-ex | grep -i "inet addr" | awk -F":" '{print $2}' | awk -F" " '{print $1}'` + # DEBUG ECHOS echo $LOCALPATH echo $DOCKERBIN @@ -23,6 +24,10 @@ echo $DNS echo $HOST_IP +# Set DNS to someting external and default GW - ODL requires a connection to the internet +sed -i -e 's/nameserver 10.20.0.2/nameserver 8.8.8.8/g' /etc/resolv.conf +route delete default gw 10.20.0.2 +route add default gw 172.30.9.1 # Start Docker daemon and in background echo "Starting Docker" |