summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Blaisonneau <david.blaisonneau@orange.com>2016-01-11 16:00:21 +0100
committerDavid Blaisonneau <david.blaisonneau@orange.com>2016-01-11 16:00:21 +0100
commit3a3abcfd016d0888329d5bcc67385fb8abee73b7 (patch)
treed44f07412c25b120929ec90082cc366ed2982978
parenta4dc79e0f6fe52628c2d07f394006d320f9a9972 (diff)
joid: Add external network creation
Change-Id: I72a902b9de735d9962de1f83b81ada9aa1848783 Signed-off-by: David Blaisonneau <david.blaisonneau@orange.com>
-rw-r--r--jjb/joid/joid-deploy.sh64
-rw-r--r--jjb/opnfv/installer-params.yml4
-rw-r--r--jjb/opnfv/slave-params.yml5
3 files changed, 55 insertions, 18 deletions
diff --git a/jjb/joid/joid-deploy.sh b/jjb/joid/joid-deploy.sh
index 1348ca0be..e23afac1c 100644
--- a/jjb/joid/joid-deploy.sh
+++ b/jjb/joid/joid-deploy.sh
@@ -5,6 +5,19 @@ set -o nounset
PWD_FILENAME="passwords.sh"
##
+##
+##
+function exit_on_error {
+ RES=$1
+ MSG=$2
+ if [ $RES != 0 ]; then
+ echo "FAILED - $MSG"
+ exit $RES
+ fi
+}
+
+
+##
## Create LAB_CONFIG folder if not exists
##
mkdir -p $LAB_CONFIG
@@ -49,11 +62,7 @@ else
sed -i -- "s/password: ubuntu/password: $MAAS_PASSWORD/" $MAASCONFIG
echo "------ Redeploy MAAS ------"
./02-maasdeploy.sh $POD_NAME
- RES=$?
- if [ $RES != 0 ]; then
- echo "MAAS Deploy FAILED"
- exit $RES
- fi
+ exit_on_error $? "MAAS Deploy FAILED"
fi
##
@@ -92,11 +101,7 @@ echo "------ Deploy with juju ------"
echo "Execute: ./deploy.sh -t $HA_MODE -o $OS_RELEASE -s $SDN_CONTROLLER -l $POD_NAME"
./deploy.sh -t $HA_MODE -o $OS_RELEASE -s $SDN_CONTROLLER -l $POD_NAME
-RES=$?
-if [ $RES != 0 ]; then
- echo "Deploy FAILED"
- exit $RES
-fi
+exit_on_error $? "Main deploy FAILED"
##
## Set Admin RC
@@ -141,10 +146,39 @@ curl -i -sw '%{http_code}' -H "Content-Type: application/json" -d "
}
}
}" http://$KEYSTONE:5000/v3/auth/tokens |grep "HTTP/1.1 20" 2>&1 >/dev/null;
-RES=$?
-if [ $RES == 0 ]; then
- echo "Deploy SUCCESS"
+exit_on_error $? "Deploy FAILED to auth to openstack"
+
+
+##
+## Create external network if needed
+##
+
+EXTERNAL_NETWORK=${EXTERNAL_NETWORK:-}
+# split EXTERNAL_NETWORK=name;type;first ip;last ip; gateway;network
+IFS=';' read -r -a EXTNET <<< "$EXTERNAL_NETWORK"
+EXTNET_NAME=${EXTNET[0]}
+EXTNET_TYPE=${EXTNET[1]}
+EXTNET_FIP=${EXTNET[2]}
+EXTNET_LIP=${EXTNET[3]}
+EXTNET_GW=${EXTNET[4]}
+EXTNET_NET=${EXTNET[5]}
+# If we have more information than only the name, try to create it
+if [ -z "$EXTNET_TYPE" ]; then
+ echo "------ No data for external network creation, pass ------"
else
- echo "Deploy FAILED to auth to openstack"
+ echo "------ External network creation ------"
+ neutron net-create $EXTNET_NAME --router:external True \
+ --provider:physical_network external --provider:network_type $EXTNET_TYPE
+ exit_on_error $? "External network creation failed"
+ neutron subnet-create $EXTNET_NAME --name $EXTNET_NAME \
+ --allocation-pool start=$EXTNET_FIP,end=$EXTNET_LIP \
+ --disable-dhcp --gateway $EXTNET_GW $EXTNET_NET
+ exit_on_error $? "External subnet creation failed"
fi
-exit $RES
+
+##
+## Exit success
+##
+
+echo "Deploy success"
+exit 0
diff --git a/jjb/opnfv/installer-params.yml b/jjb/opnfv/installer-params.yml
index b8d729796..4980889fd 100644
--- a/jjb/opnfv/installer-params.yml
+++ b/jjb/opnfv/installer-params.yml
@@ -99,8 +99,8 @@
description: 'OpenStack release (kilo|liberty)'
- string:
name: EXTERNAL_NETWORK
- default: 'net04_ext'
- description: 'external network for test'
+ default: ext-net;flat;192.168.0.2;192.168.0.253;192.168.0.1;192.168.0.0/24
+ description: "External network to create (name;type;first ip;last ip; gateway;network)"
- string:
name: CEPH_DISKS
default: '/srv'
diff --git a/jjb/opnfv/slave-params.yml b/jjb/opnfv/slave-params.yml
index 6dc0a2591..734343d88 100644
--- a/jjb/opnfv/slave-params.yml
+++ b/jjb/opnfv/slave-params.yml
@@ -374,6 +374,10 @@
name: CEPH_DISKS_CONTROLLERS
default: /dev/sdb
description: "Disks to use by ceph on controler nodes (space separated list)"
+ - string:
+ name: EXTERNAL_NETWORK
+ default: ext-net;flat;161.105.231.2;161.105.231.62;161.105.231.1;161.105.231.0/26
+ description: "External network to create (name;type;first ip;last ip; gateway;network)"
- parameter:
name: 'orange-test1-defaults'
@@ -427,4 +431,3 @@
name: SSH_KEY
default: /root/.ssh/id_rsa
description: 'SSH key to use for Apex'
-