bidirectional value: Fix inconsistency for bidir param 01/12501/4
authorChristian Trautman <ctrautma@redhat.com>
Wed, 20 Apr 2016 19:30:42 +0000 (15:30 -0400)
committerChristian Trautman <ctrautma@redhat.com>
Wed, 4 May 2016 13:10:46 +0000 (09:10 -0400)
Fixes bi-directional param and enforces string type in
testcase configuration. Modifies all instance where bi
directional value is used to string.

 * Changes documentation to specify value type as needed
 * Changes traffic defaults to use string for bidir value
 * Fixes testcases configuration files to use bidir as str
 * Change testcase conf documentation to note enforcement
   of string type
 * Sets bidir to title format to keep consitency in traffic
   profile when passed to traffic generators
 * Fix pvp/pvvp check for bidir value
 * Raise exception if testcase configuration is not set
   as str for bidir value
 * Change Xena bi-dir check to string compare instead of
   typecasting to boolean to compare.

JIRA: VSPERF-282

Change-Id: I7c91fcd7333a1d1e1371bfd31700c01d7da268b5
Signed-off-by: Christian Trautman <ctrautma@redhat.com>
conf/01_testcases.conf
conf/integration/01_testcases.conf
core/vswitch_controller_pvp.py
core/vswitch_controller_pvvp.py
testcases/testcase.py
tools/pkt_gen/trafficgen/trafficgenhelper.py
tools/pkt_gen/xena/xena.py
vsperf

index 148171f..23a3ae5 100755 (executable)
 # "Frame Modification": "vlan"     # One of the supported frame modifications:
 #                                  # vlan, mpls, mac, dscp, ttl, ip_addr,
 #                                  # ip_port.
-# "biDirectional": [true|false],   # Specifies if generated traffic will be
-#                                  # full-duplex (true) or half-duplex (false)
+# "biDirectional": ["True"|"False"]
+#                                  # Specifies if generated traffic will be
+#                                  # full-duplex (True) or half-duplex (False)
 #                                  # It can be overridden by cli option bidirectional.
-#                                  # Default value is "false".
+#                                  # Default value is "False". Must be of type
+#                                  # string.
 # "MultiStream": 0-65535           # Optional. Defines number of flows simulated
 #                                  # by traffic generator. Value 0 disables
 #                                  # MultiStream feature
index e9257ae..2edbe08 100644 (file)
@@ -136,7 +136,7 @@ INTEGRATION_TESTS = [
         "Name": "overlay_p2p_tput",
         "Traffic Type": "rfc2544",
         "Deployment": "op2p",
-        "biDirectional": False,
+        "biDirectional": 'False',
         "Tunnel Type": SUPPORTED_TUNNELING_PROTO[0],
         "Tunnel Operation": "encapsulation",
         "Description": "Overlay Encapsulation Throughput RFC2544 Test",
@@ -145,7 +145,7 @@ INTEGRATION_TESTS = [
         "Name": "overlay_p2p_cont",
         "Traffic Type": "continuous",
         "Deployment": "op2p",
-        "biDirectional": False,
+        "biDirectional": 'False',
         "Tunnel Type": SUPPORTED_TUNNELING_PROTO[0],
         "Tunnel Operation": "encapsulation",
         "Description": "Overlay Encapsulation Continuous Stream",
@@ -154,7 +154,7 @@ INTEGRATION_TESTS = [
         "Name": "overlay_p2p_decap_tput",
         "Traffic Type": "rfc2544",
         "Deployment": "op2p",
-        "biDirectional": False,
+        "biDirectional": 'False',
         "Tunnel Type": SUPPORTED_TUNNELING_PROTO[0],
         "Tunnel Operation": "decapsulation",
         "Description": "Overlay Decapsulation Throughput RFC2544 Test",
@@ -163,7 +163,7 @@ INTEGRATION_TESTS = [
         "Name": "overlay_p2p_decap_cont",
         "Traffic Type": "continuous",
         "Deployment": "op2p",
-        "biDirectional": False,
+        "biDirectional": 'False',
         "Tunnel Type": SUPPORTED_TUNNELING_PROTO[0],
         "Tunnel Operation": "decapsulation",
         "Description": "Overlay Decapsulation Continuous Stream",
@@ -264,7 +264,7 @@ INTEGRATION_TESTS = [
         "Description": "vSwitch - configure switch and execute RFC2544 throughput test",
         "TestSteps": STEP_VSWITCH_P2P_FLOWS_INIT +
                      [
-                        ['trafficgen', 'send_traffic', {'traffic_type' : 'throughput', 'bidir' : True}],
+                        ['trafficgen', 'send_traffic', {'traffic_type' : 'throughput', 'bidir' : 'True'}],
                      ] +
                      STEP_VSWITCH_P2P_FLOWS_FINIT
     },
@@ -274,7 +274,7 @@ INTEGRATION_TESTS = [
         "Description": "vSwitch - configure switch and execute RFC2544 back2back test",
         "TestSteps": STEP_VSWITCH_P2P_FLOWS_INIT +
                      [
-                        ['trafficgen', 'send_traffic', {'traffic_type' : 'back2back', 'bidir' : True}],
+                        ['trafficgen', 'send_traffic', {'traffic_type' : 'back2back', 'bidir' : 'True'}],
                      ] +
                      STEP_VSWITCH_P2P_FLOWS_FINIT
     },
@@ -284,7 +284,7 @@ INTEGRATION_TESTS = [
         "Description": "vSwitch - configure switch and execute continuous stream test",
         "TestSteps": STEP_VSWITCH_P2P_FLOWS_INIT +
                      [
-                        ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous', 'bidir' : True}],
+                        ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous', 'bidir' : 'True'}],
                      ] +
                      STEP_VSWITCH_P2P_FLOWS_FINIT
     },
@@ -306,7 +306,7 @@ INTEGRATION_TESTS = [
         "TestSteps": STEP_VSWITCH_PVP_FLOWS_INIT +
                      [
                         ['vnf', 'start'],
-                        ['trafficgen', 'send_traffic', {'traffic_type' : 'throughput', 'bidir' : True}],
+                        ['trafficgen', 'send_traffic', {'traffic_type' : 'throughput', 'bidir' : 'True'}],
                         ['vnf', 'stop'],
                      ] +
                      STEP_VSWITCH_PVP_FLOWS_FINIT
@@ -318,7 +318,7 @@ INTEGRATION_TESTS = [
         "TestSteps": STEP_VSWITCH_PVP_FLOWS_INIT +
                      [
                         ['vnf', 'start'],
-                        ['trafficgen', 'send_traffic', {'traffic_type' : 'back2back', 'bidir' : True}],
+                        ['trafficgen', 'send_traffic', {'traffic_type' : 'back2back', 'bidir' : 'True'}],
                         ['vnf', 'stop'],
                      ] +
                      STEP_VSWITCH_PVP_FLOWS_FINIT
@@ -330,7 +330,7 @@ INTEGRATION_TESTS = [
         "TestSteps": STEP_VSWITCH_PVP_FLOWS_INIT +
                      [
                         ['vnf', 'start'],
-                        ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous', 'bidir' : True}],
+                        ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous', 'bidir' : 'True'}],
                         ['vnf', 'stop'],
                      ] +
                      STEP_VSWITCH_PVP_FLOWS_FINIT
@@ -342,9 +342,9 @@ INTEGRATION_TESTS = [
         "TestSteps": STEP_VSWITCH_PVP_FLOWS_INIT +
                      [
                         ['vnf', 'start'],
-                        ['trafficgen', 'send_traffic', {'traffic_type' : 'throughput', 'bidir' : True}],
-                        ['trafficgen', 'send_traffic', {'traffic_type' : 'back2back', 'bidir' : True}],
-                        ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous', 'bidir' : True}],
+                        ['trafficgen', 'send_traffic', {'traffic_type' : 'throughput', 'bidir' : 'True'}],
+                        ['trafficgen', 'send_traffic', {'traffic_type' : 'back2back', 'bidir' : 'True'}],
+                        ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous', 'bidir' : 'True'}],
                         ['vnf', 'stop'],
                      ] +
                      STEP_VSWITCH_PVP_FLOWS_FINIT
@@ -370,7 +370,7 @@ INTEGRATION_TESTS = [
                      [
                         ['vnf1', 'start'],
                         ['vnf2', 'start'],
-                        ['trafficgen', 'send_traffic', {'traffic_type' : 'throughput', 'bidir' : True}],
+                        ['trafficgen', 'send_traffic', {'traffic_type' : 'throughput', 'bidir' : 'True'}],
                         ['vnf1', 'stop'],
                         ['vnf2', 'stop'],
                      ] +
@@ -384,7 +384,7 @@ INTEGRATION_TESTS = [
                      [
                         ['vnf1', 'start'],
                         ['vnf2', 'start'],
-                        ['trafficgen', 'send_traffic', {'traffic_type' : 'back2back', 'bidir' : True}],
+                        ['trafficgen', 'send_traffic', {'traffic_type' : 'back2back', 'bidir' : 'True'}],
                         ['vnf1', 'stop'],
                         ['vnf2', 'stop'],
                      ] +
@@ -398,7 +398,7 @@ INTEGRATION_TESTS = [
                      [
                         ['vnf1', 'start'],
                         ['vnf2', 'start'],
-                        ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous', 'bidir' : True}],
+                        ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous', 'bidir' : 'True'}],
                         ['vnf1', 'stop'],
                         ['vnf2', 'stop'],
                      ] +
@@ -412,9 +412,9 @@ INTEGRATION_TESTS = [
                      [
                         ['vnf1', 'start'],
                         ['vnf2', 'start'],
-                        ['trafficgen', 'send_traffic', {'traffic_type' : 'throughput', 'bidir' : True}],
-                        ['trafficgen', 'send_traffic', {'traffic_type' : 'back2back', 'bidir' : True}],
-                        ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous', 'bidir' : True}],
+                        ['trafficgen', 'send_traffic', {'traffic_type' : 'throughput', 'bidir' : 'True'}],
+                        ['trafficgen', 'send_traffic', {'traffic_type' : 'back2back', 'bidir' : 'True'}],
+                        ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous', 'bidir' : 'True'}],
                         ['vnf1', 'stop'],
                         ['vnf2', 'stop'],
                      ] +
@@ -434,7 +434,7 @@ INTEGRATION_TESTS = [
 #        "TestSteps": STEP_VSWITCH_PVP_FLOWS_INIT +
 #                     [
 #                        ['vnf', 'start'],
-#                        ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous', 'bidir' : True}],
+#                        ['trafficgen', 'send_traffic', {'traffic_type' : 'continuous', 'bidir' : 'True'}],
 #                        ['vnf', 'stop'],
 #                     ] +
 #                     STEP_VSWITCH_PVP_FLOWS_FINIT
index 0c98cc7..a4f6196 100644 (file)
@@ -77,7 +77,7 @@ class VswitchControllerPVP(IVswitchController):
             self._vswitch.add_flow(bridge, flow1)
             self._vswitch.add_flow(bridge, flow2)
 
-            if self._traffic['bidir']:
+            if self._traffic['bidir'] == 'True':
                 flow3 = add_ports_to_flow(flow_template, phy2_number,
                                           vport2_number)
                 flow4 = add_ports_to_flow(flow_template, vport1_number,
index c79ad9a..729aca3 100644 (file)
@@ -82,7 +82,7 @@ class VswitchControllerPVVP(IVswitchController):
             self._vswitch.add_flow(bridge, flow2)
             self._vswitch.add_flow(bridge, flow3)
 
-            if self._traffic['bidir']:
+            if self._traffic['bidir'] == 'True':
                 flow4 = add_ports_to_flow(flow_template, phy2_number,
                                           vport4_number)
                 flow5 = add_ports_to_flow(flow_template, vport3_number,
index f7908af..5b9ead6 100644 (file)
@@ -82,6 +82,10 @@ class TestCase(object):
 
         bidirectional = cfg.get('biDirectional', TRAFFIC_DEFAULTS['bidir'])
         bidirectional = get_test_param('bidirectional', bidirectional)
+        if not isinstance(bidirectional, str):
+            raise TypeError(
+                'Bi-dir value must be of type string in testcase configuration')
+        bidirectional = bidirectional.title()  # Keep things consistent
 
         traffic_type = cfg.get('Traffic Type', TRAFFIC_DEFAULTS['traffic_type'])
         traffic_type = get_test_param('traffic_type', traffic_type)
index 0a24057..90c77b0 100644 (file)
@@ -23,7 +23,7 @@ CMD_PREFIX = 'gencmd : '
 TRAFFIC_DEFAULTS = {
     'traffic_type' : 'rfc2544',
     'frame_rate' : 100,
-    'bidir' : False,
+    'bidir' : 'False',  # will be passed as string in title format to tgen
     'multistream' : 0,
     'stream_type' : 'L4',
     'pre_installed_flows' : 'No',           # used by vswitch implementation
index 67ac565..d29fc36 100755 (executable)
@@ -182,7 +182,7 @@ class Xena(ITrafficGenerator):
                 flows=self._params['traffic']['multistream'],
                 multistream_layer=self._params['traffic']['stream_type'])
             # set duplex mode
-            if bool(self._params['traffic']['bidir']):
+            if self._params['traffic']['bidir'] == "True":
                 j_file.set_topology_mesh()
             else:
                 j_file.set_topology_blocks()
diff --git a/vsperf b/vsperf
index 98bc7db..789e5df 100755 (executable)
--- a/vsperf
+++ b/vsperf
@@ -610,7 +610,7 @@ def main():
         # set traffic details, so they can be passed to traffic ctl
         traffic = copy.deepcopy(TRAFFIC_DEFAULTS)
         traffic.update({'traffic_type': get_test_param('traffic_type', 'rfc2544'),
-                        'bidir': get_test_param('bidirectional', False),
+                        'bidir': get_test_param('bidirectional', 'False'),
                         'multistream': int(get_test_param('multistream', 0)),
                         'stream_type': get_test_param('stream_type', 'L4'),
                         'frame_rate': int(get_test_param('iload', 100))})