Skip to content

Instantly share code, notes, and snippets.

Created August 30, 2016 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/e3080eb529675aba7c1a89f79dace060 to your computer and use it in GitHub Desktop.
Save anonymous/e3080eb529675aba7c1a89f79dace060 to your computer and use it in GitHub Desktop.
#!/bin/bash
set +x
set -e
cd /home/vagrant/devstack || { echo "cannot cd into devstack dir"; exit 1; }
source openrc admin admin
set -x
neutron net-list
# Create an ssh key, if there is not one yet
if [[ ! -f id_rsa_demo ]]; then
nova keypair-add demo > id_rsa_demo
chmod 600 id_rsa_demo
fi
DEF_SG=$( neutron security-group-list -f value -c id -c name | grep default | head -1 | awk '{print $1}')
neutron security-group-rule-create --direction ingress --protocol icmp --remote-ip-prefix '0.0.0.0/0' ${DEF_SG}
neutron security-group-rule-create --direction ingress --protocol tcp --remote-ip-prefix '0.0.0.0/0' ${DEF_SG}
neutron router-create rtr
neutron net-create net1
neutron subnet-create net1 10.1.0.0/24 --name subnet1
neutron router-interface-add rtr subnet1
neutron net-create net2
neutron subnet-create net2 10.2.0.0/24 --name subnet2
neutron router-interface-add rtr subnet2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment