Frame Modification: support remaining frame modification types. 39/1439/2
authorBilly O'Mahony <billy.o.mahony@intel.com>
Tue, 25 Aug 2015 10:35:28 +0000 (11:35 +0100)
committerMaryam Tahhan <maryam.tahhan@intel.com>
Thu, 24 Sep 2015 15:46:45 +0000 (15:46 +0000)
Only works for P2P. Other deployment scenarios will need to implement
the same kind of multi-table flow as P2P to enable frame modification.

Signed-off-by: Billy O'Mahony<billy.o.mahony@intel.com>
Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com>
Reviewed-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Radek Zetik <radekx.zetik@intel.com>
Reviewed-by: Dino Madarang <dino.simeonx.madarang@intel.com>
Change-Id: I2fa35972b90b165c00f0d0a7515fa275d0f17aa4

conf/01_testcases.conf
core/vswitch_controller_p2p.py
testcases/testcase.py

index a95a4b5..cb4f948 100755 (executable)
@@ -25,6 +25,9 @@
 # "Deployment": "p2p",             # One of the supported deployment scenarios.
 # "Description": "Lorem ipsum..."  # Optional. A human-readable string
 #                                  # describing the test.
+# "Frame Modification": "vlan"     # One of the supported frame modifications:
+#                                  # vlan, mpls, mac, dscp, ttl, ip_addr,
+#                                  # ip_port.
 # "biDirectional": [true|false],   # Specifies if genearted traffic will be
 #                                  # full-duplex (true) or half-duplex (false)
 # "MultiStream": 0-65535           # Optional. Defines number of flows simulated
index f2ed73d..a1158d4 100644 (file)
@@ -88,10 +88,6 @@ class VswitchControllerP2P(IVswitchController):
             # ovs-discuss 2015-06-30.
             flow = {'table':'3', 'priority':'1', 'actions': ['drop']}
             self._vswitch.add_flow(BRIDGE_NAME, flow)
-
-            flow = add_ports_to_flow(_FLOW_TEMPLATE, phy2_number, phy1_number)
-            self._vswitch.add_flow(BRIDGE_NAME, flow)
-
         except:
             self._vswitch.stop()
             raise
index 7b349ec..3ea97c3 100644 (file)
@@ -93,13 +93,82 @@ class TestCase(object):
                            'multistream': self._multistream}
 
                 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
+                # need to be retrived from the vSwitch and the metadata value
+                # updated accordingly.
                 if self._frame_mod == "vlan":
+                    # 0x8100 => VLAN ethertype
+                    self._logger.debug(" ****   VLAN   ***** ")
                     flow = {'table':'2', 'priority':'1000', 'metadata':'2',
                             'actions': ['push_vlan:0x8100', 'goto_table:3']}
                     vswitch.add_flow('br0', flow)
                     flow = {'table':'2', 'priority':'1000', 'metadata':'1',
                             'actions': ['push_vlan:0x8100', 'goto_table:3']}
                     vswitch.add_flow('br0', flow)
+                elif self._frame_mod == "mpls":
+                    # 0x8847 => MPLS unicast ethertype
+                    self._logger.debug(" ****   MPLS  ***** ")
+                    flow = {'table':'2', 'priority':'1000', 'metadata':'2',
+                            'actions': ['push_mpls:0x8847', 'goto_table:3']}
+                    vswitch.add_flow('br0', flow)
+                    flow = {'table':'2', 'priority':'1000', 'metadata':'1',
+                            'actions': ['push_mpls:0x8847', 'goto_table:3']}
+                    vswitch.add_flow('br0', flow)
+                elif self._frame_mod == "mac":
+                    flow = {'table':'2', 'priority':'1000', 'metadata':'2',
+                            'actions': ['mod_dl_src:22:22:22:22:22:22', 'goto_table:3']}
+                    vswitch.add_flow('br0', flow)
+                    flow = {'table':'2', 'priority':'1000', 'metadata':'1',
+                            'actions': ['mod_dl_src:11:11:11:11:11:11', 'goto_table:3']}
+                    vswitch.add_flow('br0', flow)
+                elif self._frame_mod == "dscp":
+                    # DSCP 184d == 0x4E<<2 => 'Expedited Forwarding'
+                    flow = {'table':'2', 'priority':'1000', 'metadata':'2',
+                            'dl_type':'0x0800',
+                            'actions': ['mod_nw_tos:184', 'goto_table:3']}
+                    vswitch.add_flow('br0', flow)
+                    flow = {'table':'2', 'priority':'1000', 'metadata':'1',
+                            'dl_type':'0x0800',
+                            'actions': ['mod_nw_tos:184', 'goto_table:3']}
+                    vswitch.add_flow('br0', flow)
+                elif self._frame_mod == "ttl":
+                    # 251 and 241 are the highest prime numbers < 255
+                    flow = {'table':'2', 'priority':'1000', 'metadata':'2',
+                            'dl_type':'0x0800',
+                            'actions': ['mod_nw_ttl:251', 'goto_table:3']}
+                    vswitch.add_flow('br0', flow)
+                    flow = {'table':'2', 'priority':'1000', 'metadata':'1',
+                            'dl_type':'0x0800',
+                            'actions': ['mod_nw_ttl:241', 'goto_table:3']}
+                    vswitch.add_flow('br0', flow)
+                elif self._frame_mod == "ip_addr":
+                    flow = {'table':'2', 'priority':'1000', 'metadata':'2',
+                            'dl_type':'0x0800',
+                            'actions': ['mod_nw_src:10.10.10.10',
+                            'mod_nw_dst:20.20.20.20', 'goto_table:3']}
+                    vswitch.add_flow('br0', flow)
+                    flow = {'table':'2', 'priority':'1000', 'metadata':'1',
+                            'dl_type':'0x0800',
+                            'actions': ['mod_nw_src:20.20.20.20',
+                            'mod_nw_dst:10.10.10.10', 'goto_table:3']}
+                    vswitch.add_flow('br0', flow)
+                elif self._frame_mod == "ip_port":
+                    # TODO BOM 15-08-27 The traffic generated is assumed
+                    # to be UDP (nw_proto 17d) which is the default case but
+                    # we will need to pick up the actual traffic params in use.
+                    flow = {'table':'2', 'priority':'1000', 'metadata':'2',
+                            'dl_type':'0x0800', 'nw_proto':'17',
+                            'actions': ['mod_tp_src:44444',
+                            'mod_tp_dst:44444', 'goto_table:3']}
+                    vswitch.add_flow('br0', flow)
+                    flow = {'table':'2', 'priority':'1000', 'metadata':'1',
+                            'dl_type':'0x0800', 'nw_proto':'17',
+                            'actions': ['mod_tp_src:44444',
+                            'mod_tp_dst:44444', 'goto_table:3']}
+                    vswitch.add_flow('br0', flow)
+                else:
+                    pass
 
                 with traffic_ctl:
                     traffic_ctl.send_traffic(traffic)