Exemplo n.º 1
0
    def setUp(self):
        SwitchMLTest.setUp(self)

        # device ID: 0
        self.dev_id = 0

        # mac, ip, and udp port number that switch will respond to
        self.switch_mac = "06:00:00:00:00:01"
        self.switch_ip = "198.19.200.200"
        logger.info("Setting up job...")
        self.job = Job(gc, self.bfrt_info, self.switch_ip, self.switch_mac)

        self.worker_rank = 0
        self.job_size = 1
        self.worker_mac = "b8:59:9f:c6:bc:ba"
        self.worker_ip = "198.19.200.50"
        self.worker_rkey = 0x110046
        self.worker_packet_size = PacketSize.IBV_MTU_1024
        self.worker_message_size = 1024
        self.worker_qpn = 0x5ec9
        self.worker_initial_psn = 0x2f63

        self.worker_front_panel_port = 1
        self.worker_front_panel_lane = 0
        self.worker_dev_port = self.job.ports.get_dev_port(
            self.worker_front_panel_port, self.worker_front_panel_lane)
        self.job.port_add(
            self.worker_front_panel_port,
            self.worker_front_panel_lane,
            100,  # speed
            'none')  # fec
        self.job.mac_address_add(self.worker_mac, self.worker_front_panel_port,
                                 self.worker_front_panel_lane)

        #[1,0]<stdout>:Sending request <RDMAConnectRequest rank=0 size=1 mac=0xb8599fc6bcba ipv4=0xc613c832 rkey=0x110046 qpn=0x5ec9 psn=0x2f64>
        #worker_add_roce 0 1 b8:59:9f:c6:bc:ba 198.19.200.50 0x110046 256 256 0x5ec9 0x2f64

        self.job.worker_add_roce(self.worker_rank, self.job_size,
                                 self.worker_mac, self.worker_ip,
                                 self.worker_rkey, self.worker_packet_size,
                                 self.worker_message_size,
                                 [(self.worker_qpn, self.worker_initial_psn)])
Exemplo n.º 2
0
    def setUp(self):
        SwitchMLTest.setUp(self)

        # device ID: 0
        self.dev_id = 0

        # mac, ip, and udp port number that switch will respond to
        self.switch_mac = "06:00:00:00:00:01"
        self.switch_ip = "198.19.200.200"
        logger.info("Setting up job...")
        self.job = Job(gc, self.bfrt_info, self.switch_ip, self.switch_mac)

        self.worker_rank = 0
        self.job_size = 1
        self.worker_mac = "b8:59:9f:c6:bc:ba"
        self.worker_ip = "198.19.200.50"
        self.worker_rkey = 0x110046
        self.worker_packet_size = PacketSize.IBV_MTU_256
        self.worker_message_size = 256
        self.worker_qpn = 0x5ec9
        self.worker_initial_psn = 0x2f64

        self.worker_front_panel_port = 1
        self.worker_front_panel_lane = 0
        self.worker_dev_port = self.job.ports.get_dev_port(
            self.worker_front_panel_port, self.worker_front_panel_lane)
        logger.info("Adding port for test...")
        self.job.port_add(
            self.worker_front_panel_port,
            self.worker_front_panel_lane,
            100,  # speed
            'none')  # fec
        self.job.mac_address_add(self.worker_mac, self.worker_front_panel_port,
                                 self.worker_front_panel_lane)

        logger.info("Adding worker for test...")
        self.job.worker_add_roce(self.worker_rank, self.job_size,
                                 self.worker_mac, self.worker_ip,
                                 self.worker_rkey, self.worker_packet_size,
                                 self.worker_message_size,
                                 [(self.worker_qpn, self.worker_initial_psn)])
Exemplo n.º 3
0
    def setUp(self):
        SwitchMLTest.setUp(self)

        # device ID: 0
        self.dev_id = 0

        # mac, ip, and udp port number that switch will respond to
        self.switch_mac = "06:00:00:00:00:01"
        self.switch_ip = "198.19.200.200"
        self.roce_port = 4791
        self.switch_qpn = 12345
        self.switch_udp_port = 0xbee0
        self.switch_udp_port_mask = 0xfff0
        self.switch_mgid = 1234

        self.worker_mac = "b8:59:9f:c6:bc:ba"
        self.worker_ip = "198.19.200.50"
        self.worker_port = 55555

        self.broadcast_mac = "ff:ff:ff:ff:ff:ff"

        #self.arp_and_icmp = ARPandICMP(gc, self.bfrt_info, self.switch_mac, self.switch_ip)
        self.job = Job(gc, self.bfrt_info, self.switch_ip, self.switch_mac,
                       self.switch_udp_port, self.switch_udp_port_mask, [
                           Worker(mac=self.worker_mac,
                                  ip=self.worker_ip,
                                  udp_port=12345,
                                  front_panel_port=1,
                                  lane=0,
                                  speed=10,
                                  fec='none'),
                           Worker(mac="b8:83:03:74:01:8c",
                                  ip="198.19.200.50",
                                  udp_port=23456,
                                  front_panel_port=1,
                                  lane=1,
                                  speed=10,
                                  fec='none')
                       ])
Exemplo n.º 4
0
class SimpleTest(SwitchMLTest):
    """
    Just send a packet and expect a response
    """
    def setUp(self):
        SwitchMLTest.setUp(self)

        # device ID: 0
        self.dev_id = 0

        # mac, ip, and udp port number that switch will respond to
        self.switch_mac = "06:00:00:00:00:01"
        self.switch_ip = "198.19.200.200"
        logger.info("Setting up job...")
        self.job = Job(gc, self.bfrt_info, self.switch_ip, self.switch_mac)

        self.worker_rank = 0
        self.job_size = 1
        self.worker_mac = "b8:59:9f:c6:bc:ba"
        self.worker_ip = "198.19.200.50"
        self.worker_rkey = 0x110046
        self.worker_packet_size = PacketSize.IBV_MTU_256
        self.worker_message_size = 256
        self.worker_qpn = 0x5ec9
        self.worker_initial_psn = 0x2f64

        self.worker_front_panel_port = 1
        self.worker_front_panel_lane = 0
        self.worker_dev_port = self.job.ports.get_dev_port(
            self.worker_front_panel_port, self.worker_front_panel_lane)
        logger.info("Adding port for test...")
        self.job.port_add(
            self.worker_front_panel_port,
            self.worker_front_panel_lane,
            100,  # speed
            'none')  # fec
        self.job.mac_address_add(self.worker_mac, self.worker_front_panel_port,
                                 self.worker_front_panel_lane)

        logger.info("Adding worker for test...")
        self.job.worker_add_roce(self.worker_rank, self.job_size,
                                 self.worker_mac, self.worker_ip,
                                 self.worker_rkey, self.worker_packet_size,
                                 self.worker_message_size,
                                 [(self.worker_qpn, self.worker_initial_psn)])

    def runTest(self):
        packet_to_send = (
            Ether(dst=self.switch_mac, src=self.worker_mac) /
            IP(dst=self.switch_ip, src=self.worker_ip, tos=2, flags="DF") /
            UDP(dport=4791, sport=58543, chksum=0) /
            IB_BTH(opcode=rdma_opcode_s2n['UC_RDMA_WRITE_ONLY_IMMEDIATE'],
                   dst_qp=0x800000,
                   psn=0) / IB_RETH(addr=0x0000100000000000, rkey=0, len=256) /
            IB_IMM(imm=0x01020304) / IB_Payload(data=[
                287454020, 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13,
                -14, 15, -16, 17, -18, 19, -20, 21, -22, 23, -24, 25, -26, 27,
                -28, 29, -30, 31, -32, 33, -34, 35, -36, 37, -38, 39, -40, 41,
                -42, 43, -44, 45, -46, 47, -48, 49, -50, 51, -52, 53, -54, 55,
                -56, 57, -58, 59, -60, 61, -62, 63
            ]) / IB_ICRC(icrc=0x12345678))
        del packet_to_send.chksum
        packet_to_send = packet_to_send.__class__(bytes(packet_to_send))

        expected_packet = (
            Ether(dst=self.worker_mac, src=self.switch_mac) /
            IP(dst=self.worker_ip, src=self.switch_ip, tos=2, flags="DF") /
            UDP(dport=4791, sport=0x8000,
                chksum=0) /  # sport is worker rank & 0x8000
            IB_BTH(opcode=rdma_opcode_s2n['UC_RDMA_WRITE_ONLY_IMMEDIATE'],
                   dst_qp=self.worker_qpn,
                   psn=self.worker_initial_psn) /
            IB_RETH(addr=0x0000100000000000, rkey=self.worker_rkey, len=256) /
            IB_IMM(imm=0x12345678) / IB_Payload(data=[
                287454020,
                1,
                -2,
                3,
                -4,
                5,
                -6,
                7,
                -8,
                9,
                -10,
                11,
                -12,
                13,
                -14,
                15,
                -16,
                17,
                -18,
                19,
                -20,
                21,
                -22,
                23,
                -24,
                25,
                -26,
                27,
                -28,
                29,
                -30,
                31,
                -32,
                33,
                -34,
                35,
                -36,
                37,
                -38,
                39,
                -40,
                41,
                -42,
                43,
                -44,
                45,
                -46,
                47,  # correct value
                -48,
                49,
                -50,
                51,
                -52,
                53,
                -54,
                55,
                -56,
                57,
                -58,
                59,
                -60,
                61,
                -62,
                63
            ]) / IB_ICRC(icrc=0x12345678))
        del expected_packet.chksum
        expected_packet = expected_packet.__class__(bytes(expected_packet))

        print("Sending packet:")
        #packet_to_send.show()
        send_packet(self, self.worker_dev_port, packet_to_send)

        print("Expecting packet:")
        #expected_packet.show()

        print("Waiting for response.")
        verify_packet(self, expected_packet, self.worker_dev_port)
Exemplo n.º 5
0
    def setUp(self):
        SwitchMLTest.setUp(self)

        # device ID: 0
        self.dev_id = 0

        # mac, ip, and udp port number that switch will respond to
        self.switch_mac = "06:00:00:00:00:01"
        self.switch_ip = "198.19.200.200"
        self.switch_udp_port = 0xbee0
        self.switch_udp_port_mask = 0xfff0
        self.switch_mgid = 1234

        self.workers = [
            Worker(mac="b8:83:03:73:a6:a0",
                   ip="198.19.200.49",
                   udp_port=12345,
                   front_panel_port=1,
                   lane=0,
                   speed=10,
                   fec='none'),
            Worker(mac="b8:83:03:74:01:8c",
                   ip="198.19.200.50",
                   udp_port=12345,
                   front_panel_port=1,
                   lane=1,
                   speed=10,
                   fec='none'),
            Worker(mac="b8:83:03:74:02:9a",
                   ip="198.19.200.48",
                   udp_port=12345,
                   front_panel_port=1,
                   lane=2,
                   speed=10,
                   fec='none')
        ]

        self.job = Job(gc, self.bfrt_info, self.switch_ip, self.switch_mac,
                       self.switch_udp_port, self.switch_udp_port_mask,
                       self.workers)

        # make packets for set 0
        ((self.pktW0S0, self.expected_pktW0S0), (self.pktW1S0,
                                                 self.expected_pktW1S0),
         (self.pktW2S0, self.expected_pktW2S0)) = self.make_switchml_packets(
             self.workers, 0x0000, 1, self.switch_udp_port)

        # make packets for set 1
        ((self.pktW0S1, self.expected_pktW0S1), (self.pktW1S1,
                                                 self.expected_pktW1S1),
         (self.pktW2S1, self.expected_pktW2S1)) = self.make_switchml_packets(
             self.workers, 0x8000, 1, self.switch_udp_port)

        # make additional packets with different values to verify slot reuse
        ((self.pktW0S0x3, self.expected_pktW0S0x3), (self.pktW1S0x3,
                                                     self.expected_pktW1S0x3),
         (self.pktW2S0x3,
          self.expected_pktW2S0x3)) = self.make_switchml_packets(
              self.workers, 0x0000, 3, self.switch_udp_port)
        ((self.pktW0S1x3, self.expected_pktW0S1x3), (self.pktW1S1x3,
                                                     self.expected_pktW1S1x3),
         (self.pktW2S1x3,
          self.expected_pktW2S1x3)) = self.make_switchml_packets(
              self.workers, 0x8000, 3, self.switch_udp_port)
Exemplo n.º 6
0
class SingleWorkerSinglePacket(SwitchMLTest):
    """
    Recreate data corruption for bug report
    """
    def setUp(self):
        SwitchMLTest.setUp(self)

        # device ID: 0
        self.dev_id = 0

        # mac, ip, and udp port number that switch will respond to
        self.switch_mac = "06:00:00:00:00:01"
        self.switch_ip = "198.19.200.200"
        logger.info("Setting up job...")
        self.job = Job(gc, self.bfrt_info, self.switch_ip, self.switch_mac)

        self.worker_rank = 0
        self.job_size = 1
        self.worker_mac = "b8:59:9f:c6:bc:ba"
        self.worker_ip = "198.19.200.50"
        self.worker_rkey = 0x110046
        self.worker_packet_size = PacketSize.IBV_MTU_1024
        self.worker_message_size = 1024
        self.worker_qpn = 0x5ec9
        self.worker_initial_psn = 0x2f63

        self.worker_front_panel_port = 1
        self.worker_front_panel_lane = 0
        self.worker_dev_port = self.job.ports.get_dev_port(
            self.worker_front_panel_port, self.worker_front_panel_lane)
        self.job.port_add(
            self.worker_front_panel_port,
            self.worker_front_panel_lane,
            100,  # speed
            'none')  # fec
        self.job.mac_address_add(self.worker_mac, self.worker_front_panel_port,
                                 self.worker_front_panel_lane)

        #[1,0]<stdout>:Sending request <RDMAConnectRequest rank=0 size=1 mac=0xb8599fc6bcba ipv4=0xc613c832 rkey=0x110046 qpn=0x5ec9 psn=0x2f64>
        #worker_add_roce 0 1 b8:59:9f:c6:bc:ba 198.19.200.50 0x110046 256 256 0x5ec9 0x2f64

        self.job.worker_add_roce(self.worker_rank, self.job_size,
                                 self.worker_mac, self.worker_ip,
                                 self.worker_rkey, self.worker_packet_size,
                                 self.worker_message_size,
                                 [(self.worker_qpn, self.worker_initial_psn)])

    def runTest(self):
        packet_to_send = (
            Ether(dst=self.switch_mac, src=self.worker_mac) /
            IP(dst=self.switch_ip, src=self.worker_ip, tos=2, flags="DF") /
            UDP(dport=4791, sport=58543, chksum=0) /
            IB_BTH(opcode=rdma_opcode_s2n['UC_RDMA_WRITE_ONLY_IMMEDIATE'],
                   dst_qp=0x800000,
                   psn=0) /
            IB_RETH(addr=0x0000100000000000, rkey=0, len=1024) /
            IB_IMM(imm=0x01020304) /
            ##IB_Payload(data=[x << 24 + x << 16 + x << 8 + x for x in range(256)]) /
            IB_Payload(data=[x
                             for x in range(256)]) / IB_ICRC(icrc=0x12345678))

        # compute checksums, etc.
        del packet_to_send.chksum
        packet_to_send = packet_to_send.__class__(bytes(packet_to_send))

        expected_packet = (
            Ether(dst=self.worker_mac, src=self.switch_mac) /
            IP(dst=self.worker_ip, src=self.switch_ip, tos=2, flags="DF") /
            UDP(dport=4791, sport=0x8000,
                chksum=0) /  # sport is worker rank & 0x8000
            IB_BTH(opcode=rdma_opcode_s2n['UC_RDMA_WRITE_ONLY_IMMEDIATE'],
                   dst_qp=self.worker_qpn,
                   psn=self.worker_initial_psn) /
            IB_RETH(addr=0x0000100000000000, rkey=self.worker_rkey, len=1024) /
            IB_IMM(imm=0x12345678) /
            ##IB_Payload(data=[x << 24 + x << 16 + x << 8 + x for x in range(256)]) /
            IB_Payload(data=[x
                             for x in range(256)]) / IB_ICRC(icrc=0x12345678))

        # compute checksums, etc.
        del expected_packet.chksum
        expected_packet = expected_packet.__class__(bytes(expected_packet))

        print("Sending packet:")
        #packet_to_send.show()
        send_packet(self, self.worker_dev_port, packet_to_send)

        print("Expecting packet:")
        #expected_packet.show()

        print("Waiting for response.")
        verify_packet(self, expected_packet, self.worker_dev_port)
Exemplo n.º 7
0
    def setUp(self):
        SwitchMLTest.setUp(self)

        # device ID: 0
        self.dev_id = 0

        # mac, ip, and udp port number that switch will respond to
        self.switch_mac = "06:00:00:00:00:01"
        self.switch_ip = "198.19.200.200"
        self.switch_udp_port = 0xbee0
        self.switch_udp_port_mask = 0xfff0

        self.all_workers = [
            # Two UDP workers
            Worker(mac="b8:83:03:73:a6:a0",
                   ip="198.19.200.49",
                   udp_port=12345,
                   front_panel_port=1,
                   lane=0,
                   speed=10,
                   fec='none'),
            Worker(mac="b8:83:03:74:01:8c",
                   ip="198.19.200.50",
                   udp_port=12345,
                   front_panel_port=1,
                   lane=1,
                   speed=10,
                   fec='none'),
            # A non-SwitchML worker
            Worker(mac="b8:83:03:74:01:c4",
                   ip="198.19.200.48",
                   front_panel_port=1,
                   lane=2,
                   speed=10,
                   fec='none'),
        ]
        self.switchml_workers = [
            w for w in self.all_workers
            if w.worker_type is not WorkerType.FORWARD_ONLY
        ]

        self.job = Job(gc, self.bfrt_info, self.switch_ip, self.switch_mac,
                       self.switch_udp_port, self.switch_udp_port_mask,
                       self.all_workers)

        # make packets for set 0
        ((self.pktW0S0, self.expected_pktW0S0),
         (self.pktW1S0, self.expected_pktW1S0)) = self.make_switchml_packets(
             self.switchml_workers, 0x0000, 1, self.switch_udp_port)

        # make packets for set 1
        ((self.pktW0S1, self.expected_pktW0S1),
         (self.pktW1S1, self.expected_pktW1S1)) = self.make_switchml_packets(
             self.switchml_workers, 0x8000, 1, self.switch_udp_port)

        # make additional packets with different values to verify slot reuse
        ((self.pktW0S0x3, self.expected_pktW0S0x3),
         (self.pktW1S0x3,
          self.expected_pktW1S0x3)) = self.make_switchml_packets(
              self.switchml_workers, 0x0000, 3, self.switch_udp_port)
        ((self.pktW0S1x3, self.expected_pktW0S1x3),
         (self.pktW1S1x3,
          self.expected_pktW1S1x3)) = self.make_switchml_packets(
              self.switchml_workers, 0x8000, 3, self.switch_udp_port)

        # make packets for the next slot with different ports
        ((self.pktW0S0p1, self.expected_pktW0S0p1),
         (self.pktW1S0p1,
          self.expected_pktW1S0p1)) = self.make_switchml_packets(
              self.switchml_workers, 0x0001, 1, self.switch_udp_port + 1)
        ((self.pktW0S1p1, self.expected_pktW0S1p1),
         (self.pktW1S1p1,
          self.expected_pktW1S1p1)) = self.make_switchml_packets(
              self.switchml_workers, 0x8001, 1, self.switch_udp_port + 1)
        self.pktW0S0p1['UDP'].sport = self.pktW0S0p1['UDP'].sport + 1
        self.pktW1S0p1['UDP'].sport = self.pktW1S0p1['UDP'].sport + 1
        self.pktW0S1p1['UDP'].sport = self.pktW0S1p1['UDP'].sport + 1
        self.pktW1S1p1['UDP'].sport = self.pktW1S1p1['UDP'].sport + 1
        self.expected_pktW0S0p1[
            'UDP'].dport = self.expected_pktW0S0p1['UDP'].dport + 1
        self.expected_pktW1S0p1[
            'UDP'].dport = self.expected_pktW1S0p1['UDP'].dport + 1
        self.expected_pktW0S1p1[
            'UDP'].dport = self.expected_pktW0S1p1['UDP'].dport + 1
        self.expected_pktW1S1p1[
            'UDP'].dport = self.expected_pktW1S1p1['UDP'].dport + 1