summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2012-06-25 06:59:51 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2012-06-26 09:38:25 +0900
commit1512e1ef496cde84184e2d0ee7f088b5ce89815c (patch)
tree215666c21d2a9c479769650ba3043e4d6ea94108
parentc860a471b15cf212f55e56f99409ab271ec934a5 (diff)
of1.2: add OXM_OF_ICMPV6_TYPE and OXM_OF_ICMPV6_CODE
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/ofproto/ofproto_v1_2_parser.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/ryu/ofproto/ofproto_v1_2_parser.py b/ryu/ofproto/ofproto_v1_2_parser.py
index 1e27b6d4..8a8df91c 100644
--- a/ryu/ofproto/ofproto_v1_2_parser.py
+++ b/ryu/ofproto/ofproto_v1_2_parser.py
@@ -940,6 +940,8 @@ class Flow(object):
self.ipv6_src = []
self.ipv6_dst = []
self.ipv6_flabel = 0
+ self.icmpv6_type = 0
+ self.icmpv6_code = 0
self.mpls_lable = 0
self.mpls_tc = 0
@@ -1115,6 +1117,14 @@ class OFPMatch(object):
self.fields.append(
OFPMatchField.make(ofproto_v1_2.OXM_OF_IPV6_FLABEL))
+ if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ICMPV6_TYPE):
+ self.fields.append(
+ OFPMatchField.make(ofproto_v1_2.OXM_OF_ICMPV6_TYPE))
+
+ if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ICMPV6_CODE):
+ self.fields.append(
+ OFPMatchField.make(ofproto_v1_2.OXM_OF_ICMPV6_CODE))
+
if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_MPLS_LABEL):
self.fields.append(
OFPMatchField.make(ofproto_v1_2.OXM_OF_MPLS_LABEL))
@@ -1320,6 +1330,14 @@ class OFPMatch(object):
self.wc.ipv6_flabel_mask = mask
self.flow.ipv6_flabel = flabel
+ def set_icmpv6_type(self, icmpv6_type):
+ self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ICMPV6_TYPE)
+ self.flow.icmpv6_type = icmpv6_type
+
+ def set_icmpv6_code(self, icmpv6_code):
+ self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ICMPV6_CODE)
+ self.flow.icmpv6_code = icmpv6_code
+
def set_mpls_label(self, mpls_label):
self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_MPLS_LABEL)
self.flow.mpls_label = mpls_label
@@ -1822,6 +1840,32 @@ class MTMplsLabel(OFPMatchField):
return MTMplsLabel(header)
+@OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_ICMPV6_TYPE])
+class MTICMPV6Type(OFPMatchField):
+ def __init__(self, header):
+ super(MTICMPV6Type, self).__init__(header, '!B')
+
+ def serialize(self, buf, offset, match):
+ self.put(buf, offset, match.flow.icmpv6_type)
+
+ @classmethod
+ def parser(cls, header, buf, offset):
+ return MTICMPV6Type(header)
+
+
+@OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_ICMPV6_CODE])
+class MTICMPV6Code(OFPMatchField):
+ def __init__(self, header):
+ super(MTICMPV6Code, self).__init__(header, '!B')
+
+ def serialize(self, buf, offset, match):
+ self.put(buf, offset, match.flow.icmpv6_code)
+
+ @classmethod
+ def parser(cls, header, buf, offset):
+ return MTICMPV6Code(header)
+
+
@OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_MPLS_TC])
class MTMplsTc(OFPMatchField):
def __init__(self, header):