blob: 05e4c12fc1b08b828afe383b2cadd74816b82554 [file] [log] [blame]
Zack Williamsf40f3ce2016-03-01 22:01:28 -07001#!/bin/bash
2
3source ~/admin-openrc.sh
4
5function create-flat-net {
6 NAME=$1
7 neutron net-show $NAME-net 2>&1 > /dev/null
8 if [ "$?" -ne 0 ]
9 then
10 neutron net-create --provider:physical_network=$NAME --provider:network_type=flat --shared $NAME-net
11 fi
12}
13
14function create-subnet {
15 NAME=$1
16 CIDR=$2
17 GW=$3
18
19 neutron subnet-show $NAME-net 2>&1 > /dev/null
20 if [ "$?" -ne 0 ]
21 then
22 neutron subnet-create $NAME-net --name $NAME-net $CIDR --gateway=$GW --disable-dhcp
23 fi
24}
25
26function create-subnet-no-gateway {
27 NAME=$1
28 CIDR=$2
29
30 neutron subnet-show $NAME-net 2>&1 > /dev/null
31 if [ "$?" -ne 0 ]
32 then
33 neutron subnet-create $NAME-net --name $NAME-net $CIDR --no-gateway --disable-dhcp
34 fi
35}
36
37create-flat-net nat
38create-subnet nat 172.16.0.0/16 172.16.0.1
39
40create-flat-net ext