Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[202012 platform_tests][test_autonegotiation] test_autonegotiation cases are failing on most platforms #8490

Closed
tjchadaga opened this issue Aug 16, 2021 · 0 comments · Fixed by sonic-net/sonic-mgmt#4053

Comments

@tjchadaga
Copy link
Contributor

tjchadaga commented Aug 16, 2021

Description

test_autonegotiation cases (enabled by sonic-net/sonic-mgmt#3780) are failing on 202012 images. Issue is seen on most platforms.
The test cases are using config command which seems to be supported only on 202106 or later images

config interface autoneg <interface_name> (Versions >= 202106)
This command is used to set port auto negotiation mode.

Steps to reproduce the issue:

  1. Run platform_tests/test_autonegotiation on testbed running 202012 image version

Describe the results you received:

Tests are failing with config command error:
"Usage: config interface [OPTIONS] COMMAND [ARGS]...",
"Try "config interface -h" for help.",
"",
"Error: No such command "autoneg".

def test_auto_negotiation_advertised_speeds_all():
    """Test all candidate ports to advertised all supported speeds and verify:
        1. All ports are up after auto negotiation
        2. All ports are negotiated to its highest supported speeds
    """
    for duthost, candidates in cadidate_test_ports.items():
        if not candidates:
            continue
        logger.info('Test candidate ports are {}'.format(candidates))
        for dut_port, fanout, fanout_port in candidates:
            logger.info('Start test for DUT port {} and fanout port {}'.format(dut_port, fanout_port))
            # Enable auto negotiation on fanout port
             success = fanout.set_auto_negotiation_mode(fanout_port, True)

            platform_tests/test_auto_negotiation.py:191: 
            _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
            common/devices/fanout.py:132: in set_auto_negotiation_mode
                return self.host.set_auto_negotiation_mode(interface_name, mode)
            common/devices/sonic.py:1502: in set_auto_negotiation_mode
                self.shell(cmd)
            _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
            
            self = <SonicHost> str2-z9332f-03, module_args = ('config interface autoneg Ethernet0 enabled',), complex_args = {}, previous_frame = <frame object at 0x7f43d55a85f0>, filename = '/var/src/sonic-mgmt-int/tests/common/devices/sonic.py'
            line_number = 1502, function_name = 'set_auto_negotiation_mode', lines = ['        self.shell(cmd)\n'], index = 0, verbose = True, module_ignore_errors = False, module_async = False
            
                def _run(self, *module_args, **complex_args):
                
                    previous_frame = inspect.currentframe().f_back
                    filename, line_number, function_name, lines, index = inspect.getframeinfo(previous_frame)
                
                    verbose = complex_args.pop('verbose', True)
                
                    if verbose:
                        logging.debug("{}::{}#{}: [{}] AnsibleModule::{}, args={}, kwargs={}"\
                            .format(filename, function_name, line_number, self.hostname,
                                    self.module_name, json.dumps(module_args), json.dumps(complex_args)))
                    else:
                        logging.debug("{}::{}#{}: [{}] AnsibleModule::{} executing..."\
                            .format(filename, function_name, line_number, self.hostname, self.module_name))
                
                    module_ignore_errors = complex_args.pop('module_ignore_errors', False)
                    module_async = complex_args.pop('module_async', False)
                
                    if module_async:
                        def run_module(module_args, complex_args):
                            return self.module(*module_args, **complex_args)[self.hostname]
                        pool = ThreadPool()
                        result = pool.apply_async(run_module, (module_args, complex_args))
                        return pool, result
                
                    res = self.module(*module_args, **complex_args)[self.hostname]
                
                    if verbose:
                        logging.debug("{}::{}#{}: [{}] AnsibleModule::{} Result => {}"\
                            .format(filename, function_name, line_number, self.hostname, self.module_name, json.dumps(res)))
                    else:
                        logging.debug("{}::{}#{}: [{}] AnsibleModule::{} done, is_failed={}, rc={}"\
                            .format(filename, function_name, line_number, self.hostname, self.module_name, \
                                    res.is_failed, res.get('rc', None)))
                
                    if (res.is_failed or 'exception' in res) and not module_ignore_errors:
            >           raise RunAnsibleModuleFail("run module {} failed".format(self.module_name), res)
            E           RunAnsibleModuleFail: run module shell failed, Ansible Results =>
            E           {
            E               "changed": true, 
            E               "cmd": "config interface autoneg Ethernet0 enabled", 
            E               "delta": "0:00:00.314941", 
            E               "end": "2021-08-17 00:44:10.970845", 
            E               "failed": true, 
            E               "invocation": {
            E                   "module_args": {
            E                       "_raw_params": "config interface autoneg Ethernet0 enabled", 
            E                       "_uses_shell": true, 
            E                       "argv": null, 
            E                       "chdir": null, 
            E                       "creates": null, 
            E                       "executable": null, 
            E                       "removes": null, 
            E                       "stdin": null, 
            E                       "stdin_add_newline": true, 
            E                       "strip_empty_ends": true, 
            E                       "warn": true
            E                   }
            E               }, 
            E               "msg": "non-zero return code", 
            E               "rc": 2, 
            E               "start": "2021-08-17 00:44:10.655904", 
            E               "stderr": "Usage: config interface [OPTIONS] COMMAND [ARGS]...\nTry \"config interface -h\" for help.\n\nError: No such command \"autoneg\".", 
            E               "stderr_lines": [
            **E                   "Usage: config interface [OPTIONS] COMMAND [ARGS]...", 
            E                   "Try \"config interface -h\" for help.", 
            E                   "", 
            E                   "Error: No such command \"autoneg\"."**
            E               ], 
            E               "stdout": "", 
            E               "stdout_lines": []
            E           }
            
            complex_args = {}
            filename   = '/var/src/sonic-mgmt-int/tests/common/devices/sonic.py'
            function_name = 'set_auto_negotiation_mode'
            index      = 0
            line_number = 1502
            lines      = ['        self.shell(cmd)\n']
            module_args = ('config interface autoneg Ethernet0 enabled',)
            module_async = False
            module_ignore_errors = False
            previous_frame = <frame object at 0x7f43d55a85f0>
            res        = {'stderr_lines': [u'Usage: config interface [OPTIONS] COMMAND [ARGS]...', u'Tr...: [], u'start': u'2021-08-17 00:44:10.655904', u'msg': u'non-zero return code'}
            self       = <SonicHost> str2-z9332f-03
            verbose    = True

Describe the results you expected:

Output of show version:

SONiC Software Version: SONiC.20201231.16
Distribution: Debian 10.10
Kernel: 4.19.0-12-2-amd64
Build commit: decfa37df2
Build date: Wed Aug 11 18:29:42 UTC 2021
Built by: AzDevOps@sonic-int-build-workers-0002L6

Output of show techsupport:

(paste your output here or download and attach the file here )

Additional information you deem important (e.g. issue happens only occasionally):

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant