How to use sriov_vf_connection_test method in lisa

Best Python code snippet using lisa_python

sriov.py

Source:sriov.py Github

copy

Full Screen

...98 )99 def verify_sriov_single_vf_connection(self, environment: Environment) -> None:100 vm_nics = initialize_nic_info(environment)101 sriov_basic_test(environment, vm_nics)102 sriov_vf_connection_test(environment, vm_nics)103 @TestCaseMetadata(104 description="""105 This case needs 2 nodes and 64 Vcpus. And it verifies module of sriov network106 interface is loaded and each synthetic nic is paired with one VF, and check107 rx statistics of source and tx statistics of dest increase after send 200 Mb108 file from source to dest.109 Steps,110 1. Check VF of synthetic nic is paired.111 2. Check module of sriov network device is loaded.112 3. Check VF counts listed from lspci is expected.113 4. Setup SSH connection between source and dest with key authentication.114 5. Ping the dest IP from the source machine to check connectivity.115 6. Generate 200Mb file, copy from source to dest.116 7. Check rx statistics of source VF and tx statistics of dest VF is increased.117 """,118 priority=2,119 requirement=simple_requirement(120 min_count=2,121 min_core_count=64,122 network_interface=features.Sriov(),123 ),124 )125 def verify_sriov_single_vf_connection_max_cpu(126 self, environment: Environment127 ) -> None:128 vm_nics = initialize_nic_info(environment)129 sriov_basic_test(environment, vm_nics)130 sriov_vf_connection_test(environment, vm_nics)131 @TestCaseMetadata(132 description="""133 This case needs 2 nodes and 8 nics. And it verifies module of sriov network134 interface is loaded and each synthetic nic is paired with one VF, and check135 rx statistics of source and tx statistics of dest increase after send 200 Mb136 file from source to dest.137 Steps,138 1. Check VF of synthetic nic is paired.139 2. Check module of sriov network device is loaded.140 3. Check VF counts listed from lspci is expected.141 4. Setup SSH connection between source and dest with key authentication.142 5. Ping the dest IP from the source machine to check connectivity.143 6. Generate 200Mb file, copy from source to dest.144 7. Check rx statistics of source VF and tx statistics of dest VF is increased.145 """,146 priority=2,147 requirement=simple_requirement(148 min_count=2,149 network_interface=schema.NetworkInterfaceOptionSettings(150 nic_count=8,151 data_path=schema.NetworkDataPath.Sriov,152 ),153 ),154 )155 def verify_sriov_max_vf_connection(self, environment: Environment) -> None:156 vm_nics = initialize_nic_info(environment)157 sriov_basic_test(environment, vm_nics)158 sriov_vf_connection_test(environment, vm_nics)159 @TestCaseMetadata(160 description="""161 This case needs 2 nodes, 8 nics and 64 Vcpus. And it verifies module of sriov162 network interface is loaded and each synthetic nic is paired with one VF, and163 check rx statistics of source and tx statistics of dest increase after send 200164 Mb file from source to dest.165 Steps,166 1. Check VF of synthetic nic is paired.167 2. Check module of sriov network device is loaded.168 3. Check VF counts listed from lspci is expected.169 4. Setup SSH connection between source and dest with key authentication.170 5. Ping the dest IP from the source machine to check connectivity.171 6. Generate 200Mb file, copy from source to dest.172 7. Check rx statistics of source VF and tx statistics of dest VF is increased.173 """,174 priority=2,175 requirement=simple_requirement(176 min_count=2,177 min_core_count=64,178 network_interface=schema.NetworkInterfaceOptionSettings(179 nic_count=8,180 data_path=schema.NetworkDataPath.Sriov,181 ),182 ),183 )184 def verify_sriov_max_vf_connection_max_cpu(self, environment: Environment) -> None:185 vm_nics = initialize_nic_info(environment)186 sriov_basic_test(environment, vm_nics)187 sriov_vf_connection_test(environment, vm_nics)188 @TestCaseMetadata(189 description="""190 This case verify VM works well after disable and enable accelerated network in191 network interface through sdk.192 Steps,193 1. Do the basic sriov check.194 2. Set enable_accelerated_networking as False to disable sriov.195 3. Set enable_accelerated_networking as True to enable sriov.196 4. Do the basic sriov check.197 5. Do step 2 ~ step 4 for 2 times.198 """,199 priority=2,200 requirement=simple_requirement(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 ),221 )222 def verify_sriov_disable_enable_pci(self, environment: Environment) -> None:223 for node in environment.nodes.list():224 lspci = node.tools[Lspci]225 lspci.disable_devices_by_type(constants.DEVICE_TYPE_SRIOV)226 lspci.enable_devices()227 vm_nics = initialize_nic_info(environment)228 sriov_basic_test(environment, vm_nics)229 sriov_vf_connection_test(environment, vm_nics)230 @TestCaseMetadata(231 description="""232 This case verify VM works well after down the VF nic and up VF nic inside VM.233 Steps,234 1. Do the basic sriov check.235 2. Do network connection test with bring down the VF nic.236 3. After copy 200Mb file from source to desc.237 4. Check rx statistics of source synthetic nic and tx statistics of dest238 synthetic nic is increased.239 5. Bring up VF nic.240 """,241 priority=2,242 requirement=simple_requirement(243 min_count=2,244 network_interface=features.Sriov(),245 ),246 )247 def verify_sriov_disable_enable_on_guest(self, environment: Environment) -> None:248 vm_nics = initialize_nic_info(environment)249 sriov_basic_test(environment, vm_nics)250 sriov_vf_connection_test(environment, vm_nics, turn_off_vf=True)251 @TestCaseMetadata(252 description="""253 This case verify VM works well after attached the max sriov nics after254 provision.255 Steps,256 1. Attach 7 extra sriov nic into the VM.257 2. Do the basic sriov testing.258 """,259 priority=2,260 use_new_environment=True,261 requirement=simple_requirement(262 network_interface=schema.NetworkInterfaceOptionSettings(263 data_path=schema.NetworkDataPath.Sriov,264 max_nic_count=8,265 ),266 ),267 )268 def verify_sriov_add_max_nics(269 self, log_path: Path, log: Logger, environment: Environment270 ) -> None:271 remove_extra_nics(environment)272 try:273 node = cast(RemoteNode, environment.nodes[0])274 network_interface_feature = node.features[NetworkInterface]275 network_interface_feature.attach_nics(extra_nic_count=7)276 is_ready, tcp_error_code = wait_tcp_port_ready(277 node.public_address, node.public_port, log=log, timeout=self.TIME_OUT278 )279 if is_ready:280 vm_nics = initialize_nic_info(environment)281 sriov_basic_test(environment, vm_nics)282 else:283 serial_console = node.features[SerialConsole]284 serial_console.check_panic(285 saved_path=log_path, stage="after_attach_nics"286 )287 raise TcpConnectionException(288 node.public_address,289 node.public_port,290 tcp_error_code,291 "no panic found in serial log after attach nics",292 )293 finally:294 restore_extra_nics(environment)295 @TestCaseMetadata(296 description="""297 This case verify VM works well when provisioning with max (8) sriov nics.298 Steps,299 1. Provision VM with max network interfaces with enabling accelerated network.300 2. Do the basic sriov testing.301 """,302 priority=2,303 requirement=simple_requirement(304 min_nic_count=8,305 network_interface=features.Sriov(),306 ),307 )308 def verify_sriov_provision_with_max_nics(self, environment: Environment) -> None:309 vm_nics = initialize_nic_info(environment)310 sriov_basic_test(environment, vm_nics)311 @TestCaseMetadata(312 description="""313 This case verify VM works well when provisioning with max (8) sriov nics.314 Steps,315 1. Provision VM with max network interfaces with enabling accelerated network.316 2. Do the basic sriov testing.317 3. Reboot VM from guest.318 4. Do the basic sriov testing.319 """,320 priority=2,321 requirement=simple_requirement(322 min_nic_count=8,323 network_interface=features.Sriov(),324 ),325 )326 def verify_sriov_provision_with_max_nics_reboot(327 self, environment: Environment328 ) -> None:329 vm_nics = initialize_nic_info(environment)330 sriov_basic_test(environment, vm_nics)331 for node in environment.nodes.list():332 node.reboot()333 sriov_basic_test(environment, vm_nics)334 @TestCaseMetadata(335 description="""336 This case verify VM works well when provisioning with max (8) sriov nics.337 Steps,338 1. Provision VM with max network interfaces with enabling accelerated network.339 2. Do the basic sriov testing.340 3. Reboot VM from API.341 4. Do the basic sriov testing.342 """,343 priority=2,344 requirement=simple_requirement(345 min_nic_count=8,346 network_interface=features.Sriov(),347 ),348 )349 def verify_sriov_provision_with_max_nics_reboot_from_platform(350 self, environment: Environment351 ) -> None:352 vm_nics = initialize_nic_info(environment)353 sriov_basic_test(environment, vm_nics)354 for node in environment.nodes.list():355 start_stop = node.features[StartStop]356 start_stop.restart()357 sriov_basic_test(environment, vm_nics)358 @TestCaseMetadata(359 description="""360 This case verify VM works well when provisioning with max (8) sriov nics.361 Steps,362 1. Provision VM with max network interfaces with enabling accelerated network.363 2. Do the basic sriov testing.364 3. Stop and Start VM from API.365 4. Do the basic sriov testing.366 """,367 priority=2,368 requirement=simple_requirement(369 min_nic_count=8,370 network_interface=features.Sriov(),371 ),372 )373 def verify_sriov_provision_with_max_nics_stop_start_from_platform(374 self, environment: Environment375 ) -> None:376 vm_nics = initialize_nic_info(environment)377 sriov_basic_test(environment, vm_nics)378 for node in environment.nodes.list():379 start_stop = node.features[StartStop]380 start_stop.stop()381 start_stop.start()382 sriov_basic_test(environment, vm_nics)383 @TestCaseMetadata(384 description="""385 This case verify VM works well during remove and load sriov modules.386 Steps,387 1. Provision VM with max network interfaces with enabling accelerated network.388 2. Do the basic sriov testing.389 3. Remove sriov module, check network traffic through synthetic nic.390 4. Load sriov module, check network traffic through VF.391 """,392 priority=2,393 requirement=simple_requirement(394 min_count=2,395 min_nic_count=8,396 network_interface=features.Sriov(),397 ),398 )399 def verify_sriov_reload_modules(self, environment: Environment) -> None:400 for node in environment.nodes.list():401 if node.tools[KernelConfig].is_built_in(get_used_config(node)):402 raise SkippedException(403 "current VM's mlx driver is built-in, can not reload."404 )405 vm_nics = initialize_nic_info(environment)406 sriov_basic_test(environment, vm_nics)407 module_in_used: Dict[str, str] = {}408 for node in environment.nodes.list():409 module_in_used[node.name] = remove_module(node)410 sriov_vf_connection_test(environment, vm_nics, remove_module=True)411 for node in environment.nodes.list():412 load_module(node, module_in_used[node.name])413 vm_nics = initialize_nic_info(environment)414 sriov_vf_connection_test(environment, vm_nics)415 @TestCaseMetadata(416 description="""417 This case verify below two kernel patches.418 1. hv_netvsc: Sync offloading features to VF NIC419 https://github.com/torvalds/linux/commit/68622d071e555e1528f3e7807f30f73311c1acae#diff-007213ba7199932efdb096be47d209a2f83e4d425c486b3adaba861d0a0c80c5 # noqa: E501420 2. hv_netvsc: Allow scatter-gather feature to be tunable421 https://github.com/torvalds/linux/commit/b441f79532ec13dc82d05c55badc4da1f62a6141#diff-007213ba7199932efdb096be47d209a2f83e4d425c486b3adaba861d0a0c80c5 # noqa: E501422 Steps,423 1. Change scatter-gather feature on synthetic nic,424 verify the the feature status sync to the VF dynamically.425 2. Disable and enable sriov,426 check the scatter-gather feature status keep consistent in VF.427 """,428 priority=2,...

Full Screen

Full Screen

stress.py

Source:stress.py Github

copy

Full Screen

...94 assert_that(iperf_log).described_as(95 f"iperf client run failed on client node, {iperf_log}"96 ).does_not_contain("error")97 # 3. Do VF connection test.98 sriov_vf_connection_test(environment, vm_nics)99 @TestCaseMetadata(100 description="""101 This case verify VM works well after disable and enable accelerated network in102 network interface through sdk under stress.103 It is a regression test case to check the bug104 https://git.launchpad.net/~canonical-kernel/ubuntu/+source/linux-azure/+git/105 bionic/commit/id=16a3c750a78d8, which misses the second hunk of the upstream106 patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/107 commit/?id=877b911a5ba0. Details please check https://bugs.launchpad.net/108 ubuntu/+source/linux-azure/+bug/1965618109 Steps,110 1. Do the basic sriov check.111 2. Set enable_accelerated_networking as False to disable sriov.112 3. Set enable_accelerated_networking as True to enable sriov....

Full Screen

Full Screen

common.py

Source:common.py Github

copy

Full Screen

...93 assert_that(devices_slots).described_as(94 "count of sriov devices listed from lspci is not expected,"95 " please check the driver works properly"96 ).is_length(len([x for x in vm_nics[node.name].values() if x.lower != ""]))97def sriov_vf_connection_test(98 environment: Environment,99 vm_nics: Dict[str, Dict[str, NicInfo]],100 turn_off_vf: bool = False,101 remove_module: bool = False,102) -> None:103 source_node = cast(RemoteNode, environment.nodes[0])104 dest_node = cast(RemoteNode, environment.nodes[1])105 source_ssh = source_node.tools[Ssh]106 dest_ssh = dest_node.tools[Ssh]107 dest_ssh.enable_public_key(source_ssh.generate_key_pairs())108 # generate 200Mb file109 source_node.execute("dd if=/dev/urandom of=large_file bs=100 count=0 seek=2M")110 max_retry_times = 10111 for _, source_nic_info in vm_nics[source_node.name].items():...

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