Best Python code snippet using lisa_python
sriov.py
Source:sriov.py  
...201            network_interface=features.Sriov(),202            supported_platform_type=[AZURE],203        ),204    )205    def verify_sriov_disable_enable(self, environment: Environment) -> None:206        sriov_disable_enable(environment)207    @TestCaseMetadata(208        description="""209        This case verify VM works well after disable and enable PCI device inside VM.210        Steps,211        1. Disable sriov PCI device inside the VM.212        2. Enable sriov PCI device inside the VM.213        3. Do the basic sriov check.214        4. Do VF connection test.215        """,216        priority=2,217        requirement=simple_requirement(218            min_count=2,219            network_interface=features.Sriov(),220        ),...stress.py
Source:stress.py  
...120            network_interface=features.Sriov(),121            supported_platform_type=[AZURE],122        ),123    )124    def verify_stress_sriov_disable_enable(self, environment: Environment) -> None:125        sriov_disable_enable(environment, times=50)126    @TestCaseMetadata(127        description="""128        This case verify VM works well when provison with max (8) synthetic nics.129        Steps,130        1. Provision VM with max network interfaces with synthetic network.131        2. Check each nic has an ip address.132        3. Reboot VM from guest.133        4. Check each nic has an ip address.134        5. Repeat step 3 and 4 for 10 times.135        """,136        priority=2,137        requirement=simple_requirement(138            min_nic_count=8,139            network_interface=schema.NetworkInterfaceOptionSettings(...common.py
Source:common.py  
...181def cleanup_iperf3(environment: Environment) -> None:182    for node in environment.nodes.list():183        kill = node.tools[Kill]184        kill.by_name("iperf3")185def sriov_disable_enable(environment: Environment, times: int = 4) -> None:186    vm_nics = initialize_nic_info(environment)187    sriov_basic_test(environment, vm_nics)188    node = cast(RemoteNode, environment.nodes[0])189    network_interface_feature = node.features[NetworkInterface]190    for _ in range(times):191        sriov_is_enabled = network_interface_feature.is_enabled_sriov()192        if sriov_is_enabled:193            sriov_basic_test(environment, vm_nics)194        network_interface_feature.switch_sriov(enable=(not sriov_is_enabled))195def remove_extra_nics_per_node(node: Node) -> None:196    node = cast(RemoteNode, node)197    network_interface_feature = node.features[NetworkInterface]198    network_interface_feature.remove_extra_nics()199def remove_extra_nics(environment: Environment) -> None:...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!!
