diff options
author | Simon Horman <horms@verge.net.au> | 2014-01-29 12:06:03 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-01-29 12:42:56 +0900 |
commit | 281be18dccb31856b404b0b938f6a7668fedf40d (patch) | |
tree | 87db40f5c73df93617a468a234ea978f5a648cda | |
parent | 7ab4ce13b55793d0e3fd4c2ca865b7be7faf59b3 (diff) |
Add OF1.4 PushVlan action support
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/ofproto/ofproto_v1_4_parser.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ryu/ofproto/ofproto_v1_4_parser.py b/ryu/ofproto/ofproto_v1_4_parser.py index 4f1adbed..3f28f72e 100644 --- a/ryu/ofproto/ofproto_v1_4_parser.py +++ b/ryu/ofproto/ofproto_v1_4_parser.py @@ -2362,6 +2362,35 @@ class OFPActionCopyTtlIn(OFPAction): return cls() +@OFPAction.register_action_type(ofproto.OFPAT_PUSH_VLAN, + ofproto.OFP_ACTION_PUSH_SIZE) +class OFPActionPushVlan(OFPAction): + """ + Push VLAN action + + This action pushes a new VLAN tag to the packet. + + ================ ====================================================== + Attribute Description + ================ ====================================================== + ethertype Ether type + ================ ====================================================== + """ + def __init__(self, ethertype, type_=None, len_=None): + super(OFPActionPushVlan, self).__init__() + self.ethertype = ethertype + + @classmethod + def parser(cls, buf, offset): + (type_, len_, ethertype) = struct.unpack_from( + ofproto.OFP_ACTION_PUSH_PACK_STR, buf, offset) + return cls(ethertype) + + def serialize(self, buf, offset): + msg_pack_into(ofproto.OFP_ACTION_PUSH_PACK_STR, buf, offset, + self.type, self.len, self.ethertype) + + @OFPAction.register_action_type(ofproto.OFPAT_PUSH_MPLS, ofproto.OFP_ACTION_PUSH_SIZE) class OFPActionPushMpls(OFPAction): |