Skip to main content

MFD CLI Client

Module for cli_client (command line interface client) utility for the Intel® Infrastructure Processing Unit (Intel® IPU). It implements the mfd-base-tool abstract class. The command line interface (CLI) is a client application that connects to and communicates with the Intel® IPU Control Plane.

Usage

import logging

from mfd_connect import RPyCConnection
from mfd_cli_client import CliClient
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

# Prepare CLI Client
cp_host_mng_ip = '10.10.10.10'
rpyc_connection_cp = RPyCConnection(ip=cp_host_mng_ip)
cli_client = CliClient(connection=rpyc_connection_cp, absolute_path_to_binary_dir='/home/root')

# Get switch stats
get_switch_stats_result = cli_client.get_switch_stats(switch_id=1)
logger.info(f'CLI Client switch stats result: {get_switch_stats_result}')

# Find VFs
vf_amount = 1
find_vf_vsi_result = cli_client.find_vf_vsi(vf_amount=vf_amount)
logger.info(f'Find VSI per VF result: {find_vf_vsi_result}')

# List VSI list entries
vsi_list = cli_client.get_mac_and_vsi_list()
logger.info(f"VSI list entries: {vsi_list}")

Exceptions raised by cli_client module

  • CliClientException

  • CliClientNotAvailable

Implemented Methods

execute_cli_client_command(self, command: str, *, timeout: int = 120, expected_return_codes: Iterable = frozenset({0})) -> str - Execute any command passed through command parameter with command line interface client tool.

get_switch_stats(self, switch_id: int = 1) -> SwitchStats - Get command line interface client switch stats.

get_vsi_statistics(self, vsi_id: int = 1) -> VSIStats - Get command line interface client vsi stats.

prepare_vm_vsi(self, vf_amount: Union[int, str] = 1) -> None - For vf_amount VFs, create a VM node and map each VF to a VM node (vf0:vm1, vf1:vm2 ...).

add_psm_vm_node(self, vm_id: Union[int, str] = 1, host_id: int = 0) -> None - Creates a VM node in the PSM tree with vm_id on host host_id.

add_group_vf2vm(self, psm_vf2vm: Dict[int, List[int]], host_id: int = 0) -> None: - From a Dict containing VMs each with a list of VFs, create full vf2vm topology in PSM on host host_id.

add_vf_to_vm_node(self, vf_id: Union[int, str] = 0, vm_id: Union[int, str] = 1, host_id: int = 0) -> None - Attaches a VF to a VM node in the PSM tree on host host_id.

find_vf_vsi(self, vf_amount: int = 1) -> Dict - Find VSI per VF.

get_mac_and_vsi_list(self) -> List[VsiListEntry] - Get MAC and VSI list.

get_tc_priorities_switch(self, switch_id: int = 1) -> TrafficClassCounters - Get Traffic Class priorities from switch stats.

apply_up_tc_changes(self, config_file_path: Union[Path,str]) -> None - Apply the up2tc file configuration changes.

apply_tuprl_changes(self, config_file_path: Union[Path, str]) -> None: - Apply the tuprl file configuration changes.

apply_vmrl_changes(self, config_file_path: Union[Path, str]) -> None: - Apply the vmrl file configuration changes.

apply_grl_changes(self, config_file_path: Union[Path, str]) -> None: - Apply the grl file configuration changes.

apply_fxprl_changes(self, config_file_path: Union[Path, str]) -> None: - Apply the fxprl file configuration changes.

apply_mrl_changes(self, config_file_path: Union[Path, str]) -> None: - Apply the mrl file configuration changes.

configure_up_up_translation(self, vsi_id: int = 0, different_value: bool = False) -> None - Configure UP-UP translation from the CLI tool such that each NUP value maps to same VUP value.

get_vsi_config_list(self) -> List[VsiConfigListEntry] - Get list containing all data in the VSI table.

send_link_change_event_all_pf(self, link_status: str, link_speed: str = "200000Mbps") -> None: - Send link change event to set link status and speed for all pfs send_link_change_event_per_pf(self, link_status: str, link_speed: str = "200000Mbps", pf_num: int = 0, vport_id: Optional[int] = None) -> None: - Send link change event to set link status and speed for a particular pf and vport

create_mirror_profile(self, profile_id: int, vsi_id: int) -> None: - Create mirror profile to mirror packets to the specified vsi

add_psm_vm_rl(self, vm_id: Union[int, str] = 1, limit: int = 10000, burst: int = 2048, host_id: int = 0) -> None - Set PSM VM rate limit and burst on vm_id of host host_id.

read_qos_vm_info(self) -> Dict[int, Dict[int, List[int]]] - Query VF2VM mapping and return a dict of host keys, with values of dict of vm keys with list of vsi indexes. Or nothing if they dont exist.

Implemented structures

@dataclass
class FlowStats:
    """Structure for single direction statistics."""
    traffic_class_counters: List[int]
    packet: int
    discards: int
@dataclass
class SwitchStats:
    """Structure for both directions statistics."""
    egress: FlowStats
    ingress: FlowStats
    unicast_packet: int
    multicast_packet: int
    broadcast_packet: int
@dataclass
class VSIFlowStats:
    """Structure for VSI statistics."""

    packet: int
    unicast_packet: int
    multicast_packet: int
    broadcast_packet: int
    discards_packet: int
    errors_packet: int
    unknown_packet: int | None = None
@dataclass
class VSIStats:
    """Structure for both directions VSI statistics."""

    ingress: VSIFlowStats
    egress: VSIFlowStats
@dataclass
class TrafficClassCounters:
    """Structure for both directions Traffic Classes Counter."""
    tx: List[int]
    rx: List[int]
@dataclass
class VsiListEntry:
    """Structure for an entry in VSI list containing VSI ID and MAC address."""

    vsi_id: int
    mac: MACAddress
@dataclass
class VsiConfigListEntry:
    """Structure for an entry in VSI Config list containing all fields."""

    fn_id: int
    host_id: int
    is_vf: bool
    vsi_id: int
    vport_id: int
    is_created: bool
    is_enabled: bool
    mac: MACAddress
class LinkStatus(IntEnum):
    """Link Status enum represents link state."""

    DOWN = 0
    UP = 1

OS supported:

  • Linux

Issue reporting

If you encounter any bugs or have suggestions for improvements, you're welcome to contribute directly or open an issue here.

Metadata

Release files for mfd-cli-client 1.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for mfd-cli-client 1.13.0
File Interpreter ABI Platform Actions
mfd_cli_client-1.13.0-py3-none-any.whl Python 3 none any Details for mfd_cli_client-1.13.0-py3-none-any.whl

Release files / mfd_cli_client-1.13.0-py3-none-any.whl

Download URL mfd_cli_client-1.13.0-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c603865baa5ccf13a7d807ddb1589d5f2d5b3d84852d8de947d2a8f082e7858c
BLAKE2b-256 checksum
How to use checksums
66c6e8a47d075b13302fed38053442f432805d760ecbd553b2e6341d0a12a749
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for mfd-cli-client 1.13.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page