Fix POP_MPLS of ofctl_v1_3.to_actions() problem
POP_MPLS (class OFPActionPopMpls) requires ethertype. Signed-off-by: Satoshi Kobayashi <satoshi-k@stratosphere.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
98998118d6
commit
bab02cfaba
@ -60,7 +60,8 @@ def to_actions(dp, acts):
|
|||||||
ethertype = int(a.get('ethertype'))
|
ethertype = int(a.get('ethertype'))
|
||||||
actions.append(parser.OFPActionPushMpls(ethertype))
|
actions.append(parser.OFPActionPushMpls(ethertype))
|
||||||
elif action_type == 'POP_MPLS':
|
elif action_type == 'POP_MPLS':
|
||||||
actions.append(parser.OFPActionPopMpls())
|
ethertype = int(a.get('ethertype'))
|
||||||
|
actions.append(parser.OFPActionPopMpls(ethertype))
|
||||||
elif action_type == 'SET_QUEUE':
|
elif action_type == 'SET_QUEUE':
|
||||||
queue_id = int(a.get('queue_id'))
|
queue_id = int(a.get('queue_id'))
|
||||||
actions.append(parser.OFPActionSetQueue(queue_id))
|
actions.append(parser.OFPActionSetQueue(queue_id))
|
||||||
|
58
ryu/tests/unit/lib/test_ofctl_v1_3.py
Normal file
58
ryu/tests/unit/lib/test_ofctl_v1_3.py
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
# Copyright (C) 2013 Stratosphere Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
# implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import logging
|
||||||
|
from nose.tools import *
|
||||||
|
|
||||||
|
from ryu.lib import ofctl_v1_3
|
||||||
|
from ryu.ofproto import ofproto_v1_3, ofproto_v1_3_parser
|
||||||
|
from ryu.ofproto.ofproto_v1_3_parser import OFPActionPopMpls
|
||||||
|
|
||||||
|
LOG = logging.getLogger('test_ofctl_v1_3')
|
||||||
|
|
||||||
|
|
||||||
|
class _Datapath(object):
|
||||||
|
ofproto = ofproto_v1_3
|
||||||
|
ofproto_parser = ofproto_v1_3_parser
|
||||||
|
|
||||||
|
|
||||||
|
class Test_ofctl_v1_3(unittest.TestCase):
|
||||||
|
|
||||||
|
""" Test case for ofctl_v1_3
|
||||||
|
"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def test_to_actions_pop_mpls(self):
|
||||||
|
dp = _Datapath()
|
||||||
|
|
||||||
|
acts = [
|
||||||
|
{
|
||||||
|
'type': 'POP_MPLS',
|
||||||
|
'ethertype': 0x0800
|
||||||
|
}
|
||||||
|
]
|
||||||
|
result = ofctl_v1_3.to_actions(dp, acts)
|
||||||
|
insts = result[0]
|
||||||
|
act = insts.actions[0]
|
||||||
|
ok_(isinstance(act, OFPActionPopMpls))
|
||||||
|
eq_(act.ethertype, 0x0800)
|
Loading…
Reference in New Issue
Block a user