From a445ef826ac13e271f89f3e6b221df2d0be3d623 Mon Sep 17 00:00:00 2001 From: Marco Platania Date: Tue, 15 Aug 2017 13:44:48 -0400 Subject: [PATCH] Update vLB to Ubuntu 1604 and VPP 1707 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 --- heat/vLB/base_vlb_openstack.env | 9 ++ heat/vLB/base_vlb_openstack.yaml | 129 +++++++++++++++++++++- vnfs/vLB/.DS_Store | Bin 10244 -> 0 bytes vnfs/vLB/scripts/.DS_Store | Bin 8196 -> 0 bytes vnfs/vLB/scripts/add_dns.sh | 13 ++- vnfs/vLB/scripts/dnsmembership.sh | 4 +- vnfs/vLB/scripts/remove_dns.sh | 14 +-- vnfs/vLB/scripts/v_dns_install.sh | 13 +++ vnfs/vLB/scripts/v_lb_init.sh | 42 ++++--- vnfs/vLB/scripts/v_lb_install.sh | 36 ++++-- vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh | 43 ++++---- vnfs/vLB/scripts/v_packetgen_install.sh | 37 ++++++- 12 files changed, 273 insertions(+), 67 deletions(-) delete mode 100644 vnfs/vLB/.DS_Store delete mode 100644 vnfs/vLB/scripts/.DS_Store diff --git a/heat/vLB/base_vlb_openstack.env b/heat/vLB/base_vlb_openstack.env index afcfccfd..ab95f362 100644 --- a/heat/vLB/base_vlb_openstack.env +++ b/heat/vLB/base_vlb_openstack.env @@ -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 diff --git a/heat/vLB/base_vlb_openstack.yaml b/heat/vLB/base_vlb_openstack.yaml index 18a0d76e..a99afb84 100644 --- a/heat/vLB/base_vlb_openstack.yaml +++ b/heat/vLB/base_vlb_openstack.yaml @@ -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 index b7ccbfd4e0d26934e82a4efe031721923a77daec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10244 zcmeI1Pj4GV6u{r4f!IkQn!eK=&pyuF|gs2Co>li^)g_v%X#!8CW^-i2o*E6f# zbwX-I@_`dKJ^&Z~bK<~}8~;B57Y?WgJ^)Bu=n3A;tXs2AluJRbG-J)Y=h^pW*T30) z_Im~ZQf~W;05$;RuuEy3$Kiw~kIO#LM$(x{lmz_&Vn`qY3NEw;tj&ZWUX@u_CQislBO6$yW??NnxibGva6+b2cq49q-Q2+hC_$849rLM|>Qy({@9CRD1P^rA+hX*vZq2L;p16$DsLyrx7URA+EQ>bx<6TFucZ>PS ze%&fmBYJ?YRhQE(7Bi0pEIG>M<*RO8>~vPHF4&93tH%p=XJw_hU@yJ+(($qNZZ0?X z!t(X?T6p~4haY|X$)}%v{>^t92uXtqOlJUne>xr3I7sP`uX=RuSymsP^G`iJX-!?2 zo|>5|6bjE=EL@tMovT~Zp4+(7jN~U<6@iG#L7VP0Bj!7y+hDx8ozQm@hux)h>q5r# zCiUNXIJJ2cqRq_13ANm75v5$Mx3RYu(`36(uhp%|xDkmUsEU{+Oz_%njJvm%(AFB? z6L>}mb|aLB;w>7*C_|=STL^@{3U9UP42d6K0jZorjt3i4A)^Dw%`ujh4do8&BD-V?mH(Zz8|Q&{OnIWRu}Hh5@;O1yu$i7FOf6Ks3^T zjK6Zo9PYuNf2)QXK*qX{^Zj0c8vgKosnc0pURtoPEMGZ0et#=(Lu{wU?;r4B2Fqg; zw+G^Gtv`}KhH?ALM-;a+8yYkhorY+I>Q2x@#-b%E6~CP{0Dk`Qw^x+OfQ5gCMYw;~ zSu)RV-{lz95HJJ`0YktL7$ySe^u^e+{{QOf|NjruC7Ww81Pp;kOn{75oJtuN?Nv*% z>&sfZjs0!xvPrwHmdXVORgOog%JKL{mg7}{2j_~YtA=_>Dk!^JqK55%|1)3+%8Dlc RKe2pk@_#?A+y2M-|37H!eTD!4 diff --git a/vnfs/vLB/scripts/.DS_Store b/vnfs/vLB/scripts/.DS_Store deleted file mode 100644 index 32f7ecabe74b3cdf4a9721f61f254dc28a7caf34..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMOKuZE5Umaou^#$zjXB9?Olwj7EBa1BlX z?^U<0o{xteLQpMrS9`i%eO~w2sN=z}o$R%uuc-DJ} z4*q)&Un6^>OXxG^TCOmwFe|W9weiZs*NBHx=nvt^!v>kq-nwIhxyLq65VPm+4sv7{ zH2WBN3gj(3WXO4=Rv62A)CL)dZ9InlCD577)k20jZE_E*Ar8rbn?xL($lcCkhMa5k z!QB&N-a<}$Nag|7hdm!00Y8g8A1l7nlQ`m+ytVv3>fnCsRenTX6Gg8OXCa@IyE#Vg z!j+!&?G93I-;1&6up_PLp6<0zE2FWxFR+zIu^z!zbSu|6iQLK0k@oYQ_E2^OZuMq} zfZ6s>+)8ubAijb3PIo@`bRV9$Zv(ozTe0pl==S6BT>IR%JP%nTyRkJKe{05oF(CIm z2WPDRU+=&FH>QjMW8fcVz#U$^zc@#Np| $FD +echo $CURR_DNS > $FD \ No newline at end of file diff --git a/vnfs/vLB/scripts/dnsmembership.sh b/vnfs/vLB/scripts/dnsmembership.sh index 345dc3ff..e18ab803 100644 --- a/vnfs/vLB/scripts/dnsmembership.sh +++ b/vnfs/vLB/scripts/dnsmembership.sh @@ -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 diff --git a/vnfs/vLB/scripts/remove_dns.sh b/vnfs/vLB/scripts/remove_dns.sh index 1d505abe..f400aa0f 100644 --- a/vnfs/vLB/scripts/remove_dns.sh +++ b/vnfs/vLB/scripts/remove_dns.sh @@ -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 diff --git a/vnfs/vLB/scripts/v_dns_install.sh b/vnfs/vLB/scripts/v_dns_install.sh index 83441ac9..19dc047e 100644 --- a/vnfs/vLB/scripts/v_dns_install.sh +++ b/vnfs/vLB/scripts/v_dns_install.sh @@ -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 diff --git a/vnfs/vLB/scripts/v_lb_init.sh b/vnfs/vLB/scripts/v_lb_init.sh index 8767a943..3c816c8d 100755 --- a/vnfs/vLB/scripts/v_lb_init.sh +++ b/vnfs/vLB/scripts/v_lb_init.sh @@ -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 diff --git a/vnfs/vLB/scripts/v_lb_install.sh b/vnfs/vLB/scripts/v_lb_install.sh index 394a6c8c..9d4a0c9e 100644 --- a/vnfs/vLB/scripts/v_lb_install.sh +++ b/vnfs/vLB/scripts/v_lb_install.sh @@ -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 diff --git a/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh b/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh index 9e7879bc..86f0b00f 100644 --- a/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh +++ b/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh @@ -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 diff --git a/vnfs/vLB/scripts/v_packetgen_install.sh b/vnfs/vLB/scripts/v_packetgen_install.sh index 2a2d7a24..50d4fce8 100644 --- a/vnfs/vLB/scripts/v_packetgen_install.sh +++ b/vnfs/vLB/scripts/v_packetgen_install.sh @@ -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 -- 2.16.6