-# get Keystone ip
-case "$HA_MODE" in
- "ha")
- KEYSTONE=$(cat bundles.yaml |shyaml get-value openstack-phase2.services.keystone.options.vip)
- ;;
- *)
- KEYSTONE=$(juju status keystone |grep public-address|sed -- 's/.*\: //')
- ;;
-esac
-
-
-# get controller IP
-case "$SDN_CONTROLLER" in
- "odl")
- SDN_CONTROLLER_IP=$(juju status odl-controller/0 |grep public-address|sed -- 's/.*\: //')
- ;;
- "onos")
- SDN_CONTROLLER_IP=$(juju status onos-controller/0 |grep public-address|sed -- 's/.*\: //')
- ;;
- *)
- SDN_CONTROLLER_IP='none'
- ;;
-esac
-SDN_PASSWORD='admin'
-
-# export the openrc file
-cat << EOF > $JOID_ADMIN_OPENRC
-export OS_USERNAME=admin
-export OS_PASSWORD=$OS_ADMIN_PASSWORD
-export OS_TENANT_NAME=admin
-export OS_AUTH_URL=http://$KEYSTONE:5000/v2.0
-export OS_REGION_NAME=Canonical
-export SDN_CONTROLLER=$SDN_CONTROLLER_IP
-export SDN_PASSWORD=$SDN_PASSWORD
-EOF
-
-##
-## Backup local juju env
-##
-
-echo "------ Backup Juju environment ------"
-cp environments.yaml $LAB_CONFIG/
-
-##
-## Basic test to return a realistic result to jenkins
-##
-
-echo "------ Do basic test ------"
-source $JOID_ADMIN_OPENRC
-curl -i -sw '%{http_code}' -H "Content-Type: application/json" -d "
-{ \"auth\": {
- \"identity\": {
- \"methods\": [\"password\"],
- \"password\": {
- \"user\": {
- \"name\": \"admin\",
- \"domain\": { \"id\": \"default\" },
- \"password\": \"$OS_ADMIN_PASSWORD\"
- }
- }
- }
- }
-}" http://$KEYSTONE:5000/v3/auth/tokens |grep "HTTP/1.1 20" 2>&1 >/dev/null;
-exit_on_error $? "Deploy FAILED to auth to openstack"
-
-
-##
-## Create external network if needed
-##
-
-# 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 ------"
-elif [[ "$DEPLOY_SCENARIO" =~ "onos" ]]; then
- echo "------ ONOS have created the external network, pass ------"
-else
- 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"
- neutron net-update $EXTNET_NAME --shared
- exit_on_error $? "External network sharing failed"