示例#1
0
    def contruct_packet(self, port_number):
        packet = testutils.simple_eth_packet(
            pktlen=14,
            eth_dst='01:80:c2:00:00:02',
            eth_type=0x8809
        ) / (chr(0x01)*50)

        return packet
示例#2
0
    def contruct_packet(self, port_number):
        src_mac = self.my_mac[port_number]

        packet = testutils.simple_eth_packet(eth_dst='01:80:c2:00:00:0e',
                                             eth_src=src_mac,
                                             eth_type=0x88cc)

        return packet
示例#3
0
    def contruct_packet(self, port_number):
        src_mac = self.my_mac[port_number]

        packet = testutils.simple_eth_packet(pktlen=117,
                                             eth_dst='01:00:0c:cc:cc:cc',
                                             eth_src=src_mac,
                                             eth_type=0x0067)

        return packet
示例#4
0
def send_eth(ptfadapter, source_port, source_mac, dest_mac):
    """
    send ethernet packet
    :param ptfadapter: PTF adapter object
    :param source_port: source port
    :param source_mac: source MAC
    :param dest_mac: destination MAC
    :return:
    """
    pkt = testutils.simple_eth_packet(eth_dst=dest_mac,
                                      eth_src=source_mac,
                                      eth_type=DEFAULT_FDB_ETHERNET_TYPE)
    logger.debug('send packet source port id {} smac: {} dmac: {}'.format(
        source_port, source_mac, dest_mac))
    testutils.send(ptfadapter, source_port, pkt)
示例#5
0
def send_recv_eth(ptfadapter, source_port, source_mac, dest_port, dest_mac):
    """
    send ethernet packet and verify it on dest_port
    :param ptfadapter: PTF adapter object
    :param source_port: source port
    :param source_mac: source MAC
    :param dest_port: destination port to receive packet on
    :param dest_mac: destination MAC
    :return:
    """
    pkt = testutils.simple_eth_packet(eth_dst=dest_mac,
                                      eth_src=source_mac,
                                      eth_type=DEFAULT_FDB_ETHERNET_TYPE)
    logger.debug(
        'send packet src port {} smac: {} dmac: {} verifying on dst port {}'.
        format(source_port, source_mac, dest_mac, dest_port))
    testutils.send(ptfadapter, source_port, pkt)
    testutils.verify_packet_any_port(ptfadapter, pkt, [dest_port])