Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

test_iface_loopback_action.py failed with TypeError: argument of type 'NoneType' is not iterable #7665

Closed
ZhaohuiS opened this issue Mar 7, 2023 · 2 comments
Assignees
Labels

Comments

@ZhaohuiS
Copy link
Contributor

ZhaohuiS commented Mar 7, 2023

Description
3 cases for test_iface_loopback_action.py all failed at setup:

iface_loopback_action/test_iface_loopback_action.py::test_loopback_action_basic ERROR [ 33%]
iface_loopback_action/test_iface_loopback_action.py::test_loopback_action_port_flap ERROR [ 66%]
iface_loopback_action/test_iface_loopback_action.py::test_loopback_action_reload ERROR [100%]

It throws TypeError: argument of type 'NoneType' is not iterable

duthost    = <MultiAsicSonicHost bjw-can-2700-1>
ptf_ifaces = ['eth13', 'eth28', 'eth17', 'eth3', 'eth14', 'eth8', ...]
ptf_ifaces_map = {0: 'eth0', 1: 'eth1', 2: 'eth2', 3: 'eth3', ...}
ptf_port_mapping_mode = 'use_orig_interface'
ptfhost    = <tests.common.devices.ptf.PTFHost object at 0x7f9fd9837490>
request    = <SubRequest 'orig_ports_configuration' for <Function test_loopback_action_basic>>
res        = {'stderr_lines': [], u'cmd': [u'cat', u'/proc/net/dev'], u'end': u'2023-03-03 ...acts': {u'discovered_interpreter_python': u'/usr/bin/python'}, 'failed': False}
tbinfo     = {'auto_recover': 'True', 'comment': 'Beijing Lab', 'conf-name': 'testbed-bjw-can-2700-1', 'duts': ['bjw-can-2700-1'], ...}

iface_loopback_action/conftest.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
iface_loopback_action/iface_loopback_action_helper.py:113: in get_tested_up_ports
    port_dict['portchannel'] = get_portchannel_of_port(config_facts, port)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

config_facts = {'ACL_TABLE': {'DATAACL': {'policy_desc': u'DATAACL', 'ports': [u'PortChannel101', u'PortChannel102', u'PortChannel103...te_limit_interval': u'600', 'state': u'enabled'}, ...}, 'BGP_DEVICE_GLOBAL': {'STATE': {'tsa_enabled': u'false'}}, ...}
port = 'Ethernet8'

    def get_portchannel_of_port(config_facts, port):
        """
        Check if the port is a member of port channel, if it is then return the portchannel, else return Noe
        :param config_facts: DUT running config facts
        :param port: the port which need to check
        :return: portchannel or None
        """
        portchannels = config_facts['PORTCHANNEL'].keys() if 'PORTCHANNEL' in config_facts else []
        for portchannel in portchannels:
            portchannel_members = config_facts['PORTCHANNEL'][portchannel].get('members')
>           if port in portchannel_members:
E           TypeError: argument of type 'NoneType' is not iterable


config_facts = {'ACL_TABLE': {'DATAACL': {'policy_desc': u'DATAACL', 'ports': [u'PortChannel101', u'PortChannel102', u'PortChannel103...te_limit_interval': u'600', 'state': u'enabled'}, ...}, 'BGP_DEVICE_GLOBAL': {'STATE': {'tsa_enabled': u'false'}}, ...}
port       = 'Ethernet8'
portchannel = 'PortChannel104'
portchannel_members = None
portchannels = ['PortChannel104', 'PortChannel101', 'PortChannel103', 'PortChannel102']

iface_loopback_action/iface_loopback_action_helper.py:148: TypeError

Steps to reproduce the issue:

  1. Load master image. "build_version": "master.227401-fffeec6ec", image file is here https://sonic-build.azurewebsites.net/ui/sonic/pipelines/139/builds/227401/artifacts?branchName=master
  2. Run test_iface_loopback_action.py

Describe the results you received:

Describe the results you expected:

Additional information you deem important:

**Output of `show version`:**

```
(paste your output here)
```

**Attach debug file `sudo generate_dump`:**

```
(paste your output here)
```
@ZhaohuiS
Copy link
Contributor Author

ZhaohuiS commented Mar 8, 2023

This issue could be fixed in #7668.
The failed reason is no member key under PORTCHANNEL in config_facts.

@ZhaohuiS ZhaohuiS self-assigned this Mar 8, 2023
@bingwang-ms
Copy link
Collaborator

Fixed by #7668

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants