Update vLB to Ubuntu 1604 and VPP 1707 21/7621/1
authorMarco Platania <platania@research.att.com>
Tue, 15 Aug 2017 17:44:48 +0000 (13:44 -0400)
committerMarco Platania <platania@research.att.com>
Tue, 15 Aug 2017 17:44:48 +0000 (13:44 -0400)
vLB based on Ubuntu 1404 and VPP 1609 doesn't work in some OpenStack labs

Change-Id: Ibbd904d0eed1f02b7aca2d173e469c53f235f700
Issue-ID: UCA-34
Signed-off-by: Marco Platania <platania@research.att.com>
12 files changed:
heat/vLB/base_vlb_openstack.env
heat/vLB/base_vlb_openstack.yaml
vnfs/vLB/.DS_Store [deleted file]
vnfs/vLB/scripts/.DS_Store [deleted file]
vnfs/vLB/scripts/add_dns.sh
vnfs/vLB/scripts/dnsmembership.sh
vnfs/vLB/scripts/remove_dns.sh
vnfs/vLB/scripts/v_dns_install.sh
vnfs/vLB/scripts/v_lb_init.sh
vnfs/vLB/scripts/v_lb_install.sh
vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh
vnfs/vLB/scripts/v_packetgen_install.sh

index afcfccf..ab95f36 100644 (file)
@@ -3,16 +3,25 @@ parameters:
   vlb_flavor_name: PUT THE FLAVOR NAME HERE
   public_net_id: PUT THE NETWORK ID HERE
   vlb_private_net_id: zdfw1lb01_private
+  pktgen_private_net_id: zdfw1pktgen01_private
   onap_private_net_id: PUT THE ONAP PRIVATE NETWORK NAME HERE
   onap_private_subnet_id: PUT THE ONAP PRIVATE NETWORK NAME HERE
   vlb_private_net_cidr: 192.168.10.0/24
+  pktgen_private_net_cidr: 192.168.9.0/24
   onap_private_net_cidr: PUT THE ONAP NETWORK CIDR HERE
   vlb_private_ip_0: 192.168.10.111
   vlb_private_ip_1: ASSIGN A PRIVATE ADDRESS IN THE ONAP NETWORK SPACE TO THE VLB
+  vlb_private_ip_2: 192.168.9.111
   vdns_private_ip_0: 192.168.10.211
   vdns_private_ip_1: ASSIGN A PRIVATE ADDRESS IN THE ONAP NETWORK SPACE TO THE VDNS
+  vpg_private_ip_0: 192.168.9.110
+  vpg_private_ip_1: ASSIGN A PRIVATE ADDRESS IN THE ONAP NETWORK SPACE TO THE VPKTGEN
+  vip: 192.168.9.112
+  gre_ipaddr: 192.168.10.112
+  pg_int: 192.168.9.109
   vlb_name_0: zdfw1lb01lb01
   vdns_name_0: zdfw1lb01dns01
+  vpg_name_0: zdfw1lb01pg01
   vnf_id: vLoadBalancer_demo_app
   vf_module_id: vLoadBalancer
   dcae_collector_ip: PUT THE ADDRESS OF THE DCAE COLLECTOR HERE
index 18a0d76..a99afb8 100644 (file)
@@ -49,6 +49,10 @@ parameters:
     type: string
     label: vLoadBalancer private network name or ID
     description: Private network that connects vLoadBalancer with vDNSs
+  pktgen_private_net_id:
+    type: string
+    label: vPacketGen private network name or ID
+    description: Private network that connects vLoadBalancer with vPacketGen
   onap_private_net_id:
     type: string
     label: ECOMP management network name or ID
@@ -61,6 +65,10 @@ parameters:
     type: string
     label: vLoadBalancer private network CIDR
     description: The CIDR of the vLoadBalancer private network
+  pktgen_private_net_cidr:
+    type: string
+    label: vPacketGen private network CIDR
+    description: The CIDR of the vPacketGen private network
   onap_private_net_cidr:
     type: string
     label: ONAP private network CIDR
@@ -73,6 +81,10 @@ parameters:
     type: string
     label: vLoadBalancer private IP address towards the ONAP management network
     description: Private IP address that is assigned to the vLoadBalancer to communicate with ONAP components
+  vlb_private_ip_2:
+    type: string
+    label: vLoadBalancer private IP address towards the vPacketGen network
+    description: Private IP address that is assigned to the vLoadBalancer to communicate with vPacketGen
   vdns_private_ip_0:
     type: string
     label: vDNS private IP address towards the private network
@@ -81,6 +93,26 @@ parameters:
     type: string
     label: vDNS private IP address towards the ONAP management network
     description: Private IP address that is assigned to the vDNS to communicate with ONAP components
+  vpg_private_ip_0:
+    type: string
+    label: vPacketGen private IP address towards the vPacketGen private network
+    description: Private IP address that is assigned to the vPacketGen to communicate with the vLoadBalancer
+  vpg_private_ip_1:
+    type: string
+    label: vPacketGen private IP address towards the ONAP management network
+    description: Private IP address that is assigned to the vPacketGen to communicate with ONAP components
+  vip:
+    type: string
+    label: Virtual Private IP of the vLoadBalancer
+    description: Virtual Private IP that is assigned to the vLoadBalancer's VPP layer
+  gre_ipaddr:
+    type: string
+    label: IP Address of the GRE tunnel
+    description: IP address assigned to the GRE tunnel on the vLoadBalancer
+  pg_int:
+    type: string
+    label: IP Address of the output vPacketGen interface
+    description: IP address assigned to the output interface of the vPacketGen's VPP layer
   vlb_name_0:
     type: string
     label: vLoadBalancer name
@@ -171,6 +203,18 @@ resources:
       network_id: { get_resource: vlb_private_network }
       cidr: { get_param: vlb_private_net_cidr }
 
+  pktgen_private_network:
+    type: OS::Neutron::Net
+    properties:
+      name: { get_param: pktgen_private_net_id }
+
+  pktgen_private_subnet:
+    type: OS::Neutron::Subnet
+    properties:
+      name: { get_param: pktgen_private_net_id }
+      network_id: { get_resource: pktgen_private_network }
+      cidr: { get_param: pktgen_private_net_cidr }
+
   vlb_private_0_port:
     type: OS::Neutron::Port
     properties:
@@ -183,6 +227,12 @@ resources:
       network: { get_param: onap_private_net_id }
       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vlb_private_ip_1 }}]
 
+  vlb_private_2_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: pktgen_private_network }
+      fixed_ips: [{"subnet": { get_resource: pktgen_private_subnet }, "ip_address": { get_param: vlb_private_ip_2 }}]
+
   vlb_0:
     type: OS::Nova::Server
     properties:
@@ -194,6 +244,7 @@ resources:
         - network: { get_param: public_net_id }
         - port: { get_resource: vlb_private_0_port }
         - port: { get_resource: vlb_private_1_port }
+        - port: { get_resource: vlb_private_2_port }
       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
       user_data_format: RAW
       user_data:
@@ -201,7 +252,11 @@ resources:
           params:
             __dcae_collector_ip__: { get_param: dcae_collector_ip }
             __dcae_collector_port__: { get_param: dcae_collector_port }
-            __local_private_ipaddr__: { get_param: vlb_private_ip_0 }
+            __ip_to_dns_net__: { get_param: vlb_private_ip_0 }
+            __ip_to_pktgen_net__: { get_param: vlb_private_ip_2 }
+            __vip__: { get_param: vip }
+            __gre_ipaddr__: { get_param: gre_ipaddr }
+            __pktgen_ipaddr__: { get_param: vpg_private_ip_0 }
             __oam_private_ipaddr__: { get_param: vlb_private_ip_1 }
             __repo_url_blob__: { get_param: repo_url_blob }
             __repo_url_artifacts__: { get_param: repo_url_artifacts }
@@ -209,6 +264,7 @@ resources:
             __install_script_version__: { get_param: install_script_version }
             __vlb_private_net_cidr__: { get_param: vlb_private_net_cidr }
             __onap_private_net_cidr__: { get_param: onap_private_net_cidr }
+            __pktgen_private_net_cidr__: { get_param: pktgen_private_net_cidr }
             __cloud_env__: { get_param: cloud_env }
           template: |
             #!/bin/bash
@@ -217,13 +273,18 @@ resources:
             mkdir /opt/config
             echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt
             echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt
-            echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
+            echo "__ip_to_dns_net__" > /opt/config/ip_to_dns_net.txt
+            echo "__ip_to_pktgen_net__" > /opt/config/ip_to_pktgen_net.txt
+            echo "__vip__" > /opt/config/vip.txt
+            echo "__gre_ipaddr__" > /opt/config/gre_ipaddr.txt
+            echo "__pktgen_ipaddr__" > /opt/config/pktgen_ipaddr.txt
             echo "__oam_private_ipaddr__" > /opt/config/oam_private_ipaddr.txt
             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
             echo "__install_script_version__" > /opt/config/install_script_version.txt
             echo "__vlb_private_net_cidr__" > /opt/config/vlb_private_net_cidr.txt
+            echo "__pktgen_private_net_cidr__" > /opt/config/pktgen_private_net_cidr.txt
             echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt
             echo "__cloud_env__" > /opt/config/cloud_env.txt
 
@@ -294,4 +355,66 @@ resources:
             curl -k __repo_url_blob__/org.onap.demo/vnfs/vlb/__install_script_version__/v_dns_install.sh -o /opt/v_dns_install.sh
             cd /opt
             chmod +x v_dns_install.sh
-            ./v_dns_install.sh
\ No newline at end of file
+            ./v_dns_install.sh
+
+
+  vpg_private_0_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_resource: pktgen_private_network }
+      fixed_ips: [{"subnet": { get_resource: pktgen_private_subnet }, "ip_address": { get_param: vpg_private_ip_0 }}]
+
+  vpg_private_1_port:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_param: onap_private_net_id }
+      fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vpg_private_ip_1 }}]
+
+  vpg_0:
+    type: OS::Nova::Server
+    properties:
+      image: { get_param: vlb_image_name }
+      flavor: { get_param: vlb_flavor_name }
+      name: { get_param: vpg_name_0 }
+      key_name: { get_resource: my_keypair }
+      networks:
+        - network: { get_param: public_net_id }
+        - port: { get_resource: vpg_private_0_port }
+        - port: { get_resource: vpg_private_1_port }
+      user_data_format: RAW
+      user_data:
+        str_replace:
+          params:
+            __repo_url_blob__: { get_param: repo_url_blob }
+            __repo_url_artifacts__: { get_param: repo_url_artifacts }
+            __local_private_ipaddr__: { get_param: vpg_private_ip_0 }
+            __oam_private_ipaddr__: { get_param: vpg_private_ip_1 }
+            __onap_private_net_cidr__: { get_param: onap_private_net_cidr }
+            __pktgen_private_net_cidr__: { get_param: pktgen_private_net_cidr }
+            __vlb_ipaddr__: { get_param: vlb_private_ip_2 }
+            __demo_artifacts_version__: { get_param: demo_artifacts_version }
+            __install_script_version__: { get_param: install_script_version }
+            __pg_int__: { get_param: pg_int }
+            __cloud_env__: { get_param: cloud_env }
+          template: |
+            #!/bin/bash
+
+            # Create configuration files
+            mkdir /opt/config
+            echo "__oam_private_ipaddr__" > /opt/config/oam_private_ipaddr.txt
+            echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt
+            echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
+            echo "__pktgen_private_net_cidr__" > /opt/config/pktgen_private_net_cidr.txt
+            echo "__vlb_ipaddr__" > /opt/config/vlb_ipaddr.txt
+            echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
+            echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
+            echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
+            echo "__install_script_version__" > /opt/config/install_script_version.txt
+            echo "__pg_int__" > /opt/config/pg_int.txt
+            echo "__cloud_env__" > /opt/config/cloud_env.txt
+
+            # Download and run install script
+            curl -k __repo_url_blob__/org.onap.demo/vnfs/vlb/__install_script_version__/v_packetgen_install.sh -o /opt/v_packetgen_install.sh
+            cd /opt
+            chmod +x v_packetgen_install.sh
+            ./v_packetgen_install.sh
\ No newline at end of file
diff --git a/vnfs/vLB/.DS_Store b/vnfs/vLB/.DS_Store
deleted file mode 100644 (file)
index b7ccbfd..0000000
Binary files a/vnfs/vLB/.DS_Store and /dev/null differ
diff --git a/vnfs/vLB/scripts/.DS_Store b/vnfs/vLB/scripts/.DS_Store
deleted file mode 100644 (file)
index 32f7eca..0000000
Binary files a/vnfs/vLB/scripts/.DS_Store and /dev/null differ
index 04dfc77..9f250f0 100644 (file)
@@ -7,15 +7,18 @@ then
 fi
 
 DNS_IPADDR=$1
-MY_PUBLIC_IP=$(cat /opt/config/local_public_ipaddr.txt)
-MY_PRIVATE_IP=$(cat /opt/config/local_private_ipaddr.txt)
+IP_TO_PKTGEN_NET=$(cat /opt/config/ip_to_pktgen_net.txt)
+IP_TO_DNS_NET=$(cat /opt/config/ip_to_dns_net.txt)
+GRE_IPADDR=$(cat /opt/config/gre_ipaddr.txt)
 
-vppctl lb as $MY_PUBLIC_IP"/32" $DNS_IPADDR
-GRE=$(vppctl create gre tunnel src $MY_PRIVATE_IP dst $DNS_IPADDR)
+#vppctl lb as $MY_PUBLIC_IP"/32" $DNS_IPADDR
+vppctl lb as $IP_TO_PKTGEN_NET"/32" $DNS_IPADDR
+GRE=$(vppctl create gre tunnel src $IP_TO_DNS_NET dst $DNS_IPADDR)
+vppctl set int ip address $GRE $GRE_IPADDR"/24"
 vppctl set int state $GRE up
 
 # Update the number of vDNSs currently active
 FD="/opt/VES/code/evel_training/VESreporting/active_dns.txt"
 CURR_DNS=$(cat $FD)
 let CURR_DNS=$CURR_DNS+1
-echo $CURR_DNS > $FD
+echo $CURR_DNS > $FD
\ No newline at end of file
index 345dc3f..e18ab80 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-MY_PUBLIC_IP=$(cat /opt/config/local_public_ipaddr.txt)
+IP_TO_PKTGEN_NET=$(cat /opt/config/ip_to_pktgen_net.txt)
 VERSION=$(cat /opt/config/demo_artifacts_version.txt)
 
-java -jar dns-manager-$VERSION.jar $MY_PUBLIC_IP 8888 10 3 0
+java -jar dns-manager-$VERSION.jar $IP_TO_PKTGEN_NET 8888 10 3 0
index 1d505ab..f400aa0 100644 (file)
@@ -2,23 +2,23 @@
 
 if [ ! "$#" -eq 1 ]
 then
-  echo "Usage: ./add_dns.sh [remote DNS server]"
+  echo "Usage: ./remove_dns.sh [remote DNS server]"
   exit
 fi
 
 DNS_IPADDR=$1
-MY_PUBLIC_IP=$(cat /opt/config/local_public_ipaddr.txt)
-MY_PRIVATE_IP=$(cat /opt/config/local_private_ipaddr.txt)
+IP_TO_PKTGEN_NET=$(cat /opt/config/ip_to_pktgen_net.txt)
+IP_TO_DNS_NET=$(cat /opt/config/ip_to_dns_net.txt)
 
-vppctl lb as $MY_PUBLIC_ID"/32" $DNS_IPADDR del
-vppctl create gre tunnel src $MY_PRIVATE_IP dst $DNS_IPADDR del
+vppctl lb as $IP_TO_PKTGEN_NET"/32" $DNS_IPADDR del
+vppctl create gre tunnel src $IP_TO_DNS_NET dst $DNS_IPADDR del
 
 # Update the number of vDNSs currently active
 FD="/opt/VES/code/evel_training/VESreporting/active_dns.txt"
 CURR_DNS=$(cat $FD)
 let CURR_DNS=$CURR_DNS-1
 if [[ $CURR_DNS -lt 0 ]]
-then 
+then
   CURR_DNS=0
 fi
-echo $CURR_DNS > $FD
+echo $CURR_DNS > $FD
\ No newline at end of file
index 83441ac..19dc047 100644 (file)
@@ -92,4 +92,17 @@ sleep 1
 cd /opt
 mv vdns.sh /etc/init.d
 update-rc.d vdns.sh defaults
+
+# Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
+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
+       sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
+       sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
+       echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
+       echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
+       reboot
+fi
+
 ./v_dns_init.sh
\ No newline at end of file
index 8767a94..3c816c8 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # Start VPP
-start vpp
+systemctl start vpp
 sleep 1
 
 # Compute the network CIDR from the Netmask
@@ -25,30 +25,41 @@ mask2cidr() {
     echo "$nbits"
 }
 
-IPADDR1_MASK=$(ifconfig eth0 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
+IPADDR1_MASK=$(ifconfig eth3 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
 IPADDR1_CIDR=$(mask2cidr $IPADDR1_MASK)
 IPADDR2_MASK=$(ifconfig eth1 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
 IPADDR2_CIDR=$(mask2cidr $IPADDR2_MASK)
 
 # Configure VPP for vPacketGenerator
-IPADDR1=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+IPADDR1=$(ifconfig eth3 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
 IPADDR2=$(ifconfig eth1 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
-HWADDR1=$(ifconfig eth0 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
+HWADDR1=$(ifconfig eth3 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
 HWADDR2=$(ifconfig eth1 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
-FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null |hexdump -v -e '/1 ":%02X"')
-FAKE_HWADDR2=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null |hexdump -v -e '/1 ":%02X"')
+FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
+FAKE_HWADDR2=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
 GW=$(route -n | grep "^0.0.0.0" | awk '{print $2}')
+PKTGEN_IPADDR=$(cat /opt/config/pktgen_ipaddr.txt)
+VIP=$(cat /opt/config/vip.txt)
 
-ifconfig eth0 down
-ifconfig eth0 hw ether $FAKE_HWADDR1
-ip addr flush dev eth0
-ifconfig eth0 up
+while [ $(ping -c 1 $PKTGEN_IPADDR | grep received | cut -d" " -f4) != 1 ]; 
+do
+       echo "Wait";
+       sleep 1;
+done
+
+sleep 3
+PKTGEN_MAC=$(arp -n | grep -w $PKTGEN_IPADDR | tr -s ' ' | cut -d' ' -f3)
+
+ifconfig eth3 down
+ifconfig eth3 hw ether $FAKE_HWADDR1
+ip addr flush dev eth3
+ifconfig eth3 up
 vppctl tap connect tappub hwaddr $HWADDR1
-vppctl set int ip address tap-0 $IPADDR1"/"$IPADDR1_CIDR
+vppctl set int ip address tap-0 $VIP"/"$IPADDR1_CIDR
 vppctl set int state tap-0 up
 brctl addbr br0
 brctl addif br0 tappub
-brctl addif br0 eth0
+brctl addif br0 eth3
 ifconfig br0 up
 
 ifconfig eth1 down
@@ -66,13 +77,16 @@ sleep 1
 
 vppctl lb conf ip4-src-address $IPADDR2
 vppctl lb vip $IPADDR1"/32" encap gre4
-vppctl ip route add 0.0.0.0/0 via $GW
 sleep 1
 
+vppctl set ip arp proxy $IPADDR1" - "$IPADDR1
+vppctl set interface proxy-arp tap-0 enable
+vppctl set ip arp tap-0 $PKTGEN_IPADDR $PKTGEN_MAC
+
 cd /opt/FDserver
 ./dnsmembership.sh &>/dev/null &disown
 
 # Start VES client
 cd /opt/VES/code/evel_training/VESreporting/
 echo 0 > active_dns.txt
-./go-client.sh &>/dev/null &disown
+./go-client.sh &>/dev/null &disown
\ No newline at end of file
index 394a6c8..9d4a0c9 100644 (file)
@@ -25,7 +25,7 @@ then
 
        MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
 
-       IP=$(cat /opt/config/local_private_ipaddr.txt)
+       IP=$(cat /opt/config/ip_to_dns_net.txt)
        BITS=$(cat /opt/config/vlb_private_net_cidr.txt | cut -d"/" -f2)
        NETMASK=$(cdr2mask $BITS)
        echo "auto eth1" >> /etc/network/interfaces
@@ -43,8 +43,18 @@ then
        echo "    netmask $NETMASK" >> /etc/network/interfaces
        echo "    mtu $MTU" >> /etc/network/interfaces
 
+       IP=$(cat /opt/config/ip_to_pktgen_net.txt)
+       BITS=$(cat /opt/config/pktgen_private_net_cidr.txt | cut -d"/" -f2)
+       NETMASK=$(cdr2mask $BITS)
+       echo "auto eth3" >> /etc/network/interfaces
+       echo "iface eth3 inet static" >> /etc/network/interfaces
+       echo "    address $IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       echo "    mtu $MTU" >> /etc/network/interfaces
+
        ifup eth1
        ifup eth2
+       ifup eth3
 fi
 
 # Download required dependencies
@@ -86,16 +96,9 @@ chmod +x /opt/FDserver/dnsmembership.sh
 chmod +x /opt/FDserver/add_dns.sh
 chmod +x /opt/FDserver/remove_dns.sh
 
-# Create a file with public IP of the VM if it doesn't exist. This is for VMs directly attached to the external network.
-if [ ! -e /opt/config/local_public_ipaddr.txt ]
-then
-       IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
-       echo $IP_ADDRESS > /opt/config/local_public_ipaddr.txt
-fi
-
 # Install VPP
-export UBUNTU="trusty"
-export RELEASE=".stable.1609"
+export UBUNTU="xenial"
+export RELEASE=".stable.1707"
 rm /etc/apt/sources.list.d/99fd.io.list
 echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/fd.io$RELEASE.ubuntu.$UBUNTU.main/ ./" | sudo tee -a /etc/apt/sources.list.d/99fd.io.list
 apt-get update
@@ -112,4 +115,17 @@ sleep 1
 cd /opt
 mv vlb.sh /etc/init.d
 update-rc.d vlb.sh defaults
+
+# Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
+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
+       sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
+       sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
+       echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
+       echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
+       reboot
+fi
+
 ./v_lb_init.sh
\ No newline at end of file
index 9e7879b..86f0b00 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # Start VPP
-start vpp
+systemctl start vpp
 sleep 1
 
 # Compute the network CIDR from the Netmask
@@ -25,51 +25,45 @@ mask2cidr() {
     echo "$nbits"
 }
 
-IPADDR1_MASK=$(ifconfig eth0 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
+IPADDR1_MASK=$(ifconfig eth1 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
 IPADDR1_CIDR=$(mask2cidr $IPADDR1_MASK)
 
 # Configure VPP for vPacketGenerator
-IPADDR1=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
-HWADDR1=$(ifconfig eth0 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
+IPADDR1=$(ifconfig eth1 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+HWADDR1=$(ifconfig eth1 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
 FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
 VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt)
 GW=$(route -n | grep "^0.0.0.0" | awk '{print $2}')
 
-ifconfig eth0 down
-ifconfig eth0 hw ether $FAKE_HWADDR1
-ip addr flush dev eth0
-ifconfig eth0 up
+ifconfig eth1 down
+ifconfig eth1 hw ether $FAKE_HWADDR1
+ip addr flush dev eth1
+ifconfig eth1 up
 vppctl tap connect tap111 hwaddr $HWADDR1
 vppctl set int ip address tap-0 $IPADDR1"/"$IPADDR1_CIDR
 vppctl set int state tap-0 up
 brctl addbr br0
 brctl addif br0 tap111
-brctl addif br0 eth0
+brctl addif br0 eth1
 ifconfig br0 up
 vppctl ip route add 0.0.0.0/0 via $GW
 sleep 1
 
-
 # Set br0 with public IP and valid MAC so that Linux will have public network access
 ifconfig br0 hw ether $HWADDR1
 ifconfig br0 $IPADDR1 netmask $IPADDR1_MASK
 route add default gw $GW
 
 #Adding static arp entry for VPP so that it will be able to send packets to default GW
-ping -c 1 $VLB_IPADDR &>/dev/null &disown
-sleep 3
+while [ $(ping -c 1 $VLB_IPADDR | grep received | cut -d" " -f4) != 1 ]; 
+do
+       echo "Wait";
+       sleep 1;
+done
 
-GW_MAC=$(arp -n | grep -w $GW | tr -s ' ' | cut -d' ' -f3)
+sleep 3
 VLB_MAC=$(arp -n | grep -w $VLB_IPADDR | tr -s ' ' | cut -d' ' -f3)
-
-# If VLB is in our network, we will use its MAC
-if [ ! -z "$VLB_MAC" ]
-then
-       vppctl set ip arp tap-0 $VLB_IPADDR $VLB_MAC
-fi
-
-# Add arp entry for default GW
-vppctl set ip arp tap-0 $GW $GW_MAC
+vppctl set ip arp tap-0 $VLB_IPADDR $VLB_MAC
 
 # Install packet streams
 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns1
@@ -104,6 +98,8 @@ vppctl exec /opt/dns_streams/stream_dns7
 vppctl exec /opt/dns_streams/stream_dns8
 vppctl exec /opt/dns_streams/stream_dns9
 vppctl exec /opt/dns_streams/stream_dns10
+
+vppctl set int ip address pg0 $(cat /opt/config/pg_int.txt)"/"$IPADDR1_CIDR
 sleep 1
 
 # Start HoneyComb
@@ -116,5 +112,4 @@ sleep 20
 # Enable traffic flows
 cd /opt
 chmod +x run_streams_dns.sh
-./run_streams_dns.sh &>/dev/null &disown
-
+./run_streams_dns.sh &>/dev/null &disown
\ No newline at end of file
index 2a2d7a2..50d4fce 100644 (file)
@@ -14,6 +14,26 @@ then
        # Allow remote login as root
        mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk
        cp /home/ubuntu/.ssh/authorized_keys /root/.ssh
+
+       MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
+
+       IP=$(cat /opt/config/local_private_ipaddr.txt)
+       BITS=$(cat /opt/config/pktgen_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 $IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       echo "    mtu $MTU" >> /etc/network/interfaces
+
+       IP=$(cat /opt/config/oam_private_ipaddr.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 $IP" >> /etc/network/interfaces
+       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       echo "    mtu $MTU" >> /etc/network/interfaces
 fi
 
 # Download required dependencies
@@ -46,8 +66,8 @@ chmod +x run_streams_dns.sh
 chmod +x vdnspacketgen_change_streams_ports.sh
 
 # Install VPP
-export UBUNTU="trusty"
-export RELEASE=".stable.1609"
+export UBUNTU="xenial"
+export RELEASE=".stable.1707"
 rm /etc/apt/sources.list.d/99fd.io.list
 echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/fd.io$RELEASE.ubuntu.$UBUNTU.main/ ./" | sudo tee -a /etc/apt/sources.list.d/99fd.io.list
 apt-get update
@@ -58,4 +78,17 @@ sleep 1
 cd /opt
 mv vpacketgenfordnsdemo.sh /etc/init.d
 update-rc.d vpacketgenfordnsdemo.sh defaults
+
+# Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
+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
+       sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
+       sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
+       echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
+       echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
+       reboot
+fi
+
 ./v_packetgen_for_dns_demo_init.sh