diff --git a/labs/config/openstack b/labs/config/openstack index 40367931..1e2446db 100644 --- a/labs/config/openstack +++ b/labs/config/openstack @@ -18,4 +18,8 @@ : ${EXTERNAL_NETWORK_GATEWAY:=192.168.100.1} : ${EXTERNAL_NETWORK_CIDR:=192.168.100.0/24} +# DEMO_NET +: ${TENANT_NETWORK_GATEWAY:=172.16.0.1} +: ${TENANT_NETWORK_CIDR:=172.16.0.0/24} + # vim: set ai ts=4 sw=4 et ft=sh: diff --git a/labs/config/scripts.controller b/labs/config/scripts.controller index 0749c93f..122a9279 100644 --- a/labs/config/scripts.controller +++ b/labs/config/scripts.controller @@ -10,6 +10,7 @@ scripts setup_cinder_volumes.sh scripts setup_horizon.sh scripts config_external_network.sh scripts config_demo_user.sh +scripts config_tenant_network.sh scripts shutdown.sh boot wait_for_shutdown diff --git a/labs/scripts/config_tenant_network.sh b/labs/scripts/config_tenant_network.sh new file mode 100755 index 00000000..f72662dd --- /dev/null +++ b/labs/scripts/config_tenant_network.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +TOP_DIR=$(cd $(dirname "$0")/.. && pwd) +source "$TOP_DIR/config/paths" +source "$CONFIG_DIR/credentials" +source "$LIB_DIR/functions.guest" +source "$CONFIG_DIR/demo-openstackrc.sh" +exec_logfile + +indicate_current_auto + +#------------------------------------------------------------------------------ +# +#------------------------------------------------------------------------------ + +echo "Creating the tenant network." +neutron net-create demo-net + +echo "Creating a subnet on the tenant network." +neutron subnet-create demo-net \ + --name demo-subnet \ + --gateway "$TENANT_NETWORK_GATEWAY" \ + "$TENANT_NETWORK_CIDR" + +echo "Creating a router on the tenant network." +neutron router-create demo-router + +echo "Attaching the router to the demo tenant subnet." +neutron router-interface-add demo-router demo-subnet + +echo "Attaching the router to the external network by setting it as the" \ + "gateway." +neutron router-gateway-set demo-router ext-net