enable no floating IPs in install scripts 47/3747/1
authorMarco Platania <platania@research.att.com>
Fri, 28 Apr 2017 14:14:15 +0000 (10:14 -0400)
committerMarco Platania <platania@research.att.com>
Fri, 28 Apr 2017 14:14:15 +0000 (10:14 -0400)
Change-Id: Iec5a16e401d7c1f581f05a4b7a9b8ee2708cd4e3
Signed-off-by: Marco Platania <platania@research.att.com>
12 files changed:
boot/aai_install.sh
boot/appc_install.sh
boot/asdc_install.sh
boot/dcae_install.sh
boot/dns_install.sh
boot/mr_install.sh
boot/mso_install.sh
boot/policy_install.sh
boot/portal_install.sh
boot/robot_install.sh
boot/sdnc_install.sh
boot/vid_install.sh

index cf9043b..255e0bd 100644 (file)
@@ -7,11 +7,38 @@ DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt)
 CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
 
 # Add host name to /etc/host to avoid warnings in openstack images
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
        echo 127.0.0.1 $(hostname) >> /etc/hosts
 fi
 
+# Set private IP in /etc/network/interfaces manually in the presence of public interface
+# Some VM images don't add the private interface automatically, we have to do it during the component installation
+if [[ $CLOUD_ENV == "openstack_nofloat" ]]
+then
+       LOCAL_IP=$(cat /opt/config/local_ip_addr.txt)
+       CIDR=$(cat /opt/config/oam_network_cidr.txt)
+       BITMASK=$(echo $CIDR | cut -d"/" -f2)
+
+       # Compute the netmask based on the network cidr
+       if [[ $BITMASK == "8" ]]
+       then
+               NETMASK=255.0.0.0
+       elif [[ $BITMASK == "16" ]]
+       then
+               NETMASK=255.255.0.0
+       elif [[ $BITMASK == "24" ]]
+       then
+               NETMASK=255.255.255.0
+       fi
+
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $LOCAL_IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       ifup eth1
+fi
+
 # Download dependencies
 add-apt-repository -y ppa:openjdk-r/ppa
 apt-get update
index 5972422..2aaca40 100644 (file)
@@ -8,11 +8,38 @@ CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
 GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt)
 
 # Add host name to /etc/host to avoid warnings in openstack images
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
        echo 127.0.0.1 $(hostname) >> /etc/hosts
 fi
 
+# Set private IP in /etc/network/interfaces manually in the presence of public interface
+# Some VM images don't add the private interface automatically, we have to do it during the component installation
+if [[ $CLOUD_ENV == "openstack_nofloat" ]]
+then
+       LOCAL_IP=$(cat /opt/config/local_ip_addr.txt)
+       CIDR=$(cat /opt/config/oam_network_cidr.txt)
+       BITMASK=$(echo $CIDR | cut -d"/" -f2)
+
+       # Compute the netmask based on the network cidr
+       if [[ $BITMASK == "8" ]]
+       then
+               NETMASK=255.0.0.0
+       elif [[ $BITMASK == "16" ]]
+       then
+               NETMASK=255.255.0.0
+       elif [[ $BITMASK == "24" ]]
+       then
+               NETMASK=255.255.255.0
+       fi
+
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $LOCAL_IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       ifup eth1
+fi
+
 # Download dependencies
 add-apt-repository -y ppa:openjdk-r/ppa
 apt-get update
index fff6432..5ef620c 100644 (file)
@@ -8,11 +8,38 @@ CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
 GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt)
 
 # Add host name to /etc/host to avoid warnings in openstack images
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
        echo 127.0.0.1 $(hostname) >> /etc/hosts
 fi
 
+# Set private IP in /etc/network/interfaces manually in the presence of public interface
+# Some VM images don't add the private interface automatically, we have to do it during the component installation
+if [[ $CLOUD_ENV == "openstack_nofloat" ]]
+then
+       LOCAL_IP=$(cat /opt/config/local_ip_addr.txt)
+       CIDR=$(cat /opt/config/oam_network_cidr.txt)
+       BITMASK=$(echo $CIDR | cut -d"/" -f2)
+
+       # Compute the netmask based on the network cidr
+       if [[ $BITMASK == "8" ]]
+       then
+               NETMASK=255.0.0.0
+       elif [[ $BITMASK == "16" ]]
+       then
+               NETMASK=255.255.0.0
+       elif [[ $BITMASK == "24" ]]
+       then
+               NETMASK=255.255.255.0
+       fi
+
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $LOCAL_IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       ifup eth1
+fi
+
 # Download dependencies
 add-apt-repository -y ppa:openjdk-r/ppa
 apt-get update
@@ -77,7 +104,7 @@ alias health='/data/scripts/docker_health.sh'
 EOF
 
 # Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
        sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
        grub-mkconfig -o /boot/grub/grub.cfg
index 7433681..410a742 100644 (file)
@@ -37,18 +37,36 @@ DCAE_HDP1_IP_ADDR=$(cat /opt/config/dcae_hdp1_ip_addr.txt)
 DCAE_HDP2_IP_ADDR=$(cat /opt/config/dcae_hdp2_ip_addr.txt)
 DCAE_HDP3_IP_ADDR=$(cat /opt/config/dcae_hdp3_ip_addr.txt)
 
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
        # Add host name to /etc/host to avoid warnings in openstack images
        echo 127.0.0.1 $(hostname) >> /etc/hosts
+fi
 
-       # Read floating IP mapping
-       DCAE_FLOAT_IP_ADDR=$(cat /opt/config/dcae_float_ip.txt)
-       DCAE_COLL_FLOAT_IP=$(cat /opt/config/dcae_coll_float_ip.txt)
-       DCAE_DB_FLOAT_IP=$(cat /opt/config/dcae_db_float_ip.txt)
-       DCAE_HDP1_FLOAT_IP=$(cat /opt/config/dcae_hdp1_float_ip.txt)
-       DCAE_HDP2_FLOAT_IP=$(cat /opt/config/dcae_hdp2_float_ip.txt)
-       DCAE_HDP3_FLOAT_IP=$(cat /opt/config/dcae_hdp3_float_ip.txt)
+# Set private IP in /etc/network/interfaces manually in the presence of public interface
+# Some VM images don't add the private interface automatically, we have to do it during the component installation
+if [[ $CLOUD_ENV == "openstack_nofloat" ]]
+then
+       CIDR=$(cat /opt/config/oam_network_cidr.txt)
+       BITMASK=$(echo $CIDR | cut -d"/" -f2)
+
+       # Compute the netmask based on the network cidr
+       if [[ $BITMASK == "8" ]]
+       then
+               NETMASK=255.0.0.0
+       elif [[ $BITMASK == "16" ]]
+       then
+               NETMASK=255.255.0.0
+       elif [[ $BITMASK == "24" ]]
+       then
+               NETMASK=255.255.255.0
+       fi
+
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $DCAE_IP_ADDR" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       ifup eth1
 fi
 
 # Download dependencies
@@ -82,7 +100,7 @@ resolvconf -u
 cd /opt
 git clone -b $GERRIT_BRANCH --single-branch http://gerrit.onap.org/r/dcae/demo/startup/controller.git dcae-startup-vm-controller
 
-# Build a configuration file for the DCAE Controller. The floating IP block is used in OpenStack only and is empty for other environments
+# Build a configuration file for the DCAE Controller.
 cd /opt/dcae-startup-vm-controller
 mkdir -p /opt/app/dcae-controller
 cat > /opt/app/dcae-controller/config.yaml << EOF_CONFIG
@@ -120,15 +138,31 @@ dcae_cdap00_ip_addr: $DCAE_HDP1_IP_ADDR
 dcae_cdap01_ip_addr: $DCAE_HDP2_IP_ADDR
 dcae_cdap02_ip_addr: $DCAE_HDP3_IP_ADDR
 
-dcae_float_ip_addr: $DCAE_FLOAT_IP_ADDR
-dcae_pstg00_float_ip_addr: $DCAE_DB_FLOAT_IP
-dcae_coll00_float_ip_addr: $DCAE_COLL_FLOAT_IP
-dcae_cdap00_float_ip_addr: $DCAE_HDP1_FLOAT_IP
-dcae_cdap01_float_ip_addr: $DCAE_HDP2_FLOAT_IP
-dcae_cdap02_float_ip_addr: $DCAE_HDP3_FLOAT_IP
-
 EOF_CONFIG
 
+# Add floating IP section to DCAE config file for OpenStack deployments that use floating IPs
+if [[ $CLOUD_ENV == "openstack" ]]
+then
+       # Read floating IP mapping
+       DCAE_FLOAT_IP_ADDR=$(cat /opt/config/dcae_float_ip.txt)
+       DCAE_COLL_FLOAT_IP=$(cat /opt/config/dcae_coll_float_ip.txt)
+       DCAE_DB_FLOAT_IP=$(cat /opt/config/dcae_db_float_ip.txt)
+       DCAE_HDP1_FLOAT_IP=$(cat /opt/config/dcae_hdp1_float_ip.txt)
+       DCAE_HDP2_FLOAT_IP=$(cat /opt/config/dcae_hdp2_float_ip.txt)
+       DCAE_HDP3_FLOAT_IP=$(cat /opt/config/dcae_hdp3_float_ip.txt)
+
+       cat >> /opt/app/dcae-controller/config.yaml << EOF_CONFIG
+
+       dcae_float_ip_addr: $DCAE_FLOAT_IP_ADDR
+       dcae_pstg00_float_ip_addr: $DCAE_DB_FLOAT_IP
+       dcae_coll00_float_ip_addr: $DCAE_COLL_FLOAT_IP
+       dcae_cdap00_float_ip_addr: $DCAE_HDP1_FLOAT_IP
+       dcae_cdap01_float_ip_addr: $DCAE_HDP2_FLOAT_IP
+       dcae_cdap02_float_ip_addr: $DCAE_HDP3_FLOAT_IP
+
+       EOF_CONFIG
+fi
+
 # Run docker containers
 cd /opt
 ./dcae_vm_init.sh
\ No newline at end of file
index 1a3425f..0bb2e5d 100644 (file)
@@ -5,20 +5,12 @@ NEXUS_REPO=$(cat /opt/config/nexus_repo.txt)
 ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt)
 CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
 
-# Add host name to /etc/host to avoid warnings in openstack images
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
+       # Add host name to /etc/host to avoid warnings in openstack images
        echo 127.0.0.1 $(hostname) >> /etc/hosts
-fi
 
-# Download dependencies
-add-apt-repository -y ppa:openjdk-r/ppa
-apt-get update
-apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk bind9 bind9utils bind9-doc ntp ntpdate
-
-# Set the Bind configuration file name based on the deployment environment
-if [[ $CLOUD_ENV == "openstack" ]]
-then
+       # Set the Bind configuration file name based on the deployment environment
        ZONE_FILE="bind_zones"
        OPTIONS_FILE="bind_options"
 else
@@ -26,6 +18,38 @@ else
        OPTIONS_FILE="named.conf.options"
 fi
 
+# Set private IP in /etc/network/interfaces manually in the presence of public interface
+# Some VM images don't add the private interface automatically, we have to do it during the component installation
+if [[ $CLOUD_ENV == "openstack_nofloat" ]]
+then
+       LOCAL_IP=$(cat /opt/config/dns_ip_addr.txt)
+       CIDR=$(cat /opt/config/oam_network_cidr.txt)
+       BITMASK=$(echo $CIDR | cut -d"/" -f2)
+
+       # Compute the netmask based on the network cidr
+       if [[ $BITMASK == "8" ]]
+       then
+               NETMASK=255.0.0.0
+       elif [[ $BITMASK == "16" ]]
+       then
+               NETMASK=255.255.0.0
+       elif [[ $BITMASK == "24" ]]
+       then
+               NETMASK=255.255.255.0
+       fi
+
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $LOCAL_IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       ifup eth1
+fi
+
+# Download dependencies
+add-apt-repository -y ppa:openjdk-r/ppa
+apt-get update
+apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk bind9 bind9utils bind9-doc ntp ntpdate
+
 # Download script
 mkdir /etc/bind/zones
 curl -k $NEXUS_REPO/org.openecomp.demo/boot/$ARTIFACTS_VERSION/$ZONE_FILE -o /etc/bind/zones/db.simpledemo.openecomp.org
@@ -33,7 +57,7 @@ curl -k $NEXUS_REPO/org.openecomp.demo/boot/$ARTIFACTS_VERSION/$OPTIONS_FILE -o
 curl -k $NEXUS_REPO/org.openecomp.demo/boot/$ARTIFACTS_VERSION/named.conf.local -o /etc/bind/named.conf.local
 
 # Set the private IP address of each ONAP VM in the Bind configuration in OpenStack deployments
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
        sed -i "s/dns_ip_addr/"$(cat /opt/config/dns_ip_addr.txt)"/g" /etc/bind/named.conf.options
        sed -i "s/aai_ip_addr/"$(cat /opt/config/aai_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org
index b00457d..ac476e5 100644 (file)
@@ -8,11 +8,38 @@ CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
 GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt)
 
 # Add host name to /etc/host to avoid warnings in openstack images
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
        echo 127.0.0.1 $(hostname) >> /etc/hosts
 fi
 
+# Set private IP in /etc/network/interfaces manually in the presence of public interface
+# Some VM images don't add the private interface automatically, we have to do it during the component installation
+if [[ $CLOUD_ENV == "openstack_nofloat" ]]
+then
+       LOCAL_IP=$(cat /opt/config/local_ip_addr.txt)
+       CIDR=$(cat /opt/config/oam_network_cidr.txt)
+       BITMASK=$(echo $CIDR | cut -d"/" -f2)
+
+       # Compute the netmask based on the network cidr
+       if [[ $BITMASK == "8" ]]
+       then
+               NETMASK=255.0.0.0
+       elif [[ $BITMASK == "16" ]]
+       then
+               NETMASK=255.255.0.0
+       elif [[ $BITMASK == "24" ]]
+       then
+               NETMASK=255.255.255.0
+       fi
+
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $LOCAL_IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       ifup eth1
+fi
+
 # Download dependencies
 add-apt-repository -y ppa:openjdk-r/ppa
 apt-get update
index 9c10e30..bec7699 100644 (file)
@@ -9,11 +9,38 @@ OPENSTACK_API_KEY=$(cat /opt/config/openstack_api_key.txt)
 GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt)
 
 # Add host name to /etc/host to avoid warnings in openstack images
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
        echo 127.0.0.1 $(hostname) >> /etc/hosts
 fi
 
+# Set private IP in /etc/network/interfaces manually in the presence of public interface
+# Some VM images don't add the private interface automatically, we have to do it during the component installation
+if [[ $CLOUD_ENV == "openstack_nofloat" ]]
+then
+       LOCAL_IP=$(cat /opt/config/local_ip_addr.txt)
+       CIDR=$(cat /opt/config/oam_network_cidr.txt)
+       BITMASK=$(echo $CIDR | cut -d"/" -f2)
+
+       # Compute the netmask based on the network cidr
+       if [[ $BITMASK == "8" ]]
+       then
+               NETMASK=255.0.0.0
+       elif [[ $BITMASK == "16" ]]
+       then
+               NETMASK=255.255.0.0
+       elif [[ $BITMASK == "24" ]]
+       then
+               NETMASK=255.255.255.0
+       fi
+
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $LOCAL_IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       ifup eth1
+fi
+
 # Download dependencies
 add-apt-repository -y ppa:openjdk-r/ppa
 apt-get update
@@ -48,7 +75,7 @@ MSO_ENCRYPTION_KEY=$(cat /opt/test_lab/encryption.key)
 echo -n "$OPENSTACK_API_KEY" | openssl aes-128-ecb -e -K $MSO_ENCRYPTION_KEY -nosalt | xxd -c 256 -p > /opt/config/api_key.txt
 
 # Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
        sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
        grub-mkconfig -o /boot/grub/grub.cfg
index ab29f55..48dcd72 100644 (file)
@@ -8,11 +8,38 @@ CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
 GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt)
 
 # Add host name to /etc/host to avoid warnings in openstack images
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
        echo 127.0.0.1 $(hostname) >> /etc/hosts
 fi
 
+# Set private IP in /etc/network/interfaces manually in the presence of public interface
+# Some VM images don't add the private interface automatically, we have to do it during the component installation
+if [[ $CLOUD_ENV == "openstack_nofloat" ]]
+then
+       LOCAL_IP=$(cat /opt/config/local_ip_addr.txt)
+       CIDR=$(cat /opt/config/oam_network_cidr.txt)
+       BITMASK=$(echo $CIDR | cut -d"/" -f2)
+
+       # Compute the netmask based on the network cidr
+       if [[ $BITMASK == "8" ]]
+       then
+               NETMASK=255.0.0.0
+       elif [[ $BITMASK == "16" ]]
+       then
+               NETMASK=255.255.0.0
+       elif [[ $BITMASK == "24" ]]
+       then
+               NETMASK=255.255.255.0
+       fi
+
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $LOCAL_IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       ifup eth1
+fi
+
 # Download dependencies
 add-apt-repository -y ppa:openjdk-r/ppa
 apt-get update
index 4fc6306..39b28d9 100644 (file)
@@ -8,11 +8,38 @@ CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
 GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt)
 
 # Add host name to /etc/host to avoid warnings in openstack images
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
        echo 127.0.0.1 $(hostname) >> /etc/hosts
 fi
 
+# Set private IP in /etc/network/interfaces manually in the presence of public interface
+# Some VM images don't add the private interface automatically, we have to do it during the component installation
+if [[ $CLOUD_ENV == "openstack_nofloat" ]]
+then
+       LOCAL_IP=$(cat /opt/config/local_ip_addr.txt)
+       CIDR=$(cat /opt/config/oam_network_cidr.txt)
+       BITMASK=$(echo $CIDR | cut -d"/" -f2)
+
+       # Compute the netmask based on the network cidr
+       if [[ $BITMASK == "8" ]]
+       then
+               NETMASK=255.0.0.0
+       elif [[ $BITMASK == "16" ]]
+       then
+               NETMASK=255.255.0.0
+       elif [[ $BITMASK == "24" ]]
+       then
+               NETMASK=255.255.255.0
+       fi
+
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $LOCAL_IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       ifup eth1
+fi
+
 # Download dependencies
 add-apt-repository -y ppa:openjdk-r/ppa
 apt-get update
index 16b3114..71b419c 100644 (file)
@@ -8,11 +8,38 @@ CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
 GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt)
 
 # Add host name to /etc/host to avoid warnings in openstack images
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
        echo 127.0.0.1 $(hostname) >> /etc/hosts
 fi
 
+# Set private IP in /etc/network/interfaces manually in the presence of public interface
+# Some VM images don't add the private interface automatically, we have to do it during the component installation
+if [[ $CLOUD_ENV == "openstack_nofloat" ]]
+then
+       LOCAL_IP=$(cat /opt/config/local_ip_addr.txt)
+       CIDR=$(cat /opt/config/oam_network_cidr.txt)
+       BITMASK=$(echo $CIDR | cut -d"/" -f2)
+
+       # Compute the netmask based on the network cidr
+       if [[ $BITMASK == "8" ]]
+       then
+               NETMASK=255.0.0.0
+       elif [[ $BITMASK == "16" ]]
+       then
+               NETMASK=255.255.0.0
+       elif [[ $BITMASK == "24" ]]
+       then
+               NETMASK=255.255.255.0
+       fi
+
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $LOCAL_IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       ifup eth1
+fi
+
 # Download dependencies
 add-apt-repository -y ppa:openjdk-r/ppa
 apt-get update
@@ -47,7 +74,7 @@ cd /opt
 git clone -b $GERRIT_BRANCH --single-branch http://gerrit.onap.org/r/testsuite/properties.git testsuite/properties
 
 # Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
        sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
        grub-mkconfig -o /boot/grub/grub.cfg
index 03d4900..8448425 100644 (file)
@@ -8,11 +8,38 @@ CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
 GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt)
 
 # Add host name to /etc/host to avoid warnings in openstack images
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
        echo 127.0.0.1 $(hostname) >> /etc/hosts
 fi
 
+# Set private IP in /etc/network/interfaces manually in the presence of public interface
+# Some VM images don't add the private interface automatically, we have to do it during the component installation
+if [[ $CLOUD_ENV == "openstack_nofloat" ]]
+then
+       LOCAL_IP=$(cat /opt/config/local_ip_addr.txt)
+       CIDR=$(cat /opt/config/oam_network_cidr.txt)
+       BITMASK=$(echo $CIDR | cut -d"/" -f2)
+
+       # Compute the netmask based on the network cidr
+       if [[ $BITMASK == "8" ]]
+       then
+               NETMASK=255.0.0.0
+       elif [[ $BITMASK == "16" ]]
+       then
+               NETMASK=255.255.0.0
+       elif [[ $BITMASK == "24" ]]
+       then
+               NETMASK=255.255.255.0
+       fi
+
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $LOCAL_IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       ifup eth1
+fi
+
 # Download dependencies
 add-apt-repository -y ppa:openjdk-r/ppa
 apt-get update
index 438a203..d75fa04 100644 (file)
@@ -8,11 +8,38 @@ CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
 GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt)
 
 # Add host name to /etc/host to avoid warnings in openstack images
-if [[ $CLOUD_ENV == "openstack" ]]
+if [[ $CLOUD_ENV != "rackspace" ]]
 then
        echo 127.0.0.1 $(hostname) >> /etc/hosts
 fi
 
+# Set private IP in /etc/network/interfaces manually in the presence of public interface
+# Some VM images don't add the private interface automatically, we have to do it during the component installation
+if [[ $CLOUD_ENV == "openstack_nofloat" ]]
+then
+       LOCAL_IP=$(cat /opt/config/local_ip_addr.txt)
+       CIDR=$(cat /opt/config/oam_network_cidr.txt)
+       BITMASK=$(echo $CIDR | cut -d"/" -f2)
+
+       # Compute the netmask based on the network cidr
+       if [[ $BITMASK == "8" ]]
+       then
+               NETMASK=255.0.0.0
+       elif [[ $BITMASK == "16" ]]
+       then
+               NETMASK=255.255.0.0
+       elif [[ $BITMASK == "24" ]]
+       then
+               NETMASK=255.255.255.0
+       fi
+
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $LOCAL_IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       ifup eth1
+fi
+
 # Download dependencies
 add-apt-repository -y ppa:openjdk-r/ppa
 apt-get update