From 8748812e5efc877f765f963c4f086d45e94099c7 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Mon, 25 Jun 2012 06:59:53 +0900 Subject: [PATCH] of1.2: add OXM_OF_IPV6_ND_SLL and OXM_OF_IPV6_ND_TLL Signed-off-by: FUJITA Tomonori --- ryu/ofproto/ofproto_v1_2.py | 2 +- ryu/ofproto/ofproto_v1_2_parser.py | 44 ++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/ryu/ofproto/ofproto_v1_2.py b/ryu/ofproto/ofproto_v1_2.py index a2d4d8e6..394f392c 100644 --- a/ryu/ofproto/ofproto_v1_2.py +++ b/ryu/ofproto/ofproto_v1_2.py @@ -833,7 +833,7 @@ OXM_OF_ICMPV6_TYPE = oxm_tlv_header(OFPXMT_OFB_ICMPV6_TYPE, 1) OXM_OF_ICMPV6_CODE = oxm_tlv_header(OFPXMT_OFB_ICMPV6_CODE, 1) OXM_OF_IPV6_ND_TARGET = oxm_tlv_header(OFPXMT_OFB_IPV6_ND_TARGET, 16) OXM_OF_IPV6_ND_SLL = oxm_tlv_header(OFPXMT_OFB_IPV6_ND_SLL, 6) -OXM_OF_IPV6_NT_TLL = oxm_tlv_header(OFPXMT_OFB_IPV6_ND_TLL, 6) +OXM_OF_IPV6_ND_TLL = oxm_tlv_header(OFPXMT_OFB_IPV6_ND_TLL, 6) OXM_OF_MPLS_LABEL = oxm_tlv_header(OFPXMT_OFB_MPLS_LABEL, 4) OXM_OF_MPLS_TC = oxm_tlv_header(OFPXMT_OFB_MPLS_TC, 1) diff --git a/ryu/ofproto/ofproto_v1_2_parser.py b/ryu/ofproto/ofproto_v1_2_parser.py index 2edd12f2..c329ed31 100644 --- a/ryu/ofproto/ofproto_v1_2_parser.py +++ b/ryu/ofproto/ofproto_v1_2_parser.py @@ -943,6 +943,8 @@ class Flow(object): self.icmpv6_type = 0 self.icmpv6_code = 0 self.ipv6_nd_target = [] + self.ipv6_nd_sll = 0 + self.ipv6_nd_tll = 0 self.mpls_lable = 0 self.mpls_tc = 0 @@ -1130,6 +1132,14 @@ class OFPMatch(object): self.fields.append( OFPMatchField.make(ofproto_v1_2.OXM_OF_IPV6_ND_TARGET)) + if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_IPV6_ND_SLL): + self.fields.append( + OFPMatchField.make(ofproto_v1_2.OXM_OF_IPV6_ND_SLL)) + + if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_IPV6_ND_TLL): + self.fields.append( + OFPMatchField.make(ofproto_v1_2.OXM_OF_IPV6_ND_TLL)) + if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_MPLS_LABEL): self.fields.append( OFPMatchField.make(ofproto_v1_2.OXM_OF_MPLS_LABEL)) @@ -1347,6 +1357,14 @@ class OFPMatch(object): self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IPV6_ND_TARGET) self.flow.ipv6_nd_target = target + def set_ipv6_nd_sll(self, ipv6_nd_sll): + self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IPV6_ND_SLL) + self.flow.ipv6_nd_sll = ipv6_nd_sll + + def set_ipv6_nd_tll(self, ipv6_nd_tll): + self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IPV6_ND_TLL) + self.flow.ipv6_nd_tll = ipv6_nd_tll + def set_mpls_label(self, mpls_label): self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_MPLS_LABEL) self.flow.mpls_label = mpls_label @@ -1888,6 +1906,32 @@ class MTIPv6NdTarget(OFPMatchField): return MTIPv6NdTarget(header) +@OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_IPV6_ND_SLL]) +class MTIPv6NdSll(OFPMatchField): + def __init__(self, header): + super(MTIPv6NdSll, self).__init__(header, '!6s') + + def serialize(self, buf, offset, match): + self.put(buf, offset, match.flow.ipv6_nd_sll) + + @classmethod + def parser(cls, header, buf, offset): + return MTIPv6NdSll(header) + + +@OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_IPV6_ND_TLL]) +class MTIPv6NdTll(OFPMatchField): + def __init__(self, header): + super(MTIPv6NdTll, self).__init__(header, '!6s') + + def serialize(self, buf, offset, match): + self.put(buf, offset, match.flow.ipv6_nd_tll) + + @classmethod + def parser(cls, header, buf, offset): + return MTIPv6NdTll(header) + + @OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_MPLS_TC]) class MTMplsTc(OFPMatchField): def __init__(self, header):