Best Python code snippet using lisa_python
dpdktestpmd.py
Source:dpdktestpmd.py
...357 self.tx_pps_data = self.get_data_from_testpmd_output(358 self._tx_pps_key, self._last_run_output359 )360 def get_mean_rx_pps(self) -> int:361 self._check_pps_data("RX")362 return _mean(self.rx_pps_data)363 def get_mean_tx_pps(self) -> int:364 self._check_pps_data("TX")365 return _mean(self.tx_pps_data)366 def get_max_rx_pps(self) -> int:367 self._check_pps_data("RX")368 return max(self.rx_pps_data)369 def get_max_tx_pps(self) -> int:370 self._check_pps_data("TX")371 return max(self.tx_pps_data)372 def get_min_rx_pps(self) -> int:373 self._check_pps_data("RX")374 return min(self.rx_pps_data)375 def get_min_tx_pps(self) -> int:376 self._check_pps_data("TX")377 return min(self.tx_pps_data)378 def get_mean_tx_pps_sriov_rescind(self) -> Tuple[int, int, int]:379 return self._get_pps_sriov_rescind(self._tx_pps_key)380 def get_mean_rx_pps_sriov_rescind(self) -> Tuple[int, int, int]:381 return self._get_pps_sriov_rescind(self._rx_pps_key)382 def add_sample_apps_to_build_list(self, apps: Union[List[str], None]) -> None:383 if apps:384 self._sample_apps_to_build = apps385 else:386 self._sample_apps_to_build = []387 def __init__(self, *args: Any, **kwargs: Any) -> None:388 super().__init__(*args, **kwargs)389 self._dpdk_source = kwargs.pop("dpdk_source", PACKAGE_MANAGER_SOURCE)390 self._dpdk_branch = kwargs.pop("dpdk_branch", "main")391 self._sample_apps_to_build = kwargs.pop("sample_apps", [])392 self._dpdk_version_info = VersionInfo(0, 0)393 self._testpmd_install_path: str = ""394 self.find_testpmd_binary(assert_on_fail=False)395 def _determine_network_hardware(self) -> None:396 lspci = self.node.tools[Lspci]397 device_list = lspci.get_devices()398 self.is_connect_x3 = any(399 ["ConnectX-3" in dev.device_info for dev in device_list]400 )401 def _check_pps_data_exists(self, rx_or_tx: str) -> None:402 data_attr_name = f"{rx_or_tx.lower()}_pps_data"403 assert_that(hasattr(self, data_attr_name)).described_as(404 (405 f"PPS data ({rx_or_tx}) did not exist for testpmd object. "406 "This indicates either testpmd did not run or the suite is "407 "missing an assert. Contact the test maintainer."408 )409 ).is_true()410 def _check_pps_data(self, rx_or_tx: str) -> None:411 self._check_pps_data_exists(rx_or_tx)412 data_set: List[int] = []413 if rx_or_tx == "RX":414 data_set = self.rx_pps_data415 elif rx_or_tx == "TX":416 data_set = self.tx_pps_data417 else:418 fail(419 "Identifier passed to _check_pps_data was not recognized, "420 f"must be RX or TX. Found {rx_or_tx}"421 )422 assert_that(any(data_set)).described_as(423 f"any({str(data_set)}) resolved to false. Test data was "424 f"empty or all zeroes for dpdktestpmd.{rx_or_tx.lower()}_pps_data."...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!