### Python CLI Client Usage Example Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Demonstrates how to initialize and use the CliClient for common operations like getting switch statistics, finding VFs, and listing VSI entries. Requires `mfd_connect` and `mfd_cli_client` libraries. It takes an IP address for the control plane host and a path to the binary directory. ```python 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}") ``` -------------------------------- ### Generate MFD-CLI-CLIENT Documentation (Shell) Source: https://github.com/intel/mfd-cli-client/blob/main/sphinx-doc/README.md This command initiates the Sphinx documentation generation process for the MFD-CLI-CLIENT project. Ensure you are in the correct directory and have the necessary Python environment activated with dependencies installed. ```shell $ python generate_docs.py ``` -------------------------------- ### Get VSI Config List Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Retrieves a list of all Virtual Station Interface (VSI) configurations. ```APIDOC ## GET VSI CONFIG LIST ### Description Get list containing all data in the VSI table. ### Method `get_vsi_config_list` ### Parameters None ### Request Example ```python cli_client.get_vsi_config_list() ``` ### Response #### Success Response (200) - **vsi_config_list** (List[VsiConfigListEntry]) - A list of VSI configuration entries. #### Response Example ```json { "vsi_config_list": [ { "vsi_id": 1, "config_data": "..." }, { "vsi_id": 2, "config_data": "..." } ] } ``` ``` -------------------------------- ### Get MAC and VSI List Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Retrieves a list of MAC addresses and Virtual Station Interface (VSI) entries. ```APIDOC ## GET MAC AND VSI LIST ### Description Get MAC and VSI list. ### Method `get_mac_and_vsi_list` ### Parameters None ### Request Example ```python cli_client.get_mac_and_vsi_list() ``` ### Response #### Success Response (200) - **vsi_list** (List[VsiListEntry]) - A list of VSI list entries, each containing MAC address and VSI information. #### Response Example ```json { "vsi_list": [ { "mac_address": "00:11:22:33:44:55", "vsi_id": 1 }, { "mac_address": "AA:BB:CC:DD:EE:FF", "vsi_id": 2 } ] } ``` ``` -------------------------------- ### Get Switch Stats Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Retrieves switch statistics from the command line interface client. ```APIDOC ## GET SWITCH STATS ### Description Get command line interface client switch stats. ### Method `get_switch_stats` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **switch_id** (int) - Optional - The ID of the switch. Defaults to 1. ### Request Example ```python cli_client.get_switch_stats(switch_id=1) ``` ### Response #### Success Response (200) - **switch_stats** (SwitchStats) - An object containing switch statistics. #### Response Example ```json { "switch_stats": { ... } } ``` ``` -------------------------------- ### Get VSI Statistics Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Retrieves Virtual Station Interface (VSI) statistics from the command line interface client. ```APIDOC ## GET VSI STATISTICS ### Description Get command line interface client vsi stats. ### Method `get_vsi_statistics` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **vsi_id** (int) - Optional - The ID of the VSI. Defaults to 1. ### Request Example ```python cli_client.get_vsi_statistics(vsi_id=1) ``` ### Response #### Success Response (200) - **vsi_stats** (VSIStats) - An object containing VSI statistics. #### Response Example ```json { "vsi_stats": { ... } } ``` ``` -------------------------------- ### Get TC Priorities Switch Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Retrieves Traffic Class (TC) priorities from the switch statistics. ```APIDOC ## GET TC PRIORITIES SWITCH ### Description Get Traffic Class priorities from switch stats. ### Method `get_tc_priorities_switch` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **switch_id** (int) - Optional - The ID of the switch. Defaults to 1. ### Request Example ```python cli_client.get_tc_priorities_switch(switch_id=1) ``` ### Response #### Success Response (200) - **traffic_class_counters** (TrafficClassCounters) - An object containing traffic class counters and priorities. #### Response Example ```json { "traffic_class_counters": { ... } } ``` ``` -------------------------------- ### Prepare VM VSI Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Prepares a Virtual Machine (VM) Virtual Station Interface (VSI) for a specified number of Virtual Functions (VFs). ```APIDOC ## PREPARE VM VSI ### Description For vf_amount VFs, create a VM node and map each VF to a VM node (vf0:vm1, vf1:vm2 ...). ### Method `prepare_vm_vsi` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **vf_amount** (Union[int, str]) - Optional - The number of Virtual Functions (VFs) to prepare. Defaults to 1. ### Request Example ```python cli_client.prepare_vm_vsi(vf_amount=2) ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Read QoS VM Info Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Queries the Quality of Service (QoS) VM information, including VF2VM mapping. ```APIDOC ## READ QOS VM INFO ### Description 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. ### Method `read_qos_vm_info` ### Parameters None ### Request Example ```python cli_client.read_qos_vm_info() ``` ### Response #### Success Response (200) - **qos_vm_info** (Dict[int, Dict[int, List[int]]]) - A dictionary containing QoS VM information, mapping host keys to VM keys with lists of VSI indexes. #### Response Example ```json { "qos_vm_info": { 1: { 10: [0, 1], 11: [2] }, 2: { 20: [3, 4, 5] } } } ``` ``` -------------------------------- ### Apply Vmrl Changes Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Applies configuration changes from a "Virtual Machine Rule List" (Vmrl) file. ```APIDOC ## APPLY VMRL CHANGES ### Description Apply the vmrl file configuration changes. ### Method `apply_vmrl_changes` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **config_file_path** (Union[Path, str]) - Required - The path to the Vmrl configuration file. ### Request Example ```python from pathlib import Path cli_client.apply_vmrl_changes(config_file_path=Path('/path/to/vmrl_config.txt')) ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Create Mirror Profile Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Creates a mirror profile to mirror packets to a specified Virtual Station Interface (VSI). ```APIDOC ## CREATE MIRROR PROFILE ### Description Create mirror profile to mirror packets to the specified vsi. ### Method `create_mirror_profile` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **profile_id** (int) - Required - The ID of the mirror profile to create. - **vsi_id** (int) - Required - The ID of the VSI to which packets will be mirrored. ### Request Example ```python cli_client.create_mirror_profile(profile_id=10, vsi_id=3) ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Add PSM VM RL Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Adds a "Pool Size Management" (PSM) Virtual Machine (VM) rule with specified limit and burst values. ```APIDOC ## ADD PSM VM RL ### Description Create mirror profile to mirror packets to the specified vsi. ### Method `add_psm_vm_rl` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **vm_id** (Union[int, str]) - Optional - The ID of the VM node. Defaults to 1. - **limit** (int) - Optional - The rate limit for the VM. Defaults to 10000. - **burst** (int) - Optional - The burst size for the VM. Defaults to 2048. ### Request Example ```python cli_client.add_psm_vm_rl(vm_id='vm-3', limit=5000, burst=1024) ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Apply Grl Changes Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Applies configuration changes from a "Global Rule List" (Grl) file. ```APIDOC ## APPLY GRL CHANGES ### Description Apply the grl file configuration changes. ### Method `apply_grl_changes` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **config_file_path** (Union[Path, str]) - Required - The path to the Grl configuration file. ### Request Example ```python from pathlib import Path cli_client.apply_grl_changes(config_file_path=Path('/path/to/grl_config.txt')) ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Apply Mrl Changes Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Applies configuration changes from a "Mirror Rule List" (Mrl) file. ```APIDOC ## APPLY MRL CHANGES ### Description Apply the mrl file configuration changes. ### Method `apply_mrl_changes` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **config_file_path** (Union[Path, str]) - Required - The path to the Mrl configuration file. ### Request Example ```python from pathlib import Path cli_client.apply_mrl_changes(config_file_path=Path('/path/to/mrl_config.txt')) ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Apply Up TC Changes Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Applies configuration changes from an "up to TC" (UP2TC) file. ```APIDOC ## APPLY UP TC CHANGES ### Description Apply the up2tc file configuration changes. ### Method `apply_up_tc_changes` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **config_file_path** (Union[Path, str]) - Required - The path to the UP2TC configuration file. ### Request Example ```python from pathlib import Path cli_client.apply_up_tc_changes(config_file_path=Path('/path/to/up2tc_config.txt')) ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Define VsiConfigListEntry structure for VSI configuration (Python) Source: https://github.com/intel/mfd-cli-client/blob/main/README.md The VsiConfigListEntry dataclass holds comprehensive configuration details for a VSI, including function ID, host ID, VSI ID, VPORT ID, creation/enable status, and MAC address. ```python @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 ``` -------------------------------- ### Apply Fxprl Changes Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Applies configuration changes from a "Flow Expiration Processing Rule List" (Fxprl) file. ```APIDOC ## APPLY FXPRL CHANGES ### Description Apply the fxprl file configuration changes. ### Method `apply_fxprl_changes` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **config_file_path** (Union[Path, str]) - Required - The path to the Fxprl configuration file. ### Request Example ```python from pathlib import Path cli_client.apply_fxprl_changes(config_file_path=Path('/path/to/fxprl_config.txt')) ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Configure UP-UP Translation Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Configures UP-UP translation from the CLI tool, mapping NUP values to VUP values. ```APIDOC ## CONFIGURE UP-UP TRANSLATION ### Description Configure UP-UP translation from the CLI tool such that each NUP value maps to same VUP value. ### Method `configure_up_up_translation` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **vsi_id** (int) - Optional - The ID of the VSI for which to configure translation. Defaults to 0. - **different_value** (bool) - Optional - If True, maps NUP to different VUP values. Defaults to False. ### Request Example ```python cli_client.configure_up_up_translation(vsi_id=5, different_value=True) ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Add PSM VM Node Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Adds a Virtual Machine (VM) node to the Physical Storage Management (PSM) tree. ```APIDOC ## ADD PSM VM NODE ### Description Creates a VM node in the PSM tree with vm_id. ### Method `add_psm_vm_node` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **vm_id** (Union[int, str]) - Optional - The ID of the VM node to create. Defaults to 1. ### Request Example ```python cli_client.add_psm_vm_node(vm_id='vm-1') ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Add VF to VM Node Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Attaches a Virtual Function (VF) to a Virtual Machine (VM) node in the Physical Storage Management (PSM) tree. ```APIDOC ## ADD VF TO VM NODE ### Description Attaches a VF to a VM node in the PSM tree. ### Method `add_vf_to_vm_node` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **vf_id** (Union[int, str]) - Optional - The ID of the VF to attach. Defaults to 0. - **vm_id** (Union[int, str]) - Optional - The ID of the VM node to attach to. Defaults to 1. ### Request Example ```python cli_client.add_vf_to_vm_node(vf_id=5, vm_id='vm-2') ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Sign Git Commits Automatically Source: https://github.com/intel/mfd-cli-client/blob/main/CONTRIBUTING.md This snippet shows how to automatically sign your Git commits using the 'Signed-off-by' line. It relies on configuring your Git user name and email. This ensures compliance with the Developer Certificate of Origin. ```git git config --global user.name "Your Name" git config --global user.email "your.email@example.com" git commit -s -m "Your commit message" ``` -------------------------------- ### Define VSIStats structure for bi-directional VSI statistics (Python) Source: https://github.com/intel/mfd-cli-client/blob/main/README.md The VSIStats dataclass provides a consolidated view of VSI statistics for both ingress and egress directions, utilizing the VSIFlowStats structure for each. ```python @dataclass class VSIStats: """Structure for both directions VSI statistics.""" ingress: VSIFlowStats egress: VSIFlowStats ``` -------------------------------- ### Apply Tuprl Changes Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Applies configuration changes from a "tunnel processing rule list" (Tuprl) file. ```APIDOC ## APPLY TUPRL CHANGES ### Description Apply the tuprl file configuration changes. ### Method `apply_tuprl_changes` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **config_file_path** (Union[Path, str]) - Required - The path to the Tuprl configuration file. ### Request Example ```python from pathlib import Path cli_client.apply_tuprl_changes(config_file_path=Path('/path/to/tuprl_config.txt')) ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Define SwitchStats structure for bi-directional statistics (Python) Source: https://github.com/intel/mfd-cli-client/blob/main/README.md The SwitchStats dataclass aggregates statistics for both ingress and egress directions. It includes FlowStats for each direction and overall unicast, multicast, and broadcast packet counts. ```python @dataclass class SwitchStats: """Structure for both directions statistics.""" egress: FlowStats ingress: FlowStats unicast_packet: int multicast_packet: int broadcast_packet: int ``` -------------------------------- ### Execute CLI Client Command Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Executes any command passed through the command parameter with the command line interface client tool. ```APIDOC ## EXECUTE CLI CLIENT COMMAND ### Description Execute any command passed through the command parameter with command line interface client tool. ### Method `execute_cli_client_command` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **command** (str) - Required - The command to execute. - **timeout** (int) - Optional - The timeout for the command execution. Defaults to 120. - **expected_return_codes** (Iterable) - Optional - A set of expected return codes. Defaults to {0}. ### Request Example ```python cli_client.execute_cli_client_command(command='show version') ``` ### Response #### Success Response (200) - **result** (str) - The output of the executed command. #### Response Example ```json { "result": "output of the command" } ``` ``` -------------------------------- ### Add Group VF2VM Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Adds a Virtual Function to Virtual Machine (VF2VM) topology in the Physical Storage Management (PSM) tree from a dictionary. ```APIDOC ## ADD GROUP VF2VM ### Description From a Dict containing VMs each with a list of VFs, create full vf2vm topology in PSM. ### Method `add_group_vf2vm` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **psm_vf2vm** (Dict[int, List[int]]) - Required - A dictionary where keys are VM IDs and values are lists of VF IDs. ### Request Example ```python cli_client.add_group_vf2vm(psm_vf2vm={1: [0, 1], 2: [2, 3]}) ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Define VSIFlowStats structure for VSI statistics (Python) Source: https://github.com/intel/mfd-cli-client/blob/main/README.md The VSIFlowStats dataclass holds statistics specific to a Virtual Station Interface (VSI). It tracks packet counts for different types (unicast, multicast, broadcast), discards, errors, and optionally unknown packets. ```python @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 ``` -------------------------------- ### Send Link Change Event Per PF Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Sends a link change event to set the link status and speed for a particular Physical Function (PF) and Virtual Port (VPort). ```APIDOC ## SEND LINK CHANGE EVENT PER PF ### Description Send link change event to set link status and speed for a particular pf and vport. ### Method `send_link_change_event_per_pf` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **link_status** (str) - Required - The desired link status (e.g., 'up', 'down'). - **link_speed** (str) - Optional - The desired link speed. Defaults to "200000Mbps". - **pf_num** (int) - Optional - The number of the Physical Function (PF). Defaults to 0. - **vport_id** (Optional[int]) - Optional - The ID of the Virtual Port (VPort). ### Request Example ```python cli_client.send_link_change_event_per_pf(link_status='up', pf_num=2, vport_id=1) ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Send Link Change Event All PF Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Sends a link change event to set the link status and speed for all Physical Functions (PFs). ```APIDOC ## SEND LINK CHANGE EVENT ALL PF ### Description Send link change event to set link status and speed for all pfs. ### Method `send_link_change_event_all_pf` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **link_status** (str) - Required - The desired link status (e.g., 'up', 'down'). - **link_speed** (str) - Optional - The desired link speed. Defaults to "200000Mbps". ### Request Example ```python cli_client.send_link_change_event_all_pf(link_status='up', link_speed='100Gbps') ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Manual Git Commit Sign-off Source: https://github.com/intel/mfd-cli-client/blob/main/CONTRIBUTING.md This snippet demonstrates the required format for manually adding a 'Signed-off-by' line to a Git commit message. This manual method is used if automatic signing is not configured. ```git git commit -m "Your commit message" git commit --amend -m "Your commit message Signed-off-by: Your Name " ``` -------------------------------- ### Define VsiListEntry structure for VSI ID and MAC (Python) Source: https://github.com/intel/mfd-cli-client/blob/main/README.md The VsiListEntry dataclass represents an entry in a VSI list, containing the VSI identifier and its associated MAC address. ```python @dataclass class VsiListEntry: """Structure for an entry in VSI list containing VSI ID and MAC address.""" vsi_id: int mac: MACAddress ``` -------------------------------- ### Find VF VSI Source: https://github.com/intel/mfd-cli-client/blob/main/README.md Finds the Virtual Station Interface (VSI) associated with a given Virtual Function (VF). ```APIDOC ## FIND VF VSI ### Description Find VSI per VF. ### Method `find_vf_vsi` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **vf_amount** (int) - Optional - The number of VFs to find VSIs for. Defaults to 1. ### Request Example ```python cli_client.find_vf_vsi(vf_amount=3) ``` ### Response #### Success Response (200) - **result** (Dict) - A dictionary mapping VF identifiers to their corresponding VSI identifiers. #### Response Example ```json { "result": { "vf_id_1": "vsi_id_1", "vf_id_2": "vsi_id_2" } } ``` ``` -------------------------------- ### Define LinkStatus enum for network link state (Python) Source: https://github.com/intel/mfd-cli-client/blob/main/README.md The LinkStatus IntEnum defines the possible states of a network link, specifically 'DOWN' (0) and 'UP' (1). ```python class LinkStatus(IntEnum): """Link Status enum represents link state.""" DOWN = 0 UP = 1 ``` -------------------------------- ### Developer Certificate of Origin (DCO) Text Source: https://github.com/intel/mfd-cli-client/blob/main/CONTRIBUTING.md The full text of the Developer Certificate of Origin, Version 1.1. This is a legal statement that contributors must agree to, certifying that they have the right to submit the code under the project's open-source license. ```text Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 660 York Street, Suite 102, San Francisco, CA 94110 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ``` -------------------------------- ### Define TrafficClassCounters structure for Tx/Rx (Python) Source: https://github.com/intel/mfd-cli-client/blob/main/README.md The TrafficClassCounters dataclass is designed to hold transmit (tx) and receive (rx) counters for different traffic classes. It is used for both directions. ```python @dataclass class TrafficClassCounters: """Structure for both directions Traffic Classes Counter.""" tx: List[int] rx: List[int] ``` -------------------------------- ### Define FlowStats structure for single direction statistics (Python) Source: https://github.com/intel/mfd-cli-client/blob/main/README.md The FlowStats dataclass is used to store statistics for a single direction of traffic. It includes counters for traffic classes, packets, and discards. ```python @dataclass class FlowStats: """Structure for single direction statistics.""" traffic_class_counters: List[int] packet: int discards: int ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.