aboutsummaryrefslogtreecommitdiffstats
path: root/vnfs/vFW/scripts/v_sink_install.sh
diff options
context:
space:
mode:
authorMarco Platania <platania@research.att.com>2017-06-05 15:35:45 -0400
committerMarco Platania <platania@research.att.com>2017-06-05 15:35:45 -0400
commit9f94d8c2fd838c1607f630dfdd5f936605d9873f (patch)
treea9d3150f74a788bdb829e8a8dd6f95d722ca4af4 /vnfs/vFW/scripts/v_sink_install.sh
parenta8a9fec9dd7ab059c46a686d81a9b2c41537d6b8 (diff)
Parametrize CIDR and Netmask in the demos
Change-Id: I01f46fc1ee5cd1774e3db2e3381081dc9fc4c967 Signed-off-by: Marco Platania <platania@research.att.com>
Diffstat (limited to 'vnfs/vFW/scripts/v_sink_install.sh')
-rw-r--r--vnfs/vFW/scripts/v_sink_install.sh24
1 files changed, 18 insertions, 6 deletions
diff --git a/vnfs/vFW/scripts/v_sink_install.sh b/vnfs/vFW/scripts/v_sink_install.sh
index 32c6167f..71bab414 100644
--- a/vnfs/vFW/scripts/v_sink_install.sh
+++ b/vnfs/vFW/scripts/v_sink_install.sh
@@ -4,6 +4,14 @@ REPO_URL_BLOB=$(cat /opt/config/repo_url_blob.txt)
INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt)
CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
+# Convert Network CIDR to Netmask
+cdr2mask () {
+ # Number of args to shift, 255..255, first non-255 byte, zeroes
+ set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
+ [ $1 -gt 1 ] && shift $1 || shift
+ echo ${1-0}.${2-0}.${3-0}.${4-0}
+}
+
# OpenStack network configuration
if [[ $CLOUD_ENV == "openstack" ]]
then
@@ -15,18 +23,22 @@ then
MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
- VSN_PRIVATE_IP_O=$(cat /opt/config/vsn_private_ip_0.txt)
+ IP=$(cat /opt/config/vsn_private_ip_0.txt)
+ BITS=$(cat /opt/config/protected_private_net_cidr.txt | cut -d"/" -f2)
+ NETMASK=$(cdr2mask $BITS)
echo "auto eth1" >> /etc/network/interfaces
echo "iface eth1 inet static" >> /etc/network/interfaces
- echo " address $VSN_PRIVATE_IP_O" >> /etc/network/interfaces
- echo " netmask 255.255.255.0" >> /etc/network/interfaces
+ echo " address $IP" >> /etc/network/interfaces
+ echo " netmask $NETMASK" >> /etc/network/interfaces
echo " mtu $MTU" >> /etc/network/interfaces
- VSN_PRIVATE_IP_1=$(cat /opt/config/vsn_private_ip_1.txt)
+ IP=$(cat /opt/config/vsn_private_ip_1.txt)
+ BITS=$(cat /opt/config/onap_private_net_cidr.txt | cut -d"/" -f2)
+ NETMASK=$(cdr2mask $BITS)
echo "auto eth2" >> /etc/network/interfaces
echo "iface eth2 inet static" >> /etc/network/interfaces
- echo " address $VSN_PRIVATE_IP_1" >> /etc/network/interfaces
- echo " netmask 255.255.255.0" >> /etc/network/interfaces
+ echo " address $IP" >> /etc/network/interfaces
+ echo " netmask $NETMASK" >> /etc/network/interfaces
echo " mtu $MTU" >> /etc/network/interfaces
ifup eth1