<s> import logging <EOL> from ryu . ofproto import ofproto_v1_2 <EOL> from ryu . ofproto import ether <EOL> from ryu . ofproto import inet <EOL> from ryu . tests . integrated import tester <EOL> LOG = logging . getLogger ( __name__ ) <EOL> class RunTest ( tester . TestFlowBase ) : <EOL> """<STR_LIT>""" <EOL> OFP_VERSIONS = [ ofproto_v1_2 . OFP_VERSION ] <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( RunTest , self ) . __init__ ( * args , ** kwargs ) <EOL> self . _verify = { } <EOL> def add_matches ( self , dp , match ) : <EOL> m = dp . ofproto_parser . OFPFlowMod ( dp , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <EOL> dp . ofproto . OFPFC_ADD , <EOL> <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT> , <EOL> dp . ofproto . OFPP_ANY , <EOL> <NUM_LIT> , <NUM_LIT:0> , match , [ ] ) <EOL> dp . send_msg ( m ) <EOL> def _set_verify ( self , headers , value , mask = None , <EOL> all_bits_masked = False , type_ = '<STR_LIT:int>' ) : <EOL> self . _verify = { } <EOL> self . _verify [ '<STR_LIT>' ] = headers <EOL> self . _verify [ '<STR_LIT:value>' ] = value <EOL> self . _verify [ '<STR_LIT>' ] = mask <EOL> self . _verify [ '<STR_LIT>' ] = all_bits_masked <EOL> self . _verify [ '<STR_LIT:type>' ] = type_ <EOL> def verify_default ( self , dp , stats ) : <EOL> type_ = self . _verify [ '<STR_LIT:type>' ] <EOL> headers = self . _verify [ '<STR_LIT>' ] <EOL> value = self . _verify [ '<STR_LIT:value>' ] <EOL> mask = self . _verify [ '<STR_LIT>' ] <EOL> value_masked = self . _masked ( type_ , value , mask ) <EOL> all_bits_masked = self . _verify [ '<STR_LIT>' ] <EOL> field = None <EOL> for s in stats : <EOL> for f in s . match . fields : <EOL> if f . header in headers : <EOL> field = f <EOL> break <EOL> if field is None : <EOL> if self . _is_all_zero_bit ( type_ , mask ) : <EOL> return True <EOL> return '<STR_LIT>' <EOL> f_value = field . value <EOL> if hasattr ( field , '<STR_LIT>' ) : <EOL> f_mask = field . mask <EOL> else : <EOL> f_mask = None <EOL> if ( f_value == value ) or ( f_value == value_masked ) : <EOL> if ( f_mask == mask ) or ( all_bits_masked and f_mask is None ) : <EOL> return True <EOL> return "<STR_LIT>" % ( self . _cnv_to_str ( type_ , value , mask , f_value , f_mask ) ) <EOL> def _masked ( self , type_ , value , mask ) : <EOL> if mask is None : <EOL> v = value <EOL> elif type_ == '<STR_LIT:int>' : <EOL> v = value & mask <EOL> elif type_ == '<STR_LIT>' : <EOL> v = self . haddr_masked ( value , mask ) <EOL> elif type_ == '<STR_LIT>' : <EOL> v = self . ipv4_masked ( value , mask ) <EOL> elif type_ == '<STR_LIT>' : <EOL> v = self . ipv6_masked ( value , mask ) <EOL> else : <EOL> raise Exception ( '<STR_LIT>' ) <EOL> return v <EOL> def _is_all_zero_bit ( self , type_ , val ) : <EOL> if type_ == '<STR_LIT:int>' or type_ == '<STR_LIT>' : <EOL> return val == <NUM_LIT:0> <EOL> elif type_ == '<STR_LIT>' : <EOL> for v in val : <EOL> if v != b'<STR_LIT:\x00>' : <EOL> return False <EOL> return True <EOL> elif type_ == '<STR_LIT>' : <EOL> for v in val : <EOL> if v != <NUM_LIT:0> : <EOL> return False <EOL> return True <EOL> else : <EOL> raise Exception ( '<STR_LIT>' ) <EOL> def _cnv_to_str ( self , type_ , value , mask , f_value , f_mask ) : <EOL> func = None <EOL> if type_ == '<STR_LIT:int>' : <EOL> pass <EOL> elif type_ == '<STR_LIT>' : <EOL> func = self . haddr_to_str <EOL> elif type_ == '<STR_LIT>' : <EOL> func = self . ipv4_to_str <EOL> elif type_ == '<STR_LIT>' : <EOL> func = self . ipv6_to_str <EOL> else : <EOL> raise Exception ( '<STR_LIT>' ) <EOL> if func : <EOL> value = func ( value ) <EOL> f_value = func ( f_value ) <EOL> if mask : <EOL> mask = func ( mask ) <EOL> if f_mask : <EOL> f_mask = func ( f_mask ) <EOL> return value , mask , f_value , f_mask <EOL> def test_rule_set_dl_dst ( self , dp ) : <EOL> dl_dst = '<STR_LIT>' <EOL> dl_dst_bin = self . haddr_to_bin ( dl_dst ) <EOL> headers = [ dp . ofproto . OXM_OF_ETH_DST , dp . ofproto . OXM_OF_ETH_DST_W ] <EOL> self . _set_verify ( headers , dl_dst_bin , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_dst ( dl_dst_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_dl_dst_masked_ff ( self , dp ) : <EOL> dl_dst = '<STR_LIT>' <EOL> dl_dst_bin = self . haddr_to_bin ( dl_dst ) <EOL> mask = '<STR_LIT>' <EOL> mask_bin = self . haddr_to_bin ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ETH_DST , dp . ofproto . OXM_OF_ETH_DST_W ] <EOL> self . _set_verify ( headers , dl_dst_bin , mask_bin , True , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_dst_masked ( dl_dst_bin , mask_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_dl_dst_masked_f0 ( self , dp ) : <EOL> dl_dst = '<STR_LIT>' <EOL> dl_dst_bin = self . haddr_to_bin ( dl_dst ) <EOL> mask = '<STR_LIT>' <EOL> mask_bin = self . haddr_to_bin ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ETH_DST , dp . ofproto . OXM_OF_ETH_DST_W ] <EOL> self . _set_verify ( headers , dl_dst_bin , mask_bin , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_dst_masked ( dl_dst_bin , mask_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_dl_dst_masked_00 ( self , dp ) : <EOL> dl_dst = '<STR_LIT>' <EOL> dl_dst_bin = self . haddr_to_bin ( dl_dst ) <EOL> mask = '<STR_LIT>' <EOL> mask_bin = self . haddr_to_bin ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ETH_DST , dp . ofproto . OXM_OF_ETH_DST_W ] <EOL> self . _set_verify ( headers , dl_dst_bin , mask_bin , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_dst_masked ( dl_dst_bin , mask_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_dl_src ( self , dp ) : <EOL> dl_src = '<STR_LIT>' <EOL> dl_src_bin = self . haddr_to_bin ( dl_src ) <EOL> headers = [ dp . ofproto . OXM_OF_ETH_SRC , dp . ofproto . OXM_OF_ETH_SRC_W ] <EOL> self . _set_verify ( headers , dl_src_bin , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_src ( dl_src_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_dl_src_masked_ff ( self , dp ) : <EOL> dl_src = '<STR_LIT>' <EOL> dl_src_bin = self . haddr_to_bin ( dl_src ) <EOL> mask = '<STR_LIT>' <EOL> mask_bin = self . haddr_to_bin ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ETH_SRC , dp . ofproto . OXM_OF_ETH_SRC_W ] <EOL> self . _set_verify ( headers , dl_src_bin , mask_bin , True , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_src_masked ( dl_src_bin , mask_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_dl_src_masked_f0 ( self , dp ) : <EOL> dl_src = '<STR_LIT>' <EOL> dl_src_bin = self . haddr_to_bin ( dl_src ) <EOL> mask = '<STR_LIT>' <EOL> mask_bin = self . haddr_to_bin ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ETH_SRC , dp . ofproto . OXM_OF_ETH_SRC_W ] <EOL> self . _set_verify ( headers , dl_src_bin , mask_bin , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_src_masked ( dl_src_bin , mask_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_dl_src_masked_00 ( self , dp ) : <EOL> dl_src = '<STR_LIT>' <EOL> dl_src_bin = self . haddr_to_bin ( dl_src ) <EOL> mask = '<STR_LIT>' <EOL> mask_bin = self . haddr_to_bin ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ETH_SRC , dp . ofproto . OXM_OF_ETH_SRC_W ] <EOL> self . _set_verify ( headers , dl_src_bin , mask_bin , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_src_masked ( dl_src_bin , mask_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_dl_type_ip ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> headers = [ dp . ofproto . OXM_OF_ETH_TYPE ] <EOL> self . _set_verify ( headers , dl_type ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_dl_type_arp ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> headers = [ dp . ofproto . OXM_OF_ETH_TYPE ] <EOL> self . _set_verify ( headers , dl_type ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_dl_type_vlan ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_8021Q <EOL> headers = [ dp . ofproto . OXM_OF_ETH_TYPE ] <EOL> self . _set_verify ( headers , dl_type ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_dl_type_ipv6 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> headers = [ dp . ofproto . OXM_OF_ETH_TYPE ] <EOL> self . _set_verify ( headers , dl_type ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_dl_type_lacp ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_SLOW <EOL> headers = [ dp . ofproto . OXM_OF_ETH_TYPE ] <EOL> self . _set_verify ( headers , dl_type ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ip_dscp ( self , dp ) : <EOL> ip_dscp = <NUM_LIT> <EOL> dl_type = ether . ETH_TYPE_IP <EOL> headers = [ dp . ofproto . OXM_OF_IP_DSCP ] <EOL> self . _set_verify ( headers , ip_dscp ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_dscp ( ip_dscp ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_vlan_vid ( self , dp ) : <EOL> vlan_vid = <NUM_LIT> <EOL> headers = [ dp . ofproto . OXM_OF_VLAN_VID , dp . ofproto . OXM_OF_VLAN_VID_W ] <EOL> self . _set_verify ( headers , vlan_vid ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_vlan_vid ( vlan_vid ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_vlan_vid_masked_ff ( self , dp ) : <EOL> vlan_vid = <NUM_LIT> <EOL> mask = <NUM_LIT> <EOL> headers = [ dp . ofproto . OXM_OF_VLAN_VID , dp . ofproto . OXM_OF_VLAN_VID_W ] <EOL> self . _set_verify ( headers , vlan_vid , mask , True ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_vlan_vid_masked ( vlan_vid , mask ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_vlan_vid_masked_f0 ( self , dp ) : <EOL> vlan_vid = <NUM_LIT> <EOL> mask = <NUM_LIT> <EOL> headers = [ dp . ofproto . OXM_OF_VLAN_VID , dp . ofproto . OXM_OF_VLAN_VID_W ] <EOL> self . _set_verify ( headers , vlan_vid , mask ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_vlan_vid_masked ( vlan_vid , mask ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_vlan_vid_masked_00 ( self , dp ) : <EOL> vlan_vid = <NUM_LIT> <EOL> mask = <NUM_LIT> <EOL> headers = [ dp . ofproto . OXM_OF_VLAN_VID , dp . ofproto . OXM_OF_VLAN_VID_W ] <EOL> self . _set_verify ( headers , vlan_vid , mask ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_vlan_vid_masked ( vlan_vid , mask ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_vlan_pcp ( self , dp ) : <EOL> vlan_vid = <NUM_LIT> <EOL> vlan_pcp = <NUM_LIT:5> <EOL> headers = [ dp . ofproto . OXM_OF_VLAN_PCP ] <EOL> self . _set_verify ( headers , vlan_pcp ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_vlan_vid ( vlan_vid ) <EOL> match . set_vlan_pcp ( vlan_pcp ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ip_ecn ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> ip_ecn = <NUM_LIT:3> <EOL> headers = [ dp . ofproto . OXM_OF_IP_ECN ] <EOL> self . _set_verify ( headers , ip_ecn ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_ecn ( ip_ecn ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ip_proto_icmp ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> ip_proto = inet . IPPROTO_ICMP <EOL> headers = [ dp . ofproto . OXM_OF_IP_PROTO ] <EOL> self . _set_verify ( headers , ip_proto ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ip_proto_tcp ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> ip_proto = inet . IPPROTO_TCP <EOL> headers = [ dp . ofproto . OXM_OF_IP_PROTO ] <EOL> self . _set_verify ( headers , ip_proto ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ip_proto_udp ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> ip_proto = inet . IPPROTO_UDP <EOL> headers = [ dp . ofproto . OXM_OF_IP_PROTO ] <EOL> self . _set_verify ( headers , ip_proto ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ip_proto_ipv6_route ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ip_proto = inet . IPPROTO_ROUTING <EOL> headers = [ dp . ofproto . OXM_OF_IP_PROTO ] <EOL> self . _set_verify ( headers , ip_proto ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ip_proto_ipv6_frag ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ip_proto = inet . IPPROTO_FRAGMENT <EOL> headers = [ dp . ofproto . OXM_OF_IP_PROTO ] <EOL> self . _set_verify ( headers , ip_proto ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ip_proto_ipv6_icmp ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ip_proto = inet . IPPROTO_ICMPV6 <EOL> headers = [ dp . ofproto . OXM_OF_IP_PROTO ] <EOL> self . _set_verify ( headers , ip_proto ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ip_proto_ipv6_none ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ip_proto = inet . IPPROTO_NONE <EOL> headers = [ dp . ofproto . OXM_OF_IP_PROTO ] <EOL> self . _set_verify ( headers , ip_proto ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ip_proto_ipv6_dstopts ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ip_proto = inet . IPPROTO_DSTOPTS <EOL> headers = [ dp . ofproto . OXM_OF_IP_PROTO ] <EOL> self . _set_verify ( headers , ip_proto ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv4_src ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> src = '<STR_LIT>' <EOL> src_int = self . ipv4_to_int ( src ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV4_SRC , dp . ofproto . OXM_OF_IPV4_SRC_W ] <EOL> self . _set_verify ( headers , src_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv4_src ( src_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv4_src_masked_32 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> src = '<STR_LIT>' <EOL> src_int = self . ipv4_to_int ( src ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv4_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV4_SRC , dp . ofproto . OXM_OF_IPV4_SRC_W ] <EOL> self . _set_verify ( headers , src_int , mask_int , True , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv4_src_masked ( src_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv4_src_masked_24 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> src = '<STR_LIT>' <EOL> src_int = self . ipv4_to_int ( src ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv4_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV4_SRC , dp . ofproto . OXM_OF_IPV4_SRC_W ] <EOL> self . _set_verify ( headers , src_int , mask_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv4_src_masked ( src_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv4_src_masked_0 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> src = '<STR_LIT>' <EOL> src_int = self . ipv4_to_int ( src ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv4_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV4_SRC , dp . ofproto . OXM_OF_IPV4_SRC_W ] <EOL> self . _set_verify ( headers , src_int , mask_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv4_src_masked ( src_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv4_dst ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> dst = '<STR_LIT>' <EOL> dst_int = self . ipv4_to_int ( dst ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV4_DST , dp . ofproto . OXM_OF_IPV4_DST_W ] <EOL> self . _set_verify ( headers , dst_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv4_dst ( dst_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv4_dst_masked_32 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> dst = '<STR_LIT>' <EOL> dst_int = self . ipv4_to_int ( dst ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv4_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV4_DST , dp . ofproto . OXM_OF_IPV4_DST_W ] <EOL> self . _set_verify ( headers , dst_int , mask_int , True , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv4_dst_masked ( dst_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv4_dst_masked_24 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> dst = '<STR_LIT>' <EOL> dst_int = self . ipv4_to_int ( dst ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv4_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV4_DST , dp . ofproto . OXM_OF_IPV4_DST_W ] <EOL> self . _set_verify ( headers , dst_int , mask_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv4_dst_masked ( dst_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv4_dst_masked_0 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> dst = '<STR_LIT>' <EOL> dst_int = self . ipv4_to_int ( dst ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv4_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV4_DST , dp . ofproto . OXM_OF_IPV4_DST_W ] <EOL> self . _set_verify ( headers , dst_int , mask_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv4_dst_masked ( dst_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_tcp_src ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> ip_proto = inet . IPPROTO_TCP <EOL> tp_src = <NUM_LIT> <EOL> headers = [ dp . ofproto . OXM_OF_TCP_SRC ] <EOL> self . _set_verify ( headers , tp_src ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> match . set_tcp_src ( tp_src ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_tcp_dst ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> ip_proto = inet . IPPROTO_TCP <EOL> tp_dst = <NUM_LIT> <EOL> headers = [ dp . ofproto . OXM_OF_TCP_DST ] <EOL> self . _set_verify ( headers , tp_dst ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> match . set_tcp_dst ( tp_dst ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_udp_src ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> ip_proto = inet . IPPROTO_UDP <EOL> tp_src = <NUM_LIT> <EOL> headers = [ dp . ofproto . OXM_OF_UDP_SRC ] <EOL> self . _set_verify ( headers , tp_src ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> match . set_udp_src ( tp_src ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_udp_dst ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> ip_proto = inet . IPPROTO_UDP <EOL> tp_dst = <NUM_LIT> <EOL> headers = [ dp . ofproto . OXM_OF_UDP_DST ] <EOL> self . _set_verify ( headers , tp_dst ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> match . set_udp_dst ( tp_dst ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_icmpv4_type ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> ip_proto = inet . IPPROTO_ICMP <EOL> icmp_type = <NUM_LIT:8> <EOL> headers = [ dp . ofproto . OXM_OF_ICMPV4_TYPE ] <EOL> self . _set_verify ( headers , icmp_type ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> match . set_icmpv4_type ( icmp_type ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_icmpv4_code ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IP <EOL> ip_proto = inet . IPPROTO_ICMP <EOL> icmp_type = <NUM_LIT:9> <EOL> icmp_code = <NUM_LIT:16> <EOL> headers = [ dp . ofproto . OXM_OF_ICMPV4_CODE ] <EOL> self . _set_verify ( headers , icmp_code ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> match . set_icmpv4_type ( icmp_type ) <EOL> match . set_icmpv4_code ( icmp_code ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_opcode ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> arp_op = <NUM_LIT:1> <EOL> headers = [ dp . ofproto . OXM_OF_ARP_OP ] <EOL> self . _set_verify ( headers , arp_op ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_opcode ( arp_op ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_spa ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> nw_src = '<STR_LIT>' <EOL> nw_src_int = self . ipv4_to_int ( nw_src ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_SPA , dp . ofproto . OXM_OF_ARP_SPA_W ] <EOL> self . _set_verify ( headers , nw_src_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_spa ( nw_src_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_spa_masked_32 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> nw_src = '<STR_LIT>' <EOL> nw_src_int = self . ipv4_to_int ( nw_src ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv4_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_SPA , dp . ofproto . OXM_OF_ARP_SPA_W ] <EOL> self . _set_verify ( headers , nw_src_int , mask_int , True , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_spa_masked ( nw_src_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_spa_masked_24 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> nw_src = '<STR_LIT>' <EOL> nw_src_int = self . ipv4_to_int ( nw_src ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv4_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_SPA , dp . ofproto . OXM_OF_ARP_SPA_W ] <EOL> self . _set_verify ( headers , nw_src_int , mask_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_spa_masked ( nw_src_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_spa_masked_00 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> nw_src = '<STR_LIT>' <EOL> nw_src_int = self . ipv4_to_int ( nw_src ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv4_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_SPA , dp . ofproto . OXM_OF_ARP_SPA_W ] <EOL> self . _set_verify ( headers , nw_src_int , mask_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_spa_masked ( nw_src_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_tpa ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> nw_dst = '<STR_LIT>' <EOL> nw_dst_int = self . ipv4_to_int ( nw_dst ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_TPA , dp . ofproto . OXM_OF_ARP_TPA_W ] <EOL> self . _set_verify ( headers , nw_dst_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_tpa ( nw_dst_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_tpa_masked_32 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> nw_dst = '<STR_LIT>' <EOL> nw_dst_int = self . ipv4_to_int ( nw_dst ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv4_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_TPA , dp . ofproto . OXM_OF_ARP_TPA_W ] <EOL> self . _set_verify ( headers , nw_dst_int , mask_int , True , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_tpa_masked ( nw_dst_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_tpa_masked_24 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> nw_dst = '<STR_LIT>' <EOL> nw_dst_int = self . ipv4_to_int ( nw_dst ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv4_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_TPA , dp . ofproto . OXM_OF_ARP_TPA_W ] <EOL> self . _set_verify ( headers , nw_dst_int , mask_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_tpa_masked ( nw_dst_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_tpa_masked_00 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> nw_dst = '<STR_LIT>' <EOL> nw_dst_int = self . ipv4_to_int ( nw_dst ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv4_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_TPA , dp . ofproto . OXM_OF_ARP_TPA_W ] <EOL> self . _set_verify ( headers , nw_dst_int , mask_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_tpa_masked ( nw_dst_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_sha ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> arp_sha = '<STR_LIT>' <EOL> arp_sha_bin = self . haddr_to_bin ( arp_sha ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_SHA , dp . ofproto . OXM_OF_ARP_SHA_W ] <EOL> self . _set_verify ( headers , arp_sha_bin , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_sha ( arp_sha_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_sha_masked_ff ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> arp_sha = '<STR_LIT>' <EOL> arp_sha_bin = self . haddr_to_bin ( arp_sha ) <EOL> mask = '<STR_LIT>' <EOL> mask_bin = self . haddr_to_bin ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_SHA , dp . ofproto . OXM_OF_ARP_SHA_W ] <EOL> self . _set_verify ( headers , arp_sha_bin , mask_bin , True , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_sha_masked ( arp_sha_bin , mask_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_sha_masked_f0 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> arp_sha = '<STR_LIT>' <EOL> arp_sha_bin = self . haddr_to_bin ( arp_sha ) <EOL> mask = '<STR_LIT>' <EOL> mask_bin = self . haddr_to_bin ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_SHA , dp . ofproto . OXM_OF_ARP_SHA_W ] <EOL> self . _set_verify ( headers , arp_sha_bin , mask_bin , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_sha_masked ( arp_sha_bin , mask_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_sha_masked_00 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> arp_sha = '<STR_LIT>' <EOL> arp_sha_bin = self . haddr_to_bin ( arp_sha ) <EOL> mask = '<STR_LIT>' <EOL> mask_bin = self . haddr_to_bin ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_SHA , dp . ofproto . OXM_OF_ARP_SHA_W ] <EOL> self . _set_verify ( headers , arp_sha_bin , mask_bin , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_sha_masked ( arp_sha_bin , mask_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_tha ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> arp_tha = '<STR_LIT>' <EOL> arp_tha_bin = self . haddr_to_bin ( arp_tha ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_THA , dp . ofproto . OXM_OF_ARP_THA_W ] <EOL> self . _set_verify ( headers , arp_tha_bin , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_tha ( arp_tha_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_tha_masked_ff ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> arp_tha = '<STR_LIT>' <EOL> arp_tha_bin = self . haddr_to_bin ( arp_tha ) <EOL> mask = '<STR_LIT>' <EOL> mask_bin = self . haddr_to_bin ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_THA , dp . ofproto . OXM_OF_ARP_THA_W ] <EOL> self . _set_verify ( headers , arp_tha_bin , mask_bin , True , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_tha_masked ( arp_tha_bin , mask_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_tha_masked_f0 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> arp_tha = '<STR_LIT>' <EOL> arp_tha_bin = self . haddr_to_bin ( arp_tha ) <EOL> mask = '<STR_LIT>' <EOL> mask_bin = self . haddr_to_bin ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_THA , dp . ofproto . OXM_OF_ARP_THA_W ] <EOL> self . _set_verify ( headers , arp_tha_bin , mask_bin , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_tha_masked ( arp_tha_bin , mask_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_arp_tha_masked_00 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_ARP <EOL> arp_tha = '<STR_LIT>' <EOL> arp_tha_bin = self . haddr_to_bin ( arp_tha ) <EOL> mask = '<STR_LIT>' <EOL> mask_bin = self . haddr_to_bin ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_ARP_THA , dp . ofproto . OXM_OF_ARP_THA_W ] <EOL> self . _set_verify ( headers , arp_tha_bin , mask_bin , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_arp_tha_masked ( arp_tha_bin , mask_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv6_src ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ipv6_src = '<STR_LIT>' <EOL> ipv6_src_int = self . ipv6_to_int ( ipv6_src ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV6_SRC , dp . ofproto . OXM_OF_IPV6_SRC_W ] <EOL> self . _set_verify ( headers , ipv6_src_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv6_src ( ipv6_src_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv6_src_masked_ff ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ipv6_src = '<STR_LIT>' <EOL> ipv6_src_int = self . ipv6_to_int ( ipv6_src ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv6_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV6_SRC , dp . ofproto . OXM_OF_IPV6_SRC_W ] <EOL> self . _set_verify ( headers , ipv6_src_int , mask_int , True , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv6_src_masked ( ipv6_src_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv6_src_masked_f0 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ipv6_src = '<STR_LIT>' <EOL> ipv6_src_int = self . ipv6_to_int ( ipv6_src ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv6_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV6_SRC , dp . ofproto . OXM_OF_IPV6_SRC_W ] <EOL> self . _set_verify ( headers , ipv6_src_int , mask_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv6_src_masked ( ipv6_src_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv6_src_masked_00 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ipv6_src = '<STR_LIT>' <EOL> ipv6_src_int = self . ipv6_to_int ( ipv6_src ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv6_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV6_SRC , dp . ofproto . OXM_OF_IPV6_SRC_W ] <EOL> self . _set_verify ( headers , ipv6_src_int , mask_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv6_src_masked ( ipv6_src_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv6_dst ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ipv6_dst = '<STR_LIT>' <EOL> ipv6_dst_int = self . ipv6_to_int ( ipv6_dst ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV6_DST , dp . ofproto . OXM_OF_IPV6_DST_W ] <EOL> self . _set_verify ( headers , ipv6_dst_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv6_dst ( ipv6_dst_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv6_dst_masked_ff ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ipv6_dst = '<STR_LIT>' <EOL> ipv6_dst_int = self . ipv6_to_int ( ipv6_dst ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv6_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV6_DST , dp . ofproto . OXM_OF_IPV6_DST_W ] <EOL> self . _set_verify ( headers , ipv6_dst_int , mask_int , True , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv6_dst_masked ( ipv6_dst_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv6_dst_masked_f0 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ipv6_dst = '<STR_LIT>' <EOL> ipv6_dst_int = self . ipv6_to_int ( ipv6_dst ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv6_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV6_DST , dp . ofproto . OXM_OF_IPV6_DST_W ] <EOL> self . _set_verify ( headers , ipv6_dst_int , mask_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv6_dst_masked ( ipv6_dst_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv6_dst_masked_00 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ipv6_dst = '<STR_LIT>' <EOL> ipv6_dst_int = self . ipv6_to_int ( ipv6_dst ) <EOL> mask = '<STR_LIT>' <EOL> mask_int = self . ipv6_to_int ( mask ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV6_DST , dp . ofproto . OXM_OF_IPV6_DST_W ] <EOL> self . _set_verify ( headers , ipv6_dst_int , mask_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv6_dst_masked ( ipv6_dst_int , mask_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv6_flabel ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ipv6_label = <NUM_LIT> <EOL> headers = [ dp . ofproto . OXM_OF_IPV6_FLABEL , <EOL> dp . ofproto . OXM_OF_IPV6_FLABEL_W ] <EOL> self . _set_verify ( headers , ipv6_label ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv6_flabel ( ipv6_label ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv6_flabel_masked_ff ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ipv6_label = <NUM_LIT> <EOL> mask = <NUM_LIT> <EOL> headers = [ dp . ofproto . OXM_OF_IPV6_FLABEL , <EOL> dp . ofproto . OXM_OF_IPV6_FLABEL_W ] <EOL> self . _set_verify ( headers , ipv6_label , mask , True ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv6_flabel_masked ( ipv6_label , mask ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv6_flabel_masked_f0 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ipv6_label = <NUM_LIT> <EOL> mask = <NUM_LIT> <EOL> headers = [ dp . ofproto . OXM_OF_IPV6_FLABEL , <EOL> dp . ofproto . OXM_OF_IPV6_FLABEL_W ] <EOL> self . _set_verify ( headers , ipv6_label , mask ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv6_flabel_masked ( ipv6_label , mask ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv6_flabel_masked_00 ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ipv6_label = <NUM_LIT> <EOL> mask = <NUM_LIT> <EOL> headers = [ dp . ofproto . OXM_OF_IPV6_FLABEL , <EOL> dp . ofproto . OXM_OF_IPV6_FLABEL_W ] <EOL> self . _set_verify ( headers , ipv6_label , mask ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ipv6_flabel_masked ( ipv6_label , mask ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_icmpv6_type ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ip_proto = inet . IPPROTO_ICMPV6 <EOL> icmp_type = <NUM_LIT> <EOL> headers = [ dp . ofproto . OXM_OF_ICMPV6_TYPE ] <EOL> self . _set_verify ( headers , icmp_type ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> match . set_icmpv6_type ( icmp_type ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_icmpv6_code ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ip_proto = inet . IPPROTO_ICMPV6 <EOL> icmp_type = <NUM_LIT> <EOL> icmp_code = <NUM_LIT:1> <EOL> headers = [ dp . ofproto . OXM_OF_ICMPV6_CODE ] <EOL> self . _set_verify ( headers , icmp_code ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> match . set_icmpv6_type ( icmp_type ) <EOL> match . set_icmpv6_code ( icmp_code ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv6_nd_target ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ip_proto = inet . IPPROTO_ICMPV6 <EOL> icmp_type = <NUM_LIT> <EOL> target = "<STR_LIT>" <EOL> target_int = self . ipv6_to_int ( target ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV6_ND_TARGET ] <EOL> self . _set_verify ( headers , target_int , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> match . set_icmpv6_type ( icmp_type ) <EOL> match . set_ipv6_nd_target ( target_int ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv6_nd_sll ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ip_proto = inet . IPPROTO_ICMPV6 <EOL> icmp_type = <NUM_LIT> <EOL> nd_sll = "<STR_LIT>" <EOL> nd_sll_bin = self . haddr_to_bin ( nd_sll ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV6_ND_SLL ] <EOL> self . _set_verify ( headers , nd_sll_bin , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> match . set_icmpv6_type ( icmp_type ) <EOL> match . set_ipv6_nd_sll ( nd_sll_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_ipv6_nd_tll ( self , dp ) : <EOL> dl_type = ether . ETH_TYPE_IPV6 <EOL> ip_proto = inet . IPPROTO_ICMPV6 <EOL> icmp_type = <NUM_LIT> <EOL> nd_tll = "<STR_LIT>" <EOL> nd_tll_bin = self . haddr_to_bin ( nd_tll ) <EOL> headers = [ dp . ofproto . OXM_OF_IPV6_ND_TLL ] <EOL> self . _set_verify ( headers , nd_tll_bin , type_ = '<STR_LIT>' ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_ip_proto ( ip_proto ) <EOL> match . set_icmpv6_type ( icmp_type ) <EOL> match . set_ipv6_nd_tll ( nd_tll_bin ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_mpls_label ( self , dp ) : <EOL> dl_type = <NUM_LIT> <EOL> label = <NUM_LIT> <EOL> headers = [ dp . ofproto . OXM_OF_MPLS_LABEL ] <EOL> self . _set_verify ( headers , label ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_mpls_label ( label ) <EOL> self . add_matches ( dp , match ) <EOL> def test_rule_set_mpls_tc ( self , dp ) : <EOL> dl_type = <NUM_LIT> <EOL> tc = <NUM_LIT:3> <EOL> headers = [ dp . ofproto . OXM_OF_MPLS_TC ] <EOL> self . _set_verify ( headers , tc ) <EOL> match = dp . ofproto_parser . OFPMatch ( ) <EOL> match . set_dl_type ( dl_type ) <EOL> match . set_mpls_tc ( tc ) <EOL> self . add_matches ( dp , match ) <EOL> def is_supported ( self , t ) : <EOL> unsupported = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> for u in unsupported : <EOL> if t . find ( u ) != - <NUM_LIT:1> : <EOL> return False <EOL> return True </s>
