Best Python code snippet using lisa_python
sriov.py
Source:sriov.py
...606 for _, client_nic_info in vm_nics[client_node.name].items():607 # 2. Get initial interrupts sum per irq and cpu number on client node.608 # only collect 'Completion Queue Interrupts' irqs609 initial_pci_interrupts_by_irqs = (610 client_interrupt_inspector.sum_cpu_counter_by_irqs(611 client_nic_info.pci_slot,612 exclude_key_words=["pages", "cmd", "async"],613 )614 )615 assert_that(len(initial_pci_interrupts_by_irqs)).described_as(616 "initial irqs count should be greater than 0"617 ).is_greater_than(0)618 initial_pci_interrupts_by_cpus = (619 client_interrupt_inspector.sum_cpu_counter_by_index(620 client_nic_info.pci_slot621 )622 )623 assert_that(len(initial_pci_interrupts_by_cpus)).described_as(624 "initial cpu count of interrupts should be equal to cpu count"625 ).is_equal_to(client_cpu_count)626 matched_server_nic_info: NicInfo627 for _, server_nic_info in vm_nics[server_node.name].items():628 if (629 server_nic_info.ip_addr.rsplit(".", maxsplit=1)[0]630 == client_nic_info.ip_addr.rsplit(".", maxsplit=1)[0]631 ):632 matched_server_nic_info = server_nic_info633 break634 assert (635 matched_server_nic_info636 ), "not found the server nic has the same subnet of"637 f" {client_nic_info.ip_addr}"638 # 3. Start iperf3 for 120 seconds with 128 threads on client node.639 client_iperf3.run_as_client(640 server_ip=matched_server_nic_info.ip_addr,641 run_time_seconds=120,642 parallel_number=128,643 client_ip=client_nic_info.ip_addr,644 )645 # 4. Get final interrupts sum per irq number on client node.646 final_pci_interrupts_by_irqs = (647 client_interrupt_inspector.sum_cpu_counter_by_irqs(648 client_nic_info.pci_slot,649 exclude_key_words=["pages", "cmd", "async"],650 )651 )652 assert_that(len(final_pci_interrupts_by_irqs)).described_as(653 "final irqs count should be greater than 0"654 ).is_greater_than(0)655 for init_interrupts_irq in initial_pci_interrupts_by_irqs:656 init_irq_number = list(init_interrupts_irq)[0]657 init_interrupts_value = init_interrupts_irq[init_irq_number]658 for final_interrupts in final_pci_interrupts_by_irqs:659 final_irq_number = list(final_interrupts)[0]660 final_interrupts_value = final_interrupts[final_irq_number]661 if init_irq_number == final_irq_number:...
interrupt_inspector.py
Source:interrupt_inspector.py
...76 metadata=matched.group("metadata"),77 )78 )79 return interrupts80 def sum_cpu_counter_by_irqs(81 self,82 pci_slot: str,83 exclude_key_words: Optional[List[str]] = None,84 ) -> List[Dict[str, int]]:85 interrupts_sum_by_irqs: List[Dict[str, int]] = []86 interrupts = self.get_interrupt_data()87 if exclude_key_words is None:88 exclude_key_words = []89 matched_interrupts = [90 x91 for x in interrupts92 if pci_slot in x.metadata93 and all(y not in x.metadata for y in exclude_key_words)94 ]...
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!!