From 36722d07218ec607497efff9e1704ff7601e3ae8 Mon Sep 17 00:00:00 2001 From: Marco Platania Date: Fri, 28 Apr 2017 10:14:15 -0400 Subject: enable no floating IPs in install scripts Change-Id: Iec5a16e401d7c1f581f05a4b7a9b8ee2708cd4e3 Signed-off-by: Marco Platania --- boot/aai_install.sh | 29 +++++++++++++++++++++- boot/appc_install.sh | 29 +++++++++++++++++++++- boot/asdc_install.sh | 31 ++++++++++++++++++++++-- boot/dcae_install.sh | 66 ++++++++++++++++++++++++++++++++++++++------------ boot/dns_install.sh | 48 +++++++++++++++++++++++++++--------- boot/mr_install.sh | 29 +++++++++++++++++++++- boot/mso_install.sh | 31 ++++++++++++++++++++++-- boot/policy_install.sh | 29 +++++++++++++++++++++- boot/portal_install.sh | 29 +++++++++++++++++++++- boot/robot_install.sh | 31 ++++++++++++++++++++++-- boot/sdnc_install.sh | 29 +++++++++++++++++++++- boot/vid_install.sh | 29 +++++++++++++++++++++- 12 files changed, 369 insertions(+), 41 deletions(-) diff --git a/boot/aai_install.sh b/boot/aai_install.sh index cf9043b9..255e0bdc 100644 --- a/boot/aai_install.sh +++ b/boot/aai_install.sh @@ -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 diff --git a/boot/appc_install.sh b/boot/appc_install.sh index 59724228..2aaca408 100644 --- a/boot/appc_install.sh +++ b/boot/appc_install.sh @@ -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 diff --git a/boot/asdc_install.sh b/boot/asdc_install.sh index fff64320..5ef620c9 100644 --- a/boot/asdc_install.sh +++ b/boot/asdc_install.sh @@ -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 diff --git a/boot/dcae_install.sh b/boot/dcae_install.sh index 74336817..410a7424 100644 --- a/boot/dcae_install.sh +++ b/boot/dcae_install.sh @@ -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 diff --git a/boot/dns_install.sh b/boot/dns_install.sh index 1a3425fb..0bb2e5df 100644 --- a/boot/dns_install.sh +++ b/boot/dns_install.sh @@ -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 diff --git a/boot/mr_install.sh b/boot/mr_install.sh index b00457d3..ac476e59 100644 --- a/boot/mr_install.sh +++ b/boot/mr_install.sh @@ -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 diff --git a/boot/mso_install.sh b/boot/mso_install.sh index 9c10e303..bec76997 100644 --- a/boot/mso_install.sh +++ b/boot/mso_install.sh @@ -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 diff --git a/boot/policy_install.sh b/boot/policy_install.sh index ab29f553..48dcd72c 100644 --- a/boot/policy_install.sh +++ b/boot/policy_install.sh @@ -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 diff --git a/boot/portal_install.sh b/boot/portal_install.sh index 4fc63061..39b28d96 100644 --- a/boot/portal_install.sh +++ b/boot/portal_install.sh @@ -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 diff --git a/boot/robot_install.sh b/boot/robot_install.sh index 16b31142..71b419c8 100644 --- a/boot/robot_install.sh +++ b/boot/robot_install.sh @@ -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 diff --git a/boot/sdnc_install.sh b/boot/sdnc_install.sh index 03d49000..8448425c 100644 --- a/boot/sdnc_install.sh +++ b/boot/sdnc_install.sh @@ -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 diff --git a/boot/vid_install.sh b/boot/vid_install.sh index 438a2032..d75fa04e 100644 --- a/boot/vid_install.sh +++ b/boot/vid_install.sh @@ -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 -- cgit