TargetSw and TesterSw are merged as OpenFlowSw.

Signed-off-by: Yuichi Ito <[email protected]>
---
 ryu/tests/switch/tester.py |   82 +++++++++++++++++++-------------------------
 1 file changed, 36 insertions(+), 46 deletions(-)

diff --git a/ryu/tests/switch/tester.py b/ryu/tests/switch/tester.py
index 7468c74..56b38cf 100644
--- a/ryu/tests/switch/tester.py
+++ b/ryu/tests/switch/tester.py
@@ -257,8 +257,8 @@ class OfTester(app_manager.RyuApp):
         test_dir = CONF['test-switch']['dir']
         self.logger.info('Test files directory = %s', test_dir)
 
-        self.target_sw = TargetSw(DummyDatapath(), self.logger)
-        self.tester_sw = TesterSw(DummyDatapath(), self.logger)
+        self.target_sw = OpenFlowSw(DummyDatapath(), self.logger)
+        self.tester_sw = OpenFlowSw(DummyDatapath(), self.logger)
         self.state = STATE_INIT_FLOW
         self.sw_waiter = None
         self.waiter = None
@@ -1061,39 +1061,24 @@ class OpenFlowSw(object):
                                 match=match, instructions=inst)
         return self.send_msg(mod)
 
-    def send_barrier_request(self):
-        """ send a BARRIER_REQUEST message."""
-        parser = self.dp.ofproto_parser
-        req = parser.OFPBarrierRequest(self.dp)
-        return self.send_msg(req)
-
-    def send_port_stats(self):
-        """ Get port stats."""
-        ofp = self.dp.ofproto
-        parser = self.dp.ofproto_parser
-        flags = 0
-        req = parser.OFPPortStatsRequest(self.dp, flags, ofp.OFPP_ANY)
-        return self.send_msg(req)
-
-    def send_flow_stats(self):
-        """ Get all flow. """
+    def del_test_flow(self):
+        """ Delete all flow except default flow. """
         ofp = self.dp.ofproto
         parser = self.dp.ofproto_parser
-        req = parser.OFPFlowStatsRequest(self.dp, 0, ofp.OFPTT_ALL,
-                                         ofp.OFPP_ANY, ofp.OFPG_ANY,
-                                         0, 0, parser.OFPMatch())
-        return self.send_msg(req)
-
-
-class TargetSw(OpenFlowSw):
-    def __init__(self, dp, logger):
-        super(TargetSw, self).__init__(dp, logger)
+        mod = parser.OFPFlowMod(self.dp,
+                                table_id=ofp.OFPTT_ALL,
+                                command=ofp.OFPFC_DELETE,
+                                out_port=ofp.OFPP_ANY,
+                                out_group=ofp.OFPG_ANY)
+        return self.send_msg(mod)
 
-    def del_test_flow(self):
+    def del_flows_for_throughput_analysis(self):
         """ Delete all flow except default flow. """
         ofp = self.dp.ofproto
         parser = self.dp.ofproto_parser
         mod = parser.OFPFlowMod(self.dp,
+                                cookie=THROUGHPUT_COOKIE,
+                                cookie_mask=0xffffffffffffffff,
                                 table_id=ofp.OFPTT_ALL,
                                 command=ofp.OFPFC_DELETE,
                                 out_port=ofp.OFPP_ANY,
@@ -1110,6 +1095,29 @@ class TargetSw(OpenFlowSw):
                                  meter_id=ofp.OFPM_ALL)
         return self.send_msg(mod)
 
+    def send_barrier_request(self):
+        """ send a BARRIER_REQUEST message."""
+        parser = self.dp.ofproto_parser
+        req = parser.OFPBarrierRequest(self.dp)
+        return self.send_msg(req)
+
+    def send_port_stats(self):
+        """ Get port stats."""
+        ofp = self.dp.ofproto
+        parser = self.dp.ofproto_parser
+        flags = 0
+        req = parser.OFPPortStatsRequest(self.dp, flags, ofp.OFPP_ANY)
+        return self.send_msg(req)
+
+    def send_flow_stats(self):
+        """ Get all flow. """
+        ofp = self.dp.ofproto
+        parser = self.dp.ofproto_parser
+        req = parser.OFPFlowStatsRequest(self.dp, 0, ofp.OFPTT_ALL,
+                                         ofp.OFPP_ANY, ofp.OFPG_ANY,
+                                         0, 0, parser.OFPMatch())
+        return self.send_msg(req)
+
     def send_meter_config_stats(self):
         """ Get all meter. """
         parser = self.dp.ofproto_parser
@@ -1122,24 +1130,6 @@ class TargetSw(OpenFlowSw):
         req = parser.OFPTableStatsRequest(self.dp, 0)
         return self.send_msg(req)
 
-
-class TesterSw(OpenFlowSw):
-    def __init__(self, dp, logger):
-        super(TesterSw, self).__init__(dp, logger)
-
-    def del_flows_for_throughput_analysis(self):
-        """ Delete all flow except default flow. """
-        ofp = self.dp.ofproto
-        parser = self.dp.ofproto_parser
-        mod = parser.OFPFlowMod(self.dp,
-                                cookie=THROUGHPUT_COOKIE,
-                                cookie_mask=0xffffffffffffffff,
-                                table_id=ofp.OFPTT_ALL,
-                                command=ofp.OFPFC_DELETE,
-                                out_port=ofp.OFPP_ANY,
-                                out_group=ofp.OFPG_ANY)
-        return self.send_msg(mod)
-
     def send_packet_out(self, data):
         """ send a PacketOut message."""
         ofp = self.dp.ofproto
-- 
1.7.10.4


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to