示例#1
0
    def runTest(self):
        match = ofp.match([ofp.oxm.eth_type(0x05ff)])

        snap_pkt = \
            scapy.Ether(dst='00:01:02:03:04:05', src='00:06:07:08:09:0a', type=48)/ \
            scapy.LLC(dsap=0xaa, ssap=0xaa, ctrl=0x03)/ \
            scapy.SNAP(OUI=0x000000, code=0x0800)/ \
            scapy.IP(src='192.168.0.1', dst='192.168.0.2', proto=6)/ \
            scapy.TCP(sport=1234, dport=80)

        llc_pkt = \
            scapy.Ether(dst='00:01:02:03:04:05', src='00:06:07:08:09:0a', type=17)/ \
            scapy.LLC(dsap=0xaa, ssap=0xab, ctrl=0x03)

        matching = {
            "llc": llc_pkt,
        }

        nonmatching = {
            "ipv4/tcp": simple_tcp_packet(),
            "ipv6/tcp": simple_tcpv6_packet(),
            "llc/snap": snap_pkt,
        }

        self.verify_match(match, matching, nonmatching)
示例#2
0
    def runTest(self):
        match = ofp.match([ofp.oxm.eth_type(0x0800)])

        snap_pkt = \
            scapy.Ether(dst='00:01:02:03:04:05', src='00:06:07:08:09:0a', type=48)/ \
            scapy.LLC(dsap=0xaa, ssap=0xaa, ctrl=0x03)/ \
            scapy.SNAP(OUI=0x000000, code=0x0800)/ \
            scapy.IP(src='192.168.0.1', dst='192.168.0.2', proto=6)/ \
            scapy.TCP(sport=1234, dport=80)

        llc_pkt = \
            scapy.Ether(dst='00:01:02:03:04:05', src='00:06:07:08:09:0a', type=17)/ \
            scapy.LLC(dsap=0xaa, ssap=0xab, ctrl=0x03)

        if (config["correction"]):
            matching = {
                "ipv4/tcp": simple_tcp_packet(),
                "ipv4/udp": simple_udp_packet(),
                "ipv4/icmp": simple_icmp_packet(),
                "llc/snap": snap_pkt,
            }
        else:
            matching = {
                "ipv4/tcp":
                simple_tcp_packet(),
                "ipv4/udp":
                simple_udp_packet(),
                "ipv4/icmp":
                simple_icmp_packet(),
                "vlan tagged":
                simple_tcp_packet(dl_vlan_enable=True, vlan_vid=2, vlan_pcp=3),
                "llc/snap":
                snap_pkt,
            }

        nonmatching = {
            "arp": simple_arp_packet(),
            "llc": llc_pkt,
            "ipv6/tcp": simple_tcpv6_packet(),
        }

        self.verify_match(match, matching, nonmatching)
    def runTest(self):
        logging.info("Running Testcase 60.50 for matching on Ethernet types")
        logging.info("---Running subtestcases")
        logging.info("Running for Ethernet type IPv4")
        match = ofp.match([ofp.oxm.eth_type(0x0800)])

        snap_pkt = \
            scapy.Ether(dst='00:01:02:03:04:05', src='00:06:07:08:09:0a', type=48)/ \
            scapy.LLC(dsap=0xaa, ssap=0xaa, ctrl=0x03)/ \
            scapy.SNAP(OUI=0x000000, code=0x0800)/ \
            scapy.IP(src='192.168.0.1', dst='192.168.0.2', proto=6)/ \
            scapy.TCP(sport=1234, dport=80)

        llc_pkt = \
            scapy.Ether(dst='00:01:02:03:04:05', src='00:06:07:08:09:0a', type=17)/ \
            scapy.LLC(dsap=0xaa, ssap=0xab, ctrl=0x03)

        matching = {
            "ipv4/tcp": simple_tcp_packet(),
            "ipv4/udp": simple_udp_packet(),
            "ipv4/icmp": simple_icmp_packet(),
            #"vlan tagged": simple_tcp_packet(dl_vlan_enable=True, vlan_vid=2, vlan_pcp=3),
            #"qinq/tcp": qinq_tcp_packet(),
        }

        nonmatching = {
            "arp": simple_arp_packet(),
            "llc": llc_pkt,
            "ipv6/tcp": simple_tcpv6_packet(),
        }

        self.verify_match(match, matching, nonmatching)

        logging.info("---Running subtestcases")
        logging.info("Running for Ethernet Type IPv6")
        match = ofp.match([ofp.oxm.eth_type(0x86dd)])

        matching = {
            "ipv6/tcp": simple_tcpv6_packet(),
            "ipv6/udp": simple_udpv6_packet(),
            "ipv6/icmp": simple_icmpv6_packet(),
            #"vlan tagged": simple_tcpv6_packet(dl_vlan_enable=True, vlan_vid=2, vlan_pcp=3),
        }

        nonmatching = {
            "ipv4/tcp": simple_tcp_packet(),
            "arp": simple_arp_packet(),
        }

        self.verify_match(match, matching, nonmatching)

        logging.info("---Running subtestcases")
        logging.info("Running for Ethernet Type ARP")
        match = ofp.match([ofp.oxm.eth_type(0x0806)])

        matching = {
            "arp": simple_arp_packet(),
            #"vlan tagged": simple_arp_packet(vlan_vid=2, vlan_pcp=3),
        }

        nonmatching = {
            "ipv4/tcp": simple_tcp_packet(),
            "ipv6/tcp": simple_tcpv6_packet(),
        }

        self.verify_match(match, matching, nonmatching)