diff --git a/ryu/ofproto/ofproto_v1_0.py b/ryu/ofproto/ofproto_v1_0.py index 4cac2626..c6cd9736 100644 --- a/ryu/ofproto/ofproto_v1_0.py +++ b/ryu/ofproto/ofproto_v1_0.py @@ -265,10 +265,12 @@ OFPFW_TP_DST = 1 << 7 # TCP/UDP destination port. OFPFW_NW_SRC_SHIFT = 8 OFPFW_NW_SRC_BITS = 6 OFPFW_NW_SRC_MASK = ((1 << OFPFW_NW_SRC_BITS) - 1) << OFPFW_NW_SRC_SHIFT +OFPFW_NW_SRC = OFPFW_NW_SRC_MASK # IP source address (not in OF Spec). OFPFW_NW_SRC_ALL = 32 << OFPFW_NW_SRC_SHIFT OFPFW_NW_DST_SHIFT = 14 OFPFW_NW_DST_BITS = 6 OFPFW_NW_DST_MASK = ((1 << OFPFW_NW_DST_BITS) - 1) << OFPFW_NW_DST_SHIFT +OFPFW_NW_DST = OFPFW_NW_DST_MASK # IP destination address (not in OF Spec). OFPFW_NW_DST_ALL = 32 << OFPFW_NW_DST_SHIFT OFPFW_DL_VLAN_PCP = 1 << 20 # VLAN priority. OFPFW_NW_TOS = 1 << 21 # IP ToS (DSCP field, 6 bits). diff --git a/ryu/ofproto/ofproto_v1_0_parser.py b/ryu/ofproto/ofproto_v1_0_parser.py index 73d3409b..fd2687d4 100644 --- a/ryu/ofproto/ofproto_v1_0_parser.py +++ b/ryu/ofproto/ofproto_v1_0_parser.py @@ -241,6 +241,10 @@ class OFPMatch(StringifyMixin): else: raise KeyError(name) + def __contains__(self, name): + wc = getattr(ofproto, 'OFPFW_' + name.upper(), 0) + return ~self.wildcards & wc + def serialize(self, buf, offset): msg_pack_into(ofproto.OFP_MATCH_PACK_STR, buf, offset, self.wildcards, self.in_port, self.dl_src,