of1.2: add OXM_OF_IP_DSCP

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: Simon Horman <horms@verge.net.au>
This commit is contained in:
FUJITA Tomonori 2012-06-23 10:43:56 +09:00
parent c68f4bb414
commit 1e9855b2eb

View File

@ -867,6 +867,7 @@ class Flow(object):
self.dl_type = 0
self.vlan_vid = 0
self.vlan_pcp = 0
self.ip_dscp = 0
self.arp_op = 0
self.arp_spa = 0
self.arp_tpa = 0
@ -938,6 +939,10 @@ class OFPMatch(object):
self.fields.append(
OFPMatchField.make(ofproto_v1_2.OXM_OF_VLAN_PCP))
if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_IP_DSCP):
self.fields.append(
OFPMatchField.make(ofproto_v1_2.OXM_OF_IP_DSCP))
if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ARP_OP):
self.fields.append(
OFPMatchField.make(ofproto_v1_2.OXM_OF_ARP_OP))
@ -1036,6 +1041,10 @@ class OFPMatch(object):
self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_VLAN_PCP)
self.flow.vlan_pcp = pcp
def set_ip_dscp(self, ip_dscp):
self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IP_DSCP)
self.flow.ip_dscp = ip_dscp
def set_arp_opcode(self, arp_op):
self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ARP_OP)
self.flow.arp_op = arp_op
@ -1240,6 +1249,19 @@ class MTVlanPcp(OFPMatchField):
return MTVlanPcp(header)
@OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_IP_DSCP])
class MTIPDscp(OFPMatchField):
def __init__(self, header):
super(MTIPDscp, self).__init__(header, '!B')
def serialize(self, buf, offset, match):
self.put(buf, offset, match.flow.ip_dscp)
@classmethod
def parser(cls, header, buf, offset):
return MTIPDscp(header)
@OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_ARP_OP])
class MTArpOp(OFPMatchField):
def __init__(self, header):