Best Python code snippet using lisa_python
dpdktestpmd.py
Source:dpdktestpmd.py
...359 )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)...
dpdkutil.py
Source:dpdkutil.py
...341 "txonly",342 pmd,343 )344 testpmd.run_for_n_seconds(testpmd_cmd, 10)345 tx_pps = testpmd.get_mean_tx_pps()346 log.info(347 f"TX-PPS:{tx_pps} from {test_nic.upper}/{test_nic.lower}:"348 + f"{test_nic.pci_slot}"349 )350 assert_that(tx_pps).described_as(351 f"TX-PPS ({tx_pps}) should have been greater than 2^20 (~1m) PPS."352 ).is_greater_than(2**20)353def verify_dpdk_send_receive(354 environment: Environment,355 log: Logger,356 variables: Dict[str, Any],357 pmd: str,358 use_max_nics: bool = False,359 use_service_cores: int = 1,360) -> Tuple[DpdkTestResources, DpdkTestResources]:361 # helpful to have the public ips labeled for debugging362 external_ips = []363 for node in environment.nodes.list():364 if isinstance(node, RemoteNode):365 external_ips += node.connection_info[366 constants.ENVIRONMENTS_NODES_REMOTE_ADDRESS367 ]368 else:369 raise SkippedException()370 log.debug((f"\nsender:{external_ips[0]}\nreceiver:{external_ips[1]}\n"))371 test_kits = init_nodes_concurrent(environment, log, variables, pmd)372 check_send_receive_compatibility(test_kits)373 sender, receiver = test_kits374 kit_cmd_pairs = generate_send_receive_run_info(375 pmd,376 sender,377 receiver,378 use_max_nics=use_max_nics,379 use_service_cores=use_service_cores,380 )381 results = run_testpmd_concurrent(kit_cmd_pairs, 15, log)382 # helpful to have the outputs labeled383 log.debug(f"\nSENDER:\n{results[sender]}")384 log.debug(f"\nRECEIVER:\n{results[receiver]}")385 rcv_rx_pps = receiver.testpmd.get_mean_rx_pps()386 snd_tx_pps = sender.testpmd.get_mean_tx_pps()387 log.info(f"receiver rx-pps: {rcv_rx_pps}")388 log.info(f"sender tx-pps: {snd_tx_pps}")389 # differences in NIC type throughput can lead to different snd/rcv counts390 assert_that(rcv_rx_pps).described_as(391 "Throughput for RECEIVE was below the correct order-of-magnitude"392 ).is_greater_than(2**20)393 assert_that(snd_tx_pps).described_as(394 "Throughput for SEND was below the correct order of magnitude"395 ).is_greater_than(2**20)396 return sender, receiver397def verify_dpdk_send_receive_multi_txrx_queue(398 environment: Environment,399 log: Logger,400 variables: Dict[str, Any],401 pmd: str,402 use_max_nics: bool = False,403 use_service_cores: int = 1,404) -> Tuple[DpdkTestResources, DpdkTestResources]:405 test_kits = init_nodes_concurrent(environment, log, variables, pmd)406 check_send_receive_compatibility(test_kits)407 sender, receiver = test_kits408 kit_cmd_pairs = generate_send_receive_run_info(409 pmd,410 sender,411 receiver,412 txq=4,413 rxq=4,414 use_max_nics=use_max_nics,415 use_service_cores=use_service_cores,416 )417 results = run_testpmd_concurrent(kit_cmd_pairs, 15, log)418 # helpful to have the outputs labeled419 log.debug(f"\nSENDER:\n{results[sender]}")420 log.debug(f"\nRECEIVER:\n{results[receiver]}")421 rcv_rx_pps = receiver.testpmd.get_mean_rx_pps()422 snd_tx_pps = sender.testpmd.get_mean_tx_pps()423 log.info(f"receiver rx-pps: {rcv_rx_pps}")424 log.info(f"sender tx-pps: {snd_tx_pps}")425 # differences in NIC type throughput can lead to different snd/rcv counts426 # check that throughput it greater than 1m pps as a baseline427 assert_that(rcv_rx_pps).described_as(428 "Throughput for RECEIVE was below the correct order-of-magnitude"429 ).is_greater_than(2**20)430 assert_that(snd_tx_pps).described_as(431 "Throughput for SEND was below the correct order of magnitude"432 ).is_greater_than(2**20)...
dpdkperf.py
Source:dpdkperf.py
...364 # send side fields365 sender = send_kit.testpmd366 sender_fields["role"] = "sender"367 sender_fields["tx_pps_maximum"] = sender.get_max_tx_pps()368 sender_fields["tx_pps_average"] = sender.get_mean_tx_pps()369 sender_fields["tx_pps_minimum"] = sender.get_min_tx_pps()370 # receive side fields371 receiver = receive_kit.testpmd372 receiver_fields["role"] = "receiver/forwarder"373 receiver_fields["rx_pps_maximum"] = receiver.get_max_rx_pps()374 receiver_fields["rx_pps_average"] = receiver.get_mean_rx_pps()375 receiver_fields["rx_pps_minimum"] = receiver.get_min_rx_pps()376 send_results = create_perf_message(377 NetworkPPSPerformanceMessage,378 send_kit.node,379 test_result,380 test_case_name,381 sender_fields,382 )...
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!!