Ejemplo n.º 1
0
 def test_check_dmesg_warn(self):
     '''
     :avocado: tags=test_check_dmesg_warn,fast_check
     polarion_id: RHEL7-103851
     '''
     self.session.connect(timeout=self.ssh_wait_timeout)
     aws.check_dmesg(self, 'warn')
 def test_sriov_ena_dmesg(self):
     '''
     :avocado: tags=test_sriov_ena_dmesg,fast_check
     description:
         Check dmesg related to ENA (Elastic Network Adapter) driver in RHEL on AWS. Linked case RHEL7-87117.
     polarion_id:
         https://polarion.engineering.redhat.com/polarion/#/project/RedHatEnterpriseLinux7/workitems?query=title:"[AWS]NetworkTest.test_sriov_ena_dmesg"
     bugzilla_id: 
         n/a
     customer_case_id: 
         n/a
     maintainer: 
         xiliang
     case_priority:
         0
     case_component: 
         network
     key_steps:
         1. Launch an instance with ENA drivers (instance list refer to description in case test_sriov_ena) on AWS.
         2. Connect the instance via ssh, and verify the ena module is being used on a particular interface via command "$ sudo ethtool -i eth0".
         3. Check the dmesg info related to ena "$ sudo dmesg|grep -w ena".
     pass_criteria: 
         The ena driver is used by the specified network interface.
         There are no error/warning/failure/unsupported feature messages about ena, better to compare the output with privious version, make sure there isn't regression which doesn't display as error in message.
     '''
     self.session1.connect(timeout=self.ssh_wait_timeout)
     self.session = self.session1
     aws.check_session(self)
     cmd = "ethtool -i eth0"
     output = utils_lib.run_cmd(self, cmd, expect_ret=0)
     if "driver: ena" not in output:
         self.cancel("No ena driver found!")
     self.log.info("Trying to check sriov ena boot messages!")
     aws.check_dmesg(self, 'ena', match_word_exact=True)
 def test_sriov_ena_dmesg(self):
     '''
     :avocado: tags=test_sriov_ena_dmesg,fast_check
     polarion_id:
     '''
     self.session1.connect(timeout=self.ssh_wait_timeout)
     self.session = self.session1
     aws.check_session(self)
     cmd = "ethtool -i eth0"
     output = utils_lib.run_cmd(self, cmd, expect_ret=0)
     if "driver: ena" not in output:
         self.cancel("No ena driver found!")
     self.log.info("Trying to check sriov ena boot messages!")
     aws.check_dmesg(self, 'ena', match_word_exact=True)
    def test_xen_netfront_unload_load(self):
        '''
        :avocado: tags=test_xen_netfront_unload_load,fast_check
        description:
            Test unload and reload xen_netfront module in RHEL on AWS.
            Instances with xen_netfront dirver include T2 and G2.
        polarion_id:
            https://polarion.engineering.redhat.com/polarion/#/project/RedHatEnterpriseLinux7/workitems?query=title:"[AWS]NetworkTest.test_xen_netfront_unload_load"
        bugzilla_id: 
            n/a
        customer_case_id: 
            n/a
        maintainer: 
            xiliang
        case_priority:
            0
        case_component: 
            network
        key_steps:
            1. Launch an T2 or G2 instance on AWS.
            2. Connect the instance via ssh, and verify the xen_netfront module is being used on a particular interface via command "$ sudo ethtool -i eth0".
            3. Unload and load xen_netfront moudle via command "$ sudo modprobe -r xen_netfront; sudo modprobe xen_netfront".
            4. Check the dmesg info related to xen_netfront "$ sudo dmesg|grep -w ena".
        pass_criteria: 
            The xen_netfront can be unloaded and loaded without error.
            There are no error/warning/failure/unsupported feature messages about xen_netfront.
        '''
        self.log.info("Test unload and load xen_netfront module")
        self.session1.connect(timeout=self.ssh_wait_timeout)
        self.session = self.session1
        cmd = 'sudo ethtool -i eth0'
        output = utils_lib.run_cmd(self, cmd, msg='Check network driver!')
        if 'driver: vif' not in output:
            self.cancel('No xen_netfront used!')
        aws.check_session(self)
        cmd_string = 'modprobe -r xen_netfront;modprobe xen_netfront'
        cmd = 'sudo echo "%s" >/tmp/mod.sh' % cmd_string
        utils_lib.run_cmd(self, cmd, expect_ret=0)
        cmd = 'sudo chmod 755 /tmp/mod.sh'
        utils_lib.run_cmd(self, cmd, expect_ret=0)
        cmd = 'sudo su'
        utils_lib.run_cmd(self, cmd, expect_ret=0)
        cmd = '/tmp/mod.sh'
        utils_lib.run_cmd(self, cmd, expect_ret=0)

        aws.check_dmesg(self, 'xen_netfront', match_word_exact=True)
    def test_sriov_ena_unload_load(self):
        '''
        :avocado: tags=test_sriov_ena_unload_load,fast_check,kernel
        description:
            Test unload and reload ENA (Elastic Network Adapter) module in RHEL on AWS.
        polarion_id:
            https://polarion.engineering.redhat.com/polarion/#/project/RedHatEnterpriseLinux7/workitems?query=title:"[AWS]NetworkTest.test_sriov_ena_unload_load"
        bugzilla_id: 
            n/a
        customer_case_id: 
            n/a
        maintainer: 
            xiliang
        case_priority:
            0
        case_component: 
            network
        key_steps:
            1. Launch an instance with ENA drivers (instance list refer to description in case test_sriov_ena) on AWS.
            2. Connect the instance via ssh, and verify the ena module is being used on a particular interface via command "$ sudo ethtool -i eth0".
            3. Unload and load ena moudle via command "$ sudo modprobe -r ena; sudo modprobe ena".
            4. Check the dmesg info related to ena "$ sudo dmesg|grep -w ena".
        pass_criteria: 
            The ena can be unloaded and loaded without error.
            There are no error/warning/failure/unsupported feature messages about ena.
        '''
        self.log.info("Test unload and load ena module")
        self.session1.connect(timeout=self.ssh_wait_timeout)
        self.session = self.session1
        aws.check_session(self)
        utils_lib.run_cmd(self, 'ethtool -i eth0', cancel_kw='ena')
        cmd_string = 'modprobe -r ena;modprobe ena'
        cmd = 'sudo echo "%s" >/tmp/mod.sh' % cmd_string
        utils_lib.run_cmd(self, cmd, expect_ret=0)
        cmd = 'sudo chmod 755 /tmp/mod.sh'
        utils_lib.run_cmd(self, cmd, expect_ret=0)
        cmd = 'sudo su'
        utils_lib.run_cmd(self, cmd, expect_ret=0)
        cmd = '/tmp/mod.sh'
        utils_lib.run_cmd(self, cmd, expect_ret=0)

        aws.check_dmesg(self, 'ena', match_word_exact=True)
    def test_sriov_ena_unload_load(self):
        '''
        :avocado: tags=test_sriov_ena_unload_load,fast_check
        polarion_id:
        '''
        self.log.info("Test unload and load ena module")
        self.session1.connect(timeout=self.ssh_wait_timeout)
        self.session = self.session1
        aws.check_session(self)
        cmd_string = 'modprobe -r ena;modprobe ena'
        cmd = 'sudo echo "%s" >/tmp/mod.sh' % cmd_string
        utils_lib.run_cmd(self, cmd, expect_ret=0)
        cmd = 'sudo chmod 755 /tmp/mod.sh'
        utils_lib.run_cmd(self, cmd, expect_ret=0)
        cmd = 'sudo su'
        utils_lib.run_cmd(self, cmd, expect_ret=0)
        cmd = '/tmp/mod.sh'
        utils_lib.run_cmd(self, cmd, expect_ret=0)

        aws.check_dmesg(self, 'ena', match_word_exact=True)
    def test_xen_netfront_unload_load(self):
        '''
        :avocado: tags=test_xen_netfront_unload_load,fast_check
        polarion_id:
        '''
        self.log.info("Test unload and load xen_netfront module")
        self.session1.connect(timeout=self.ssh_wait_timeout)
        self.session = self.session1
        cmd = 'sudo ethtool -i eth0'
        output = utils_lib.run_cmd(self, cmd, msg='Check network driver!')
        if 'driver: vif' not in output:
            self.cancel('No xen_netfront used!')
        aws.check_session(self)
        cmd_string = 'modprobe -r xen_netfront;modprobe xen_netfront'
        cmd = 'sudo echo "%s" >/tmp/mod.sh' % cmd_string
        utils_lib.run_cmd(self, cmd, expect_ret=0)
        cmd = 'sudo chmod 755 /tmp/mod.sh'
        utils_lib.run_cmd(self, cmd, expect_ret=0)
        cmd = 'sudo su'
        utils_lib.run_cmd(self, cmd, expect_ret=0)
        cmd = '/tmp/mod.sh'
        utils_lib.run_cmd(self, cmd, expect_ret=0)

        aws.check_dmesg(self, 'ena', match_word_exact=True)
 def test_pci_reset(self):
     '''
     :avocado: tags=test_pci_reset
     description:
         [Skip] Test unload and reload xen_netfront module in RHEL on AWS.
         Skip this case since there is a CANTFIX bug 1687330 with this case.
     polarion_id:
         https://polarion.engineering.redhat.com/polarion/#/project/RedHatEnterpriseLinux7/workitems?query=title:"[AWS]NetworkTest.test_pci_reset"
     bugzilla_id: 
         n/a
     customer_case_id: 
         n/a
     maintainer: 
         xiliang
     case_priority:
         0
     case_component: 
         network
     key_steps:
         1. Launch an instance with ENA drivers (instance list refer to description in case test_sriov_ena) on AWS.
         2. Connect the instance via ssh, check the ena driver is used by NIC via command "$ sudo ethtool -i eth0".
         3. List PCI devices information via command "$ sudo lspci".
         4. Reset ena device via command "$ sudo echo 1 > /sys/devices/pci0000:00/0000:00:05.0/reset".
     pass_criteria: 
         PCI reset successfully.
         There are no error/warning/failure/unsupported feature messages about ena.
     '''
     self.session1.connect(timeout=self.ssh_wait_timeout)
     self.session = self.session1
     cmd = 'sudo lspci'
     utils_lib.run_cmd(self, cmd)
     self.cancel('Cancel this case as bug 1687330 which is TESTONLY!')
     cmd = 'sudo find /sys -name reset* -type f|grep pci'
     output = utils_lib.run_cmd(self, cmd)
     if 'reset' not in output:
         self.cancel("No pci support reset!")
     for pci_reset in output.split('\n'):
         cmd = 'sudo su'
         utils_lib.run_cmd(self, cmd)
         cmd = 'echo 1 > %s' % pci_reset
         utils_lib.run_cmd(self, cmd, expect_ret=0, timeout=120)
     aws.check_dmesg(self, 'fail')
     aws.check_dmesg(self, 'error')
     aws.check_dmesg(self, 'warn')
     cmd = 'dmesg'
     utils_lib.run_cmd(self, cmd, expect_ret=0, expect_not_kw='Call Trace')
 def test_pci_reset(self):
     '''
     :avocado: tags=test_pci_reset
     polarion_id:
     '''
     self.session1.connect(timeout=self.ssh_wait_timeout)
     self.session = self.session1
     cmd = 'sudo lspci'
     utils_lib.run_cmd(self, cmd)
     self.cancel('Cancel this case as bug 1687330 which is TESTONLY!')
     cmd = 'sudo find /sys -name reset* -type f|grep pci'
     output = utils_lib.run_cmd(self, cmd)
     if 'reset' not in output:
         self.cancel("No pci support reset!")
     for pci_reset in output.split('\n'):
         cmd = 'sudo su'
         utils_lib.run_cmd(self, cmd)
         cmd = 'echo 1 > %s' % pci_reset
         utils_lib.run_cmd(self, cmd, expect_ret=0, timeout=120)
     aws.check_dmesg(self, 'fail')
     aws.check_dmesg(self, 'error')
     aws.check_dmesg(self, 'warn')
     cmd = 'dmesg'
     utils_lib.run_cmd(self, cmd, expect_ret=0, expect_not_kw='Call Trace')
 def test_check_dmesg_warn(self):
     '''
     :avocado: tags=test_check_dmesg_warn,fast_check
     polarion_id: RHEL7-103851
     '''
     aws.check_dmesg(self, 'warn')
 def test_check_dmesg_fail(self):
     '''
     :avocado: tags=test_check_dmesg_fail,fast_check
     polarion_id: RHEL7-103851
     '''
     aws.check_dmesg(self, 'fail')
 def test_check_dmesg_error(self):
     '''
     :avocado: tags=test_check_dmesg_error,fast_check
     polarion_id: RHEL7-103851
     '''
     aws.check_dmesg(self, 'error')
    def test_ethtool_K_offload(self):
        '''
        :avocado: tags=test_ethtool_K_offload,fast_check
        polarion_id:
        '''
        self.session1.connect(timeout=self.ssh_wait_timeout)
        self.session = self.session1
        aws.check_session(self)
        cmd = ' sudo  ethtool -k eth0'
        utils_lib.run_cmd(self, cmd, msg='Show current settings.')
        cmd = 'sudo ethtool -i eth0'
        output = utils_lib.run_cmd(self, cmd, msg='Check network driver!')
        if 'driver: ena' in output:
            option_dict = {
                'tx': 'tx-checksumming',
                'sg': 'scatter-gather',
                'gso': 'generic-segmentation-offload',
                'gro': 'generic-receive-offload',
                'tx-nocache-copy': 'tx-nocache-copy',
                'rxhash': 'receive-hashing',
                'highdma': 'highdma'
            }
        elif 'driver: vif' in output:
            option_dict = {
                'sg': 'scatter-gather',
                'tso': 'tcp-segmentation-offload',
                'gso': 'generic-segmentation-offload',
                'gro': 'generic-receive-offload',
                'tx-nocache-copy': 'tx-nocache-copy'
            }
        else:
            option_dict = {
                'rx': 'rx-checksumming',
                'tx': 'tx-checksumming',
                'sg': 'scatter-gather',
                'tso': 'tcp-segmentation-offload',
                'gso': 'generic-segmentation-offload',
                'gro': 'generic-receive-offload',
                'tx-gre-segmentation': 'tx-gre-segmentation',
                'tx-nocache-copy': 'tx-nocache-copy',
                'tx-ipip-segmentation': 'tx-ipip-segmentation',
                'tx-sit-segmentation': 'tx-sit-segmentation',
                'tx-udp_tnl-segmentation': 'tx-udp_tnl-segmentation',
                'tx-gre-csum-segmentation': 'tx-gre-csum-segmentation',
                'tx-udp_tnl-csum-segmentation': 'tx-udp_tnl-csum-segmentation',
                'tx-gso-partial': 'tx-gso-partial'
            }

        for option in option_dict.keys():
            cmd = 'sudo ethtool -K eth0 %s off' % option
            utils_lib.run_cmd(self, cmd)
            cmd = 'sudo ethtool -k eth0'
            utils_lib.run_cmd(self,
                              cmd,
                              expect_kw="%s: off" % option_dict[option])
            cmd = 'sudo ethtool -K eth0 %s on' % option
            utils_lib.run_cmd(self, cmd, expect_ret=0)
            cmd = 'sudo ethtool -k eth0'
            utils_lib.run_cmd(self,
                              cmd,
                              expect_kw="%s: on" % option_dict[option])

        cmd = 'dmesg|tail -20'
        utils_lib.run_cmd(self, cmd)
        aws.check_dmesg(self, 'fail')
        aws.check_dmesg(self, 'error')
        aws.check_dmesg(self, 'warn')
        cmd = 'dmesg'
        utils_lib.run_cmd(self, cmd, expect_ret=0, expect_not_kw='Call Trace')
    def test_ethtool_K_offload(self):
        '''
        :avocado: tags=test_ethtool_K_offload,fast_check
        description:
            Test use ethtool to change the offload parameters and other features of the specified network device in RHEL on AWS.
        polarion_id:
            https://polarion.engineering.redhat.com/polarion/#/project/RedHatEnterpriseLinux7/workitems?query=title:"[AWS]NetworkTest.test_ethtool_K_offload"
        bugzilla_id: 
            n/a
        customer_case_id: 
            n/a
        maintainer: 
            xiliang
        case_priority: 
            0
        case_component: 
            network
        key_steps:
            1. Launch an instance on AWS EC2.
            2. Use command "$ sudo  ethtool -k eth0" to query currently state of protocol offload and other features.
            3. Use ethtool to turn off offload parameters and other features via command "$ sudo ethtool -K eth0 $feature off".
            4. Check currently state of offload and other features again.
            5. Use ethtool to turn on offload parameters and other features via command "$ sudo ethtool -K eth0 $feature on".
            6. Check currently state of offload and other features.
       pass_criteria: 
            Each offload and features could be turned off and turned on again, and no exception, warn, fail or call trace in dmesg.
        '''
        self.session1.connect(timeout=self.ssh_wait_timeout)
        self.session = self.session1
        aws.check_session(self)
        cmd = ' sudo  ethtool -k eth0'
        setting_out = utils_lib.run_cmd(self,
                                        cmd,
                                        msg='Show current settings.')
        cmd = 'sudo ethtool -i eth0'
        output = utils_lib.run_cmd(self, cmd, msg='Check network driver!')
        if 'driver: ena' in output:
            option_dict = {
                'tx': 'tx-checksumming',
                'sg': 'scatter-gather',
                'gso': 'generic-segmentation-offload',
                'gro': 'generic-receive-offload',
                'tx-nocache-copy': 'tx-nocache-copy',
                'rxhash': 'receive-hashing',
                'highdma': 'highdma'
            }
        elif 'driver: vif' in output:
            option_dict = {
                'sg': 'scatter-gather',
                'tso': 'tcp-segmentation-offload',
                'gso': 'generic-segmentation-offload',
                'gro': 'generic-receive-offload',
                'tx-nocache-copy': 'tx-nocache-copy'
            }
        else:
            option_dict = {
                'rx': 'rx-checksumming',
                'tx': 'tx-checksumming',
                'sg': 'scatter-gather',
                'tso': 'tcp-segmentation-offload',
                'gso': 'generic-segmentation-offload',
                'gro': 'generic-receive-offload',
                'tx-gre-segmentation': 'tx-gre-segmentation',
                'tx-nocache-copy': 'tx-nocache-copy',
                'tx-ipip-segmentation': 'tx-ipip-segmentation',
                'tx-sit-segmentation': 'tx-sit-segmentation',
                'tx-udp_tnl-segmentation': 'tx-udp_tnl-segmentation',
                'tx-gre-csum-segmentation': 'tx-gre-csum-segmentation',
                'tx-udp_tnl-csum-segmentation': 'tx-udp_tnl-csum-segmentation',
                'tx-gso-partial': 'tx-gso-partial'
            }

        for option in option_dict.keys():
            if option_dict[option] not in setting_out:
                continue
            cmd = 'sudo ethtool -K eth0 %s off' % option
            utils_lib.run_cmd(self, cmd)
            cmd = 'sudo ethtool -k eth0'
            utils_lib.run_cmd(self,
                              cmd,
                              expect_kw="%s: off" % option_dict[option])
            cmd = 'sudo ethtool -K eth0 %s on' % option
            utils_lib.run_cmd(self, cmd, expect_ret=0)
            cmd = 'sudo ethtool -k eth0'
            utils_lib.run_cmd(self,
                              cmd,
                              expect_kw="%s: on" % option_dict[option])

        cmd = 'dmesg|tail -20'
        utils_lib.run_cmd(self, cmd)
        aws.check_dmesg(self, 'fail')
        aws.check_dmesg(self, 'error')
        aws.check_dmesg(self, 'warn')
        cmd = 'dmesg'
        utils_lib.run_cmd(self, cmd, expect_ret=0, expect_not_kw='Call Trace')