backing up
[vsorcdistro/.git] / ryu / build / lib.linux-armv7l-2.7 / ryu / tests / unit / lib / test_ofctl_v1_3.py
1 # Copyright (C) 2013 Stratosphere Inc.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #    http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12 # implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 # vim: tabstop=4 shiftwidth=4 softtabstop=4
17
18 import unittest
19 import logging
20 from nose.tools import *
21
22 from ryu.lib import ofctl_v1_3
23 from ryu.ofproto import ofproto_v1_3, ofproto_v1_3_parser
24 from ryu.ofproto import ofproto_protocol
25 from ryu.ofproto.ofproto_v1_3_parser import OFPActionPopMpls
26
27 LOG = logging.getLogger('test_ofctl_v1_3')
28
29
30 class Test_ofctl_v1_3(unittest.TestCase):
31
32     """ Test case for ofctl_v1_3
33     """
34
35     def setUp(self):
36         pass
37
38     def tearDown(self):
39         pass
40
41     def test_to_actions_pop_mpls(self):
42         dp = ofproto_protocol.ProtocolDesc(version=ofproto_v1_3.OFP_VERSION)
43
44         acts = [
45             {
46                 'type': 'POP_MPLS',
47                 'ethertype': 0x0800
48             }
49         ]
50         result = ofctl_v1_3.to_actions(dp, acts)
51         insts = result[0]
52         act = insts.actions[0]
53         ok_(isinstance(act, OFPActionPopMpls))
54         eq_(act.ethertype, 0x0800)