summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2012-06-25 06:59:50 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2012-06-26 09:38:20 +0900
commitc860a471b15cf212f55e56f99409ab271ec934a5 (patch)
treece0f8f727facee431b72346c24c96386ad4cc79d
parent9cf752cbb265c4f87c6b1c47e7e6e1675e5ee11f (diff)
of1.2: add OXM_OF_IPV6_FLABEL
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/ofproto/ofproto_v1_2_parser.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/ryu/ofproto/ofproto_v1_2_parser.py b/ryu/ofproto/ofproto_v1_2_parser.py
index c24a77c4..1e27b6d4 100644
--- a/ryu/ofproto/ofproto_v1_2_parser.py
+++ b/ryu/ofproto/ofproto_v1_2_parser.py
@@ -939,6 +939,7 @@ class Flow(object):
self.arp_tha = 0
self.ipv6_src = []
self.ipv6_dst = []
+ self.ipv6_flabel = 0
self.mpls_lable = 0
self.mpls_tc = 0
@@ -956,6 +957,7 @@ class FlowWildcards(object):
self.arp_tha_mask = 0
self.ipv6_src_mask = []
self.ipv6_dst_mask = []
+ self.ipv6_flabel_mask = 0
self.wildcards = (1 << 64) - 1
def ft_set(self, shift):
@@ -1105,6 +1107,14 @@ class OFPMatch(object):
self.fields.append(
OFPMatchField.make(ofproto_v1_2.OXM_OF_IPV6_DST))
+ if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_IPV6_FLABEL):
+ if self.wc.ipv6_flabel_mask:
+ self.fields.append(
+ OFPMatchField.make(ofproto_v1_2.OXM_OF_IPV6_FLABEL_W))
+ else:
+ self.fields.append(
+ OFPMatchField.make(ofproto_v1_2.OXM_OF_IPV6_FLABEL))
+
if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_MPLS_LABEL):
self.fields.append(
OFPMatchField.make(ofproto_v1_2.OXM_OF_MPLS_LABEL))
@@ -1301,6 +1311,15 @@ class OFPMatch(object):
self.wc.ipv6_dst_mask = mask
self.flow.ipv6_dst = [x & y for (x, y) in itertools.izip(dst, mask)]
+ def set_ipv6_flabel(self, flabel):
+ self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IPV6_FLABEL)
+ self.flow.ipv6_flabel = flabel
+
+ def set_ipv6_flabel_masked(self, flabel, mask):
+ self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IPV6_FLABEL)
+ self.wc.ipv6_flabel_mask = mask
+ self.flow.ipv6_flabel = flabel
+
def set_mpls_label(self, mpls_label):
self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_MPLS_LABEL)
self.flow.mpls_label = mpls_label
@@ -1772,6 +1791,24 @@ class MTIPv6Dst(OFPMatchField):
return MTIPv6Dst(header)
+@OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_IPV6_FLABEL,
+ ofproto_v1_2.OXM_OF_IPV6_FLABEL_W])
+class MTIPv6Flabel(OFPMatchField):
+ def __init__(self, header):
+ super(MTIPv6Flabel, self).__init__(header, '!I')
+
+ def serialize(self, buf, offset, match):
+ if self.header == ofproto_v1_2.OXM_OF_IPV6_FLABEL_W:
+ self.put_w(buf, offset, match.flow.ipv6_flabel,
+ match.wc.ipv6_flabel_mask)
+ else:
+ self.put(buf, offset, match.flow.ipv6_flabel)
+
+ @classmethod
+ def parser(cls, header, buf, offset):
+ return MTIPv6Flabel(header)
+
+
@OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_MPLS_LABEL])
class MTMplsLabel(OFPMatchField):
def __init__(self, header):