From 3572d56f5733592db30f0df2273fe93e731cba2d Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Tue, 13 Oct 2015 06:35:33 +0100 Subject: 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 Reviewed-by: Billy O Mahony Reviewed-by: Maryam Tahhan Reviewed-by: Fatih Degirmenci Reviewed-by: Gene Snider Reviewed-by: Al Morton Reviewed-by: Tv Rao Reviewed-by: Brian Castelli --- core/vswitch_controller_pvvp.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'core/vswitch_controller_pvvp.py') diff --git a/core/vswitch_controller_pvvp.py b/core/vswitch_controller_pvvp.py index 43cf8a35..c79ad9a3 100644 --- a/core/vswitch_controller_pvvp.py +++ b/core/vswitch_controller_pvvp.py @@ -34,7 +34,7 @@ class VswitchControllerPVVP(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 PVVP deployment scenario. :vswitch_class: the vSwitch class to be used. @@ -43,7 +43,7 @@ class VswitchControllerPVVP(IVswitchController): self._vswitch_class = vswitch_class self._vswitch = vswitch_class() self._deployment_scenario = "PVVP" - self._bidir = bidir + self._traffic = traffic.copy() self._logger.debug('Creation using ' + str(self._vswitch_class)) def setup(self): @@ -65,22 +65,29 @@ class VswitchControllerPVVP(IVswitchController): (_, vport4_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, vport3_number) - flow3 = add_ports_to_flow(_FLOW_TEMPLATE, vport4_number, + flow3 = add_ports_to_flow(flow_template, vport4_number, phy2_number) self._vswitch.add_flow(bridge, flow1) self._vswitch.add_flow(bridge, flow2) self._vswitch.add_flow(bridge, flow3) - if self._bidir: - flow4 = add_ports_to_flow(_FLOW_TEMPLATE, phy2_number, + if self._traffic['bidir']: + flow4 = add_ports_to_flow(flow_template, phy2_number, vport4_number) - flow5 = add_ports_to_flow(_FLOW_TEMPLATE, vport3_number, + flow5 = add_ports_to_flow(flow_template, vport3_number, vport2_number) - flow6 = add_ports_to_flow(_FLOW_TEMPLATE, vport1_number, + flow6 = add_ports_to_flow(flow_template, vport1_number, phy1_number) self._vswitch.add_flow(bridge, flow4) self._vswitch.add_flow(bridge, flow5) -- cgit 1.2.3-korg