summaryrefslogtreecommitdiffstats
path: root/fuel
diff options
context:
space:
mode:
Diffstat (limited to 'fuel')
-rw-r--r--fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp7
-rw-r--r--fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/change.sh219
-rwxr-xr-xfuel/build/f_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh82
-rwxr-xr-xfuel/build/f_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh5
4 files changed, 285 insertions, 28 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..c286127 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,11 +40,16 @@ 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,
}
+ file { '/opt/opnfv/odl/change.sh':
+ ensure => present,
+ source => '/etc/puppet/modules/opnfv/scripts/change.sh',
+ mode => 750,
+ }
# fix failed to find the cgroup root issue
diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/change.sh b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/change.sh
new file mode 100644
index 0000000..f7f3d6e
--- /dev/null
+++ b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/change.sh
@@ -0,0 +1,219 @@
+#!/bin/bash
+# script to remove bridges and reset networking for ODL
+
+
+#VARS
+MODE=0
+DNS=8.8.8.8
+
+#ENV
+source ~/openrc
+
+# GET IPS for that node
+function get_ips {
+ BR_MGMT=`grep address /etc/network/ifcfg_backup/ifcfg-br-mgmt | awk -F" " '{print $2}'`
+ BR_STORAGE=`grep address /etc/network/ifcfg_backup/ifcfg-br-storage | awk -F" " '{print $2}'`
+ BR_FW_ADMIN=`grep address /etc/network/ifcfg_backup/ifcfg-br-fw-admin | awk -F" " '{print $2}'`
+ BR_EX=`grep address /etc/network/ifcfg_backup/ifcfg-br-ex | awk -F" " '{print $2}'`
+ DEF_NETMASK=255.255.255.0
+ DEF_GW=172.30.9.1
+}
+
+function backup_ifcfg {
+ echo " backing up "
+ mkdir -p /etc/network/ifcfg_backup
+ mv /etc/network/interfaces.d/ifcfg-br-ex /etc/network/ifcfg_backup/.
+ mv /etc/network/interfaces.d/ifcfg-br-fw-admin /etc/network/ifcfg_backup/.
+ mv /etc/network/interfaces.d/ifcfg-br-mgmt /etc/network/ifcfg_backup/.
+ mv /etc/network/interfaces.d/ifcfg-br-storage /etc/network/ifcfg_backup/.
+ mv /etc/network/interfaces.d/ifcfg-br-prv /etc/network/ifcfg_backup/.
+ mv /etc/network/interfaces.d/ifcfg-eth0 /etc/network/ifcfg_backup/.
+ mv /etc/network/interfaces.d/ifcfg-eth1 /etc/network/ifcfg_backup/.
+ rm -rf /etc/network/interfaces.d/ifcfg-eth1.300
+ rm -rf /etc/network/interfaces.d/ifcfg-eth1.301
+ rm -rf /etc/network/interfaces.d/ifcfg-eth1
+ rm -rf /etc/network/interfaces.d/ifcfg-eth0
+
+}
+
+
+function create_ifcfg_br_mgmt {
+ echo "migrating br_mgmt"
+ echo "auto eth1.300" >> /etc/network/interfaces.d/ifcfg-eth1.300
+ echo "iface eth1.300 inet static" >> /etc/network/interfaces.d/ifcfg-eth1.300
+ echo " address $BR_MGMT" >> /etc/network/interfaces.d/ifcfg-eth1.300
+ echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth1.300
+}
+
+function create_ifcfg_br_storage {
+ echo "migration br_storage"
+ echo "auto eth1.301" >> /etc/network/interfaces.d/ifcfg-eth1.301
+ echo "iface eth1.301 inet static" >> /etc/network/interfaces.d/ifcfg-eth1.301
+ echo " address $BR_STORAGE" >> /etc/network/interfaces.d/ifcfg-eth1.301
+ echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth1.301
+}
+
+function create_ifcfg_br_fw_admin {
+ echo " migratinng br_fw_admin"
+ echo "auto eth1" >> /etc/network/interfaces.d/ifcfg-eth1
+ echo "iface eth1 inet static" >> /etc/network/interfaces.d/ifcfg-eth1
+ echo " address $BR_FW_ADMIN" >> /etc/network/interfaces.d/ifcfg-eth1
+ echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth1
+}
+
+function create_ifcfg_eth0 {
+ echo "migratinng br-ex to eth0 - temporarily"
+ echo "auto eth0" >> /etc/network/interfaces.d/ifcfg-eth0
+ echo "iface eth0 inet static" >> /etc/network/interfaces.d/ifcfg-eth0
+ echo " address $BR_EX" >> /etc/network/interfaces.d/ifcfg-eth0
+ echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth0
+ echo " gateway $DEF_GW" >> /etc/network/interfaces.d/ifcfg-eth0
+}
+
+function set_mode {
+ if [ -d "/var/lib/glance/images" ]
+ then
+ echo " controller "
+ MODE=0
+ else
+ echo " compute "
+ MODE=1
+ fi
+}
+
+
+function stop_ovs {
+ echo "Stopping OpenVSwitch"
+ service openvswitch-switch stop
+
+}
+
+function start_ovs {
+ echo "Starting OVS"
+ service openvswitch-switch start
+ ovs-vsctl show
+}
+
+
+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 reboot_me {
+ reboot
+}
+
+function allow_challenge {
+ sed -i -e 's/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config
+ service ssh restart
+}
+
+function clean_neutron {
+ subnets=( `neutron subnet-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` )
+ networks=( `neutron net-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` )
+ ports=( `neutron port-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` )
+ routers=( `neutron router-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` )
+
+ #display all elements
+ echo "SUBNETS: ${subnets[@]} "
+ echo "NETWORKS: ${networks[@]} "
+ echo "PORTS: ${ports[@]} "
+ echo "ROUTERS: ${routers[@]} "
+
+
+ # get port and subnet for each router
+ for i in "${routers[@]}"
+ do
+ routerport=( `neutron router-port-list $i | awk -F" " '{print $2}' | grep -v id | sed '/^$/d' `)
+ routersnet=( `neutron router-port-list $i | awk -F" " '{print $8}' | grep -v fixed | sed '/^$/d' | sed 's/,$//' | sed -e 's/^"//' -e 's/"$//' `)
+ done
+
+ echo "ROUTER PORTS: ${routerport[@]} "
+ echo "ROUTER SUBNET: ${routersnet[@]} "
+
+ #remove router subnets
+ echo "router-interface-delete"
+ for i in "${routersnet[@]}"
+ do
+ neutron router-interface-delete ${routers[0]} $i
+ done
+
+ #remove subnets
+ echo "subnet-delete"
+ for i in "${subnets[@]}"
+ do
+ neutron subnet-delete $i
+ done
+
+ #remove nets
+ echo "net-delete"
+ for i in "${networks[@]}"
+ do
+ neutron net-delete $i
+ done
+
+ #remove routers
+ echo "router-delete"
+ for i in "${routers[@]}"
+ do
+ neutron router-delete $i
+ done
+
+ #remove ports
+ echo "port-delete"
+ for i in "${ports[@]}"
+ do
+ neutron port-delete $i
+ done
+
+ #remove subnets
+ echo "subnet-delete second pass"
+ for i in "${subnets[@]}"
+ do
+ neutron subnet-delete $i
+ done
+
+}
+
+function set_dns {
+ sed -i -e 's/nameserver 10.20.0.2/nameserver $DNS/g' /etc/resolv.conf
+}
+
+
+#OUTPUT
+
+function check {
+ echo $BR_MGMT
+ echo $BR_STORAGE
+ echo $BR_FW_ADMIN
+ echo $BR_EX
+}
+
+### MAIN
+
+
+set_mode
+backup_ifcfg
+get_ips
+create_ifcfg_br_mgmt
+create_ifcfg_br_storage
+create_ifcfg_br_fw_admin
+if [ $MODE == "0" ]
+then
+ create_ifcfg_eth0
+fi
+allow_challenge
+clean_ovs
+check
+reboot_me
+
+
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 d292acd..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,28 +6,29 @@
#
# 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
- cat "[ml2_odl]" >> $ML2_CONF
- cat "password = admin" >> $ML2_CONF
- cat "username = admin" >> $ML2_CONF
- cat "url = http://${CONTROL_HOST}:8080/controller/nb/v2/neutron" >> $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
+ echo "url = http://${CONTROL_HOST}:8080/controller/nb/v2/neutron" >> $ML2_CONF
}
function reset_neutrondb {
@@ -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 {
@@ -72,7 +79,7 @@ function verify_ML2_working {
function set_mode {
- if ls -l /var/lib/glance/images
+ if [ -d "/var/lib/glance/images" ]
then
echo "Controller Mode"
MODE=0
@@ -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-mgmt | 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"