diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-05-08 00:21:45 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-05-08 20:37:20 +0900 |
commit | 23c7ea05519fdd46ff3891b77a2643603090efb5 (patch) | |
tree | 53396f118ea614cfb9f945b05b3614c0e33c182b | |
parent | ed75589dcddea548b492d1d62a387e45f5611dad (diff) |
Add OFPActionStripVlan class
Avoid hitting the assert in OFPAction class' parser method.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/ofproto/ofproto_v1_0_parser.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ryu/ofproto/ofproto_v1_0_parser.py b/ryu/ofproto/ofproto_v1_0_parser.py index bb57282e..f6ea77dc 100644 --- a/ryu/ofproto/ofproto_v1_0_parser.py +++ b/ryu/ofproto/ofproto_v1_0_parser.py @@ -212,6 +212,21 @@ class OFPActionVlanPcp(OFPAction): buf, offset, self.type, self.len, self.vlan_pcp) +@OFPAction.register_action_type(ofproto_v1_0.OFPAT_STRIP_VLAN, + ofproto_v1_0.OFP_ACTION_HEADER_SIZE) +class OFPActionStripVlan(OFPAction): + def __init__(self): + super(OFPActionStripVlan, self).__init__() + + @classmethod + def parser(cls, buf, offset): + type_, len_ = struct.unpack_from( + ofproto_v1_0.OFP_ACTION_HEADER_PACK_STR, buf, offset) + assert type_ == ofproto_v1_0.OFPAT_STRIP_VLAN + assert len_ == ofproto_v1_0.OFP_ACTION_HEADER_SIZE + return cls() + + class OFPActionDlAddr(OFPAction): def __init__(self, dl_addr): super(OFPActionDlAddr, self).__init__() |