fix: IPV6 packet generation, packet loss reporting 83/70683/1
authorLuc Provoost <luc.provoost@intel.com>
Thu, 6 Aug 2020 12:11:05 +0000 (14:11 +0200)
committerLuc Provoost <luc.provoost@intel.com>
Thu, 6 Aug 2020 12:54:01 +0000 (14:54 +0200)
UDP and IP packet length and source UDP port and destination UDP port
were wrongly set for IPv6 packets.
In the *.test files, there is now an optional boolean field (ipv6) in
the [TestParameters] section. When set to true, the generator will use
the IPv6 packet layout to place the right values at the proper offset
in the packet. If not present or set to false, the IPv4 layout will be
used. Note also that packet size needs to be at least 84 bytes for IPV6
traffic since we need space for latency and other information in each
packet.
Packet loss ratio is now printed as a percentage of the total packets
sent.

Change-Id: I2136e87f3032348ae95b69052be7da8461c6303c
Signed-off-by: Luc Provoost <luc.provoost@intel.com>
VNFs/DPPD-PROX/helper-scripts/rapid/TST009_Throughput.test
VNFs/DPPD-PROX/helper-scripts/rapid/format.yaml
VNFs/DPPD-PROX/helper-scripts/rapid/ipv6.test
VNFs/DPPD-PROX/helper-scripts/rapid/machine.map
VNFs/DPPD-PROX/helper-scripts/rapid/params_rapid.yaml
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py
VNFs/DPPD-PROX/helper-scripts/rapid/runrapid.py

index d931faa..ce9ba72 100644 (file)
@@ -15,7 +15,7 @@
 ##
 
 [TestParameters]
-name = TST009Testing
+name = Rapid_ETSINFV_TST009
 number_of_tests = 2
 total_number_of_test_machines = 2
 lat_percentile = 99
index a6e5b0c..1ac48ab 100644 (file)
@@ -1,5 +1,7 @@
 ;Format: PushGateway
 ;Format: Xtesting
+;URL:
+  part1: http://testresults.opnfv.org/test/api/v1/results
 ;URL:
   part1: http://192.168.36.61:9091/metrics/job/
   part2: test
@@ -20,8 +22,8 @@
   PacketsReceived: PacketsReceived
   PacketsLost: PacketsLost
 rapid_flowsizetest:
-  project_name: "vsperf"
-  scenario: "vsperf"
+  project_name: "cirv"
+  scenario: "rapid"
   start_date: start_date
   stop_date: stop_date
   case_name: test
index 966c073..b9f00f7 100644 (file)
@@ -19,6 +19,7 @@ name = BasicSwapTesting
 number_of_tests = 2
 total_number_of_test_machines = 2
 lat_percentile = 99
+ipv6 = True
 
 [TestM1]
 name = Generator
@@ -38,7 +39,7 @@ cores = [1]
 [test1]
 test=warmuptest
 flowsize=512
-imix=[64]
+imix=[84]
 warmupspeed=1
 warmuptime=2
 
@@ -49,8 +50,11 @@ test=flowsizetest
 # all combinations must be meeting the same threshold
 # The threshold is expressed in Mpps
 pass_threshold=0.1
-imixs=[[64], [128]]
-# the number of flows in the list need to be powers of 2, max 2^30
+# DO NOT USE IMIX FOR IPV6 TESTING
+# PACKET SIZE NEEDS TO BE AT LEAST 84 (66 + 18) FOR IPV6
+# 18 bytes needed for UDP LATENCY AND COUNTER CONTENT
+imixs=[[84],[250]]
+# Number of flows in the list need to be powers of 2, max 2^30
 # If not a power of 2, we will use the lowest power of 2 that is larger than
 # the requested number of flows. e.g. 9 will result in 16 flows
 flows=[64,500000]
index 6d48d19..941fba0 100644 (file)
@@ -4,3 +4,5 @@ parameters:
   PROX_image: testrapidVM\r
   my_availability_zone: nova\r
   security_group: prox_security_group\r
+  PROXVM_count: 4\r
+  PROX2VM_count: 0\r
index 8d7b4e3..1cd1fa3 100644 (file)
@@ -35,7 +35,7 @@ class RandomPortBits(object):
             # throw exeption since we need the first bit to be 1
             # Otherwise, the randomization could results in all 0's
             # and that might be an invalid UDP port and result in 
-            # packets begin discarded
+            # packets being discarded
         src_number_of_random_bits = number_of_random_bits // 2
         dst_number_of_random_bits = (number_of_random_bits -
                 src_number_of_random_bits)
@@ -43,12 +43,38 @@ class RandomPortBits(object):
                 src_number_of_random_bits)
         dst_port_bitmap = '1000000000000000'.replace ('0','X',
                 dst_number_of_random_bits)
-        return [src_port_bitmap, dst_port_bitmap, 1<<number_of_random_bits]
+        return [src_port_bitmap, dst_port_bitmap, 1 << number_of_random_bits]
 
 class RapidGeneratorMachine(RapidMachine):
     """
-    Class to deal with rapid configuration files
+    Class to deal with a generator PROX instance (VM, bare metal, container)
     """
+    def __init__(self, key, user, vim, rundir, machine_params, ipv6):
+        mac_address_size = 6
+        ethertype_size = 2
+        FCS_size = 4
+        if ipv6:
+            ip_header_size = 40
+            self.ip_length_offset = 18
+            # In IPV6, the IP size is the size of the IP content
+            self.frame_size_minus_ip_size = (2 * mac_address_size +
+                    ethertype_size + ip_header_size + FCS_size)
+        else:
+            ip_header_size = 20
+            self.ip_length_offset = 16
+            # In IPV4, the IP size is the size of the IP header + IP content
+            self.frame_size_minus_ip_size = (2 * mac_address_size +
+                    ethertype_size + FCS_size)
+        self.frame_size_minus_udp_header_and_content = (2 * mac_address_size +
+                ethertype_size + ip_header_size + FCS_size )
+        udp_header_start_offset = (2 * mac_address_size + ethertype_size +
+                ip_header_size)
+        self.udp_source_port_offset = udp_header_start_offset 
+        self.udp_dest_port_offset = udp_header_start_offset + 2
+        self.udp_length_offset = udp_header_start_offset + 4
+        self.ipv6 = ipv6
+        super().__init__(key, user, vim, rundir, machine_params)
+
     def get_cores(self):
         return (self.machine_params['gencores'] +
                 self.machine_params['latcores'])
@@ -62,9 +88,8 @@ class RapidGeneratorMachine(RapidMachine):
             for index, gw_ip in enumerate(self.machine_params['gw_ips'],
                     start = 1):
                 appendix = appendix + 'gw_ip{}="{}"\n'.format(index, gw_ip)
-                appendix = (appendix +
-                        'gw_hex_ip{}=convertIPToHex(gw_ip{})\n'.format(index,
-                            index))
+                appendix = (appendix + 'gw_hex_ip{}=convertIPToHex(gw_ip{})\n'.
+                        format(index, index))
         if 'bucket_size_exp' in self.machine_params.keys():
             self.bucket_size_exp = self.machine_params['bucket_size_exp']
         else:
@@ -100,15 +125,17 @@ class RapidGeneratorMachine(RapidMachine):
             # The set_size function takes the PROX packet size as a parameter
             self.socket.set_size(self.machine_params['gencores'], 0,
                     imix_frame_sizes[0] - 4)
-            # 18 is the difference between the frame size and IP size =
-            # size of (MAC addresses, ethertype and FCS)
-            self.socket.set_value(self.machine_params['gencores'], 0, 16,
-                    imix_frame_sizes[0] - 18, 2)
-            # 38 is the difference between the frame size and UDP size = 
-            # 18 + size of IP header (=20)
-            self.socket.set_value(self.machine_params['gencores'], 0, 38,
-                    imix_frame_sizes[0] - 38, 2)
+            # Writing length in the ip header
+            self.socket.set_value(self.machine_params['gencores'], 0,
+                    self.ip_length_offset, imix_frame_sizes[0] - 
+                    self.frame_size_minus_ip_size, 2)
+            # Writing length in the udp header
+            self.socket.set_value(self.machine_params['gencores'], 0,
+                    self.udp_length_offset, imix_frame_sizes[0] -
+                    self.frame_size_minus_udp_header_and_content, 2)
         else:
+            if self.ipv6:
+                RapidLog.critical('IMIX not supported for IPV6')
             prox_sizes = [frame_size - 4 for frame_size in imix_frame_sizes]
             self.socket.set_imix(self.machine_params['gencores'], 0,
                     prox_sizes)
@@ -116,10 +143,10 @@ class RapidGeneratorMachine(RapidMachine):
     def set_flows(self, number_of_flows):
         source_port, destination_port, actualflows = RandomPortBits.get_bitmap(
                 number_of_flows)
-        self.socket.set_random(self.machine_params['gencores'],0,34,
-                source_port,2)
-        self.socket.set_random(self.machine_params['gencores'],0,36,
-                destination_port,2)
+        self.socket.set_random(self.machine_params['gencores'],0,
+                self.udp_source_port_offset, source_port,2)
+        self.socket.set_random(self.machine_params['gencores'],0,
+                self.udp_dest_port_offset, destination_port,2)
         return actualflows
 
     def start_gen_cores(self):
index 7a5ebd4..fc3e291 100644 (file)
@@ -22,7 +22,7 @@ import re
 
 class RapidMachine(object):
     """
-    Class to deal with rapid configuration files
+    Class to deal with a PROX instance (VM, bare metal, container)
     """
     def __init__(self, key, user, vim, rundir, machine_params):
         self.name = machine_params['name']
index bdf2703..5c79c2c 100644 (file)
@@ -45,6 +45,10 @@ class RapidConfigParser(object):
             test_params['lat_percentile'] = 0.99
         RapidLog.info('Latency percentile at {:.0f}%'.format(
             test_params['lat_percentile']*100))
+        if testconfig.has_option('TestParameters', 'ipv6'):
+            test_params['ipv6'] = testconfig.getboolean('TestParameters','ipv6')
+        else:
+            test_params['ipv6'] = False
         config = configparser.RawConfigParser()
         config.read(test_params['environment_file'])
         test_params['vim_type'] = config.get('Varia', 'vim')
@@ -62,7 +66,6 @@ class RapidConfigParser(object):
                 if option in ['imix','imixs','flows']:
                     test[option] = ast.literal_eval(testconfig.get(section,
                         option))
-#                    test[option] = [int(i) for i in test[option]]
                 elif option in ['maxframespersecondallingress','stepsize',
                         'flowsize']:
                     test[option] = int(testconfig.get(section, option))
index 3be07c2..9cbc4de 100644 (file)
@@ -188,7 +188,7 @@ class RapidTest(object):
                 + ' us | ' + '{:>9.0f}'.format(tx) + ' | {:>9.0f}'.format(rx) +
                 ' | '+ abs_drop_rate_prefix+ '{:>9.0f}'.format(tx-rx) +
                 tot_drop_str +drop_rate_prefix +
-                '{:>5.2f}'.format(old_div(float(tx-rx),tx)) + bcolors.ENDC +
+                '{:>5.2f}'.format(100*old_div(float(tx-rx),tx)) + bcolors.ENDC +
                 ' |' + elapsed_time_str)
             
     def run_iteration(self, requested_duration, flow_number, size, speed):
index d3885bf..023b4bc 100755 (executable)
@@ -56,7 +56,8 @@ class RapidTestManager(object):
             if 'gencores' in machine_params.keys():
                 machine = RapidGeneratorMachine(test_params['key'],
                         test_params['user'], test_params['vim_type'],
-                        test_params['rundir'], machine_params)
+                        test_params['rundir'], machine_params,
+                        test_params['ipv6'])
                 if machine_params['monitor']:
                     if monitor_gen:
                         RapidLog.exception("Can only monitor 1 generator")