1 # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
2 # Copyright (C) 2013 Isaku Yamahata <yamahata at private email ne jp>
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # vim: tabstop=4 shiftwidth=4 softtabstop=4
21 from imp import reload
28 from nose.tools import eq_
31 LOG = logging.getLogger('test_ofproto')
34 class TestOfprotCommon(unittest.TestCase):
35 """ Test case for ofproto
38 def test_ofp_event(self):
41 import ryu.controller.ofp_event
42 reload(ryu.controller.ofp_event)
44 def test_ofproto(self):
45 # When new version of OFP support is added,
46 # this test must be updated.
49 ofp_modules = ryu.ofproto.get_ofp_modules()
51 import ryu.ofproto.ofproto_v1_0
52 import ryu.ofproto.ofproto_v1_2
53 import ryu.ofproto.ofproto_v1_3
54 import ryu.ofproto.ofproto_v1_4
55 import ryu.ofproto.ofproto_v1_5
56 eq_(set(ofp_modules.keys()), set([ryu.ofproto.ofproto_v1_0.OFP_VERSION,
57 ryu.ofproto.ofproto_v1_2.OFP_VERSION,
58 ryu.ofproto.ofproto_v1_3.OFP_VERSION,
59 ryu.ofproto.ofproto_v1_4.OFP_VERSION,
60 ryu.ofproto.ofproto_v1_5.OFP_VERSION,
62 consts_mods = set([ofp_mod[0] for ofp_mod in ofp_modules.values()])
63 eq_(consts_mods, set([ryu.ofproto.ofproto_v1_0,
64 ryu.ofproto.ofproto_v1_2,
65 ryu.ofproto.ofproto_v1_3,
66 ryu.ofproto.ofproto_v1_4,
67 ryu.ofproto.ofproto_v1_5,
70 parser_mods = set([ofp_mod[1] for ofp_mod in ofp_modules.values()])
71 import ryu.ofproto.ofproto_v1_0_parser
72 import ryu.ofproto.ofproto_v1_2_parser
73 import ryu.ofproto.ofproto_v1_3_parser
74 import ryu.ofproto.ofproto_v1_4_parser
75 import ryu.ofproto.ofproto_v1_5_parser
76 eq_(parser_mods, set([ryu.ofproto.ofproto_v1_0_parser,
77 ryu.ofproto.ofproto_v1_2_parser,
78 ryu.ofproto.ofproto_v1_3_parser,
79 ryu.ofproto.ofproto_v1_4_parser,
80 ryu.ofproto.ofproto_v1_5_parser,