How to use _load_drivers_for_dpdk method in lisa

Best Python code snippet using lisa_python

dpdktestpmd.py

Source:dpdktestpmd.py Github

copy

Full Screen

...460 f"Installed DPDK version {str(self._dpdk_version_info)} "461 "from package manager"462 )463 self.find_testpmd_binary()464 self._load_drivers_for_dpdk()465 return True466 # otherwise install from source tarball or git467 self.node.log.info(f"Installing dpdk from source: {self._dpdk_source}")468 self._dpdk_repo_path_name = "dpdk"469 self.dpdk_path = self.node.working_path.joinpath(self._dpdk_repo_path_name)470 if self.find_testpmd_binary(471 assert_on_fail=False, check_path="/usr/local/bin"472 ): # tools are already installed473 return True474 git_tool = node.tools[Git]475 echo_tool = node.tools[Echo]476 if self._dpdk_source and self._dpdk_source.endswith(".tar.gz"):477 wget_tool = node.tools[Wget]478 tar_tool = node.tools[Tar]479 if self._dpdk_branch:480 node.log.warn(481 (482 "DPDK tarball source does not need dpdk_branch defined. "483 "User-defined variable dpdk_branch will be ignored."484 )485 )486 working_path = str(node.working_path)487 wget_tool.get(488 self._dpdk_source,489 working_path,490 )491 dpdk_filename = self._dpdk_source.split("/")[-1]492 # extract tar into dpdk/ folder and discard old root folder name493 tar_tool.extract(494 str(node.working_path.joinpath(dpdk_filename)),495 str(self.dpdk_path),496 strip_components=1,497 )498 self.set_version_info_from_source_install(499 self._dpdk_source, self._version_info_from_tarball_regex500 )501 else:502 git_tool.clone(503 self._dpdk_source,504 cwd=node.working_path,505 dir_name=self._dpdk_repo_path_name,506 )507 if not self._dpdk_branch:508 # dpdk stopped using a default branch509 # if a branch is not specified, get latest version tag.510 self._dpdk_branch = git_tool.get_tag(511 self.dpdk_path, filter=r"^v.*" # starts w 'v'512 )513 git_tool.checkout(self._dpdk_branch, cwd=self.dpdk_path)514 self.set_version_info_from_source_install(515 self._dpdk_branch, self._version_info_from_git_tag_regex516 )517 self._load_drivers_for_dpdk()518 # add sample apps to compilation if they are present519 if self._sample_apps_to_build:520 sample_apps = f"-Dexamples={','.join(self._sample_apps_to_build)}"521 else:522 sample_apps = ""523 node.execute(524 f"meson {sample_apps} build",525 shell=True,526 cwd=self.dpdk_path,527 expected_exit_code=0,528 expected_exit_code_failure_message=(529 "meson build for dpdk failed, check that"530 "dpdk build has not changed to eliminate the use of meson or "531 "meson version is compatible with this dpdk version and OS."532 ),533 )534 self.dpdk_build_path = self.dpdk_path.joinpath("build")535 node.execute(536 "ninja",537 cwd=self.dpdk_build_path,538 timeout=1800,539 expected_exit_code=0,540 expected_exit_code_failure_message=(541 "ninja build for dpdk failed. check build spew for missing headers "542 "or dependencies. Also check that this ninja version requirement "543 "has not changed for dpdk."544 ),545 )546 node.execute(547 "ninja install",548 cwd=self.dpdk_build_path,549 sudo=True,550 expected_exit_code=0,551 expected_exit_code_failure_message=(552 "ninja install failed for dpdk binaries."553 ),554 )555 node.execute(556 "ldconfig",557 cwd=self.dpdk_build_path,558 sudo=True,559 expected_exit_code=0,560 expected_exit_code_failure_message="ldconfig failed, check for error spew.",561 )562 library_bashrc_lines = [563 "export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/usr/local/lib64/pkgconfig/",564 "export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib64/",565 ]566 echo_tool.write_to_file(567 ";".join(library_bashrc_lines),568 node.get_pure_path("~/.bashrc"),569 append=True,570 )571 self.find_testpmd_binary(check_path="/usr/local/bin")572 return True573 def _load_drivers_for_dpdk(self) -> None:574 self.node.log.info("Loading drivers for infiniband, rdma, and mellanox hw...")575 if self.is_connect_x3:576 mellanox_drivers = ["mlx4_core", "mlx4_ib"]577 else:578 mellanox_drivers = ["mlx5_core", "mlx5_ib"]579 modprobe = self.node.tools[Modprobe]580 if isinstance(self.node.os, Ubuntu):581 # Ubuntu shouldn't need any special casing, skip to loading rdma/ib582 pass583 elif isinstance(self.node.os, Debian):584 # NOTE: debian buster doesn't include rdma and ib drivers585 # on 5.4 specifically for linux-image-cloud:586 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1012639587 # for backports on this release we should update the kernel to latest...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful