blob: 05e4c12fc1b08b828afe383b2cadd74816b82554 [file] [log] [blame]
Andy Bavier8cca3472015-04-15 16:55:38 -04001#!/bin/bash
Andy Bavier8d51c6c2015-04-01 11:40:22 -04002
Andy Bavier8cca3472015-04-15 16:55:38 -04003source ~/admin-openrc.sh
Andy Bavier8d51c6c2015-04-01 11:40:22 -04004
Andy Baviercccf27b2015-08-17 14:48:29 -04005function 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}
Andy Bavier8d51c6c2015-04-01 11:40:22 -040013
Andy Baviercccf27b2015-08-17 14:48:29 -040014function create-subnet {
15 NAME=$1
16 CIDR=$2
17 GW=$3
Andy Bavier8d51c6c2015-04-01 11:40:22 -040018
Andy Baviercccf27b2015-08-17 14:48:29 -040019 neutron subnet-show $NAME-net 2>&1 > /dev/null
20 if [ "$?" -ne 0 ]
21 then
Andy Bavier000adf12015-09-17 16:21:39 -040022 neutron subnet-create $NAME-net --name $NAME-net $CIDR --gateway=$GW --disable-dhcp
Andy Baviercccf27b2015-08-17 14:48:29 -040023 fi
24}
Andy Bavier8d51c6c2015-04-01 11:40:22 -040025
Andy Baviercccf27b2015-08-17 14:48:29 -040026function create-subnet-no-gateway {
27 NAME=$1
28 CIDR=$2
Andy Bavier8d51c6c2015-04-01 11:40:22 -040029
Andy Baviercccf27b2015-08-17 14:48:29 -040030 neutron subnet-show $NAME-net 2>&1 > /dev/null
31 if [ "$?" -ne 0 ]
32 then
Andy Bavier000adf12015-09-17 16:21:39 -040033 neutron subnet-create $NAME-net --name $NAME-net $CIDR --no-gateway --disable-dhcp
Andy Baviercccf27b2015-08-17 14:48:29 -040034 fi
35}
36
37create-flat-net nat
38create-subnet nat 172.16.0.0/16 172.16.0.1
39
40create-flat-net ext