コード例 #1
0
ファイル: pfc.py プロジェクト: Rangababu-R/SONiC-Test
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
コード例 #2
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
コード例 #3
0
        def create_config(self, phy_ports):
            """
            Creates config for traffic generator with given physical ports

            :param phy_ports: Physical ports config creation on traffic generator
            """
            ports = []
            one_hundred_gbe_ports = []

            for index, phy_port in enumerate(phy_ports, 1):
                port_location = get_location(phy_port)
                port = Port(name='Port' + str(index), location=port_location)
                if (phy_port['speed'] / 1000 == 100):
                    one_hundred_gbe_ports.append(port.name)
                else:
                    pytest_assert(
                        False,
                        "This test supports only 100gbe speed as of now, need to enhance the script based on requirement"
                    )

                ports.append(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)

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

            layer1 = Layer1(name='Layer1 settings',
                            choice=one_hundred_gbe,
                            port_names=one_hundred_gbe_ports)

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

            return config
コード例 #4
0
def port_configs():
    """This fixture demonstrates setting up configurations that consist 
    only of port, layer1 and device settings.
    """
    from abstract_open_traffic_generator.config import Config
    from abstract_open_traffic_generator.device import Device, Ethernet, Ipv4
    from abstract_open_traffic_generator.layer1 import FlowControl, Ieee8021qbb, Layer1, OneHundredGbe
    from abstract_open_traffic_generator.port import Port

    port1 = Port(name='Port 1')
    port2 = Port(name='Port 2')
    configs = []
    for ports in [[port1, port2], [copy.deepcopy(port2),
                                   copy.deepcopy(port1)]]:
        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)
        one_hundred_gbe = OneHundredGbe(link_training=True,
                                        ieee_media_defaults=False,
                                        auto_negotiate=False,
                                        speed='one_hundred_gbps',
                                        flow_control=flow_ctl,
                                        rs_fec=True)
        layer1 = Layer1(name='Layer1 settings',
                        choice=one_hundred_gbe,
                        port_names=[ports[0].name, ports[1].name])
        ports[0].devices.append(
            Device('Tx Devices',
                   choice=Ipv4(name='Tx Ipv4',
                               ethernet=Ethernet(name='Tx Ethernet'))))
        ports[1].devices.append(
            Device('Rx Devices',
                   choice=Ipv4(name='Rx Ipv4',
                               ethernet=Ethernet(name='Rx Ethernet'))))
        config = Config(ports=ports, layer1=[layer1])
        configs.append(config)
    return configs
コード例 #5
0
def configure_pfc_lossy(api,
                        phy_tx_port,
                        phy_rx_port,
                        port_speed,
                        tx_port_ip='0.0.0.0',
                        rx_port_ip='0.0.0.0',
                        tx_gateway_ip='0.0.0.0',
                        rx_gateway_ip='0.0.0.',
                        tx_ip_incr='0.0.0.0',
                        rx_ip_incr='0.0.0.0',
                        tx_gateway_incr='0.0.0.0',
                        rx_gateway_incr='0.0.0.0',
                        configure_pause_frame=True):

    api.set_config(None)

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

    #########################################################################
    # common L1 configuration
    #########################################################################
    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',
                                     rs_fec=True,
                                     flow_control=flow_ctl)

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

    ###########################################################################
    # Create TX stack configuration
    ###########################################################################
    tx_ipv4 = Ipv4(name='Tx Ipv4',
                   address=Pattern(tx_port_ip),
                   prefix=Pattern('24'),
                   gateway=Pattern(tx_gateway_ip),
                   ethernet=Ethernet(name='Tx Ethernet'))

    tx.devices.append(Device(name='Tx Device', device_count=1, choice=tx_ipv4))

    ###########################################################################
    # Create RX stack configuration
    ###########################################################################
    rx_ipv4 = Ipv4(name='Rx Ipv4',
                   address=Pattern(rx_port_ip),
                   prefix=Pattern('24'),
                   gateway=Pattern(rx_gateway_ip),
                   ethernet=Ethernet(name='Rx Ethernet'))

    rx.devices.append(Device(name='Rx Device', device_count=1, choice=rx_ipv4))

    ###########################################################################
    # Traffic configuration Test data
    ###########################################################################
    data_endpoint = DeviceTxRx(tx_device_names=[tx.devices[0].name],
                               rx_device_names=[rx.devices[0].name])

    test_dscp = Priority(
        Dscp(phb=PATTERN(choice=["0", "1", "2", "5", "6", "7"])))

    test_flow = Flow(name='Test Data',
                     tx_rx=TxRx(data_endpoint),
                     packet=[
                         Header(choice=ETHERNET()),
                         Header(choice=IPV4(priority=test_dscp))
                     ],
                     size=Size(128),
                     rate=Rate('line', 50),
                     duration=Duration(
                         FixedPackets(packets=0,
                                      delay=1000000000,
                                      delay_unit='nanoseconds')))

    ###########################################################################
    # Traffic configuration Background data
    ###########################################################################
    background_dscp = Priority(Dscp(phb=PATTERN(choice=["3", "4"])))
    background_flow = Flow(name='Background Data',
                           tx_rx=TxRx(data_endpoint),
                           packet=[
                               Header(choice=ETHERNET()),
                               Header(choice=IPV4(priority=background_dscp))
                           ],
                           size=Size(128),
                           rate=Rate('line', 50),
                           duration=Duration(
                               FixedPackets(packets=0,
                                            delay=1000000000,
                                            delay_unit='nanoseconds')))

    ###########################################################################
    # Traffic configuration Pause
    ###########################################################################
    if (configure_pause_frame):
        pause_endpoint = PortTxRx(tx_port_name=rx.name)
        pause = Header(
            PfcPause(
                dst=PATTERN(choice='01:80:C2:00:00:01'),
                src=PATTERN(choice='00:00:fa:ce:fa:ce'),
                class_enable_vector=PATTERN(choice='E7'),
                pause_class_0=PATTERN(choice='ffff'),
                pause_class_1=PATTERN(choice='ffff'),
                pause_class_2=PATTERN(choice='ffff'),
                pause_class_3=PATTERN(choice='0'),
                pause_class_4=PATTERN(choice='0'),
                pause_class_5=PATTERN(choice='ffff'),
                pause_class_6=PATTERN(choice='ffff'),
                pause_class_7=PATTERN(choice='ffff'),
            ))

        pause_flow = Flow(name='Pause Storm',
                          tx_rx=TxRx(pause_endpoint),
                          packet=[pause],
                          size=Size(64),
                          rate=Rate('line', value=100),
                          duration=Duration(
                              FixedPackets(packets=0,
                                           delay=0,
                                           delay_unit='nanoseconds')))
        flows = [test_flow, background_flow, pause_flow]
    else:
        flows = [test_flow, background_flow]

    ###########################################################################
    # Set config
    ###########################################################################
    config = Config(ports=[tx, rx], layer1=[common_l1_config], flows=flows)

    api.set_config(config)
    return config
コード例 #6
0
ファイル: test_ecn_config.py プロジェクト: ByReaL/ixnetwork
def configure_pfc_lossy(api,
                        phy_tx_port,
                        phy_rx_port,
                        port_speed,
                        tx_port_ip='0.0.0.0',
                        rx_port_ip='0.0.0.0',
                        tx_gateway_ip='0.0.0.0',
                        rx_gateway_ip='0.0.0.',
                        tx_ip_incr='0.0.0.0',
                        rx_ip_incr='0.0.0.0',
                        tx_gateway_incr='0.0.0.0',
                        rx_gateway_incr='0.0.0.0',
                        configure_pause_frame=True):

    api.set_config(None)

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

    #########################################################################
    # common L1 configuration
    #########################################################################
    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',
                                     rs_fec=True,
                                     flow_control=flow_ctl)

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

    ###########################################################################
    # Create TX stack configuration
    ###########################################################################
    tx_ipv4 = Ipv4(name='Tx Ipv4',
                   address=Pattern(tx_port_ip),
                   prefix=Pattern('24'),
                   gateway=Pattern(tx_gateway_ip))

    tx_ethernet = Ethernet(name='Tx Ethernet', ipv4=tx_ipv4)

    tx_device = Device(name='Tx Device',
                       devices_per_port=1,
                       ethernets=[tx_ethernet])

    tx_device_group = DeviceGroup(name='Tx Device Group',
                                  port_names=[tx.name],
                                  devices=[tx_device])

    ###########################################################################
    # Create RX stack configuration
    ###########################################################################
    rx_ipv4 = Ipv4(name='Rx Ipv4',
                   address=Pattern(rx_port_ip),
                   prefix=Pattern('24'),
                   gateway=Pattern(rx_gateway_ip))

    rx_ethernet = Ethernet(name='Rx Ethernet', ipv4=rx_ipv4)

    rx_device = Device(name='Rx Device',
                       devices_per_port=1,
                       ethernets=[rx_ethernet])

    rx_device_group = DeviceGroup(name='Rx Device Group',
                                  port_names=[rx.name],
                                  devices=[rx_device])

    ###########################################################################
    # Traffic configuration Test data
    # DHCP = [3, 4]
    # ECN BIT = 1
    ###########################################################################
    test_dscp = Priority(
        Dscp(phb=FieldPattern(choice=[3, 4]), ecn=FieldPattern('1')))

    data_endpoint = DeviceEndpoint(tx_device_names=[tx_device.name],
                                   rx_device_names=[rx_device.name],
                                   packet_encap='ipv4',
                                   src_dst_mesh='',
                                   route_host_mesh='',
                                   bi_directional=False,
                                   allow_self_destined=False)

    test_flow = Flow(name='Test Data',
                     endpoint=Endpoint(data_endpoint),
                     packet=[
                         Header(choice=EthernetHeader()),
                         Header(choice=Ipv4Header(priority=test_dscp))
                     ],
                     size=Size(128),
                     rate=Rate('line', 50),
                     duration=Duration(
                         FixedPackets(packets=0,
                                      delay=1000000000,
                                      delay_unit='nanoseconds')))

    ###########################################################################
    # Traffic configuration Pause
    ###########################################################################
    if (configure_pause_frame):
        pause_endpoint = PortEndpoint(tx_port_name=rx.name)
        pause = Header(
            PfcPause(
                dst=FieldPattern(choice='01:80:C2:00:00:01'),
                src=FieldPattern(choice='00:00:fa:ce:fa:ce'),
                class_enable_vector=FieldPattern(choice='18'),
                pause_class_0=FieldPattern(choice='0'),
                pause_class_1=FieldPattern(choice='0'),
                pause_class_2=FieldPattern(choice='0'),
                pause_class_3=FieldPattern(choice='ffff'),
                pause_class_4=FieldPattern(choice='ffff'),
                pause_class_5=FieldPattern(choice='0'),
                pause_class_6=FieldPattern(choice='0'),
                pause_class_7=FieldPattern(choice='0'),
            ))

        pause_flow = Flow(name='Pause Storm',
                          endpoint=Endpoint(pause_endpoint),
                          packet=[pause],
                          size=Size(64),
                          rate=Rate('line', value=100),
                          duration=Duration(
                              FixedPackets(packets=0,
                                           delay=0,
                                           delay_unit='nanoseconds')))
        flows = [test_flow, pause_flow]
    else:
        flows = [test_flow]

    ###########################################################################
    # Set config
    ###########################################################################
    config = Config(ports=[tx, rx],
                    layer1=[common_l1_config],
                    device_groups=[tx_device_group, rx_device_group],
                    flows=flows)

    api.set_config(config)
    return config