Пример #1
0
    def runTest(self):
        logging.info(
            "Running Testcase   for matching on IPv6 dst CIDR masking")
        flow = "2001:0db8:85a2::"
        mask = "ffff:ffff:fffe::"
        correct1 = "2001:0db8:85a3::8a2e:0370:7331"
        correct2 = "2001:0db8:85a2::ffff:ffff:ffff"
        incorrect1 = "2001:0db8:85a1::"

        match = ofp.match([
            ofp.oxm.eth_type(0x86dd),
            ofp.oxm.ipv6_dst_masked(parse_ipv6(flow), parse_ipv6(mask)),
        ])

        matching = {
            "flow": simple_tcpv6_packet(ipv6_dst=flow),
            "correct1": simple_tcpv6_packet(ipv6_dst=correct1),
            "correct2": simple_tcpv6_packet(ipv6_dst=correct2),
        }

        nonmatching = {
            "incorrect1": simple_tcpv6_packet(ipv6_dst=incorrect1),
        }

        self.verify_match(match, matching, nonmatching)
Пример #2
0
    def runTest(self):
        flow = "2001:0db8:85a3::0001"
        mask = "ffff:ffff:ffff::000f"
        correct1 = "2001:0db8:85a3::8a2e:0370:7331"
        correct2 = "2001:0db8:85a3::ffff:ffff:fff1"
        incorrect1 = "2001:0db8:85a2::0001"
        incorrect2 = "2001:0db8:85a3::0000"

        match = ofp.match([
            ofp.oxm.eth_type(0x86dd),
            ofp.oxm.ipv6_dst_masked(parse_ipv6(flow), parse_ipv6(mask)),
        ])

        matching = {
            "flow": simple_tcpv6_packet(ipv6_dst=flow),
            "correct1": simple_tcpv6_packet(ipv6_dst=correct1),
            "correct2": simple_tcpv6_packet(ipv6_dst=correct2),
        }

        nonmatching = {
            "incorrect1": simple_tcpv6_packet(ipv6_dst=incorrect1),
            "incorrect2": simple_tcpv6_packet(ipv6_dst=incorrect2),
        }

        self.verify_match(match, matching, nonmatching)
Пример #3
0
    def runTest(self):
        flow =       "2001:0db8:85a3::0001"
        mask =       "ffff:ffff:ffff::000f"
        correct1 =   "2001:0db8:85a3::8a2e:0370:7331"
        correct2 =   "2001:0db8:85a3::ffff:ffff:fff1"
        incorrect1 = "2001:0db8:85a2::0001"
        incorrect2 = "2001:0db8:85a3::0000"

        match = ofp.match([
            ofp.oxm.eth_type(0x86dd),
            ofp.oxm.ipv6_dst_masked(parse_ipv6(flow), parse_ipv6(mask)),
        ])

        matching = {
            "flow": simple_tcpv6_packet(ipv6_dst=flow),
            "correct1": simple_tcpv6_packet(ipv6_dst=correct1),
            "correct2": simple_tcpv6_packet(ipv6_dst=correct2),
        }

        nonmatching = {
            "incorrect1": simple_tcpv6_packet(ipv6_dst=incorrect1),
            "incorrect2": simple_tcpv6_packet(ipv6_dst=incorrect2),
        }

        self.verify_match(match, matching, nonmatching)
Пример #4
0
    def runTest(self):
        logging.info(
            "Running Testcase 60.90 for matching on IPv6 src(subnet masked)")
        flow = "2001:0db8:85a3::"
        mask = "ffff:ffff:ffff::"
        correct1 = "2001:0db8:85a3::8a2e:0370:7331"
        correct2 = "2001:0db8:85a3::ffff:ffff:ffff"
        incorrect1 = "2001:0db8:85a2::"

        match = ofp.match([
            ofp.oxm.eth_type(0x86dd),
            ofp.oxm.ipv6_src(parse_ipv6(flow)),
        ])

        matching = {
            "flow": simple_tcpv6_packet(ipv6_src=flow),
            #"correct1": simple_tcpv6_packet(ipv6_src=correct1),
            #"correct2": simple_tcpv6_packet(ipv6_src=correct2),
        }

        nonmatching = {
            "incorrect1": simple_tcpv6_packet(ipv6_src=incorrect1),
        }

        self.verify_match(match, matching, nonmatching)
Пример #5
0
    def runTest(self):
        logging.info("Running Testcase   for matching on IPv6 dst CIDR masking")
        flow =       "2001:0db8:85a2::"
        mask =       "ffff:ffff:fffe::"
        correct1 =   "2001:0db8:85a3::8a2e:0370:7331"
        correct2 =   "2001:0db8:85a2::ffff:ffff:ffff"
        incorrect1 = "2001:0db8:85a1::"

        match = ofp.match([
            ofp.oxm.eth_type(0x86dd),
            ofp.oxm.ipv6_dst_masked(parse_ipv6(flow), parse_ipv6(mask)),
        ])

        matching = {
            "flow": simple_tcpv6_packet(ipv6_dst=flow),
            "correct1": simple_tcpv6_packet(ipv6_dst=correct1),
            "correct2": simple_tcpv6_packet(ipv6_dst=correct2),
        }

        nonmatching = {
            "incorrect1": simple_tcpv6_packet(ipv6_dst=incorrect1),
        }

        self.verify_match(match, matching, nonmatching)
Пример #6
0
    def runTest(self):
        correct = "2001:db8:85a3::8a2e:370:7334"
        incorrect = "2001:db8:85a3::8a2e:370:7324"
        unspecified = "::"

        match = ofp.match([ofp.oxm.eth_type(0x86DD), ofp.oxm.ipv6_dst(parse_ipv6(correct))])

        matching = {"correct": simple_tcpv6_packet(ipv6_dst=correct)}

        nonmatching = {
            "incorrect": simple_tcpv6_packet(ipv6_dst=incorrect),
            "unspecified": simple_tcpv6_packet(ipv6_dst=unspecified),
        }

        self.verify_match(match, matching, nonmatching)
Пример #7
0
    def runTest(self):
        logging.info("Running Testcase 60.100 for matching on IPv6 dst(subnet masked)")
        flow = "2001:0db8:85a3::"
        mask = "ffff:ffff:ffff::"
        correct1 = "2001:0db8:85a3::8a2e:0370:7331"
        correct2 = "2001:0db8:85a3::ffff:ffff:ffff"
        incorrect1 = "2001:0db8:85a2::"

        match = ofp.match([ofp.oxm.eth_type(0x86DD), ofp.oxm.ipv6_dst(parse_ipv6(flow))])

        matching = {
            "flow": simple_tcpv6_packet(ipv6_dst=flow),
            # "correct1": simple_tcpv6_packet(ipv6_dst=correct1),
            # "correct2": simple_tcpv6_packet(ipv6_dst=correct2),
        }

        nonmatching = {"incorrect1": simple_tcpv6_packet(ipv6_dst=incorrect1)}

        self.verify_match(match, matching, nonmatching)
Пример #8
0
    def runTest(self):
        correct = "2001:db8:85a3::8a2e:370:7334"
        incorrect = "2001:db8:85a3::8a2e:370:7324"
        unspecified = "::"

        match = ofp.match([
            ofp.oxm.eth_type(0x86dd),
            ofp.oxm.ipv6_dst(parse_ipv6(correct)),
        ])

        matching = {
            "correct": simple_tcpv6_packet(ipv6_dst=correct),
        }

        nonmatching = {
            "incorrect": simple_tcpv6_packet(ipv6_dst=incorrect),
            "unspecified": simple_tcpv6_packet(ipv6_dst=unspecified),
        }

        self.verify_match(match, matching, nonmatching)
Пример #9
0
    def runTest(self):
        logging.info("Running testcase 90.60 all supported")

        delete_all_flows(self.controller)
        in_port, out_port,bad_port = openflow_ports(3)
        table_id = test_param_get("table", 0)
        priority=1
        actions=[ofp.action.output(port=out_port,max_len=128)]
        instructions=[ofp.instruction.apply_actions(actions=actions)]
        
        #Flow 1
        match = ofp.match([
                    ofp.oxm.eth_src_masked([0x00, 0x01, 0x02, 0x03, 0x04, 0x05],
                                           [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
                    ofp.oxm.eth_dst_masked([0x00, 0x01, 0x02, 0x03, 0x04, 0x05],
                                           [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
                    ofp.oxm.in_port(in_port),
                    ofp.oxm.eth_type(0x0800),
                    ofp.oxm.ip_proto(6),
                    ofp.oxm.ipv4_src_masked(0xc0a80001, 0xfffeffff),
                    ofp.oxm.ipv4_dst_masked(0xc0a80001, 0xfffeffff),
                    ofp.oxm.tcp_src(53),
                    ofp.oxm.tcp_dst(54), # change dst port to a port different from src port
                    ])
        req = ofp.message.flow_add(table_id=table_id,
                                   match= match,
                                   buffer_id=ofp.OFP_NO_BUFFER,
                                   instructions=instructions,
                                   priority=priority)
        self.controller.message_send(req)
        reply, _= self.controller.poll(exp_msg=ofp.OFPT_ERROR, timeout=3)
        self.assertIsNone(reply,"The switch generated an OFPT_ERROR")
        matching_pkt = str(simple_tcp_packet(eth_dst ='ff:01:02:f3:04:05',
                                             eth_src ='ff:01:02:f3:04:05',
                                             ip_src ='192.169.0.1',
                                             ip_dst='192.168.0.1',
                                             tcp_sport=53,
                                             tcp_dport=54))
        self.dataplane.send(in_port,matching_pkt)
        verify_packet(self,matching_pkt,out_port)
        logging.info("Packet in received for a matching packet")
        nonmatching_pkt = str(simple_tcp_packet(eth_dst ='ff:01:02:f3:04:05',
                                             eth_src ='ff:01:02:f3:04:05',
                                             ip_src ='192.167.0.1',
                                             ip_dst='192.168.0.1',
                                             tcp_sport=53,
                                             tcp_dport=52))
        self.dataplane.send(in_port,nonmatching_pkt)
        verify_no_packet(self,nonmatching_pkt,out_port)
        logging.info("Packet in not received for a non matching packet")
        logging.info("Installing a different combination of match fields")

        #Flow 2
        match = ofp.match([
                ofp.oxm.eth_dst_masked([0x00, 0x01, 0x02, 0x03, 0x04, 0x05],
                                       [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
                ofp.oxm.eth_src_masked([0x00, 0x01, 0x02, 0x03, 0x04, 0x05],
                                       [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
                ofp.oxm.in_port(in_port),
                ofp.oxm.eth_type(0x0800),
                ofp.oxm.ip_proto(17),
                ofp.oxm.ipv4_src_masked(0xc0a80000, 0xfffff000),
                ofp.oxm.ipv4_dst_masked(0xc0a80000, 0xfffff000), # change ip dst to a address different from ip src
                ofp.oxm.udp_src(53),
                ofp.oxm.udp_dst(54), # change dst port to a port different from src port
                ])
        req = ofp.message.flow_add(table_id=table_id,
                                   match= match,
                                   buffer_id=ofp.OFP_NO_BUFFER,
                                   instructions=instructions,
                                   priority=priority)
        self.controller.message_send(req)
        reply, _ = self.controller.poll(exp_msg=ofp.OFPT_ERROR, timeout=3)
        self.assertIsNone(reply,"The switch generated an OFPT_ERROR")
        matching_pkt = str(simple_udp_packet(eth_dst ='ff:01:02:f3:04:05',
                                             eth_src ='ff:01:02:f3:04:05',
                                             ip_src ='192.168.4.2',
                                             ip_dst='192.168.4.3',
                                             udp_sport=53,
                                             udp_dport=54))
        self.dataplane.send(in_port,matching_pkt)
        verify_packet(self,matching_pkt,out_port)
        logging.info("Packet in received for a matching packet")
        nonmatching_pkt = str(simple_udp_packet(eth_dst ='ff:01:02:f3:04:05',
                                             eth_src ='ff:01:02:f3:04:05',
                                             ip_src ='192.168.4.2',
                                             ip_dst='192.167.255.255',
                                             udp_sport=53,
                                             udp_dport=55))
        self.dataplane.send(in_port,nonmatching_pkt)
        verify_no_packet(self,nonmatching_pkt,out_port)
        logging.info("Packet in not received for a non matching packet")

        #Flow3
        flow =       "2001:0db8:85a3::0001"
        mask =       "ffff:ffff:ffff::000f"
        match = ofp.match([
                ofp.oxm.eth_dst_masked([0x00, 0x01, 0x02, 0x03, 0x04, 0x05],
                                       [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
                ofp.oxm.eth_src_masked([0x00, 0x01, 0x02, 0x03, 0x04, 0x05],
                                       [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
                ofp.oxm.in_port(in_port),
                ofp.oxm.eth_type(0x86dd),
                ofp.oxm.ip_proto(6),
                ofp.oxm.ipv6_src_masked(parse_ipv6(flow), parse_ipv6(mask)),
                ofp.oxm.ipv6_dst_masked(parse_ipv6(flow), parse_ipv6(mask)),
                ofp.oxm.tcp_src(53),
                ofp.oxm.tcp_dst(54), # change dst port to a port different from src port
                ])
        req = ofp.message.flow_add(table_id=table_id,
                                   match= match,
                                   buffer_id=ofp.OFP_NO_BUFFER,
                                   instructions=instructions,
                                   priority=priority)
        self.controller.message_send(req)
        reply, _ = self.controller.poll(exp_msg=ofp.OFPT_ERROR, timeout=3)
        self.assertIsNone(reply,"The switch generated an OFPT_ERROR")
        matching_pkt = str(simple_tcpv6_packet(eth_dst ='ff:01:02:f3:04:05',
                                             eth_src ='ff:01:02:f3:04:05',
                                             ipv6_src ='2001:0db8:85a3::8a2e:0370:7331',
                                             ipv6_dst='2001:0db8:85a3::8a2e:0370:7331',
                                             tcp_sport=53,
                                             tcp_dport=54))
        self.dataplane.send(in_port,matching_pkt)
        verify_packet(self,matching_pkt,out_port)
        logging.info("Packet in received for a matching packet")
        nonmatching_pkt = str(simple_tcpv6_packet(eth_dst ='ff:01:02:f3:04:05',
                                             eth_src ='ff:01:02:f3:04:05',
                                             ipv6_src ='2001:0db8:85a2::0001',
                                             ipv6_dst='2001:0db8:85a2::0001',
                                             tcp_sport=53,
                                             tcp_dport=55))
        self.dataplane.send(in_port,nonmatching_pkt)
        verify_no_packet(self,nonmatching_pkt,out_port)
        logging.info("Packet in not received for a non matching packet")

        #Flow4
        match = ofp.match([
                ofp.oxm.eth_dst_masked([0x00, 0x01, 0x02, 0x03, 0x04, 0x05],
                                       [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
                ofp.oxm.eth_src_masked([0x00, 0x01, 0x02, 0x03, 0x04, 0x05],
                                       [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
                ofp.oxm.in_port(in_port),
                ofp.oxm.eth_type(0x86dd),
                ofp.oxm.ip_proto(17),
                ofp.oxm.ipv6_src_masked(parse_ipv6(flow), parse_ipv6(mask)),
                ofp.oxm.ipv6_dst_masked(parse_ipv6(flow), parse_ipv6(mask)),
                ofp.oxm.udp_src(53),
                ofp.oxm.udp_dst(54), # change dst port to a port different from src port
                ])
        req = ofp.message.flow_add(table_id=table_id,
                                   match= match,
                                   buffer_id=ofp.OFP_NO_BUFFER,
                                   instructions=instructions,
                                   priority=priority)
        self.controller.message_send(req)
        reply, _ = self.controller.poll(exp_msg=ofp.OFPT_ERROR, timeout=3)
        self.assertIsNone(reply,"The switch generated an OFPT_ERROR")
        matching_pkt = str(simple_udpv6_packet(eth_dst ='ff:01:02:f3:04:05',
                                             eth_src ='ff:01:02:f3:04:05',
                                             ipv6_src ='2001:0db8:85a3::8a2e:0370:7331',
                                             ipv6_dst='2001:0db8:85a3::8a2e:0370:7331',
                                             udp_sport=53,
                                             udp_dport=54))
        self.dataplane.send(in_port,matching_pkt)
        verify_packet(self,matching_pkt,out_port)
        logging.info("Packet in received for a matching packet")
        nonmatching_pkt = str(simple_udpv6_packet(eth_dst ='ff:01:02:f3:04:05',
                                             eth_src ='ff:01:02:f3:04:05',
                                             ipv6_src ='2001:0db8:85a2::0001',
                                             ipv6_dst='2001:0db8:85a2::0001',
                                             udp_sport=53,
                                             udp_dport=55))
        self.dataplane.send(in_port,nonmatching_pkt)
        verify_no_packet(self,nonmatching_pkt,out_port)
        logging.info("Packet in not received for a non matching packet")
        
Пример #10
0
    def runTest(self):
        logging.info("Running testcase 90.60 all supported")

        delete_all_flows(self.controller)
        in_port, out_port, bad_port = openflow_ports(3)
        table_id = test_param_get("table", 0)
        priority = 1
        actions = [ofp.action.output(port=out_port, max_len=128)]
        instructions = [ofp.instruction.apply_actions(actions=actions)]

        #Flow 1
        match = ofp.match([
            ofp.oxm.eth_src_masked([0x00, 0x06, 0x07, 0x08, 0x09, 0x0a],
                                   [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
            ofp.oxm.eth_dst_masked([0x00, 0x01, 0x02, 0x03, 0x04, 0x05],
                                   [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
            ofp.oxm.in_port(in_port),
            ofp.oxm.eth_type(0x0800),
            ofp.oxm.ip_proto(6),
            ofp.oxm.ipv4_src_masked(0xc0a80001, 0xfffeffff),
            ofp.oxm.ipv4_dst_masked(0xc0a80002, 0xfffeffff),
            ofp.oxm.tcp_src(53),
            ofp.oxm.tcp_dst(
                54),  # change dst port to a port different from src port
        ])
        req = ofp.message.flow_add(table_id=table_id,
                                   match=match,
                                   buffer_id=ofp.OFP_NO_BUFFER,
                                   instructions=instructions,
                                   priority=priority)
        self.controller.message_send(req)
        reply, _ = self.controller.poll(exp_msg=ofp.OFPT_ERROR, timeout=3)
        self.assertIsNone(reply, "The switch generated an OFPT_ERROR")
        matching_pkt = str(
            simple_tcp_packet(eth_dst='00:01:02:f3:04:05',
                              eth_src='00:06:07:f8:09:0a',
                              ip_src='192.169.0.1',
                              ip_dst='192.168.0.2',
                              tcp_sport=53,
                              tcp_dport=54))
        self.dataplane.send(in_port, matching_pkt)
        verify_packet(self, matching_pkt, out_port)
        logging.info("Packet in received for a matching packet")
        nonmatching_pkt = str(
            simple_tcp_packet(eth_dst='00:01:02:f3:04:05',
                              eth_src='00:06:07:f8:09:0a',
                              ip_src='192.167.0.1',
                              ip_dst='192.168.0.2',
                              tcp_sport=53,
                              tcp_dport=52))
        self.dataplane.send(in_port, nonmatching_pkt)
        verify_no_packet(self, nonmatching_pkt, out_port)
        logging.info("Packet in not received for a non matching packet")
        logging.info("Installing a different combination of match fields")

        #Flow 2
        match = ofp.match([
            ofp.oxm.eth_dst_masked([0x00, 0x01, 0x02, 0x03, 0x04, 0x05],
                                   [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
            ofp.oxm.eth_src_masked([0x00, 0x06, 0x07, 0x08, 0x09, 0x0a],
                                   [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
            ofp.oxm.in_port(in_port),
            ofp.oxm.eth_type(0x0800),
            ofp.oxm.ip_proto(17),
            ofp.oxm.ipv4_src_masked(0xc0a80000, 0xfffff000),
            ofp.oxm.ipv4_dst_masked(
                0xc0a80000, 0xfffff000
            ),  # change ip dst to a address different from ip src
            ofp.oxm.udp_src(53),
            ofp.oxm.udp_dst(
                54),  # change dst port to a port different from src port
        ])
        req = ofp.message.flow_add(table_id=table_id,
                                   match=match,
                                   buffer_id=ofp.OFP_NO_BUFFER,
                                   instructions=instructions,
                                   priority=priority)
        self.controller.message_send(req)
        reply, _ = self.controller.poll(exp_msg=ofp.OFPT_ERROR, timeout=3)
        self.assertIsNone(reply, "The switch generated an OFPT_ERROR")
        matching_pkt = str(
            simple_udp_packet(eth_dst='00:01:02:f3:04:05',
                              eth_src='00:06:07:f8:09:0a',
                              ip_src='192.168.4.2',
                              ip_dst='192.168.4.3',
                              udp_sport=53,
                              udp_dport=54))
        self.dataplane.send(in_port, matching_pkt)
        verify_packet(self, matching_pkt, out_port)
        logging.info("Packet in received for a matching packet")
        nonmatching_pkt = str(
            simple_udp_packet(eth_dst='00:01:02:f3:04:05',
                              eth_src='00:06:07:f8:09:0a',
                              ip_src='192.168.4.2',
                              ip_dst='192.167.255.255',
                              udp_sport=53,
                              udp_dport=55))
        self.dataplane.send(in_port, nonmatching_pkt)
        verify_no_packet(self, nonmatching_pkt, out_port)
        logging.info("Packet in not received for a non matching packet")

        #Flow3
        flow = "2001:0db8:85a3::0001"
        mask = "ffff:ffff:ffff::000f"
        match = ofp.match([
            ofp.oxm.eth_dst_masked([0x00, 0x01, 0x02, 0x03, 0x04, 0x05],
                                   [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
            ofp.oxm.eth_src_masked([0x00, 0x06, 0x07, 0x08, 0x09, 0x0a],
                                   [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
            ofp.oxm.in_port(in_port),
            ofp.oxm.eth_type(0x86dd),
            ofp.oxm.ip_proto(6),
            ofp.oxm.ipv6_src_masked(parse_ipv6(flow), parse_ipv6(mask)),
            ofp.oxm.ipv6_dst_masked(parse_ipv6(flow), parse_ipv6(mask)),
            ofp.oxm.tcp_src(53),
            ofp.oxm.tcp_dst(
                54),  # change dst port to a port different from src port
        ])
        req = ofp.message.flow_add(table_id=table_id,
                                   match=match,
                                   buffer_id=ofp.OFP_NO_BUFFER,
                                   instructions=instructions,
                                   priority=priority)
        self.controller.message_send(req)
        reply, _ = self.controller.poll(exp_msg=ofp.OFPT_ERROR, timeout=3)
        self.assertIsNone(reply, "The switch generated an OFPT_ERROR")
        matching_pkt = str(
            simple_tcpv6_packet(eth_dst='00:01:02:f3:04:05',
                                eth_src='00:06:07:f8:09:0a',
                                ipv6_src='2001:0db8:85a3::8a2e:0370:7331',
                                ipv6_dst='2001:0db8:85a3::8a2e:0370:7331',
                                tcp_sport=53,
                                tcp_dport=54))
        self.dataplane.send(in_port, matching_pkt)
        verify_packet(self, matching_pkt, out_port)
        logging.info("Packet in received for a matching packet")
        nonmatching_pkt = str(
            simple_tcpv6_packet(eth_dst='00:01:02:f3:04:05',
                                eth_src='00:06:07:f8:09:0a',
                                ipv6_src='2001:0db8:85a2::0001',
                                ipv6_dst='2001:0db8:85a2::0001',
                                tcp_sport=53,
                                tcp_dport=55))
        self.dataplane.send(in_port, nonmatching_pkt)
        verify_no_packet(self, nonmatching_pkt, out_port)
        logging.info("Packet in not received for a non matching packet")

        #Flow4
        match = ofp.match([
            ofp.oxm.eth_dst_masked([0x00, 0x01, 0x02, 0x03, 0x04, 0x05],
                                   [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
            ofp.oxm.eth_src_masked([0x00, 0x06, 0x07, 0x08, 0x09, 0x0a],
                                   [0x00, 0xff, 0xff, 0x0f, 0xff, 0xff]),
            ofp.oxm.in_port(in_port),
            ofp.oxm.eth_type(0x86dd),
            ofp.oxm.ip_proto(17),
            ofp.oxm.ipv6_src_masked(parse_ipv6(flow), parse_ipv6(mask)),
            ofp.oxm.ipv6_dst_masked(parse_ipv6(flow), parse_ipv6(mask)),
            ofp.oxm.udp_src(53),
            ofp.oxm.udp_dst(
                54),  # change dst port to a port different from src port
        ])
        req = ofp.message.flow_add(table_id=table_id,
                                   match=match,
                                   buffer_id=ofp.OFP_NO_BUFFER,
                                   instructions=instructions,
                                   priority=priority)
        self.controller.message_send(req)
        reply, _ = self.controller.poll(exp_msg=ofp.OFPT_ERROR, timeout=3)
        self.assertIsNone(reply, "The switch generated an OFPT_ERROR")
        matching_pkt = str(
            simple_udpv6_packet(eth_dst='00:01:02:f3:04:05',
                                eth_src='00:06:07:f8:09:0a',
                                ipv6_src='2001:0db8:85a3::8a2e:0370:7331',
                                ipv6_dst='2001:0db8:85a3::8a2e:0370:7331',
                                udp_sport=53,
                                udp_dport=54))
        self.dataplane.send(in_port, matching_pkt)
        verify_packet(self, matching_pkt, out_port)
        logging.info("Packet in received for a matching packet")
        nonmatching_pkt = str(
            simple_udpv6_packet(eth_dst='ff:01:02:f3:04:05',
                                eth_src='ff:06:07:f8:09:0a',
                                ipv6_src='2001:0db8:85a2::0001',
                                ipv6_dst='2001:0db8:85a2::0001',
                                udp_sport=53,
                                udp_dport=55))
        self.dataplane.send(in_port, nonmatching_pkt)
        verify_no_packet(self, nonmatching_pkt, out_port)
        logging.info("Packet in not received for a non matching packet")