### FreeBSD DCB Usage Example Source: https://github.com/intel/mfd-dcb/blob/main/README.md Example demonstrating how to use the FreeBSD DCB implementation for configuring DSCP maps, PFC modes, and ETS minimum rates. ```APIDOC ## FreeBSD DCB Usage Example ### Importing necessary modules ```python from mfd_dcb import Dcb from mfd_dcb import FreeBsdDcb, DSCPMap from mfd_connect import RPyCConnection ``` ### Establishing a connection and initializing the Dcb object ```python # Replace 'x.x.x.x' with the actual IP address of the remote server conn = RPyCConnection(ip="x.x.x.x") dcb_obj = FreeBsdDcb(connection=conn) ``` ### DSCP Map Configuration ```python # Initialize DSCP map with 64 zeros dscpmap = [0] * 64 # Apply the initial DSCP map to interface 'ice0' dcb_obj.dscp_apply_map(interface_name="ice0", dscpmap=dscpmap) # Read and print the current DSCP map print(dcb_obj.dscp_read_map(interface_name="ice0")) # Modify the DSCP map (set the first element to 7) dscpmap[0]=7 # Apply the modified DSCP map dcb_obj.dscp_apply_map(interface_name="ice0", dscpmap=dscpmap) # Verify if the DSCP map is correctly applied assert dcb_obj.dscp_verify_map(interface_name="ice0", dscpmap) is True ``` ### PFC Mode Configuration ```python # Set PFC mode to DSCP for interface 'ice0' # Assuming PfcMode is an enum or constant defined elsewhere dcb_obj.set_pfc_mode("ice0", PfcMode.DSCP) # Get and print the current PFC mode print(dcb_obj.get_pfc_mode("ice0")) ``` ### ETS Minimum Rate Configuration ```python # Set the minimum rate for ETS on interface 'ice0' # Example: [100, 0, 0, 0, 0, 0, 0, 0] specifies 100% for the first traffic class dcb_obj.set_ets_min_rate("ice0", [100, 0, 0, 0, 0, 0, 0, 0]) # Get and print the current ETS minimum rates print(dcb_obj.get_ets_min_rate("ice0")) ``` ``` -------------------------------- ### FreeBSD DCB Usage Example Source: https://github.com/intel/mfd-dcb/blob/main/README.md This Python code snippet demonstrates how to use the `FreeBsdDcb` class to manage DCB configurations on FreeBSD systems. It includes examples of applying and verifying DSCP maps, setting and getting PFC modes, and setting and getting ETS minimum rates. This requires an active RPyC connection. ```python from mfd_dcb import Dcb from mfd_dcb import FreeBsdDcb, DSCPMap from mfd_connect import RPyCConnection conn = RPyCConnection(ip="x.x.x.x") dcb_obj = FreeBsdDcb(connection=conn) dscpmap = [0] * 64 dcb_obj.dscp_apply_map(interface_name="ice0", dscpmap=dscpmap) print(dcb_obj.dscp_read_map(interface_name="ice0")) dscpmap[0]=7 dcb_obj.dscp_apply_map(interface_name="ice0", dscpmap=dscpmap) assert dcb_obj.dscp_verify_map(interface_name="ice0", dscpmap) is True dcb_obj.set_pfc_mode("ice0", PfcMode.DSCP) print(dcb_obj.get_pfc_mode("ice0")) dcb_obj.set_ets_min_rate("ice0", [100, 0, 0, 0, 0, 0, 0, 0]) print(dcb_obj.get_ets_min_rate("ice0")) ``` -------------------------------- ### Python DCB Configuration and Management with MFD DCB Source: https://github.com/intel/mfd-dcb/blob/main/README.md Demonstrates the usage of the MFD DCB Python module for configuring and managing Data Center Bridging (DCB) features. It includes examples for setting policies, QoS, PFC, ETS, and retrieving various DCB operational values and statuses. This snippet requires the mfd_dcb, mfd_connect, and mfd_typing libraries. ```python from mfd_dcb import Dcb from mfd_connect import RPyCConnection from mfd_typing import DeviceID conn = RPyCConnection(ip="x.x.x.x") dcb_obj = Dcb(connection=conn) print(dcb_obj.is_willing()) print(dcb_obj.set_willing(enable=False, is_40g_or_later=True)) print(dcb_obj.set_policy('test1', 1, "-IPSrcPrefixMatchCondition x.x.x.x -IPDstPortStartMatchCondition 5001 -IPDstPortEndMatchCondition 5001")) print(dcb_obj.remove_policy('test1')) print(dcb_obj.get_policies()) print(dcb_obj.verify_policy(dcb_obj.verify_policy({'test1': {'PriorityValue': '1'}}))) print(dcb_obj.is_qos_enabled("SLOT 4 Port 1")) print(dcb_obj.set_qos("SLOT 4 Port 1", True)) print(dcb_obj.set_default_config()) print(dcb_obj.set_pfc([1, 1, 1, 1, 1, 1, 1, 1])) print(dcb_obj.set_ets(['1', '2', '3', '4', '5', '6', '7'], [5, 7, 10, 15, 17, 20, 23])) print(dcb_obj.get_dcb("SLOT 4 Port 1")) print(dcb_obj.get_ets("SLOT 4 Port 1")) print(dcb_obj.get_pfc("SLOT 4 Port 1")) print(dcb_obj.get_app("SLOT 4 Port 1")) print(dcb_obj.get_remote_ets("SLOT 4 Port 1")) print(dcb_obj.get_remote_pfc("SLOT 4 Port 1")) print(dcb_obj.get_remote_app("SLOT 4 Port 1")) print(dcb_obj.set_dcb_operational_value("Intel(R) Ethernet Network Adapter E810-C-Q2", "DCB", "Enabled")) print(dcb_obj.get_dcb_operational_value("Intel(R) Ethernet Network Adapter E810-C-Q2", "DCB Version")) val = dcb_obj.get_dcb("SLOT 4 Port 1") print(dcb_obj.verify_dcb("SLOT 4 Port 1", val)) print(dcb_obj.verify_ets("SLOT 4 Port 1", {'ETS': {'0': {'TSA': 'ETS', 'Bandwidth': 1000, 'Priorities': [0, 1, 2, 3, 4, 5, 6, 7]}}})) print(dcb_obj.verify_pfc("SLOT 4 Port 1", {'PFC': [True, False, True, False, True, False, True, False]})) print(dcb_obj.verify_app("SLOT 4 Port 1", {'APP': {'0x8906': {'Priority': 3, 'Protocol': 'Ethertype'}, '3260': {'Priority': 34, 'Protocol': 'TCP'}}})) print(dcb_obj.pfc_bool_to_str(True)) print(dcb_obj.remove_dcb_all_user_priorities()) print(dcb_obj.get_all_dcb_operational_values("Intel(R) Ethernet Network Adapter E810-C-Q2")) print(dcb_obj.get_dcb_status("Intel(R) Ethernet Network Adapter E810-C-Q2")) print(dcb_obj.set_dcb_status("Intel(R) Ethernet Network Adapter E810-C-Q2", enable_dcb=False, enable_willing_mode=False)) print(dcb_obj.get_pfc_enabled_bits("SLOT 4 Port 1", "Intel(R) Ethernet Network Adapter E810-C-Q2", True)) print(dcb_obj.get_pfc_port_statistics("Intel(R) Ethernet Network Adapter E810-C-Q2", 1)) print(dcb_obj.get_pfc_counters("Intel(R) Ethernet Network Adapter E810-C-Q2")) print(dcb_obj.set_dcb_user_priority_to_tcp_port("10.10.10.10")) print(dcb_obj.get_dcb_max_supported_traffic_class(True, DeviceID(0x10FB))) print(dcb_obj.set_dcb(True, "SLOT 4 Port 1")) ``` -------------------------------- ### PFC Statistics and Configuration API Source: https://github.com/intel/mfd-dcb/blob/main/README.md APIs to get PFC enabled bits and port statistics for a given priority. ```APIDOC ## GET /intel/mfd-dcb/get_pfc_enabled_bits ### Description Get the remote and local PFC enable bits for all user priorities for a given adapter. ### Method GET ### Endpoint /intel/mfd-dcb/get_pfc_enabled_bits ### Parameters #### Query Parameters - **adapter_name** (str) - Required - The name of the adapter. - **adapter_description** (str) - Required - A description or identifier for the adapter. - **is_40g_or_later** (bool) - Required - Indicates if the adapter is 40Gbps or later. ### Request Example None ``` -------------------------------- ### PFC Configuration API Source: https://github.com/intel/mfd-dcb/blob/main/README.md APIs for setting and getting the PFC mode on network interfaces. ```APIDOC ## set_pfc_mode ### Description Enable/disable DSCP mode on the interface. ### Method Not specified (likely a method within a class) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **interface_name** (str) - Required - The name of the network interface. - **mode** (PfcMode) - Required - The PFC mode to set (e.g., ENABLED, DISABLED). ### Request Example ```json { "interface_name": "eth0", "mode": "ENABLED" } ``` ### Response #### Success Response (200) None (None) #### Response Example None ## get_pfc_mode ### Description Get the current PFC mode on the interface. ### Method Not specified (likely a method within a class) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **interface_name** (str) - Required - The name of the network interface. ### Request Example ```json { "interface_name": "eth0" } ``` ### Response #### Success Response (200) - **mode** (PfcMode) - The current PFC mode of the interface. #### Response Example ```json { "mode": "ENABLED" } ``` ``` -------------------------------- ### Get DCB Status and Willing Mode Source: https://github.com/intel/mfd-dcb/blob/main/README.md Retrieves the current DCB status (enabled/disabled) and the willing mode for a given adapter. Requires the adapter description. ```python get_dcb_status(self, adapter_description: str) -> tuple ``` -------------------------------- ### Get All DCB Operational Values Source: https://github.com/intel/mfd-dcb/blob/main/README.md Retrieves all operational values for DCB settings on a specified adapter. Requires the adapter description as input. ```python get_all_dcb_operational_values(self, adapter_description: str) -> Dict[str, str] ``` -------------------------------- ### Linux DCB API Methods Source: https://github.com/intel/mfd-dcb/blob/main/README.md This section lists the available API methods for managing DCB configurations on Linux systems. These methods cover setting and getting ETS, PFC, LLDP, and DCBX configurations, as well as restarting services and removing configurations. Note that these APIs are designed for LINUX environments. ```python def set_ets(self, user_priority_mapping, bandwidth_per_traffic_class, mode="ieee", interface_name: str) -> None: """Set ETS configuration based on User Priority mapping to Traffic Classes and given bandwidth.""" def set_pfc(self, interface_name: str, pfc_per_priority: list = [], mode: str = "ieee") -> None: """Turn ON or OFF Priority Flow Control for each User Priority.""" def restart_lldpad(self, action: str = "default") -> None: """Restart/stop lldpad service and lldp agent daemon.""" def set_sw_dcb(self, interface_name: str, enable: bool = False, dcbx_mode: str = "ieee") -> None: """Turn ON or OFF software DCB.""" def set_dcbx_mode(self, interface_name: str, mode: str = "", fw_lldp: bool = False) -> None: """Set adapter DCB to given DCBX mode.""" def is_sw_dcb_mode_enabled(self, interface_name: str, dcbx_mode: str) -> bool: """Check software DCB status.""" def set_willing(self, interface_name: str, enable: bool, mode: str, is_fwlldp_enabled: bool) -> None: """Turn ON or OFF Willing of remote DCB configuration on the server.""" def get_pfc_counters(self, interface_name: str, is_10g_adapter: bool = False, is_40g_adapter: bool = False) -> Dict[str, Dict[str, str]]: """Get PFC counters values for all User Priorities.""" def remove_lldpad_conf(self) -> None: """Remove lldpad conf file to restore settings.""" def get_dcb(self, interface_name: str, tool_name: str = dcbnl) -> Dict[str, Dict[str, str]]: """Get complete DCB configuration for ETS, PFC and APP TLVs, local and remote.""" def get_ets(self, interface_name: str, tool_name: str = dcbnl, from_cache: bool = False) -> Dict[str, Dict[str, Any]]: """Get local ETS TLV configuration of the adapter.""" def get_tool(self, interface_name: str, tool_name: str = dcbnl) -> str: """Returns particular tool based on tool name.""" def get_app(self, interface_name: str, tool_name: str = dcbnl, from_cache: bool = False) -> Dict[str, Dict[str, Any]]: """Get local APP TLV configuration of the adapter.""" def get_pfc(self, interface_name: str, tool_name: str = dcbnl) -> Dict[str, Dict[str, Any]]: """Get local PFC TLV configuration of the adapter.""" def get_dcb(self, interface_name: str, tool_name: str = dcbtool) -> Dict[str, Dict[str, str]]: """Get complete DCB configuration for ETS, PFC and APP TLVs, local and remote.""" def get_ets(self, interface_name: str, tool_name: str = dcbtool, from_cache: bool = False) -> Dict[str, Dict[str, Any]]: """Get local ETS TLV configuration of the adapter.""" def get_tool(self, interface_name: str, tool_name: str = dcbtool) -> str: """Returns particular tool based on tool name.""" def get_pfc(self, interface_name: str, tool_name: str = dcbtool) -> Dict[str, Dict[str, Any]]: """Get local PFC TLV configuration of the adapter.""" def verify_dcb(self, interface_name: str, dcb_map: dict, dcb_config: dict | None = None, retry: int | None = 6, interval: int | None = 10, switch: object | None = None, switch_port: str | None = None) -> bool: """Verify if DCB configuration is correct.""" def verify_ets(self, interface_name: str, dcb_map: dict, ets_config: dict | None = None) -> bool: """Verify if ETS configuration is correct.""" def verify_pfc(self, interface_name: str, dcb_map: dict, pfc_config: dict | None = None) -> bool: """Verify if PFC configuration is correct.""" def verify_app(self, interface_name: str, dcb_map: dict, app_config: dict | None = None) -> bool: """Verify if APP TLV configuration is correct.""" ``` -------------------------------- ### ETS Configuration API Source: https://github.com/intel/mfd-dcb/blob/main/README.md APIs for setting and getting the ETS minimum rate configuration on network interfaces. ```APIDOC ## set_ets_min_rate ### Description Configure ETS on an interface. ### Method Not specified (likely a method within a class) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **interface_name** (str) - Required - The name of the network interface. - **ets** (List[int]) - Required - The ETS minimum rate configuration. ### Request Example ```json { "interface_name": "eth0", "ets": [1000, 2000, 3000] } ``` ### Response #### Success Response (200) None (None) #### Response Example None ## get_ets_min_rate ### Description Read current ETS bandwidth table. ### Method Not specified (likely a method within a class) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **interface_name** (str) - Required - The name of the network interface. ### Request Example ```json { "interface_name": "eth0" } ``` ### Response #### Success Response (200) - **ets** (List[int]) - The current ETS bandwidth table. #### Response Example ```json { "ets": [1000, 2000, 3000] } ``` ``` -------------------------------- ### DCB Willing Status API Source: https://github.com/intel/mfd-dcb/blob/main/README.md APIs to get and set the willing status of DCB configuration on the server. ```APIDOC ## GET /intel/mfd-dcb/is_willing ### Description Get Willing status of DCB configuration on the server. ### Method GET ### Endpoint /intel/mfd-dcb/is_willing ### Parameters None ### Request Example None ### Response #### Success Response (200) - **return_value** (bool) - True if willing, False otherwise. #### Response Example ```json { "return_value": true } ``` ## POST /intel/mfd-dcb/set_willing ### Description Turn ON or OFF Willing status of DCB configuration on the server. ### Method POST ### Endpoint /intel/mfd-dcb/set_willing ### Parameters #### Request Body - **enable** (bool) - Required - Enable or disable willing status. - **is_40g_or_later** (bool) - Required - Indicates if the adapter is 40Gbps or later. - **adapter_name** (str) - Optional - The name of the adapter. Defaults to "". - **mode** (str) - Optional - The mode for setting willing status. Defaults to "ieee". ### Request Example ```json { "enable": true, "is_40g_or_later": false, "adapter_name": "eth0", "mode": "ieee" } ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Get PFC Counters for All Priorities Source: https://github.com/intel/mfd-dcb/blob/main/README.md Retrieves the PFC (Priority Flow Control) counter values for all User Priorities on a specified adapter. Requires the adapter description. ```python get_pfc_counters(self, adapter_description: str) -> Dict[int, Dict[str, int]] ``` -------------------------------- ### Get PFC Enabled Bits Source: https://github.com/intel/mfd-dcb/blob/main/README.md Retrieves the remote and local PFC (Priority Flow Control) enable bits for all user priorities on an adapter. This function requires the adapter name, adapter description, and a flag indicating if it's a 40G or later adapter. ```python get_pfc_enabled_bits(self, adapter_name: str, adapter_description: str, is_40g_or_later: bool -> Optional[tuple] ``` -------------------------------- ### Get PFC Port Statistics Source: https://github.com/intel/mfd-dcb/blob/main/README.md Retrieves PFC (Priority Flow Control) RX/TX XOFF and XON counters for a specific priority on a given port. Requires the adapter description and the priority level. ```python get_pfc_port_statistics(self, adapter_description: str, priority: int) -> Dict[str, int] ``` -------------------------------- ### Get DCB Operational Value Source: https://github.com/intel/mfd-dcb/blob/main/README.md Retrieves the operational value for a given DCB setting on an adapter. Requires the adapter description and the DCB setting name. ```python get_dcb_operational_value(self, adapter_description: str, dcb_setting: str) -> str ``` -------------------------------- ### Manage Quality of Service (QoS) Policies Source: https://github.com/intel/mfd-dcb/blob/main/README.md Functions for creating, removing, and retrieving Quality of Service policies. The `set_policy` function creates a policy with a given name, priority, and parameters. `remove_policy` deletes a policy by name, and `get_policies` retrieves all available policies. `verify_policy` checks if the current policies match expected ones. ```python set_policy(self, name: str, priority: int, parameters: str = "") -> None remove_policy(self, name: str) -> None get_policies(self) -> Dict verify_policy(self, expected_policies: Dict, policies: Dict = None) -> bool ``` -------------------------------- ### Configure Linux DCB Settings with Python Source: https://github.com/intel/mfd-dcb/blob/main/README.md This Python script demonstrates how to use the LinuxDcb class to configure various Data Center Bridging (DCB) parameters on a Linux interface. It includes setting ETS, PFC, DCBX mode, and willing status, as well as retrieving configuration details and PFC counters. Dependencies include 'mfd_dcb' and 'mfd_connect' libraries. ```python from mfd_dcb import Dcb from mfd_dcb import LinuxDcb from mfd_connect import SSHConnection conn = SSHConnection(username="xxx", password="xxx", ip="x.x.x.x") dcb_obj = LinuxDcb(connection=conn) user_priority_mapping = [(0, 1), (3, 2), (5, 4), (6, 7)] bandwidth_per_traffic_class = [25, 25, 25, 25] print(dcb_obj.set_ets(user_priority_mapping, bandwidth_per_traffic_class, interface_name="eth4", mode="ieee")) pfc_per_priority = [False, True, True, False, False, False, False, False] print(dcb_obj.set_pfc(interface_name="eth4",pfc_per_priority=pfc_per_priority)) print(dcb_obj.restart_lldpad()) print(dcb_obj.set_dcbx_mode(interface_name="eth4", mode="ieee")) print(dcb_obj.is_sw_dcb_mode_enabled(interface_name="eth4")) print(dcb_obj.is_sw_dcb_mode_enabled(interface_name="eth4", dcbx_mode="ieee")) print(dcb_obj.set_willing(interface_name="eth4", enable=True, mode="ieee", is_fwlldp_enabled=False)) print(dcb_obj.set_willing(interface_name="eth4", enable=True, mode="ieee", is_fwlldp_enabled=True)) print(dcb_obj.set_willing(interface_name="eth4", enable=True, mode="cee", is_fwlldp_enabled=True)) print(dcb_obj.set_willing(interface_name="eth4", enable=False, mode="cee", is_fwlldp_enabled=False)) print(dcb_obj.get_pfc_counters(interface_name="enp59s0f1")) print(dcb_obj.get_pfc_counters(interface_name="enp59s0f1", is_40g_adapter=True)) print(dcb_obj.get_pfc_counters(interface_name="enp94s0f0", is_10g_adapter=True)) print(dcb_obj.remove_lldpad_conf()) print(dcb_obj.get_dcb(interface_name="eth4", tool_name="dcbnl")) print(dcb_obj.get_ets(interface_name="eth4", tool_name="dcbnl")) print(dcb_obj.get_app(interface_name="eth4", tool_name="dcbnl")) print(dcb_obj.get_pfc(interface_name="eth4", tool_name="dcbnl")) print(dcb_obj.get_dcb(interface_name="eth4", tool_name="dcbtool")) print(dcb_obj.get_ets(interface_name="eth4", tool_name="dcbtool")) print(dcb_obj.get_app(interface_name="eth4", tool_name="dcbtool")) print(dcb_obj.get_pfc(interface_name="eth4", tool_name="dcbtool")) DCB_MAP = { "LOCAL_ETS": { "0": {"TSA": "ETS", "Bandwidth": 40, "Priorities": [0, 1, 2, 5, 6, 7]}, "1": {"TSA": "ETS", "Bandwidth": 30, "Priorities": [3]}, "2": {"TSA": "ETS", "Bandwidth": 30, "Priorities": [4]}, }, "LOCAL_PFC": [False, False, False, True, True, False, False, False], "LOCAL_APP": {"3260": {"Priority": 4, "Protocol": "TCP"}}, } print(dcb_obj.verify_dcb(interface_name="eth4", dcb_map=DCB_MAP)) print(dcb_obj.verify_ets(interface_name="eth4", dcb_map=DCB_MAP)) print(dcb_obj.verify_pfc(interface_name"eth4", dcb_map=DCB_MAP)) print(dcb_obj.verify_app(interface_name"eth4", dcb_map=DCB_MAP)) ``` -------------------------------- ### DCB Verification API Source: https://github.com/intel/mfd-dcb/blob/main/README.md APIs to verify the correctness of DCB, ETS, PFC, and APP configurations. ```APIDOC ## POST /intel/mfd-dcb/verify_dcb ### Description Verify if the DCB configuration is correct for a given adapter against expected settings. ### Method POST ### Endpoint /intel/mfd-dcb/verify_dcb ### Parameters #### Request Body - **adapter_name** (str) - Required - The name of the adapter. - **dcb_map** (Dict[str, Dict[str, str]]) - Required - A map defining the expected DCB configuration parameters. - **dcb_config** (Optional[Dict[str, str]]) - Optional - The actual DCB configuration to verify. If not provided, the current configuration will be used. ### Request Example ```json { "adapter_name": "eth0", "dcb_map": { "PFC": {"enabled": "true"}, "ETS": {"bandwidth": "100"} }, "dcb_config": { "PFC": "true", "ETS": "100" } } ``` ### Response #### Success Response (200) - **verification_result** (bool) - True if the DCB configuration matches the expected settings, False otherwise. #### Response Example ```json { "verification_result": true } ``` ## POST /intel/mfd-dcb/verify_ets ### Description Verify if the ETS configuration is correct for a given adapter against expected settings. ### Method POST ### Endpoint /intel/mfd-dcb/verify_ets ### Parameters #### Request Body - **adapter_name** (str) - Required - The name of the adapter. - **dcb_map** (Dict[str, Dict[str, str]]) - Required - A map defining the expected ETS configuration parameters. - **ets_config** (Optional[Dict[str, Dict[str, str]]]) - Optional - The actual ETS configuration to verify. If not provided, the current configuration will be used. ### Request Example ```json { "adapter_name": "eth0", "dcb_map": { "priority_group": {"0": "[0, 1]"}, "min_bandwidth": {"0": "50"} }, "ets_config": { "priority_group": {"0": [0, 1]}, "min_bandwidth": {"0": 50} } } ``` ### Response #### Success Response (200) - **verification_result** (bool) - True if the ETS configuration matches the expected settings, False otherwise. #### Response Example ```json { "verification_result": true } ``` ## POST /intel/mfd-dcb/verify_pfc ### Description Verify if the PFC configuration is correct for a given adapter against expected settings. ### Method POST ### Endpoint /intel/mfd-dcb/verify_pfc ### Parameters #### Request Body - **adapter_name** (str) - Required - The name of the adapter. - **dcb_map** (Dict[str, List[bool]]) - Required - A map defining the expected PFC configuration (enabled priorities). - **pfc_config** (Optional[Dict[str, List[bool]]]) - Optional - The actual PFC configuration to verify. If not provided, the current configuration will be used. ### Request Example ```json { "adapter_name": "eth0", "dcb_map": { "enabled_priorities": [true, false, true] }, "pfc_config": { "enabled_priorities": [true, false, true] } } ``` ### Response #### Success Response (200) - **verification_result** (bool) - True if the PFC configuration matches the expected settings, False otherwise. #### Response Example ```json { "verification_result": true } ``` ## POST /intel/mfd-dcb/verify_app ### Description Verify if the APP TLV configuration is correct for a given adapter against expected settings. ### Method POST ### Endpoint /intel/mfd-dcb/verify_app ### Parameters #### Request Body - **adapter_name** (str) - Required - The name of the adapter. - **dcb_map** (Dict[str, Dict[str, str]]) - Required - A map defining the expected APP TLV configuration parameters. - **app_config** (Optional[Dict[str, Dict[str, str]]]) - Optional - The actual APP TLV configuration to verify. If not provided, the current configuration will be used. ### Request Example ```json { "adapter_name": "eth0", "dcb_map": { "protocol_id": {"value": "0x010C"}, "priority": {"value": "3"} }, "app_config": { "protocol_id": "0x010C", "priority": "3" } } ``` ### Response #### Success Response (200) - **verification_result** (bool) - True if the APP TLV configuration matches the expected settings, False otherwise. #### Response Example ```json { "verification_result": true } ``` ``` -------------------------------- ### Verify APP TLV Configuration Source: https://github.com/intel/mfd-dcb/blob/main/README.md Verifies if the APP TLV configuration on an adapter matches the expected configuration. It takes the adapter name, a map of DCB settings, and an optional APP configuration dictionary. ```python verify_app(self, adapter_name: str, dcb_map: Dict[str, Dict[str, str]], app_config: Optional[Dict[str, Dict[str, str]]] = None) -> bool ``` -------------------------------- ### Verify DCB Configuration Source: https://github.com/intel/mfd-dcb/blob/main/README.md Verifies if the current DCB configuration matches the expected configuration. It takes the adapter name, a dictionary mapping DCB settings to their expected values, and an optional current DCB configuration. ```python verify_dcb(self, adapter_name: str, dcb_map: Dict[str, Dict[str, str]], dcb_config: Optional[Dict[str, str]] = None) -> bool ``` -------------------------------- ### Verify PFC Configuration Source: https://github.com/intel/mfd-dcb/blob/main/README.md Verifies if the PFC configuration on an adapter matches the expected configuration. It takes the adapter name, a map of DCB settings, and an optional PFC configuration dictionary. ```python verify_pfc(self, adapter_name: str, dcb_map: Dict[str, List[bool]], pfc_config: Optional[Dict[str, List[bool]]] = None) -> bool ``` -------------------------------- ### Generate MFD DCB Docs using Python Source: https://github.com/intel/mfd-dcb/blob/main/sphinx-doc/README.md This snippet shows the shell command to initiate the documentation generation process for MFD DCB using Python. It assumes a Python environment is set up and activated, and the user is in the correct directory. ```shell python generate_docs.py ``` -------------------------------- ### Get Max Supported Traffic Class Source: https://github.com/intel/mfd-dcb/blob/main/README.md Retrieves the maximum number of traffic classes supported by the current adapter. This depends on whether the adapter is 40G or later and requires a DeviceID object. ```python get_dcb_max_supported_traffic_class(self, is_40g_or_later: bool, device_id: "DeviceID") -> int ``` -------------------------------- ### QoS Policy Management API Source: https://github.com/intel/mfd-dcb/blob/main/README.md APIs to manage Quality of Service (QoS) policies, including creation, removal, and retrieval. ```APIDOC ## POST /intel/mfd-dcb/set_policy ### Description Create a Quality of Service (QoS) policy. ### Method POST ### Endpoint /intel/mfd-dcb/set_policy ### Parameters #### Request Body - **name** (str) - Required - The name of the QoS policy. - **priority** (int) - Required - The priority level for the policy. - **parameters** (str) - Optional - Additional parameters for the policy. Defaults to "". ### Request Example ```json { "name": "high_priority_traffic", "priority": 5, "parameters": "bandwidth=80%" } ``` ### Response #### Success Response (200) None #### Response Example None ## DELETE /intel/mfd-dcb/remove_policy ### Description Remove a Quality of Service (QoS) policy by its name. ### Method DELETE ### Endpoint /intel/mfd-dcb/remove_policy ### Parameters #### Query Parameters - **name** (str) - Required - The name of the QoS policy to remove. ### Request Example None ### Response #### Success Response (200) None #### Response Example None ## GET /intel/mfd-dcb/get_policies ### Description Get all available Quality of Service (QoS) policies. ### Method GET ### Endpoint /intel/mfd-dcb/get_policies ### Parameters None ### Request Example None ### Response #### Success Response (200) - **policies** (Dict) - A dictionary containing all available QoS policies. #### Response Example ```json { "policies": { "policy1": {"priority": 3, "parameters": ""}, "policy2": {"priority": 5, "parameters": "bandwidth=50%"} } } ``` ## POST /intel/mfd-dcb/verify_policy ### Description Verify if the expected NetQosPolicies are correct. ### Method POST ### Endpoint /intel/mfd-dcb/verify_policy ### Parameters #### Request Body - **expected_policies** (Dict) - Required - A dictionary representing the expected QoS policies. - **policies** (Dict) - Optional - A dictionary representing the actual QoS policies to verify. If not provided, the current policies will be used. ### Request Example ```json { "expected_policies": { "policy1": {"priority": 3, "parameters": ""} }, "policies": { "policy1": {"priority": 3, "parameters": ""}, "policy2": {"priority": 5, "parameters": "bandwidth=50%"} } } ``` ### Response #### Success Response (200) - **verification_result** (bool) - True if the policies match the expectation, False otherwise. #### Response Example ```json { "verification_result": true } ``` ``` -------------------------------- ### Verify ETS Configuration Source: https://github.com/intel/mfd-dcb/blob/main/README.md Verifies if the ETS configuration on an adapter matches the expected configuration. It takes the adapter name, a map of DCB settings, and an optional ETS configuration dictionary. ```python verify_ets(self, adapter_name: str, dcb_map: Dict[str, Dict[str, str]], ets_config: Optional[Dict[str, Dict[str, str]]] = None) -> bool ``` -------------------------------- ### DCB Configuration Retrieval API Source: https://github.com/intel/mfd-dcb/blob/main/README.md APIs to retrieve complete DCB configuration and specific TLV configurations (ETS, PFC, APP) for a given adapter. ```APIDOC ## GET /intel/mfd-dcb/get_dcb ### Description Get the complete DCB configuration for ETS, PFC, and APP TLVs, including local and remote settings for a specific adapter. ### Method GET ### Endpoint /intel/mfd-dcb/get_dcb ### Parameters #### Query Parameters - **adapter_name** (str) - Required - The name of the adapter. ### Request Example None ### Response #### Success Response (200) - **dcb_config** (Dict) - A dictionary containing the full DCB configuration. #### Response Example ```json { "dcb_config": { "ets": {"local": {...}, "remote": {...}}, "pfc": {"local": {...}, "remote": {...}}, "app": {"local": {...}, "remote": {...}} } } ``` ## GET /intel/mfd-dcb/get_ets ### Description Get the local ETS TLV configuration of the adapter. ### Method GET ### Endpoint /intel/mfd-dcb/get_ets ### Parameters #### Query Parameters - **adapter_name** (str) - Required - The name of the adapter. - **from_cache** (bool) - Optional - Whether to retrieve the configuration from cache. Defaults to `false`. ### Request Example None ### Response #### Success Response (200) - **ets_config** (Dict) - A dictionary containing the local ETS configuration. #### Response Example ```json { "ets_config": { "priority_group": [0, 3], "strict_priority": 0, "min_bandwidth": [100, 0] } } ``` ## GET /intel/mfd-dcb/get_pfc ### Description Get the local PFC TLV configuration of the adapter. ### Method GET ### Endpoint /intel/mfd-dcb/get_pfc ### Parameters #### Query Parameters - **adapter_name** (str) - Required - The name of the adapter. - **from_cache** (bool) - Optional - Whether to retrieve the configuration from cache. Defaults to `false`. ### Request Example None ### Response #### Success Response (200) - **pfc_config** (Dict) - A dictionary containing the local PFC configuration. #### Response Example ```json { "pfc_config": { "enabled_priorities": [0, 3, 4], "disable_pg": [1, 2, 5, 6, 7] } } ``` ## GET /intel/mfd-dcb/get_app ### Description Get the local APP TLV configuration of the adapter. ### Method GET ### Endpoint /intel/mfd-dcb/get_app ### Parameters #### Query Parameters - **adapter_name** (str) - Required - The name of the adapter. - **from_cache** (bool) - Optional - Whether to retrieve the configuration from cache. Defaults to `false`. ### Request Example None ### Response #### Success Response (200) - **app_config** (Dict) - A dictionary containing the local APP configuration. #### Response Example ```json { "app_config": { "protocol_id": "0x010C", "priority": 3 } } ``` ## GET /intel/mfd-dcb/get_remote_ets ### Description Get the remote ETS TLV configuration of the adapter. ### Method GET ### Endpoint /intel/mfd-dcb/get_remote_ets ### Parameters #### Query Parameters - **adapter_name** (str) - Required - The name of the adapter. - **from_cache** (bool) - Optional - Whether to retrieve the configuration from cache. Defaults to `false`. ### Request Example None ### Response #### Success Response (200) - **remote_ets_config** (Dict) - A dictionary containing the remote ETS configuration. #### Response Example ```json { "remote_ets_config": { "priority_group": [0, 3], "strict_priority": 0, "min_bandwidth": [100, 0] } } ``` ## GET /intel/mfd-dcb/get_remote_pfc ### Description Get the remote PFC TLV configuration of the adapter. ### Method GET ### Endpoint /intel/mfd-dcb/get_remote_pfc ### Parameters #### Query Parameters - **adapter_name** (str) - Required - The name of the adapter. - **from_cache** (bool) - Optional - Whether to retrieve the configuration from cache. Defaults to `false`. ### Request Example None ### Response #### Success Response (200) - **remote_pfc_config** (Dict) - A dictionary containing the remote PFC configuration. #### Response Example ```json { "remote_pfc_config": { "enabled_priorities": [0, 3, 4], "disable_pg": [1, 2, 5, 6, 7] } } ``` ## GET /intel/mfd-dcb/get_remote_app ### Description Get the remote APP TLV configuration of the adapter. ### Method GET ### Endpoint /intel/mfd-dcb/get_remote_app ### Parameters #### Query Parameters - **adapter_name** (str) - Required - The name of the adapter. - **from_cache** (bool) - Optional - Whether to retrieve the configuration from cache. Defaults to `false`. ### Request Example None ### Response #### Success Response (200) - **remote_app_config** (Dict) - A dictionary containing the remote APP configuration. #### Response Example ```json { "remote_app_config": { "protocol_id": "0x010C", "priority": 3 } } ``` ``` -------------------------------- ### Get PFC Mode from Interface (Python) Source: https://github.com/intel/mfd-dcb/blob/main/README.md Retrieves the current Priority Flow Control (PFC) mode configured on a specified network interface. This function is part of the MFD DCB API for FreeBSD. It takes the interface name as input and returns the current PFC mode. ```python get_pfc_mode(self, interface_name: str) -> PfcMode: ```