diff options
author | Marco Platania <platania@research.att.com> | 2017-08-15 16:58:44 -0400 |
---|---|---|
committer | Marco Platania <platania@research.att.com> | 2017-08-15 16:58:44 -0400 |
commit | 5008a779ccb979e1b7aa9ffa6238272f3471702b (patch) | |
tree | 5ad98a065846345ca2bd2d49fbdd6b02cfff774b | |
parent | 6eb5e72e6cf45445615586a09815fb00ed02c294 (diff) |
Fix ARP issues in vLB and vPKTGEN
- Retrieve vLB and vPKTGEN's MAC address in Heat template
- Assign those MAC addresses to VPP tap interfaces
Change-Id: Ib4e5d4981031328ca8dc54bd7e5b0031c7f41846
Issue-ID: UCA-34
Signed-off-by: Marco Platania <platania@research.att.com>
-rw-r--r-- | heat/vLB/base_vlb_openstack.yaml | 8 | ||||
-rw-r--r-- | vnfs/vLB/scripts/v_dns_install.sh | 4 | ||||
-rwxr-xr-x | vnfs/vLB/scripts/v_lb_init.sh | 10 | ||||
-rw-r--r-- | vnfs/vLB/scripts/v_lb_install.sh | 4 | ||||
-rw-r--r-- | vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh | 12 | ||||
-rw-r--r-- | vnfs/vLB/scripts/v_packetgen_install.sh | 8 |
6 files changed, 19 insertions, 27 deletions
diff --git a/heat/vLB/base_vlb_openstack.yaml b/heat/vLB/base_vlb_openstack.yaml index a99afb84..fa4fea0a 100644 --- a/heat/vLB/base_vlb_openstack.yaml +++ b/heat/vLB/base_vlb_openstack.yaml @@ -121,6 +121,10 @@ parameters: type: string label: vDNS name description: Name of the vDNS + vpg_name_0: + type: string + label: vPKTGEN name + description: Name of the vPKTGEN vnf_id: type: string label: VNF ID @@ -265,6 +269,7 @@ resources: __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 } + __pktgen_mac__: { get_attr: [vpg_private_0_port, mac_address] } __cloud_env__: { get_param: cloud_env } template: | #!/bin/bash @@ -286,6 +291,7 @@ resources: 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 "__pktgen_mac__" > /opt/config/pktgen_mac.txt echo "__cloud_env__" > /opt/config/cloud_env.txt # Download and run install script @@ -395,6 +401,7 @@ resources: __demo_artifacts_version__: { get_param: demo_artifacts_version } __install_script_version__: { get_param: install_script_version } __pg_int__: { get_param: pg_int } + __vlb_mac__: { get_attr: [vlb_private_2_port, mac_address] } __cloud_env__: { get_param: cloud_env } template: | #!/bin/bash @@ -411,6 +418,7 @@ resources: 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 "__vlb_mac__" > /opt/config/vlb_mac.txt echo "__cloud_env__" > /opt/config/cloud_env.txt # Download and run install script diff --git a/vnfs/vLB/scripts/v_dns_install.sh b/vnfs/vLB/scripts/v_dns_install.sh index 19dc047e..84d7a017 100644 --- a/vnfs/vLB/scripts/v_dns_install.sh +++ b/vnfs/vLB/scripts/v_dns_install.sh @@ -42,9 +42,6 @@ then echo " address $IP" >> /etc/network/interfaces echo " netmask $NETMASK" >> /etc/network/interfaces echo " mtu $MTU" >> /etc/network/interfaces - - ifup eth1 - ifup eth2 fi # Download required dependencies @@ -54,7 +51,6 @@ apt-get install -y wget openjdk-8-jdk bind9 bind9utils bind9-doc apt-transport-h sleep 1 # Download vDNS demo code for DNS Server -mkdir /opt/config mkdir /opt/FDclient cd /opt diff --git a/vnfs/vLB/scripts/v_lb_init.sh b/vnfs/vLB/scripts/v_lb_init.sh index 3c816c8d..9223e043 100755 --- a/vnfs/vLB/scripts/v_lb_init.sh +++ b/vnfs/vLB/scripts/v_lb_init.sh @@ -39,17 +39,9 @@ FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump 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) +PKTGEN_MAC=$(cat /opt/config/pktgen_mac.txt) VIP=$(cat /opt/config/vip.txt) -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 diff --git a/vnfs/vLB/scripts/v_lb_install.sh b/vnfs/vLB/scripts/v_lb_install.sh index 9d4a0c9e..6c093c08 100644 --- a/vnfs/vLB/scripts/v_lb_install.sh +++ b/vnfs/vLB/scripts/v_lb_install.sh @@ -51,10 +51,6 @@ then 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 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 86f0b00f..c38d2baf 100644 --- a/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh +++ b/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh @@ -33,6 +33,7 @@ IPADDR1=$(ifconfig eth1 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d' 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) +VLB_MAC=$(cat /opt/config/vlb_mac.txt) GW=$(route -n | grep "^0.0.0.0" | awk '{print $2}') ifconfig eth1 down @@ -53,16 +54,7 @@ sleep 1 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 -while [ $(ping -c 1 $VLB_IPADDR | grep received | cut -d" " -f4) != 1 ]; -do - echo "Wait"; - sleep 1; -done - -sleep 3 -VLB_MAC=$(arp -n | grep -w $VLB_IPADDR | tr -s ' ' | cut -d' ' -f3) +sleep 1 vppctl set ip arp tap-0 $VLB_IPADDR $VLB_MAC # Install packet streams diff --git a/vnfs/vLB/scripts/v_packetgen_install.sh b/vnfs/vLB/scripts/v_packetgen_install.sh index 50d4fce8..0f8014f7 100644 --- a/vnfs/vLB/scripts/v_packetgen_install.sh +++ b/vnfs/vLB/scripts/v_packetgen_install.sh @@ -6,6 +6,14 @@ DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt) INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt) CLOUD_ENV=$(cat /opt/config/cloud_env.txt) +# Convert Network CIDR to Netmask +cdr2mask () { + # Number of args to shift, 255..255, first non-255 byte, zeroes + set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0 + [ $1 -gt 1 ] && shift $1 || shift + echo ${1-0}.${2-0}.${3-0}.${4-0} +} + # OpenStack network configuration if [[ $CLOUD_ENV == "openstack" ]] then |