diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-06-23 10:44:02 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-06-23 15:56:27 +0900 |
commit | e931aeb2996775806c3c0901968cc85ee5c17a2d (patch) | |
tree | f08a32d9a788be49210453121158469e97aac79d | |
parent | c4c8b0792c0934444520a1274334c979c3b02ffb (diff) |
of1.2: add OXM_OF_SCTP_SRC and OXM_OF_SCTP_DST
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: Simon Horman <horms@verge.net.au>
-rw-r--r-- | ryu/ofproto/ofproto_v1_2_parser.py | 44 |
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 2a6b748e..cd21eab0 100644 --- a/ryu/ofproto/ofproto_v1_2_parser.py +++ b/ryu/ofproto/ofproto_v1_2_parser.py @@ -876,6 +876,8 @@ class Flow(object): self.tcp_dst = 0 self.udp_src = 0 self.udp_dst = 0 + self.sctp_src = 0 + self.sctp_dst = 0 self.arp_op = 0 self.arp_spa = 0 self.arp_tpa = 0 @@ -993,6 +995,14 @@ class OFPMatch(object): self.fields.append( OFPMatchField.make(ofproto_v1_2.OXM_OF_UDP_DST)) + if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_SCTP_SRC): + self.fields.append( + OFPMatchField.make(ofproto_v1_2.OXM_OF_SCTP_SRC)) + + if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_SCTP_DST): + self.fields.append( + OFPMatchField.make(ofproto_v1_2.OXM_OF_SCTP_DST)) + if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ARP_OP): self.fields.append( OFPMatchField.make(ofproto_v1_2.OXM_OF_ARP_OP)) @@ -1135,6 +1145,14 @@ class OFPMatch(object): self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_UDP_DST) self.flow.udp_dst = udp_dst + def set_sctp_src(self, sctp_src): + self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_SCTP_SRC) + self.flow.sctp_src = sctp_src + + def set_sctp_dst(self, sctp_dst): + self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_SCTP_DST) + self.flow.sctp_dst = sctp_dst + def set_arp_opcode(self, arp_op): self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ARP_OP) self.flow.arp_op = arp_op @@ -1466,6 +1484,32 @@ class MTUDPDst(OFPMatchField): return MTUDPDst(header) +@OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_SCTP_SRC]) +class MTSCTPSrc(OFPMatchField): + def __init__(self, header): + super(MTSCTPSrc, self).__init__(header, '!H') + + def serialize(self, buf, offset, match): + self.put(buf, offset, match.flow.sctp_src) + + @classmethod + def parser(cls, header, buf, offset): + return MTSCTPSrc(header) + + +@OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_SCTP_DST]) +class MTSCTPDst(OFPMatchField): + def __init__(self, header): + super(MTSCTPDst, self).__init__(header, '!H') + + def serialize(self, buf, offset, match): + self.put(buf, offset, match.flow.sctp_dst) + + @classmethod + def parser(cls, header, buf, offset): + return MTSCTPDst(header) + + @OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_ARP_OP]) class MTArpOp(OFPMatchField): def __init__(self, header): |