NFVBENCH-157 Add possibility to not use the ARP static configuration for VPP loop VM 75/69575/1
authorfmenguy <francoisregis.menguy@orange.com>
Wed, 22 Jan 2020 15:00:48 +0000 (16:00 +0100)
committerfmenguy <francoisregis.menguy@orange.com>
Thu, 23 Jan 2020 14:40:20 +0000 (15:40 +0100)
Change-Id: Ifd3f183345e21c7866e9e9898c7bbda601793b2c
Signed-off-by: fmenguy <francoisregis.menguy@orange.com>
docs/testing/user/userguide/advanced.rst
nfvbench/cfg.default.yaml
nfvbench/chain_runner.py
nfvbench/chaining.py
nfvbench/nfvbench.py
nfvbenchvm/dib/build-image.sh
nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local

index b36f01e..5424a05 100644 (file)
@@ -292,6 +292,7 @@ MAC Addresses
 NFVbench will dicover the MAC addresses to use for generated frames using:
 - either OpenStack discovery (find the MAC of an existing VM) in the case of PVP and PVVP service chains
 - or using dynamic ARP discovery (find MAC from IP) in the case of external chains.
+- In case of L3 chain with SDN-GW or router between traffic generator and loop VM ARP is needed to discover SDN-GW mac addresses, use ``--loop-vm-arp`` flag or ``loop_vm_arp: true`` in config file.
 
 Status and Cleanup of NFVbench Resources
 ----------------------------------------
index d3a3fb9..2abc8dc 100755 (executable)
@@ -610,6 +610,11 @@ vlans: []
 #       (see mac_addrs_left and mac_addrs_right)
 no_arp: false
 
+# Loop VM (VPP forwarder) can use ARP to discover next hop mac address
+# False (default): do not send ARP but use static config devices macs instead (TRex gratuitous ARP are not interpreted by VPP)
+# True: ARP requests are sent to find out next hop MAC addresses (for instance SDN-GW)
+loop_vm_arp: false
+
 # Traffic Profiles
 # You can add here more profiles as needed
 # `l2frame_size` can be specified in any none zero integer value to represent the size in bytes
index 418d667..bb35426 100644 (file)
@@ -105,7 +105,8 @@ class ChainRunner(object):
         if not self.config.no_traffic:
             # ARP is needed for EXT chain or VxLAN overlay unless disabled explicitly
             if (self.config.service_chain == ChainType.EXT or
-                    self.config.vxlan or self.config.l3_router) and not self.config.no_arp:
+                    self.config.vxlan or self.config.l3_router or self.config.loop_vm_arp)\
+                    and not self.config.no_arp:
                 self.traffic_client.ensure_arp_successful()
             self.traffic_client.ensure_end_to_end()
 
index a8d6295..71693be 100644 (file)
@@ -456,8 +456,12 @@ class ChainVnf(object):
         else:
             tg_gateway1_ip = devices[LEFT].tg_gateway_ip_addrs
             tg_gateway2_ip = devices[RIGHT].tg_gateway_ip_addrs
-            tg_mac1 = remote_mac_pair[0]
-            tg_mac2 = remote_mac_pair[1]
+            if not config.loop_vm_arp:
+                tg_mac1 = remote_mac_pair[0]
+                tg_mac2 = remote_mac_pair[1]
+            else:
+                tg_mac1 = ""
+                tg_mac2 = ""
 
             g1cidr = devices[LEFT].get_gw_ip(
                 self.chain.chain_id) + self.__get_network_mask(
index eb86dea..168c545 100644 (file)
@@ -343,6 +343,12 @@ def _parse_opts_from_cli():
                         help='Do not use ARP to find MAC addresses, '
                              'instead use values in config file')
 
+    parser.add_argument('--loop-vm-arp', dest='loop_vm_arp',
+                        default=None,
+                        action='store_true',
+                        help='Use ARP to find MAC addresses '
+                             'instead of using values from TRex ports (VPP forwarder only)')
+
     parser.add_argument('--no-vswitch-access', dest='no_vswitch_access',
                         default=None,
                         action='store_true',
index 09ccf6a..87c1169 100755 (executable)
@@ -30,7 +30,7 @@ set -e
 gs_url=artifacts.opnfv.org/nfvbench/images
 
 # image version number
-__version__=0.11
+__version__=0.12
 image_name=nfvbenchvm_centos-$__version__
 
 # if image exists skip building
index 64557d4..d69cd0e 100644 (file)
@@ -211,12 +211,22 @@ if [ $PCI_ADDRESS_1 ] && [ $PCI_ADDRESS_2 ]; then
         INTFS=`vppctl show int | grep Ethernet | xargs`
         INTF_1=`echo $INTFS | awk '{ print $1 }'`
         INTF_2=`echo $INTFS | awk '{ print $4 }'`
+        if [ -z "${TG_MAC1}" ]; then
+            # vm.conf does not support lines commented with #, so
+            # we need to remove the line to set the static ARP entry.
+            sed -i "/{{TG_MAC1}}/d" /etc/vpp/vm.conf
+        else
+            sed -i "s/{{TG_MAC1}}/${TG_MAC1}/g" /etc/vpp/vm.conf
+        fi
+        if [ -z "${TG_MAC2}" ]; then
+            sed -i "/{{TG_MAC2}}/d" /etc/vpp/vm.conf
+        else
+            sed -i "s/{{TG_MAC2}}/${TG_MAC2}/g" /etc/vpp/vm.conf
+        fi
         sed -i "s/{{INTF_1}}/${INTF_1//\//\/}/g" /etc/vpp/vm.conf
         sed -i "s/{{INTF_2}}/${INTF_2//\//\/}/g" /etc/vpp/vm.conf
         sed -i "s/{{VNF_GATEWAY1_CIDR}}/${VNF_GATEWAY1_CIDR//\//\/}/g" /etc/vpp/vm.conf
         sed -i "s/{{VNF_GATEWAY2_CIDR}}/${VNF_GATEWAY2_CIDR//\//\/}/g" /etc/vpp/vm.conf
-        sed -i "s/{{TG_MAC1}}/${TG_MAC1}/g" /etc/vpp/vm.conf
-        sed -i "s/{{TG_MAC2}}/${TG_MAC2}/g" /etc/vpp/vm.conf
         sed -i "s/{{TG_NET1}}/${TG_NET1//\//\/}/g" /etc/vpp/vm.conf
         sed -i "s/{{TG_NET2}}/${TG_NET2//\//\/}/g" /etc/vpp/vm.conf
         sed -i "s/{{TG_GATEWAY1_IP}}/${TG_GATEWAY1_IP}/g" /etc/vpp/vm.conf