summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYuichi Ito <ito.yuichi0@gmail.com>2014-05-21 17:21:28 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-05-21 17:50:52 +0900
commitcc47d4d9f22d69eff2a7b41b93b3a7f7acc53df5 (patch)
treeb7b009ab3bcaf1df439fe85fcfe42d18fba5f576
parentd73d3bb136e9b2a2dd38f814d48305b2ef19107e (diff)
sw test tool: Reduce similar methods of deleting flows
OpenFlowSw.del_test_flow() and OpenFlowSw.del_flows_for_throughput_analysis() are merged as OpenFlowSw.del_flows(). And rename OpenFlowSw.del_test_meter() to OpenFlowSw.del_meters(), like OpenFlowSw.del_flows(). Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/tests/switch/tester.py28
1 files changed, 10 insertions, 18 deletions
diff --git a/ryu/tests/switch/tester.py b/ryu/tests/switch/tester.py
index 56b38cf1..e7158322 100644
--- a/ryu/tests/switch/tester.py
+++ b/ryu/tests/switch/tester.py
@@ -492,7 +492,7 @@ class OfTester(app_manager.RyuApp):
def _test(self, state, *args):
test = {STATE_INIT_FLOW: self._test_initialize_flow,
STATE_INIT_THROUGHPUT_FLOW: self._test_initialize_flow_tester,
- STATE_INIT_METER: self.target_sw.del_test_meter,
+ STATE_INIT_METER: self.target_sw.del_meters,
STATE_FLOW_INSTALL: self._test_msg_install,
STATE_THROUGHPUT_FLOW_INSTALL: self._test_msg_install,
STATE_METER_INSTALL: self._test_msg_install,
@@ -516,7 +516,7 @@ class OfTester(app_manager.RyuApp):
return test[state](*args)
def _test_initialize_flow(self):
- xid = self.target_sw.del_test_flow()
+ xid = self.target_sw.del_flows()
self.send_msg_xids.append(xid)
xid = self.target_sw.send_barrier_request()
@@ -528,7 +528,7 @@ class OfTester(app_manager.RyuApp):
assert isinstance(msg, ofproto_v1_3_parser.OFPBarrierReply)
def _test_initialize_flow_tester(self):
- xid = self.tester_sw.del_flows_for_throughput_analysis()
+ xid = self.tester_sw.del_flows(THROUGHPUT_COOKIE)
self.send_msg_xids.append(xid)
xid = self.tester_sw.send_barrier_request()
@@ -1061,31 +1061,23 @@ class OpenFlowSw(object):
match=match, instructions=inst)
return self.send_msg(mod)
- def del_test_flow(self):
+ def del_flows(self, cookie=0):
""" Delete all flow except default flow. """
ofp = self.dp.ofproto
parser = self.dp.ofproto_parser
+ cookie_mask = 0
+ if cookie:
+ cookie_mask = 0xffffffffffffffff
mod = parser.OFPFlowMod(self.dp,
+ cookie=cookie,
+ cookie_mask=cookie_mask,
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_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 del_test_meter(self):
+ def del_meters(self):
""" Delete all meter entries. """
ofp = self.dp.ofproto
parser = self.dp.ofproto_parser