Esempio n. 1
0
def test_testbed(testbed, conn_graph_facts, duthost, fanout_graph_facts,
                 ixia_api_server_session, fanouthosts):

    logger.info("Connection Graph Facts = %s " % (conn_graph_facts))
    logger.info("Fanout Graph facts = %s" % (fanout_graph_facts))
    logger.info("DUT hostname = %s" % (duthost.hostname))

    mg_facts = duthost.minigraph_facts(host=duthost.hostname)
    gateway_ip = mg_facts['ansible_facts']['minigraph_vlan_interfaces'][0][
        'addr']
    start_interface_ip = increment_ip_address(gateway_ip)

    ixiaFanoutHostList = IxiaFanoutManager(fanout_graph_facts)
    ixiaFanoutHostList.get_fanout_device_details(device_number=0)

    session = ixia_api_server_session

    logger.info("Configuring ports.")
    port_list = configure_ports(session=session,
                                port_list=ixiaFanoutHostList.get_ports())

    logger.info("Creating topology.")
    topology = create_topology(session=session,
                               ports=port_list,
                               name="Sender",
                               ip_start=start_interface_ip,
                               ip_incr_step='0.0.0.1',
                               gw_start=gateway_ip,
                               gw_incr_step='0.0.0.0')

    logger.info("Starting all protocols")
    start_protocols(session)

    # Create a traffic item
    logger.info("Configuring traffic.")
    traffic_item = create_ip_traffic_item(session=session,
                                          src_start_port=1,
                                          src_port_count=1,
                                          src_first_route_index=1,
                                          src_route_count=1,
                                          dst_start_port=2,
                                          dst_port_count=3,
                                          dst_first_route_index=1,
                                          dst_route_count=1)

    # Generate, apply and start traffic.
    start_traffic(session)

    logger.info("run traffic for 5 seconds")
    time.sleep(5)

    # Fetch statistics.
    stats = get_traffic_statistics(session=session,
                                   stat_view_name='Traffic Item Statistics')
    logger.info(stats)

    stop_traffic(session)
    stop_protocols(session)
def test_pfc_pause_single_lossless_priority(conn_graph_facts,
                                            lossless_prio_dscp_map, duthost,
                                            ixia_dev, ixia_api_server_session,
                                            fanout_graph_facts):
    """
    RDMA PFC - Pauses on single lossless priority.
    1. On SONiC DUT enable PFC on any priorities Pi. (0 <= i <= 7).
    2. Disable the PFC watchdog on the SONiC DUT.
    3. On the Ixia Tx port create two flows - a) 'Test Data Traffic' and
       b) 'Background Data traffic'.
    4. The flow 'Test Data Traffic' can assume one of the lossless priority
       values Pi.
    5. The flow 'Background Data Traffic' can assume all the priority values
       which are not in 'Test Data Traffic'. For example if the priority of
       'Test Data Traffic' is 3, the priorities of the 'Background Data
       Traffic' should be 0, 1, 2, 4, 5, 6, 7.
    6. From Rx port send pause frames on priority Pi. Such that priority of
       'Test Data Traffic' at Tx end == Pause Priority at Rx end. That is,
       send pause frames on priority Pi.
    7. Start 'Test Data Traffic' and 'Background Data Traffic'.
    8. Repeat step 6 and 7 for each lossless priorities.
    9. Expected result -
       a. No 'Test Data Traffic' will flow. Since priority of
          'Test Data Traffic' equals to the priority of PFC pause frames.
       b. 'Background Data Traffic' will always flow.

    Note: Test and background traffic should be started after PFC pause storm.

    """
    port_list = list()
    fanout_devices = IxiaFanoutManager(fanout_graph_facts)
    fanout_devices.get_fanout_device_details(device_number=0)
    device_conn = conn_graph_facts['device_conn'][duthost.hostname]

    for intf in fanout_devices.get_ports():
        peer_port = intf['peer_port']
        intf['speed'] = int(device_conn[peer_port]['speed'])
        port_list.append(intf)

    # The topology should have at least two interfaces.
    pytest_assert(
        len(device_conn) >= 2,
        "The topology should have at least two interfaces")

    # Test pausing each lossless priority individually.
    session = ixia_api_server_session
    for prio in lossless_prio_dscp_map:
        for i in range(len(port_list)):
            for send_pause_frame in [True, False]:
                paused = send_pause_frame
                vports = configure_ports(session, port_list)

                rx_id = i
                tx_id = (i + 1) % len(port_list)

                rx_port = vports[rx_id]
                tx_port = vports[tx_id]
                rx_port_bw = port_list[rx_id]['speed']
                tx_port_bw = port_list[tx_id]['speed']

                pytest_assert(rx_port_bw == tx_port_bw)

                # All the DSCP values mapped to this priority.
                test_dscp_list = lossless_prio_dscp_map[prio]
                # The other DSCP values.
                bg_dscp_list = [
                    x for x in range(64) if x not in test_dscp_list
                ]

                exp_dur = 2

                run_pfc_exp(session=session,
                            dut=duthost,
                            tx_port=tx_port,
                            rx_port=rx_port,
                            port_bw=tx_port_bw,
                            test_prio_list=[prio],
                            test_dscp_list=test_dscp_list,
                            bg_dscp_list=bg_dscp_list,
                            exp_dur=exp_dur,
                            test_traffic_pause_expected=paused,
                            send_pause_frame=send_pause_frame)

                clean_configuration(session=session)
def test_pfc_pause_multi_lossless_priorities(conn_graph_facts,
                                             lossless_prio_dscp_map, duthost,
                                             ixia_dev, ixia_api_server_session,
                                             fanout_graph_facts):
    """
    RDMA PFC - Pauses on multiple lossless priorities.
    1. On SONiC DUT enable PFC on several priorities e.g priority 3 and 4.
    2. Disable the PFC watchdog on the SONiC DUT.
    3. On the Ixia Tx port create two flows - a) 'Test Data Traffic' and
       b) 'Background Data traffic'.
    4. Configure 'Test Data Traffic' such that it contains traffic items
       with all lossless priorities.
    5. Configure 'Background Data Traffic' it contains traffic items with
       all lossy priorities.
    6. From Rx port send pause frames on all lossless priorities. Then
       start 'Test Data Traffic' and 'Background Data Traffic'.
    7. When pause frames are started 'Test Data Traffic' will stop;
       and when pause frames are stopped 'Test Data Traffic' will start.
    8. 'Background Data Traffic' will always flow.
    9. Repeat the steps 4 to 8 on all ports.

    """
    port_list = list()
    fanout_devices = IxiaFanoutManager(fanout_graph_facts)
    fanout_devices.get_fanout_device_details(device_number=0)
    device_conn = conn_graph_facts['device_conn']

    for intf in fanout_devices.get_ports():
        peer_port = intf['peer_port']
        intf['speed'] = int(device_conn[peer_port]['speed'])
        port_list.append(intf)

    # The topology should have at least two interfaces.
    pytest_assert(
        len(device_conn) >= 2,
        "The topology should have at least two interfaces")

    session = ixia_api_server_session
    for i in range(len(port_list)):
        for send_pause_frame in [True, False]:
            paused = send_pause_frame
            vports = configure_ports(session, port_list)

            rx_id = i
            tx_id = (i + 1) % len(port_list)

            rx_port = vports[rx_id]
            tx_port = vports[tx_id]
            rx_port_bw = port_list[rx_id]['speed']
            tx_port_bw = port_list[tx_id]['speed']
            pytest_assert(rx_port_bw == tx_port_bw)

            test_dscp_list = []
            test_priority_list = [prio for prio in lossless_prio_dscp_map]
            for prio in lossless_prio_dscp_map:
                test_dscp_list += lossless_prio_dscp_map[prio]

            bg_dscp_list = [x for x in range(64) if x not in test_dscp_list]
            exp_dur = 2

            run_pfc_exp(session=session,
                        dut=duthost,
                        tx_port=tx_port,
                        rx_port=rx_port,
                        port_bw=tx_port_bw,
                        test_prio_list=test_priority_list,
                        test_dscp_list=test_dscp_list,
                        bg_dscp_list=bg_dscp_list,
                        exp_dur=exp_dur,
                        test_traffic_pause_expected=paused,
                        send_pause_frame=send_pause_frame)

            clean_configuration(session=session)
Esempio n. 4
0
def test_testbed(conn_graph_facts, duthosts, rand_one_dut_hostname,
                 fanout_graph_facts, ixia_api_server_session, fanouthosts):
    duthost = duthosts[rand_one_dut_hostname]

    logger.info("Connection Graph Facts = %s " % (conn_graph_facts))
    logger.info("Fanout Graph facts = %s" % (fanout_graph_facts))
    logger.info("DUT hostname = %s" % (duthost.hostname))

    ixia_fanout = get_peer_ixia_chassis(conn_data=conn_graph_facts,
                                        dut_hostname=duthost.hostname)

    pytest_require(ixia_fanout is not None,
                   skip_message="Cannot find the peer IXIA chassis")

    ixia_fanout_id = list(fanout_graph_facts.keys()).index(ixia_fanout)
    ixia_fanout_list = IxiaFanoutManager(fanout_graph_facts)
    ixia_fanout_list.get_fanout_device_details(device_number=ixia_fanout_id)

    logger.info("Configuring ports.")
    port_list = ixia_fanout_list.get_ports(peer_device=duthost.hostname)
    session = ixia_api_server_session
    vports = configure_ports(session=session, port_list=port_list)

    subnet = get_vlan_subnet(duthost)
    gw = subnet.split('/')[0]
    ip_list = get_addrs_in_subnet(subnet=subnet, number_of_ip=len(vports))

    logger.info("Creating topology.")
    topo_receiver = create_topology(session=session,
                                    name="Receiver",
                                    port_list=[vports[0]],
                                    ip_list=[ip_list[0]],
                                    gw_list=[gw])

    topo_sender = create_topology(session=session,
                                  name="Sender",
                                  port_list=vports[1:],
                                  ip_list=ip_list[1:],
                                  gw_list=[gw] * len(vports[1:]))

    logger.info("Starting all protocols")
    start_protocols(session)

    # Create a traffic item
    logger.info("Configuring traffic.")
    traffic_item = create_ipv4_traffic(session=session,
                                       name="Test Data Traffic",
                                       source=topo_sender,
                                       destination=topo_receiver)

    # Generate, apply and start traffic.
    start_traffic(session)

    logger.info("run traffic for 5 seconds")
    time.sleep(5)

    # Fetch per-flow statistics.
    stats = dump_flow_statistics(session=session)

    logger.info(stats)

    stop_traffic(session)
    stop_protocols(session)