summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYuichi Ito <ito.yuichi0@gmail.com>2014-03-28 13:19:59 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-03-30 10:43:06 +0900
commit897dd9c5d0662df59e32f9385a767deb8056db23 (patch)
treec96da459866be037a71ae80da63bd6e90cae15b2
parent477b1ce33d78e4a02924c0fae383009ea4ffd0da (diff)
sw test tool: Enable sending packets continuously
Signed-off-by: WATANABE Fumitaka <watanabe.fumitaka1@gmail.com> 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.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/ryu/tests/switch/tester.py b/ryu/tests/switch/tester.py
index b95417a4..c8049274 100644
--- a/ryu/tests/switch/tester.py
+++ b/ryu/tests/switch/tester.py
@@ -347,10 +347,10 @@ class OfTester(app_manager.RyuApp):
# Test execute.
try:
- # 0. Initialize.
+ # Initialize.
self._test(STATE_INIT_METER)
self._test(STATE_INIT_FLOW)
- # 1. Install flows.
+ # Install flows.
for flow in test.prerequisite:
if isinstance(flow, ofproto_v1_3_parser.OFPFlowMod):
self._test(STATE_FLOW_INSTALL, flow)
@@ -358,13 +358,26 @@ class OfTester(app_manager.RyuApp):
elif isinstance(flow, ofproto_v1_3_parser.OFPMeterMod):
self._test(STATE_METER_INSTALL, flow)
self._test(STATE_METER_EXIST_CHK, flow)
- # 2. Check flow matching.
+ # Do tests.
for pkt in test.tests:
+
+ # Get stats before sending packet(s).
if KEY_EGRESS in pkt or KEY_PKT_IN in pkt:
target_pkt_count = [self._test(STATE_TARGET_PKT_COUNT,
True)]
tester_pkt_count = [self._test(STATE_TESTER_PKT_COUNT,
False)]
+ elif KEY_TBL_MISS in pkt:
+ before_stats = self._test(STATE_GET_MATCH_COUNT)
+
+ # Send packet(s).
+ if KEY_INGRESS in pkt:
+ self._one_time_packet_send(pkt)
+ elif KEY_PACKETS in pkt:
+ self._continuous_packet_send(pkt)
+
+ # Check a result.
+ if KEY_EGRESS in pkt or KEY_PKT_IN in pkt:
result = self._test(STATE_FLOW_MATCH_CHK, pkt)
if result == TIMEOUT:
target_pkt_count.append(self._test(
@@ -375,11 +388,11 @@ class OfTester(app_manager.RyuApp):
else KEY_PKT_IN)
self._test(STATE_NO_PKTIN_REASON, test_type,
target_pkt_count, tester_pkt_count)
- else:
- before_stats = self._test(STATE_GET_MATCH_COUNT)
+ elif KEY_TBL_MISS in pkt:
self._test(STATE_SEND_BARRIER)
hub.sleep(INTERVAL)
self._test(STATE_FLOW_UNMATCH_CHK, before_stats, pkt)
+
result = [TEST_OK]
result_type = TEST_OK
except (TestFailure, TestError,