How to use change_device_channels_info method in lisa

Best Python code snippet using lisa_python

ethtool.py

Source:ethtool.py Github

copy

Full Screen

...476 if vcpu_count < device_channel_info.max_channels:477 device_channel_info.max_channels = vcpu_count478 device.device_channel = device_channel_info479 return device_channel_info480 def change_device_channels_info(481 self,482 interface: str,483 channel_count: int,484 ) -> DeviceChannel:485 change_result = self.run(486 f"-L {interface} combined {channel_count}", sudo=True, force_run=True487 )488 change_result.assert_exit_code(489 message=f" Couldn't change device {interface} channels count."490 )491 return self.get_device_channels_info(interface, force_run=True)492 def get_device_enabled_features(493 self, interface: str, force_run: bool = False494 ) -> DeviceFeatures:...

Full Screen

Full Screen

networksettings.py

Source:networksettings.py Github

copy

Full Screen

...172 )173 continue174 skip_test = False175 for new_channels in range(1, max_channels + 1):176 channels_info = ethtool.change_device_channels_info(177 interface, new_channels178 )179 assert_that(180 channels_info.current_channels,181 f"Setting channels count to {new_channels} didn't succeed",182 ).is_equal_to(new_channels)183 if new_channels != channels:184 # revert back the channel count to original value185 channels_info = ethtool.change_device_channels_info(interface, channels)186 assert_that(187 channels_info.current_channels,188 f"Reverting channels count to its original value {channels} didn't"189 f" succeed. Current Value is {channels_info.current_channels}",190 ).is_equal_to(channels)191 if skip_test:192 raise SkippedException(193 "Max Channel count for all the devices is <=1 and cannot be"194 " tested for changing. Skipping test."195 )196 @TestCaseMetadata(197 description="""198 This test case verifies required device features are enabled.199 Steps:...

Full Screen

Full Screen

cpusuite.py

Source:cpusuite.py Github

copy

Full Screen

...176 node.tools[Ethtool].get_device_channels_info("eth0", True)177 ).current_channels178 # set channel count into 1 to get idle cpus179 if len(idle_cpus) == 0:180 node.tools[Ethtool].change_device_channels_info("eth0", 1)181 idle_cpus = get_idle_cpus(node)182 log.debug(f"idle cpus: {idle_cpus}")183 if len(idle_cpus) == 0:184 raise SkippedException(185 "all of the cpu are associated vmbus channels, "186 "no idle cpu can be used to test hotplug."187 )188 # set idle cpu state offline and change channels189 # current max channel will be cpu_count - len(idle_cpus)190 # check channels of synthetic network adapter align with current setting channel191 try:192 # take idle cpu to offline193 set_cpu_state_serial(log, node, idle_cpus, CPUState.OFFLINE)194 # get vmbus channels of synthetic network adapter. the synthetic network195 # drivers have class id "f8615163-df3e-46c5-913f-f2d2f965ed0e"196 node.tools[Lsvmbus].get_device_channels(force_run=True)197 cpu_count = node.tools[Lscpu].get_core_count()198 # current max channel count need minus count of idle cpus199 max_channel_count = cpu_count - len(idle_cpus)200 # change current channel201 first_channel_count = random.randint(1, min(max_channel_count, 64))202 node.tools[Ethtool].change_device_channels_info("eth0", first_channel_count)203 # verify that the added channels do not handle interrupts on offline cpu204 lsvmbus_channels = node.tools[Lsvmbus].get_device_channels(force_run=True)205 for channel in lsvmbus_channels:206 # verify synthetic network adapter channels align with expected value207 if channel.class_id == "f8615163-df3e-46c5-913f-f2d2f965ed0e":208 log.debug(f"Network synthetic channel: {channel}")209 assert_that(channel.channel_vp_map).is_length(first_channel_count)210 # verify that devices do not handle interrupts on offline cpu211 for channel_vp in channel.channel_vp_map:212 assert_that(channel_vp.target_cpu).is_not_in(idle_cpus)213 # reset idle cpu to online214 set_cpu_state_serial(log, node, idle_cpus, CPUState.ONLINE)215 # reset max and current channel count into original ones216 # by reloading hv_netvsc driver217 node.tools[Modprobe].reload(["hv_netvsc"])218 # change the combined channels count after all cpus online219 second_channel_count = random.randint(1, min(cpu_count, 64))220 while True:221 if first_channel_count != second_channel_count:222 break223 second_channel_count = random.randint(1, min(cpu_count, 64))224 node.tools[Ethtool].change_device_channels_info(225 "eth0", second_channel_count226 )227 # verify that the network adapter channels count changed228 # into new channel count229 lsvmbus_channels = node.tools[Lsvmbus].get_device_channels(force_run=True)230 for channel in lsvmbus_channels:231 # verify that channels were added to synthetic network adapter232 if channel.class_id == "f8615163-df3e-46c5-913f-f2d2f965ed0e":233 log.debug(f"Network synthetic channel: {channel}")234 assert_that(channel.channel_vp_map).is_length(second_channel_count)235 finally:236 # reset idle cpu to online237 set_cpu_state_serial(log, node, idle_cpus, CPUState.ONLINE)238 # restore channel count into origin value239 current_device_channel = (240 node.tools[Ethtool].get_device_channels_info("eth0", True)241 ).current_channels242 if current_device_channel != origin_device_channel:243 node.tools[Ethtool].change_device_channels_info(244 "eth0", origin_device_channel245 )246 # when kernel doesn't support set vmbus channels target cpu feature, the247 # dict which stores original status is empty, nothing need to be restored....

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