Example #1
0
        def get_available_phy_ports(self):
            """
            Adds interface speed and returns available physical ports

            Return:
                [{'card_id': u'9',
                'ip': u'10.36.78.53',
                'peer_port': u'Ethernet0',
                'port_id': u'1',
                'speed': 100000},
                {'card_id': u'9',
                'ip': u'10.36.78.53',
                'peer_port': u'Ethernet4',
                'port_id': u'2',
                'speed': 100000},
                {'card_id': u'9',
                'ip': u'10.36.78.53',
                'peer_port': u'Ethernet8',
                'port_id': u'3',
                'speed': 100000}]
            """
            fanout_devices = IxiaFanoutManager(self.fanout_graph_facts)
            fanout_devices.get_fanout_device_details(device_number=0)
            device_conn = self.conn_graph_facts['device_conn']
            available_phy_port = fanout_devices.get_ports()
            for intf in available_phy_port:
                peer_port = intf['peer_port']
                intf['speed'] = int(device_conn[peer_port]['speed'])
            return available_phy_port
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)
Example #3
0
def one_hundred_gbe(testbed, conn_graph_facts, fanout_graph_facts, serializer):

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

    # The number of ports should be at least two for this test
    available_phy_port = fanout_devices.get_ports()
    pytest_assert(
        len(available_phy_port) > 2,
        "Number of physical ports must be at least 2")

    configs = []
    for i in range(len(available_phy_port)):
        rx_id = i
        tx_id = (i + 1) % len(available_phy_port)

        phy_tx_port = get_location(available_phy_port[tx_id])
        phy_rx_port = get_location(available_phy_port[rx_id])

        #########################################################################
        # common L1 configuration
        #########################################################################

        tx = Port(name='Tx', location=phy_tx_port)
        rx = Port(name='Rx', location=phy_rx_port)

        pfc = Ieee8021qbb(pfc_delay=1,
                          pfc_class_0=0,
                          pfc_class_1=1,
                          pfc_class_2=2,
                          pfc_class_3=3,
                          pfc_class_4=4,
                          pfc_class_5=5,
                          pfc_class_6=6,
                          pfc_class_7=7)

        flow_ctl = FlowControl(choice=pfc)

        l1_oneHundredGbe = OneHundredGbe(link_training=True,
                                         ieee_media_defaults=False,
                                         auto_negotiate=False,
                                         speed='one_hundred_gbps',
                                         flow_control=flow_ctl,
                                         rs_fec=True)

        common_l1_config = Layer1(name='common L1 config',
                                  choice=l1_oneHundredGbe,
                                  port_names=[tx.name, rx.name])

        config = Config(ports=[tx, rx],
                        layer1=[common_l1_config],
                        options=Options(PortOptions(location_preemption=True)))

        configs.append(config)

    return configs
Example #4
0
        def create_config(self):

            fanout_devices = IxiaFanoutManager(self.fanout_graph_facts)
            fanout_devices.get_fanout_device_details(device_number=0)
            device_conn = self.conn_graph_facts['device_conn']

            # The number of ports should be at least three for this test
            available_phy_port = fanout_devices.get_ports()
            pytest_assert(
                len(available_phy_port) > 3,
                "Number of physical ports must be at least 3")

            # Get interface speed of peer port
            for intf in available_phy_port:
                peer_port = intf['peer_port']
                intf['speed'] = int(device_conn[peer_port]['speed'])

            config = ""

            port1_location = get_location(available_phy_port[0])
            port2_location = get_location(available_phy_port[1])
            port3_location = get_location(available_phy_port[2])

            port1 = Port(name='Port1', location=port1_location)
            port2 = Port(name='Port2', location=port2_location)
            port3 = Port(name='Port3', location=port3_location)

            pfc = Ieee8021qbb(pfc_delay=1,
                              pfc_class_0=0,
                              pfc_class_1=1,
                              pfc_class_2=2,
                              pfc_class_3=3,
                              pfc_class_4=4,
                              pfc_class_5=5,
                              pfc_class_6=6,
                              pfc_class_7=7)

            flow_ctl = FlowControl(choice=pfc)

            l1_oneHundredGbe = OneHundredGbe(link_training=True,
                                             ieee_media_defaults=False,
                                             auto_negotiate=False,
                                             speed='one_hundred_gbps',
                                             flow_control=flow_ctl,
                                             rs_fec=True)

            common_l1_config = Layer1(
                name='common L1 config',
                choice=l1_oneHundredGbe,
                port_names=[port1.name, port2.name, port3.name])

            config = Config(ports=[port1, port2, port3],
                            layer1=[common_l1_config],
                            options=Options(
                                PortOptions(location_preemption=True)))

            return config
Example #5
0
def port_bandwidth(testbed, conn_graph_facts, fanout_graph_facts,
                   bw_multiplier):

    fanout_devices = IxiaFanoutManager(fanout_graph_facts)
    fanout_devices.get_fanout_device_details(device_number=0)
    device_conn = conn_graph_facts['device_conn']
    available_phy_port = fanout_devices.get_ports()
    reference_peer = available_phy_port[0]['peer_port']
    reference_speed = int(device_conn[reference_peer]['speed'])

    for intf in available_phy_port:
        peer_port = intf['peer_port']
        intf['speed'] = int(device_conn[peer_port]['speed'])
        pytest_assert(intf['speed'] == reference_speed,
                      "speed of all the ports are not same")

    return reference_speed * bw_multiplier
Example #6
0
def testbed_config(conn_graph_facts, fanout_graph_facts, duthost):
    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)

    ixia_ports = ixia_fanout_list.get_ports(peer_device=duthost.hostname)
    pytest_require(len(ixia_ports) >= 2,
                   skip_message="The test requires at least two ports")

    rx_id = 0
    tx_id = 1

    rx_port_location = get_tgen_location(ixia_ports[rx_id])
    tx_port_location = get_tgen_location(ixia_ports[tx_id])

    rx_port_speed = int(ixia_ports[rx_id]['speed'])
    tx_port_speed = int(ixia_ports[tx_id]['speed'])
    pytest_require(rx_port_speed == tx_port_speed,
                   skip_message="Two ports should have the same speed")
    """ L1 configuration """
    rx_port = Port(name='Rx Port', location=rx_port_location)
    tx_port = Port(name='Tx Port', location=tx_port_location)

    pfc = Ieee8021qbb(pfc_delay=1,
                      pfc_class_0=0,
                      pfc_class_1=1,
                      pfc_class_2=2,
                      pfc_class_3=3,
                      pfc_class_4=4,
                      pfc_class_5=5,
                      pfc_class_6=6,
                      pfc_class_7=7)

    flow_ctl = FlowControl(choice=pfc)

    auto_negotiation = AutoNegotiation(link_training=True, rs_fec=True)

    l1_config = Layer1(name='L1 config',
                       speed='speed_%d_gbps' % (rx_port_speed / 1000),
                       auto_negotiate=False,
                       auto_negotiation=auto_negotiation,
                       flow_control=flow_ctl,
                       port_names=[tx_port.name, rx_port.name])

    config = Config(ports=[tx_port, rx_port],
                    layer1=[l1_config],
                    options=Options(PortOptions(location_preemption=True)))

    vlan_subnet = get_vlan_subnet(duthost)
    pytest_assert(vlan_subnet is not None,
                  "Fail to get Vlan subnet information")

    vlan_ip_addrs = get_addrs_in_subnet(vlan_subnet, 2)
    gw_addr = vlan_subnet.split('/')[0]
    prefix = vlan_subnet.split('/')[1]
    tx_port_ip = vlan_ip_addrs[0]
    rx_port_ip = vlan_ip_addrs[1]
    tx_gateway_ip = gw_addr
    rx_gateway_ip = gw_addr
    """ L2/L3 configuration """
    tx_ipv4 = Ipv4(name='Tx Ipv4',
                   address=Pattern(tx_port_ip),
                   prefix=Pattern(prefix),
                   gateway=Pattern(tx_gateway_ip),
                   ethernet=Ethernet(name='Tx Ethernet'))

    config.devices.append(
        Device(name='Tx Device',
               device_count=1,
               container_name=tx_port.name,
               choice=tx_ipv4))

    rx_ipv4 = Ipv4(name='Rx Ipv4',
                   address=Pattern(rx_port_ip),
                   prefix=Pattern(prefix),
                   gateway=Pattern(rx_gateway_ip),
                   ethernet=Ethernet(name='Rx Ethernet'))

    config.devices.append(
        Device(name='Rx Device',
               device_count=1,
               container_name=rx_port.name,
               choice=rx_ipv4))

    return config
Example #7
0
def ixia_testbed_config(conn_graph_facts, fanout_graph_facts, duthosts,
                        rand_one_dut_hostname):
    """
    Geenrate Tgen API config and port config information for the testbed

    Args:
        conn_graph_facts (pytest fixture)
        fanout_graph_facts (pytest fixture)
        duthosts (pytest fixture): list of DUTs
        rand_one_dut_hostname (pytest fixture): DUT hostname

    Returns:
        - config (obj): Tgen API config of the testbed
        - port_config_list (list): list of port configuration information
    """
    duthost = duthosts[rand_one_dut_hostname]
    """ Generate L1 config """
    ixia_fanout = get_peer_ixia_chassis(conn_data=conn_graph_facts,
                                        dut_hostname=duthost.hostname)

    pytest_assert(ixia_fanout is not None, 'Fail to get ixia_fanout')

    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)

    ixia_ports = ixia_fanout_list.get_ports(peer_device=duthost.hostname)

    ports = []
    port_names = []
    port_speed = None

    for i in range(len(ixia_ports)):
        port = Port(name='Port {}'.format(i),
                    location=get_tgen_location(ixia_ports[i]))

        ports.append(port)
        port_names.append(port.name)

        if port_speed is None:
            port_speed = int(ixia_ports[i]['speed'])

        pytest_assert(port_speed == int(ixia_ports[i]['speed']),
                      'Ports have different link speeds')

    pfc = Ieee8021qbb(pfc_delay=0,
                      pfc_class_0=0,
                      pfc_class_1=1,
                      pfc_class_2=2,
                      pfc_class_3=3,
                      pfc_class_4=4,
                      pfc_class_5=5,
                      pfc_class_6=6,
                      pfc_class_7=7)

    flow_ctl = FlowControl(choice=pfc)

    auto_negotiation = AutoNegotiation(link_training=True, rs_fec=True)

    speed_gbps = int(port_speed / 1000)

    l1_config = Layer1(name='L1 config',
                       speed='speed_{}_gbps'.format(speed_gbps),
                       auto_negotiate=False,
                       auto_negotiation=auto_negotiation,
                       ieee_media_defaults=False,
                       flow_control=flow_ctl,
                       port_names=port_names)

    config = Config(ports=ports,
                    layer1=[l1_config],
                    options=Options(PortOptions(location_preemption=True)))

    port_config_list = []

    config_result = __vlan_intf_config(config=config,
                                       port_config_list=port_config_list,
                                       duthost=duthost,
                                       ixia_ports=ixia_ports)
    pytest_assert(config_result is True, 'Fail to configure Vlan interfaces')

    config_result = __portchannel_intf_config(
        config=config,
        port_config_list=port_config_list,
        duthost=duthost,
        ixia_ports=ixia_ports)
    pytest_assert(config_result is True,
                  'Fail to configure portchannel interfaces')

    return config, port_config_list
Example #8
0
def ixia_testbed(conn_graph_facts, fanout_graph_facts, duthosts,
                 rand_one_dut_hostname):
    """
    L2/L3 Tgen API config for the T0 testbed

    Args:
        conn_graph_facts (pytest fixture)
        fanout_graph_facts (pytest fixture)
        duthosts (pytest fixture): list of DUTs
        rand_one_dut_hostname (pytest fixture): DUT hostname

    Returns:
        L2/L3 config for the T0 testbed
    """
    duthost = duthosts[rand_one_dut_hostname]
    ixia_fanout = get_peer_ixia_chassis(conn_data=conn_graph_facts,
                                        dut_hostname=duthost.hostname)

    if ixia_fanout is None:
        return None

    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)

    ixia_ports = ixia_fanout_list.get_ports(peer_device=duthost.hostname)

    ports = list()
    port_names = list()
    port_speed = None
    """ L1 config """
    for i in range(len(ixia_ports)):
        port = Port(name='Port {}'.format(i),
                    location=get_tgen_location(ixia_ports[i]))

        ports.append(port)
        port_names.append(port.name)

        if port_speed is None:
            port_speed = int(ixia_ports[i]['speed'])

        elif port_speed != int(ixia_ports[i]['speed']):
            """ All the ports should have the same bandwidth """
            return None

    pfc = Ieee8021qbb(pfc_delay=0,
                      pfc_class_0=0,
                      pfc_class_1=1,
                      pfc_class_2=2,
                      pfc_class_3=3,
                      pfc_class_4=4,
                      pfc_class_5=5,
                      pfc_class_6=6,
                      pfc_class_7=7)

    flow_ctl = FlowControl(choice=pfc)

    auto_negotiation = AutoNegotiation(link_training=True, rs_fec=True)

    l1_config = Layer1(name='L1 config',
                       speed='speed_%d_gbps' % int(port_speed / 1000),
                       auto_negotiate=False,
                       auto_negotiation=auto_negotiation,
                       ieee_media_defaults=False,
                       flow_control=flow_ctl,
                       port_names=port_names)

    config = Config(ports=ports,
                    layer1=[l1_config],
                    options=Options(PortOptions(location_preemption=True)))
    """ L2/L3 config """
    vlan_subnet = get_vlan_subnet(duthost)
    if vlan_subnet is None:
        return None

    vlan_ip_addrs = get_addrs_in_subnet(vlan_subnet, len(ixia_ports))
    gw_addr = vlan_subnet.split('/')[0]
    prefix = vlan_subnet.split('/')[1]

    for i in range(len(ixia_ports)):
        ip_stack = Ipv4(name='Ipv4 {}'.format(i),
                        address=Pattern(vlan_ip_addrs[i]),
                        prefix=Pattern(prefix),
                        gateway=Pattern(gw_addr),
                        ethernet=Ethernet(name='Ethernet {}'.format(i)))

        device = Device(name='Device {}'.format(i),
                        device_count=1,
                        container_name=port_names[i],
                        choice=ip_stack)

        config.devices.append(device)

    return config
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)
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)
Example #11
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)