Best Python code snippet using lisa_python
performance.py
Source:performance.py
...405 ),406 ]407 )408 # capture existing stats to calculate delta409 original_forwarded_count = get_forwarded_count(410 node=forwarder,411 nic=forwarder_nic,412 previous_count=0,413 log=log,414 )415 original_dropped_count = get_dropped_count(416 node=receiver,417 nic=receiver_nic,418 previous_count=0,419 log=log,420 )421 try:422 # start xdpdump423 forwarder_xdpdump.start_async(nic_name=forwarder_nic.upper, timeout=0)424 receiver_xdpdump.start_async(nic_name=receiver_nic.upper, timeout=0)425 pktgen_result = self._send_packets(426 is_multi_threads, sender, pktgen, sender_nic, forwarder_nic427 )428 self._wait_packets_proceeded(429 log, receiver, receiver_nic, original_dropped_count430 )431 finally:432 # kill xdpdump processes.433 forwarder_kill = forwarder.tools[Kill]434 forwarder_kill.by_name("xdpdump")435 receiver_kill = receiver.tools[Kill]436 receiver_kill.by_name("xdpdump")437 # capture stats to calculate delta438 dropped_count = get_dropped_count(439 node=receiver,440 nic=receiver_nic,441 previous_count=original_dropped_count,442 log=log,443 )444 forwarded_count = get_forwarded_count(445 node=forwarder,446 nic=forwarder_nic,447 previous_count=original_forwarded_count,448 log=log,449 )450 # In some nodes like synthetic nic, there is no forward counter,451 # so count it by dropped count.452 validate_count = forwarded_count453 if not validate_count:454 validate_count = dropped_count455 log.debug(456 f"sender pktgen result: {pktgen_result}, "457 f"on forwarder: {forwarded_count}, "458 f"on receiver: {dropped_count}"...
common.py
Source:common.py
...25 xdpdump = node.tools[XdpDump]26 except UnsupportedDistroException as identifier:27 raise SkippedException(identifier)28 return xdpdump29def get_forwarded_count(30 node: Node, nic: NicInfo, previous_count: int, log: Logger31) -> int:32 return _aggregate_count(33 node=node,34 nic=nic,35 previous_count=previous_count,36 log=log,37 counter_name="xdp forwarded",38 patterns=_tx_forwarded_patterns,39 )40def get_dropped_count(41 node: Node, nic: NicInfo, previous_count: int, log: Logger42) -> int:43 return _aggregate_count(...
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!!