summaryrefslogtreecommitdiffstats
path: root/core/vswitch_controller_pvp.py
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2015-10-13 06:35:33 +0100
committerMaryam Tahhan <maryam.tahhan@intel.com>2015-10-21 13:59:21 +0000
commit3572d56f5733592db30f0df2273fe93e731cba2d (patch)
treec3e8d9a497e22a2138e24dcdc6fefd831f90a592 /core/vswitch_controller_pvp.py
parentba33eda4f9ad307178668c2634de6bec1c53a0d3 (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 'core/vswitch_controller_pvp.py')
-rw-r--r--core/vswitch_controller_pvp.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/core/vswitch_controller_pvp.py b/core/vswitch_controller_pvp.py
index b2337bd6..0c98cc7f 100644
--- a/core/vswitch_controller_pvp.py
+++ b/core/vswitch_controller_pvp.py
@@ -34,7 +34,7 @@ class VswitchControllerPVP(IVswitchController):
_deployment_scenario: A string describing the scenario to set-up in the
constructor.
"""
- def __init__(self, vswitch_class, bidir=False):
+ def __init__(self, vswitch_class, traffic):
"""Initializes up the prerequisites for the PVP deployment scenario.
:vswitch_class: the vSwitch class to be used.
@@ -43,7 +43,7 @@ class VswitchControllerPVP(IVswitchController):
self._vswitch_class = vswitch_class
self._vswitch = vswitch_class()
self._deployment_scenario = "PVP"
- self._bidir = bidir
+ self._traffic = traffic.copy()
self._logger.debug('Creation using ' + str(self._vswitch_class))
def setup(self):
@@ -63,17 +63,24 @@ class VswitchControllerPVP(IVswitchController):
(_, vport2_number) = self._vswitch.add_vport(bridge)
self._vswitch.del_flow(bridge)
- flow1 = add_ports_to_flow(_FLOW_TEMPLATE, phy1_number,
+
+ # configure flows according to the TC definition
+ flow_template = _FLOW_TEMPLATE.copy()
+ if self._traffic['flow_type'] == 'IP':
+ flow_template.update({'dl_type':'0x0800', 'nw_src':self._traffic['l3']['srcip'],
+ 'nw_dst':self._traffic['l3']['dstip']})
+
+ flow1 = add_ports_to_flow(flow_template, phy1_number,
vport1_number)
- flow2 = add_ports_to_flow(_FLOW_TEMPLATE, vport2_number,
+ flow2 = add_ports_to_flow(flow_template, vport2_number,
phy2_number)
self._vswitch.add_flow(bridge, flow1)
self._vswitch.add_flow(bridge, flow2)
- if self._bidir:
- flow3 = add_ports_to_flow(_FLOW_TEMPLATE, phy2_number,
+ if self._traffic['bidir']:
+ flow3 = add_ports_to_flow(flow_template, phy2_number,
vport2_number)
- flow4 = add_ports_to_flow(_FLOW_TEMPLATE, vport1_number,
+ flow4 = add_ports_to_flow(flow_template, vport1_number,
phy1_number)
self._vswitch.add_flow(bridge, flow3)
self._vswitch.add_flow(bridge, flow4)