summaryrefslogtreecommitdiffstats
path: root/meta-openstack-compute-test-config
diff options
context:
space:
mode:
authorVu Tran <vu.tran@windriver.com>2014-05-23 22:10:37 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2014-05-26 11:30:08 -0400
commita1395e1fde90d4e56cabef5e783848d9b1c4262b (patch)
tree9a6a78d7413124b40089045e0c2c6b16441ea07b /meta-openstack-compute-test-config
parent4d8e797075343d7afa635e6f19ae0d3c41aef768 (diff)
downloadmeta-cloud-services-a1395e1fde90d4e56cabef5e783848d9b1c4262b.tar.gz
neutron compute test config
Create startup script on Compute side to create a flat network that is required by tempest. Signed-off-by: Vu Tran <vu.tran@windriver.com>
Diffstat (limited to 'meta-openstack-compute-test-config')
-rw-r--r--meta-openstack-compute-test-config/recipes-devtools/python/python-neutron/neutron-test-config.init57
-rw-r--r--meta-openstack-compute-test-config/recipes-devtools/python/python-neutron_git.bbappend20
2 files changed, 77 insertions, 0 deletions
diff --git a/meta-openstack-compute-test-config/recipes-devtools/python/python-neutron/neutron-test-config.init b/meta-openstack-compute-test-config/recipes-devtools/python/python-neutron/neutron-test-config.init
new file mode 100644
index 0000000..a8bae04
--- /dev/null
+++ b/meta-openstack-compute-test-config/recipes-devtools/python/python-neutron/neutron-test-config.init
@@ -0,0 +1,57 @@
1#!/bin/sh
2
3### BEGIN INIT INFO
4# Provides:
5# Required-Start: $remote_fs $network $syslog
6# Required-Stop: $remote_fs $syslog
7# Default-Start: 2 3 4 5
8# Default-Stop: 0 1 6
9# Short-Description: Neutron Test Config
10# Description: OpenStack Neutron Test Config
11### END INIT INFO
12
13
14OVS_NEUTRON_PLUGIN=/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
15
16
17start()
18{
19 local eth_dev="%NEUTRON_CONF_EXT_ETH_IF%"
20 local ip="%COMPUTE_IP%"
21 local ip_subnet="`echo $ip | cut -d '.' -f 1`.`echo $ip | cut -d '.' -f 2`.`echo $ip | cut -d '.' -f 3`"
22 if [ -z "$gate_way" ]; then
23 local gate_way="${ip_subnet}.1"
24 fi
25
26 sed -i "s/^# Example: network_vlan_ranges = physnet1:1000:2999/network_vlan_ranges = ph-eth0:1:1/" $OVS_NEUTRON_PLUGIN
27 sed -i "s/^network_vlan_ranges = .*/network_vlan_ranges = ph-eth0:1:1/" $OVS_NEUTRON_PLUGIN
28 sed -i "s/^# Example: bridge_mappings = physnet1:br-eth1/bridge_mappings = ph-eth0:br-eth0/" $OVS_NEUTRON_PLUGIN
29 sed -i "s/^bridge_mappings = .*/bridge_mappings = ph-eth0:br-eth0/" $OVS_NEUTRON_PLUGIN
30 sed -i "s/^local_ip = .*/local_ip = ${ip}/" $OVS_NEUTRON_PLUGIN
31
32 # Setup host OVS
33 ovs-vsctl add-br br-${eth_dev}
34 ovs-vsctl add-port br-${eth_dev} ${eth_dev}
35 ifconfig ${eth_dev} 0.0.0.0
36 ifconfig br-${eth_dev} ${ip}/16
37 route add default gw $gate_way
38
39 /etc/init.d/neutron-openvswitch-agent stop
40 /etc/init.d/nova-compute reload
41 /etc/init.d/neutron-openvswitch-agent start
42}
43
44case "$1" in
45 start)
46 start
47 ;;
48 stop|force-reload|restart|reload|status)
49 echo "WARNING: command $1 is not supported"
50 ;;
51 *)
52 echo "Usage: $0 {start|stop|force-reload|restart|reload|status}"
53 exit 1
54 ;;
55esac
56
57exit 0
diff --git a/meta-openstack-compute-test-config/recipes-devtools/python/python-neutron_git.bbappend b/meta-openstack-compute-test-config/recipes-devtools/python/python-neutron_git.bbappend
new file mode 100644
index 0000000..60e70fc
--- /dev/null
+++ b/meta-openstack-compute-test-config/recipes-devtools/python/python-neutron_git.bbappend
@@ -0,0 +1,20 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2
3SRC_URI += " file://neutron-test-config.init"
4
5NEUTRON_CONF_EXT_ETH_IF ?= "eth0"
6
7do_install_append() {
8 sed -e "s:%NEUTRON_CONF_EXT_ETH_IF%:${NEUTRON_CONF_EXT_ETH_IF}:g" -i ${WORKDIR}/neutron-test-config.init
9 sed -e "s:%COMPUTE_IP%:${COMPUTE_IP}:g" -i ${WORKDIR}/neutron-test-config.init
10 install -m 0755 ${WORKDIR}/neutron-test-config.init ${D}${sysconfdir}/init.d/neutron-test-config
11}
12
13PACKAGES += " ${SRCNAME}-test-config"
14FILES_${SRCNAME}-test-config = "${sysconfdir}/init.d/neutron-test-config"
15
16RDEPENDS_${SRCNAME}-tests += "${SRCNAME}-test-config"
17
18INITSCRIPT_PACKAGES += " ${SRCNAME}-test-config"
19INITSCRIPT_NAME_${SRCNAME}-test-config = "neutron-test-config"
20INITSCRIPT_PARAMS_${SRCNAME}-test-config = "defaults 95 10"