diff options
author | Martin Klozik <martinx.klozik@intel.com> | 2015-10-13 06:35:33 +0100 |
---|---|---|
committer | Maryam Tahhan <maryam.tahhan@intel.com> | 2015-10-21 13:59:21 +0000 |
commit | 3572d56f5733592db30f0df2273fe93e731cba2d (patch) | |
tree | c3e8d9a497e22a2138e24dcdc6fefd831f90a592 /testcases/testcase.py | |
parent | ba33eda4f9ad307178668c2634de6bec1c53a0d3 (diff) |
Flow Classification extension
Flow definition can be changed by testcase setup. By default
only ingress ports are used to route traffic, but flow can be
extended by src and dst IP addresses used by the traffic
generator.
Change-Id: I694714537ad2d818192a39f3235d8e6bf0f59a49
JIRA: VSPERF-90
Signed-off-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Billy O Mahony <billy.o.mahony@intel.com>
Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com>
Reviewed-by: Fatih Degirmenci <fatih.degirmenci@ericsson.com>
Reviewed-by: Gene Snider <eugene.snider@huawei.com>
Reviewed-by: Al Morton <acmorton@att.com>
Reviewed-by: Tv Rao <tv.rao@freescale.com>
Reviewed-by: Brian Castelli <brian.castelli@spirent.com>
Diffstat (limited to 'testcases/testcase.py')
-rw-r--r-- | testcases/testcase.py | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/testcases/testcase.py b/testcases/testcase.py index feb264d3..78f65239 100644 --- a/testcases/testcase.py +++ b/testcases/testcase.py @@ -24,6 +24,7 @@ import core.component_factory as component_factory from core.loader import Loader from tools.report import report from conf import settings as S +from tools.pkt_gen.trafficgen.trafficgenhelper import TRAFFIC_DEFAULTS class TestCase(object): """TestCase base class @@ -41,9 +42,7 @@ class TestCase(object): self._logger = logging.getLogger(__name__) self.name = cfg['Name'] self.desc = cfg.get('Description', 'No description given.') - self._traffic_type = cfg['Traffic Type'] self.deployment = cfg['Deployment'] - self._bidir = cfg['biDirectional'] self._frame_mod = cfg.get('Frame Modification', None) # check if test requires background load and which generator it uses @@ -57,7 +56,13 @@ class TestCase(object): if self._frame_mod: self._frame_mod = self._frame_mod.lower() self._results_dir = results_dir - self._multistream = cfg.get('MultiStream', 0) + + # set traffic details, so they can be passed to vswitch and traffic ctls + self._traffic = TRAFFIC_DEFAULTS.copy() + self._traffic.update({'traffic_type': cfg['Traffic Type'], + 'flow_type': cfg.get('Flow Type', 'port'), + 'bidir': cfg['biDirectional'], + 'multistream': cfg.get('MultiStream', 0)}) def run(self): """Run the test @@ -66,10 +71,18 @@ class TestCase(object): """ self._logger.debug(self.name) + # OVS Vanilla requires guest VM MAC address and IPs + # to work + if (self.deployment in ["pvp", "pvvp"] and S.getValue('VSWITCH') == "OvsVanilla"): + self._traffic['l2'] = {'srcmac': S.getValue('GUEST_NET2_MAC')[0], + 'dstmac': S.getValue('GUEST_NET1_MAC')[0]} + self._traffic['l3'] = {'srcip': S.getValue('VANILLA_TGEN_PORT1_IP'), + 'dstip': S.getValue('VANILLA_TGEN_PORT2_IP')} + self._logger.debug("Controllers:") loader = Loader() traffic_ctl = component_factory.create_traffic( - self._traffic_type, + self._traffic['traffic_type'], loader.get_trafficgen_class()) vnf_ctl = component_factory.create_vnf( self.deployment, @@ -77,7 +90,7 @@ class TestCase(object): vswitch_ctl = component_factory.create_vswitch( self.deployment, loader.get_vswitch_class(), - self._bidir) + self._traffic) collector = component_factory.create_collector( loader.get_collector_class(), self._results_dir, self.name) @@ -88,23 +101,6 @@ class TestCase(object): self._logger.debug("Setup:") with vswitch_ctl, loadgen: with vnf_ctl, collector: - traffic = {'traffic_type': self._traffic_type, - 'bidir': self._bidir, - 'multistream': self._multistream} - - # OVS Vanilla requires guest VM MAC address and IPs - # to work - if (self.deployment in ["pvp", "pvvp"] and - S.getValue('VSWITCH') == "OvsVanilla"): - - traffic['l2'] = {'srcmac': S.getValue('GUEST_NET2_MAC')[0], - 'dstmac': S.getValue('GUEST_NET1_MAC')[0]} - - traffic['l3'] = {'srcip': - S.getValue('VANILLA_TGEN_PORT1_IP'), - 'dstip': - S.getValue('VANILLA_TGEN_PORT2_IP')} - vswitch = vswitch_ctl.get_vswitch() # TODO BOM 15-08-07 the frame mod code assumes that the # physical ports are ports 1 & 2. The actual numbers @@ -189,7 +185,7 @@ class TestCase(object): pass with traffic_ctl: - traffic_ctl.send_traffic(traffic) + traffic_ctl.send_traffic(self._traffic) # dump vswitch flows before they are affected by VNF termination vswitch_ctl.dump_vswitch_flows() |