Best Python code snippet using lisa_python
dpdkutil.py
Source:dpdkutil.py
...222 except UnsupportedDistroException as err:223 # forward message from distro exception224 raise SkippedException(err)225 # verify SRIOV is setup as-expected on the node after compat check226 node.nics.wait_for_sriov_enabled()227 # create tool, initialize testpmd tool (installs dpdk)228 testpmd: DpdkTestpmd = node.tools.get(229 DpdkTestpmd,230 dpdk_source=dpdk_source,231 dpdk_branch=dpdk_branch,232 sample_apps=sample_apps,233 )234 # init and enable hugepages (required by dpdk)235 init_hugepages(node)236 assert_that(len(node.nics)).described_as(237 "Test needs at least 1 NIC on the test node."238 ).is_greater_than_or_equal_to(1)239 test_nic = node.nics.get_nic_by_index()240 # check an assumption that our nics are bound to hv_netvsc...
nic.py
Source:nic.py
...231 def reload(self) -> None:232 self.nics.clear()233 self._initialize()234 @retry(tries=15, delay=3, backoff=1.15)235 def wait_for_sriov_enabled(self) -> None:236 lspci = self._node.tools[Lspci]237 # check for VFs on the guest238 vfs = lspci.get_devices_by_type(constants.DEVICE_TYPE_SRIOV, force_run=True)239 assert_that(len(vfs)).described_as(240 "Could not identify any SRIOV NICs on the test node."241 ).is_not_zero()242 # check if the NIC driver has finished setting up the243 # failsafe pair, reload if not244 if not self.get_lower_nics():245 self.reload()246 if not self.get_lower_nics():247 assert_that(self.get_lower_nics()).described_as(248 "Did not detect any upper/lower sriov paired nics!: "249 f"upper: {self.get_upper_nics()} "...
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!!