-
Notifications
You must be signed in to change notification settings - Fork 77
Test: Support for PFs in tests fxitures #1274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -24,18 +24,18 @@ def _nicctl_path(self) -> str: | |||||
| return str(self.connection.path(self.mtl_path, "script", self.tool_name)) | ||||||
| return str(self.connection.path(nicctl_path, self.tool_name)) | ||||||
|
|
||||||
| def _parse_vf_list(self, output: str, all: bool = True) -> list: | ||||||
| def _parse_vf_list(self, output: str) -> list: | ||||||
| if "No VFs found" in output: | ||||||
| return [] | ||||||
| vf_info_regex = r"\d{1,3}\s+(.+)\s+vfio" if all else r"(\d{4}:\S+)" | ||||||
| vf_info_regex = r"(\d{4}[0-9a-fA-F:.]+)\(?\S*\)?\s+\S*\s*vfio" | ||||||
| return re.findall(vf_info_regex, output) | ||||||
|
|
||||||
| def vfio_list(self, pci_addr: str = "all") -> list: | ||||||
| """Returns list of VFs created on host.""" | ||||||
| resp = self.connection.execute_command( | ||||||
| f"{self.nicctl} list {pci_addr}", shell=True | ||||||
| ) | ||||||
| return self._parse_vf_list(resp.stdout, "all" in pci_addr) | ||||||
| return self._parse_vf_list(resp.stdout) | ||||||
|
|
||||||
| def create_vfs(self, pci_id: str, num_of_vfs: int = 6) -> list: | ||||||
| """Create VFs on NIC. | ||||||
|
|
@@ -68,3 +68,124 @@ def prepare_vfs_for_test(self, nic: NetworkInterface) -> list: | |||||
| self.create_vfs(nic_pci) | ||||||
| self.host.vfs = self.vfio_list(nic_pci) | ||||||
| return self.host.vfs | ||||||
|
|
||||||
| def bind_pmd(self, pci_id: str) -> None: | ||||||
| """Bind VF to DPDK PMD driver.""" | ||||||
| self.connection.execute_command(self.nicctl + " bind_pmd " + pci_id, shell=True) | ||||||
|
|
||||||
| def bind_kernel(self, pci_id: str) -> None: | ||||||
| """Bind VF to kernel driver.""" | ||||||
| self.connection.execute_command( | ||||||
| self.nicctl + " bind_kernel " + pci_id, shell=True | ||||||
| ) | ||||||
|
|
||||||
|
|
||||||
| class InterfaceSetup: | ||||||
| def __init__(self, hosts, mtl_path): | ||||||
| self.hosts = hosts | ||||||
| self.mtl_path = mtl_path | ||||||
| self.nicctl_objs = { | ||||||
| host.name: Nicctl(mtl_path, host) for host in hosts.values() | ||||||
| } | ||||||
| self.customs = [] | ||||||
| self.cleanups = [] | ||||||
|
|
||||||
| def get_test_interfaces(self, interface_type="VF", count=2, host=None) -> dict: | ||||||
| """ | ||||||
| Creates VFs and binds them into dpdk or bind PF into dpdk. | ||||||
|
|
||||||
| :param interface_type: VF - create X VFs on firt available test adapter, | ||||||
| PF - prepare list of PFs PCI addresses for test, | ||||||
| xxVFxPF - create xx number VFs per each PF. E.G if you need 3 VFs | ||||||
| on every PF and you have 2 PF then pass 3VFxPF param with count=6 | ||||||
| if you type just VFxPF then one VF will be created on each PF. | ||||||
| :param count: total number of VFs or PFs needed for test. | ||||||
| :param host: You can specify host if you need to test only on this host | ||||||
| :return: Returns dictionary with list of PCI addresses of VFs or PFs per host name. | ||||||
| """ | ||||||
| if host: | ||||||
| hosts = [host] | ||||||
| else: | ||||||
| hosts = list(self.hosts.values()) | ||||||
| selected_interfaces = {k.name: [] for k in hosts} | ||||||
| for host in hosts: | ||||||
| if getattr(host.topology.extra_info, "custom_interface", None): | ||||||
| selected_interfaces[host.name] = [ | ||||||
| host.topology.extra_info["custom_interface"] | ||||||
|
||||||
| host.topology.extra_info["custom_interface"] | |
| getattr(host.topology.extra_info, "custom_interface", None) |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -18,3 +18,7 @@ ebu_server: | |||||
| user: user | ||||||
| password: password | ||||||
| proxy: false | ||||||
| interface_type: VF - create X VFs on firt available test adapter, | ||||||
|
||||||
| interface_type: VF - create X VFs on firt available test adapter, | |
| interface_type: VF - create X VFs on first available test adapter, |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,6 +57,7 @@ def execute_test( | |
| test_time: int, | ||
| build: str, | ||
| host, | ||
| nic_port_list, | ||
| type_: str, | ||
| video_format: str, | ||
| pg_format: str, | ||
|
|
@@ -65,13 +66,9 @@ def execute_test( | |
| multiple_sessions: bool = False, | ||
| tx_is_ffmpeg: bool = True, | ||
| ): | ||
| # Initialize logging for this test | ||
| init_test_logging() | ||
|
|
||
| case_id = os.environ.get("PYTEST_CURRENT_TEST", "ffmpeg_test") | ||
| case_id = case_id[: case_id.rfind("(") - 1] if "(" in case_id else case_id | ||
|
|
||
| nic_port_list = host.vfs | ||
| video_size, fps = decode_video_format_16_9(video_format) | ||
|
Comment on lines
70
to
72
|
||
| match output_format: | ||
| case "yuv": | ||
|
|
@@ -234,14 +231,14 @@ def execute_test_rgb24( | |
| test_time: int, | ||
| build: str, | ||
| host, | ||
| nic_port_list, | ||
| type_: str, | ||
| video_format: str, | ||
| pg_format: str, | ||
| video_url: str, | ||
| ): | ||
| # Initialize logging for this test | ||
| init_test_logging() | ||
| nic_port_list = host.vfs | ||
| video_size, fps = decode_video_format_16_9(video_format) | ||
| logger.info(f"Creating RX config for RGB24 test with video_format: {video_format}") | ||
| try: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'firt' to 'first'.