diff options
Diffstat (limited to 'installation')
-rwxr-xr-x | installation/sdnc/src/main/scripts/addIpAddresses.sh | 33 | ||||
-rwxr-xr-x | installation/sdnc/src/main/scripts/addVnis.sh | 31 |
2 files changed, 64 insertions, 0 deletions
diff --git a/installation/sdnc/src/main/scripts/addIpAddresses.sh b/installation/sdnc/src/main/scripts/addIpAddresses.sh new file mode 100755 index 00000000..7c088a91 --- /dev/null +++ b/installation/sdnc/src/main/scripts/addIpAddresses.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +MYSQL_USER=${MYSQL_USER:-sdnctl} +MYSQL_PWD=${MYSQL_PWD:-gamma} +MYSQL_DB=${MYSQL_DB:-sdnctl} +MYSQL_HOST=${MYSQL_HOST:-dbhost} + +universe=$1 +subnet=$2 +start=$3 + +if [ $# -eq 3 ] +then + mysql --user=${MYSQL_USER} --password=${MYSQL_PWD} --host=${MYSQL_HOST} ${MYSQL_DB} <<EOF +INSERT INTO IPV4_ADDRESS_POOL VALUES('$aicSiteId', '$universe', 'AVAILABLE', '${subnet}.${start}'); +EOF +elif [ $# -eq 4 ] +then + stop=$4 + ip=$start + + while [ $ip -le $stop ] + do + mysql --user=${MYSQL_USER} --password=${MYSQL_PWD} --host=${MYSQL_HOST} ${MYSQL_DB} <<EOF +INSERT INTO IPV4_ADDRESS_POOL VALUES('$aicSiteId', '$universe', 'AVAILABLE','${subnet}.${ip}'); +EOF +ip=$(( ip+1 )) +done +else + echo "Usage: $0 universe subnet start [stop]" + exit 1 +fi + diff --git a/installation/sdnc/src/main/scripts/addVnis.sh b/installation/sdnc/src/main/scripts/addVnis.sh new file mode 100755 index 00000000..a8b50eb6 --- /dev/null +++ b/installation/sdnc/src/main/scripts/addVnis.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +MYSQL_USER=${MYSQL_USER:-sdnctl} +MYSQL_PWD=${MYSQL_PWD:-gamma} +MYSQL_DB=${MYSQL_DB:-sdnctl} +MYSQL_HOST=${MYSQL_HOST:-dbhost} + +start=$1 + +if [ $# -eq 1 ] +then + mysql --user=${MYSQL_USER} --password=${MYSQL_PWD} --host ${MYSQL_HOST} ${MYSQL_DB} <<EOF +INSERT INTO VLAN_ID_POOL (purpose, status, vlan_id) VALUES('VNI', 'AVAILABLE', $start); +EOF +elif [ $# -eq 2 ] +then + stop=$2 + vlanid=$start + + while [ $vlanid -le $stop ] + do + mysql --user=${MYSQL_USER} --password=${MYSQL_PWD} --host ${MYSQL_HOST} ${MYSQL_DB} <<EOF +INSERT INTO VLAN_ID_POOL (purpose, status, vlan_id) VALUES( 'VNI', 'AVAILABLE', $vlanid); +EOF +vlanid=$(( vlanid+1 )) +done +else + echo "Usage: $0 start [stop]" + exit 1 +fi + |