summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYuichi Ito <ito.yuichi0@gmail.com>2013-10-23 14:36:28 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2013-10-24 07:58:56 +0900
commitb466614b6c093c69dc407ee543c8294af7ed4327 (patch)
treeebe2c676b1f5d1248876560aea976f4f343af962
parent3b1f07680505a2403dac31e0c57b7dcc33697159 (diff)
of13: support PUSH_PBB/POP_PBB actions
Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/ofproto/ofproto_v1_3_parser.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/ryu/ofproto/ofproto_v1_3_parser.py b/ryu/ofproto/ofproto_v1_3_parser.py
index 606ffa23..bd71fe1a 100644
--- a/ryu/ofproto/ofproto_v1_3_parser.py
+++ b/ryu/ofproto/ofproto_v1_3_parser.py
@@ -3017,6 +3017,60 @@ class OFPActionSetField(OFPAction):
yield (self.key, self.value)
+@OFPAction.register_action_type(ofproto_v1_3.OFPAT_PUSH_PBB,
+ ofproto_v1_3.OFP_ACTION_PUSH_SIZE)
+class OFPActionPushPbb(OFPAction):
+ """
+ Push PBB action
+
+ This action pushes a new PBB header to the packet.
+
+ ================ ======================================================
+ Attribute Description
+ ================ ======================================================
+ ethertype Ether type
+ ================ ======================================================
+ """
+ def __init__(self, ethertype, type_=None, len_=None):
+ super(OFPActionPushPbb, self).__init__()
+ self.ethertype = ethertype
+
+ @classmethod
+ def parser(cls, buf, offset):
+ (type_, len_, ethertype) = struct.unpack_from(
+ ofproto_v1_3.OFP_ACTION_PUSH_PACK_STR, buf, offset)
+ return cls(ethertype)
+
+ def serialize(self, buf, offset):
+ msg_pack_into(ofproto_v1_3.OFP_ACTION_PUSH_PACK_STR, buf, offset,
+ self.type, self.len, self.ethertype)
+
+
+@OFPAction.register_action_type(ofproto_v1_3.OFPAT_POP_PBB,
+ ofproto_v1_3.OFP_ACTION_HEADER_SIZE)
+class OFPActionPopPbb(OFPAction):
+ """
+ Pop PBB action
+
+ This action pops the outermost PBB service instance header from
+ the packet.
+ """
+ def __init__(self, type_=None, len_=None):
+ super(OFPActionPopPbb, self).__init__()
+
+ @classmethod
+ def parser(cls, buf, offset):
+ (type_, len_) = struct.unpack_from(
+ ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
+ return cls()
+
+ @classmethod
+ def parser(cls, buf, offset):
+ (type_, len_) = struct.unpack_from(
+ ofproto_v1_3.OFP_ACTION_HEADER_PACK_STR, buf, offset)
+ return cls()
+
+
@OFPAction.register_action_type(
ofproto_v1_3.OFPAT_EXPERIMENTER,
ofproto_v1_3.OFP_ACTION_EXPERIMENTER_HEADER_SIZE)