From 47875a6f01fa9dc1738d4c4a29ad75e12e251077 Mon Sep 17 00:00:00 2001 From: Christian Trautman Date: Wed, 20 Apr 2016 15:30:42 -0400 Subject: bidirectional value: Fix inconsistency for bidir param 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 --- conf/01_testcases.conf | 8 +++--- conf/integration/01_testcases.conf | 40 ++++++++++++++-------------- core/vswitch_controller_pvp.py | 2 +- core/vswitch_controller_pvvp.py | 2 +- testcases/testcase.py | 4 +++ tools/pkt_gen/trafficgen/trafficgenhelper.py | 2 +- tools/pkt_gen/xena/xena.py | 2 +- vsperf | 2 +- 8 files changed, 34 insertions(+), 28 deletions(-) diff --git a/conf/01_testcases.conf b/conf/01_testcases.conf index 148171fd..23a3ae57 100755 --- a/conf/01_testcases.conf +++ b/conf/01_testcases.conf @@ -28,10 +28,12 @@ # "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 diff --git a/conf/integration/01_testcases.conf b/conf/integration/01_testcases.conf index e9257ae0..2edbe08b 100644 --- a/conf/integration/01_testcases.conf +++ b/conf/integration/01_testcases.conf @@ -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 diff --git a/core/vswitch_controller_pvp.py b/core/vswitch_controller_pvp.py index 0c98cc7f..a4f61961 100644 --- a/core/vswitch_controller_pvp.py +++ b/core/vswitch_controller_pvp.py @@ -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, diff --git a/core/vswitch_controller_pvvp.py b/core/vswitch_controller_pvvp.py index c79ad9a3..729aca3f 100644 --- a/core/vswitch_controller_pvvp.py +++ b/core/vswitch_controller_pvvp.py @@ -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, diff --git a/testcases/testcase.py b/testcases/testcase.py index f7908af9..5b9ead69 100644 --- a/testcases/testcase.py +++ b/testcases/testcase.py @@ -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) diff --git a/tools/pkt_gen/trafficgen/trafficgenhelper.py b/tools/pkt_gen/trafficgen/trafficgenhelper.py index 0a240579..90c77b09 100644 --- a/tools/pkt_gen/trafficgen/trafficgenhelper.py +++ b/tools/pkt_gen/trafficgen/trafficgenhelper.py @@ -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 diff --git a/tools/pkt_gen/xena/xena.py b/tools/pkt_gen/xena/xena.py index 67ac5652..d29fc362 100755 --- a/tools/pkt_gen/xena/xena.py +++ b/tools/pkt_gen/xena/xena.py @@ -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 98bc7db0..789e5df8 100755 --- 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))}) -- cgit 1.2.3-korg