Best Python code snippet using lisa_python
ethtool.py
Source:ethtool.py  
...788        devices = self.get_device_list()789        for device in devices:790            devices_channel_list.append(self.get_device_channels_info(device))791        return devices_channel_list792    def get_all_device_enabled_features(793        self, force_run: bool = False794    ) -> List[DeviceFeatures]:795        devices_features_list = []796        devices = self.get_device_list(force_run)797        for device in devices:798            devices_features_list.append(799                self.get_device_enabled_features(device, force_run)800            )801        return devices_features_list802    def get_all_device_gro_lro_settings(self) -> List[DeviceGroLroSettings]:803        devices_gro_lro_settings = []804        devices = self.get_device_list()805        for device in devices:806            devices_gro_lro_settings.append(self.get_device_gro_lro_settings(device))...networksettings.py
Source:networksettings.py  
...213            "scatter-gather",214            "tcp-segmentation-offload",215        ]216        ethtool = node.tools[Ethtool]217        devices_features = ethtool.get_all_device_enabled_features()218        for device_features in devices_features:219            enabled_features = device_features.enabled_features220            if not set(required_features).issubset(enabled_features):221                raise LisaException(222                    "Not all the required features (rx-checksumming, tx-checksumming,"223                    " scatter-gather, tcp-segmentation-offload) are enabled for"224                    f" device {device_features.device_name}."225                    f" Enabled features list - {enabled_features}"226                )227    @TestCaseMetadata(228        description="""229            This test case verifies changing device's GRO and LRO setting takes230            into affect.231            Steps:...sriov.py
Source:sriov.py  
...452                )453            else:454                break455        # save original enabled features456        device_enabled_features_origin = client_ethtool.get_all_device_enabled_features(457            True458        )459        # run iperf3 on server side and client side460        # iperfResults.log stored client side log461        source_iperf3 = server_node.tools[Iperf3]462        dest_iperf3 = client_node.tools[Iperf3]463        source_iperf3.run_as_server_async()464        dest_iperf3.run_as_client_async(465            server_ip=server_node.internal_address,466            log_file=client_iperf3_log,467            run_time_seconds=self.TIME_OUT,468        )469        # wait for a while then check any error shown up in iperfResults.log470        dest_cat = client_node.tools[Cat]471        iperf_log = dest_cat.read(client_iperf3_log, sudo=True, force_run=True)472        assert_that(iperf_log).does_not_contain("error")473        # disable and enable VF in pci level474        for node in environment.nodes.list():475            lspci = node.tools[Lspci]476            lspci.disable_devices_by_type(constants.DEVICE_TYPE_SRIOV)477            lspci.enable_devices()478        # check VF still paired with synthetic nic479        vm_nics = initialize_nic_info(environment)480        # get the enabled features after disable and enable VF481        # make sure there is not any change482        device_enabled_features_after = client_ethtool.get_all_device_enabled_features(483            True484        )485        assert_that(device_enabled_features_origin[0].enabled_features).is_equal_to(486            device_enabled_features_after[0].enabled_features487        )488        # set on for scatter-gather feature for synthetic nic489        # verify vf scatter-gather feature has value 'on'490        for _, client_nic_info in vm_nics[client_node.name].items():491            new_settings = client_ethtool.change_device_sg_settings(492                client_nic_info.upper, True493            )494            device_vf_sg_settings = client_ethtool.get_device_sg_settings(495                client_nic_info.lower, True496            )...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!!
