diff options
author | Yuichi Ito <ito.yuichi0@gmail.com> | 2014-03-28 13:13:37 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-03-30 10:42:47 +0900 |
commit | f9f88f44096ae2e3a2414089f1abb24f918a8cb5 (patch) | |
tree | e3b77e941f723bec8d136da6109dea6ed495632a | |
parent | acdfd2347dadb2036b522f8c64deb7750db06f75 (diff) |
sw test tool: Enable parsing OFPMeterMod messages in 'prerequisite'
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.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ryu/tests/switch/tester.py b/ryu/tests/switch/tester.py index 4d857415..171d552c 100644 --- a/ryu/tests/switch/tester.py +++ b/ryu/tests/switch/tester.py @@ -86,6 +86,7 @@ WAIT_TIMER = 3 # sec KEY_DESC = 'description' KEY_PREREQ = 'prerequisite' KEY_FLOW = 'OFPFlowMod' +KEY_METER = 'OFPMeterMod' KEY_TESTS = 'tests' KEY_INGRESS = 'ingress' KEY_EGRESS = 'egress' @@ -982,9 +983,15 @@ class Test(stringify.StringifyMixin): prerequisite = [] if not KEY_PREREQ in buf: raise ValueError('a test requires a "%s" block' % KEY_PREREQ) + allowed_mod = [KEY_FLOW, KEY_METER] for flow in buf[KEY_PREREQ]: - cls = getattr(ofproto_v1_3_parser, KEY_FLOW) - msg = cls.from_jsondict(flow[KEY_FLOW], datapath=DummyDatapath()) + key, value = flow.popitem() + if key not in allowed_mod: + raise ValueError( + '"%s" block allows only the followings: %s' % ( + KEY_PREREQ, allowed_mod)) + cls = getattr(ofproto_v1_3_parser, key) + msg = cls.from_jsondict(value, datapath=DummyDatapath()) msg.version = ofproto_v1_3.OFP_VERSION msg.msg_type = msg.cls_msg_type msg.xid = 0 |