Best Python code snippet using lisa_python
ethtool.py
Source:ethtool.py
...616 device.device_ringbuffer_settings = DeviceRingBufferSettings(617 interface, result.stdout618 )619 return device.device_ringbuffer_settings620 def change_device_ring_buffer_settings(621 self, interface: str, rx: int, tx: int622 ) -> DeviceRingBufferSettings:623 change_result = self.run(624 f"-G {interface} rx {rx} tx {tx}", sudo=True, force_run=True625 )626 change_result.assert_exit_code(627 message=f" Couldn't change device {interface} ring buffer settings."628 )629 return self.get_device_ring_buffer_settings(interface, force_run=True)630 def get_device_rss_hash_key(631 self, interface: str, force_run: bool = False632 ) -> DeviceRssHashKey:633 device = self._get_or_create_device_setting(interface)634 if not force_run and device.device_rss_hash_key:...
networksettings.py
Source:networksettings.py
...109 else (original_txbuffer + 2)110 )111 expected_rx = int((rxbuffer * 1024 * 1024) / 1728)112 expected_tx = int((txbuffer * 1024 * 1024) / 6144)113 actual_settings = ethtool.change_device_ring_buffer_settings(114 interface, expected_rx, expected_tx115 )116 # The buffer size gets rounded up per PAGE_size117 # so the expected_rx and expected_tx can vary in a range118 # /* Get receive buffer area. */119 # buf_size = device_info->recv_sections * device_info->recv_section_size;120 # buf_size = roundup(buf_size, PAGE_SIZE);121 #122 # /* Now setup the send buffer. */123 # buf_size = device_info->send_sections * device_info->send_section_size;124 # buf_size = round_up(buf_size, PAGE_SIZE);125 assert_that(126 int(actual_settings.current_ring_buffer_settings["RX"]),127 "Changing RX Ringbuffer setting didn't succeed",128 ).is_between(expected_rx - 5, expected_rx + 5)129 assert_that(130 int(actual_settings.current_ring_buffer_settings["TX"]),131 "Changing TX Ringbuffer setting didn't succeed",132 ).is_between(expected_tx - 5, expected_rx + 5)133 # Revert the settings back to original values134 reverted_settings = ethtool.change_device_ring_buffer_settings(135 interface, original_rx, original_tx136 )137 assert_that(138 int(reverted_settings.current_ring_buffer_settings["RX"]),139 "Reverting RX Ringbuffer setting to original value didn't succeed",140 ).is_equal_to(original_rx)141 assert_that(142 int(reverted_settings.current_ring_buffer_settings["TX"]),143 "Reverting TX Ringbuffer setting to original value didn't succeed",144 ).is_equal_to(original_tx)145 @TestCaseMetadata(146 description="""147 This test case verifies changing device channels count with ethtool.148 Steps:...
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!!