8.3.2.3. Port

This module contains the L47 port classes.

The Xena L47 test execution engine has seven states: off, prepare, prepare_rdy, prerun, prerun_rdy, running and stopped. Traffic is generated in the prerun and running states only, and configuration of parameters is only valid in state off except for a few runtime options. Port traffic commands can be given with P4_TRAFFIC and port state queried by P4_STATE.

  • off - default state. Entered from stopped or prepare on OFF command. This is the only state that allows configuration commands. P_RESET is also considered a configuration command. Upon entering off state, some internal ‘’house cleaning’’’ is done. For example: freeing TCP Connections, clearing test specific counters etc.

  • prepare - this state is entered from state off on PREPARE command. Here internal data structures relevant for the test configuration are created.

  • prepare_rdy - entered automatically after activities in prepare have completed successfully.

  • prepare_fail - entered automatically from prepare, if an error occurs. An error could for example be failure to load a configured replay file.

  • prerun - entered from prepare_ready on PRERUN command. If enabled, this is where ARP and NDP requests are sent.

  • prerun_rdy - entered automatically after activities in prerun have completed.

  • running - entered either from prepare_ready or prerun_ready on ON command. This is where TCP connections are established, payload is generated and connections are closed again.

  • stopping - entered from running, prerun_ready or prerun on STOP command. Stops Rx/Tx traffic. In the stopping state, post-test data are calculated and captured packets are saved to files.

  • stopped - entered automatically after activities in stopping are complete. This is where you can read post-test statistics and extract captured packets.


class P4_APTITUDES[source]

Bases: object

Returns the ports aptitudes - i.e. what is possible to configure on the port in terms of features and performance.

Current schema of the BSON document:

schema = {
    'chassis': {
        'type': 'int32',
        'required': True,
        'enum': ['CHASSIS_TYPE_UNKNOWN',
                'CHASSIS_TYPE_APPLIANCE',
                'CHASSIS_TYPE_BAY',
                'CHASSIS_TYPE_COMPACT',
                'CHASSIS_TYPE_SAFIRE']
    },
    'tcp_udp': {
        'type': 'document',
        'required': True,
        'properties': {
            'cc': {
                'type': 'int32',
                'required': True,
            },
        }
    },
    'tls': {
        'type': 'document',
        'required': True,
        'properties': {
            'supported': {
                'type': 'bool',
                'required': True,
            },
            'cc': {
                'type': 'int32',
                'required': True,
            }
        }
    }
}
get()[source]

Get the ports aptitudes

Returns:

the ports aptitudes in BSON format

Return type:

P4_APTITUDES.GetDataAttr

class P4_ARP_CONFIG[source]

Bases: object

Configure the value of the ARP request transmission rate, retransmission timeout and max. retries.

get()[source]

Get the ARP configuration on the port.

Returns:

the ARP configuration on the port

Return type:

P4_ARP_CONFIG.GetDataAttr

set(rate, retrans_timeout, retries)[source]

Set the ARP configuration on the port.

Parameters:
  • rate (int) – ARP Request transmission rate (requests/sec) - must be larger than 0

  • retrans_timeout (int) – ARP Request retransmission timeout [ms] - must be larger than 0

  • retries (int) – maximum ARP Request retransmission retries

class P4_ARP_COUNTERS[source]

Bases: object

Return total Port ARP protocol error statistics since last clear.

get()[source]

Get total Port ARP protocol error statistics since last clear.

Returns:

total Port ARP protocol error statistics since last clear.

Return type:

P4_ARP_COUNTERS.GetDataAttr

class P4_ARP_RX_COUNTERS[source]

Bases: object

Return total Port ARP protocol receive statistics since last clear.

get()[source]

Get total Port ARP protocol receive statistics since last clear.

Returns:

total Port ARP protocol receive statistics since last clear.

Return type:

P4_ARP_RX_COUNTERS.GetDataAttr

class P4_ARP_TX_COUNTERS[source]

Bases: object

Return total Port ARP protocol transmit statistics since last clear.

get()[source]

Get total Port ARP protocol transmit statistics since last clear.

Returns:

total Port ARP protocol transmit statistics since last clear.

Return type:

P4_ARP_TX_COUNTERS.GetDataAttr

class P4_CAPABILITIES[source]

Bases: object

Report the speeds supported by the L47 port.

get()[source]

Get the speeds supported by the L47 port.

Returns:

the speeds supported by the L47 port

Return type:

P4_CAPABILITIES.GetDataAttr

class P4_CAPTURE[source]

Bases: object

Starts or stops packet capture on this port.

get()[source]

Get packet capture state on this port.

Returns:

packet capture state on this port

Return type:

P4_CAPTURE.GetDataAttr

set(on_off)[source]

Set packet capture state on this port.

Parameters:

on_off (OnOff) – specifying whether to capture traffic on this port

set_off()

Stop packet capture on this port.

set_on()

Start packet capture on this port.

class P4_CAPTURE_GET_FIRST[source]

Bases: object

Returns the first captured frame on the port. Command is only valid when port is in state STOPPED

get()[source]

Get the first captured frame on the port

Returns:

the first captured frame on the port

Return type:

P4_CAPTURE_GET_FIRST.GetDataAttr

class P4_CAPTURE_GET_NEXT[source]

Bases: object

Returns the next captured frame on the port. Command is only valid when port is in state STOPPED

get()[source]

Get the next captured frame on the port

Returns:

the next captured frame on the port

Return type:

P4_CAPTURE_GET_NEXT.GetDataAttr

class P4_CLEAR[source]

Bases: object

Set the Port State to OFF and delete all configured Connection Groups for the port.

set()[source]

Set the Port State to OFF and delete all configured Connection Groups for the port.

class P4_CLEAR_COUNTERS[source]

Bases: object

Clears all run-time port counters.

set()[source]

Clears all run-time port counters.

class P4_DEV_NAME[source]

Bases: object

Report the name of the device (NIC) on which the port is located.

get()[source]

Get the name of the device (NIC) on which the port is located.

Returns:

the name of the device (NIC) on which the port is located.

Return type:

P4_DEV_NAME.GetDataAttr

class P4_DHCP_CONFIG[source]

Bases: object

Configure DHCP Client in order to aquire a pool of ip addresses.

get()[source]

Get the DHCP configuration.

Returns:

the DHCP configuration

Return type:

P4_DHCP_CONFIG.GetDataAttr

set(num_requests, retransmit_retries, timeout, base_hw_addr)[source]

Set the DHCP configuration.

Parameters:
  • num_requests (unsigned int) – Number of DHCP requests - must be larger than 0

  • retransmit_retries (unsigned int) – maximum DHCP Request retransmission retries - must be larger than 0

  • timeout (unsigned int) – retransmission timeout [ms]

  • base_hw_addr (str) – base hw address for generating DHCP requests (the first 3 bytes is being used)

class P4_DHCP_RESULT[source]

Bases: object

Get the port’s last DHCP client process result

get()[source]

Get the port’s the result of the last DHCP client process

Returns:

A list that contains the response for each DHCP request that had lunched by the last DHCP client process

Return type:

P4_DHCP_RESULT.GetDataAttr

class P4_DHCP_RUN[source]

Bases: object

Run DHCP Client process to obtain a pool of address.

set()[source]

Run DHCP Client Process.

class P4_DHCP_STATE[source]

Bases: object

Get the last state of the DHCP Client Process.

get()[source]
Get the last state of the DHCP Client Process.

The dhcp_state is an enum type of DhcpState{DHCP_STATE_UNKNOWN=0, DHCP_STATE_RUNNING=1, DHCP_STATE_COMPLETED=2, DHCP_STATE_FAILED=3}

Returns:

the last state of the DHCP Client Process.

Return type:

P4_DHCP_STATE.GetDataAttr

class P4_DHCP_VLAN[source]

Bases: object

Configure a set of VLAN tags for current DHCP Process.

get()[source]

Get the DHCP VLAN configuration :return: Whether DHCP VLAN is configured or not :rtype: P4_DHCP_RESULT.GetDataAttr :return: A list of vlans :rtype: P4_DHCP_RESULT.GetDataAttr

set(state, vlans)[source]

Set a list of VLANs for current DHCP Process, up to 8 TCIs can be defined. The order of the VLANs is like the following: ethernet/vlan0/vlan1/../vlanN/uppler_layer(like IPv4)

Parameters:
  • state (DhcpVlanState) – Enable/Disable Vlan configuration

  • vlans (List[subtypes.VlanTag]) – specifying a list of VlanTag

class P4_ETH_COUNTERS[source]

Bases: object

Return total port Ethernet statistics since last clear.

get()[source]

Get total port Ethernet statistics since last clear.

Returns:

total port Ethernet statistics since last clear.

Return type:

P4_ETH_COUNTERS.GetDataAttr

class P4_ETH_QUEUE_COUNTERS[source]

Bases: object

Get the stats of the all active queues of the port

get()[source]

Get the stats of the all active queues of the port :return: The current time (mSec since module restart) :rtype: P4_ETH_QUEUE_COUNTERS.GetDataAttr :return: Reference time (mSec for P4_TRAFFIC on) :rtype: P4_ETH_QUEUE_COUNTERS.GetDataAttr :return: Number of Active queues :rtype: P4_ETH_QUEUE_COUNTERS.GetDataAttr :return: A list that each contains stats of a queue :rtype: P4_ETH_QUEUE_COUNTERS.GetDataAttr

class P4_ETH_RX_COUNTERS[source]

Bases: object

Return total port Ethernet receive statistics since last clear.

get()[source]

Get total port Ethernet receive statistics since last clear.

Returns:

total port Ethernet receive statistics since last clear.

Return type:

P4_ETH_RX_COUNTERS.GetDataAttr

class P4_ETH_TX_COUNTERS[source]

Bases: object

Return total port Ethernet transmit statistics since last clear.

get()[source]

Get total port Ethernet transmit statistics since last clear.

Returns:

total port Ethernet transmit statistics since last clear.

Return type:

P4_ETH_TX_COUNTERS.GetDataAttr

class P4_FW_VER[source]

Bases: object

Report the firmware version of the port (NIC).

get()[source]

Get the firmware version of the port (NIC).

Returns:

the firmware version of the port (NIC)

Return type:

P4_FW_VER.GetDataAttr

class P4_ICMP_COUNTERS[source]

Bases: object

Return total Port ICMP protocol error statistics since last clear.

get()[source]

Get total Port ICMP protocol error statistics since last clear.

Returns:

total Port ICMP protocol error statistics since last clear.

Return type:

P4_ICMP_COUNTERS.GetDataAttr

class P4_ICMP_RX_COUNTERS[source]

Bases: object

Return total Port ICMP protocol receive statistics since last clear.

get()[source]

Get total Port ICMP protocol receive statistics since last clear.

Returns:

total Port ICMP protocol receive statistics since last clear.

Return type:

P4_ICMP_RX_COUNTERS.GetDataAttr

class P4_ICMP_TX_COUNTERS[source]

Bases: object

Return total Port ICMP protocol transmit statistics since last clear.

get()[source]

Get total Port ICMP protocol transmit statistics since last clear.

Returns:

total Port ICMP protocol transmit statistics since last clear.

Return type:

P4_ICMP_TX_COUNTERS.GetDataAttr

class P4_IPV4_COUNTERS[source]

Bases: object

Return total Port IPv4 protocol error statistics since last clear.

get()[source]

Get total Port IPv4 protocol error statistics since last clear.

Returns:

total Port IPv4 protocol error statistics since last clear.

Return type:

P4_IPV4_COUNTERS.GetDataAttr

class P4_IPV4_RX_COUNTERS[source]

Bases: object

Return total Port IPv4 protocol receive statistics since last clear.

get()[source]

Get total Port IPv4 protocol receive statistics since last clear.

Returns:

total Port IPv4 protocol receive statistics since last clear.

Return type:

P4_IPV4_RX_COUNTERS.GetDataAttr

class P4_IPV4_TX_COUNTERS[source]

Bases: object

Return total Port IPv4 protocol transmit statistics since last clear.

get()[source]

Get total Port IPv4 protocol transmit statistics since last clear.

Returns:

total Port IPv4 protocol transmit statistics since last clear.

Return type:

P4_IPV4_TX_COUNTERS.GetDataAttr

class P4_IPV6_COUNTERS[source]

Bases: object

Return total Port IPv6 protocol error statistics since last clear.

get()[source]

Get total Port IPv6 protocol error statistics since last clear.

Returns:

total Port IPv6 protocol error statistics since last clear.

Return type:

P4_IPV6_COUNTERS.GetDataAttr

class P4_IPV6_RX_COUNTERS[source]

Bases: object

Return total Port IPv6 protocol receive statistics since last clear.

get()[source]

Get total Port IPv6 protocol receive statistics since last clear.

Returns:

total Port IPv6 protocol receive statistics since last clear.

Return type:

P4_IPV6_RX_COUNTERS.GetDataAttr

class P4_IPV6_TX_COUNTERS[source]

Bases: object

Return total Port IPv6 protocol transmit statistics since last clear.

get()[source]

Get total Port IPv6 protocol transmit statistics since last clear.

Returns:

total Port IPv6 protocol transmit statistics since last clear.

Return type:

P4_IPV6_TX_COUNTERS.GetDataAttr

class P4_LICENSE_INFO[source]

Bases: object

Returns the information on the license assigned to the port - if any.

get()[source]

Get the information on the license assigned to the port.

Returns:

the information on the license assigned to the port

Return type:

P4_LICENSE_INFO.GetDataAttr

class P4_MAX_PACKET_RATE[source]

Bases: object

Specifies the maximum number of packets per second allowed to be transmitted on the port.

get()[source]

Get the maximum number of packets per second allowed to be transmitted on the port.

Returns:

the maximum number of packets per second allowed to be transmitted on the port.

Return type:

P4_MAX_PACKET_RATE.GetDataAttr

set(mode, rate, time_window)[source]

Set the maximum number of packets per second allowed to be transmitted on the port.

Parameters:
  • mode (AutoOrManual) – specifies the mode of the max. pps mechanism

  • rate (int) – maximum number of packets per second to transmit on this port

  • time_window (int) – time window [us] to measure the pps rate

set_automatic(rate, time_window)

Set port max packet rate mode to Automatic.

set_manual(rate, time_window)

Set port max packet rate mode to Manual.

class P4_NDP_CONFIG[source]

Bases: object

Configure the value of the NDP Neighbor Solicitation transmission rate, retransmission timeout and max. retries.

get()[source]

Get the NDP configuration on the port.

Returns:

the NDP configuration on the port

Return type:

P4_NDP_CONFIG.GetDataAttr

set(rate, retrans_timeout, retries)[source]

Set the NDP configuration on the port.

Parameters:
  • rate (int) – NDP Neighbor Solicitation transmission rate (requests/sec) - must be larger than 0

  • retrans_timeout (int) – NDP Neighbor Solicitation retransmission timeout [ms] - must be larger than 0

  • retries (int) – maximum NDP Neighbor Solicitation retransmission retries

class P4_NDP_COUNTERS[source]

Bases: object

Return total Port NDP protocol error statistics since last clear.

get()[source]

Get total Port NDP protocol error statistics since last clear.

Returns:

total Port NDP protocol error statistics since last clear.

Return type:

P4_NDP_COUNTERS.GetDataAttr

class P4_NDP_RX_COUNTERS[source]

Bases: object

Return total Port NDP protocol receive statistics since last clear.

get()[source]

Get total Port NDP protocol receive statistics since last clear.

Returns:

total Port NDP protocol receive statistics since last clear.

Return type:

P4_NDP_RX_COUNTERS.GetDataAttr

class P4_NDP_TX_COUNTERS[source]

Bases: object

Return total Port NDP protocol transmit statistics since last clear.

get()[source]

Get total Port NDP protocol transmit statistics since last clear.

Returns:

total Port NDP protocol transmit statistics since last clear.

Return type:

P4_NDP_TX_COUNTERS.GetDataAttr

class P4_PCI_INFO[source]

Bases: object

Report the port PCI info.

get()[source]

Get the port PCI info.

Returns:

the port PCI info

Return type:

P4_PCI_INFO.GetDataAttr

class P4_PORT_COUNTERS[source]

Bases: object

Return total port transmit error statistics since last clear.

get()[source]

Get total port transmit error statistics since last clear.

Returns:

total port transmit error statistics since last clear.

Return type:

P4_PORT_COUNTERS.GetDataAttr

class P4_PORT_RX_COUNTERS[source]

Bases: object

Return total port receive statistics since last clear.

get()[source]

Get total port receive statistics since last clear.

Returns:

total port receive statistics since last clear.

Return type:

P4_PORT_RX_COUNTERS.GetDataAttr

class P4_PORT_TX_COUNTERS[source]

Bases: object

Return total port transmit statistics since last clear.

get()[source]

Get total port transmit statistics since last clear.

Returns:

total port transmit statistics since last clear.

Return type:

P4_PORT_TX_COUNTERS.GetDataAttr

class P4_PORT_TYPE[source]

Bases: object

Report the port type. The different possible ports are divided into types.

get()[source]

Get the L47 port type.

Returns:

the L47 port type

Return type:

P4_PORT_TYPE.GetDataAttr

class P4_RX_MTU[source]

Bases: object

Return histogram over received (layer 3) packets sizes in 1 byte intervals. Each bin represents a packet size in the interval [576..1500] bytes.

get()[source]

Get histogram over received (layer 3) packets sizes in 1 byte intervals.

Returns:

histogram over received (layer 3) packets sizes in 1 byte intervals.

Return type:

P4_RX_MTU.GetDataAttr

class P4_RX_PACKET_SIZE[source]

Bases: object

Return a histogram over received (layer 2) packets sizes in 100 bytes intervals.

get()[source]

Get a histogram over received (layer 2) packets sizes in 100 bytes intervals.

Returns:

a histogram over received (layer 2) packets sizes in 100 bytes intervals.

Return type:

P4_RX_PACKET_SIZE.GetDataAttr

class P4_SPEEDSELECTION[source]

Bases: object

Sets the port speed. The selected speed must be one of the speeds supported by the port, which can be retrieved with P4_CAPABILITIES.

get()[source]

Get the port speed mode.

Returns:

the port speed mode.

Return type:

P4_SPEEDSELECTION.GetDataAttr

set(speed)[source]

Set the port speed mode.

Parameters:

speed (L47PortSpeed) – specifies the speed mode of the port

set_auto()

Set the port speed mode to Auto.

set_f100g()

Set the port speed mode to 100 Gbit/s.

set_f100m()

Set the port speed mode to 100 Mbit/s.

set_f10g()

Set the port speed mode to 10 Gbit/s.

set_f1g()

Set the port speed mode to 1 Gbit/s.

set_f25g()

Set the port speed mode to 25 Gbit/s.

set_f2_5g()

Set the port speed mode to 2.5 Gbit/s.

set_f40g()

Set the port speed mode to 40 Gbit/s.

set_f50g()

Set the port speed mode to 50 Gbit/s.

set_f5g()

Set the port speed mode to 5 Gbit/s.

class P4_STATE[source]

Bases: object

Display the current state of the L47 port.

get()[source]

Get the current state of the L47 port.

Returns:

the current state of the L47 port

Return type:

P4_STATE.GetDataAttr

class P4_STATE_STATUS[source]

Bases: object

Returns status of the last port state change. If the port state has changed to PREPARE_FAIL, the status contains information about the reason for the fail. Currently the status will be “OK”in all other states.

get()[source]

Get status of the last port state change.

Returns:

status of the last port state change

Return type:

P4_STATE_STATUS.GetDataAttr

class P4_TCP_COUNTERS[source]

Bases: object

Return total Port TCP protocol error statistics since last clear.

get()[source]

Get total Port TCP protocol error statistics since last clear.

Returns:

total Port TCP protocol error statistics since last clear.

Return type:

P4_TCP_COUNTERS.GetDataAttr

class P4_TCP_RX_COUNTERS[source]

Bases: object

Return total Port TCP protocol receive statistics since last clear.

get()[source]

Get total Port TCP protocol receive statistics since last clear.

Returns:

total Port TCP protocol receive statistics since last clear.

Return type:

P4_TCP_RX_COUNTERS.GetDataAttr

class P4_TCP_TX_COUNTERS[source]

Bases: object

Return total Port TCP protocol transmit statistics since last clear.

get()[source]

Get total Port TCP protocol transmit statistics since last clear.

Returns:

total Port TCP protocol transmit statistics since last clear.

Return type:

P4_TCP_TX_COUNTERS.GetDataAttr

class P4_TRAFFIC[source]

Bases: object

Gives a traffic state command to a L47 port.

set(traffic_state)[source]

Set L47 port traffic state.

Parameters:

traffic_state (L47TrafficState) – the traffic state command issued to the port

set_off()

Set L47 port traffic state to Off.

set_on()

Set L47 port traffic state to On.

set_prepare()

Set L47 port traffic state to Prepare.

set_prerun()

Set L47 port traffic state to Prerun.

set_stop()

Set L47 port traffic state to Stop.

class P4_TX_MTU[source]

Bases: object

Return histogram over transmitted (layer 3) packets sizes in 1 byte intervals. Each bin represents a packet size in the interval [576..1500] bytes.

get()[source]

Get histogram over transmitted (layer 3) packets sizes in 1 byte intervals.

Returns:

histogram over transmitted (layer 3) packets sizes in 1 byte intervals.

Return type:

P4_TX_MTU.GetDataAttr

class P4_TX_PACKET_SIZE[source]

Bases: object

Return histogram over transmitted (layer 2) packets sizes in 100 bytes intervals.

get()[source]

Get a histogram over transmitted (layer 2) packets sizes in 100 bytes intervals.

Returns:

histogram over transmitted (layer 2) packets sizes in 100 bytes intervals.

Return type:

P4_TX_PACKET_SIZE.GetDataAttr

class P4_UDP_COUNTERS[source]

Bases: object

Return total Port UDP protocol error statistics since last clear.

get()[source]

Get total Port UDP protocol error statistics since last clear.

Returns:

total Port UDP protocol error statistics since last clear.

Return type:

P4_UDP_COUNTERS.GetDataAttr

class P4_UDP_RX_COUNTERS[source]

Bases: object

Return total Port UDP protocol receive statistics since last clear.

get()[source]

Get total Port UDP protocol receive statistics since last clear.

Returns:

total Port UDP protocol receive statistics since last clear.

Return type:

P4_UDP_RX_COUNTERS.GetDataAttr

class P4_UDP_TX_COUNTERS[source]

Bases: object

Return total Port UDP protocol transmit statistics since last clear.

get()[source]

Get total Port UDP protocol transmit statistics since last clear.

Returns:

total Port UDP protocol transmit statistics since last clear.

Return type:

P4_UDP_TX_COUNTERS.GetDataAttr

class P4_VLAN_OFFLOAD[source]

Bases: object

Specifies if 802.1Q VLAN tag should be inserted and stripped by the Ethernet device. If VLAN Offload is switched ON, VLAN tags will not be present in frames captured by the L47 Server.

get()[source]

Get the VLAN offload status.

Returns:

VLAN offload status

Return type:

P4_VLAN_OFFLOAD.GetDataAttr

set(offload)[source]

Set the VLAN offload state.

Parameters:

offload (OnOff) – specifies if VLAN Offload is enabled

set_off()

Disable VLAN offload.

set_on()

Enable VLAN offload.