sonic-net / sonic-mgmt

Configuration management examples for SONiC
Other
201 stars 728 forks source link

[chassis][pytest fails] test_snmp_interfaces failed because of Interface not found in SNMP facts #5156

Open ysmanman opened 2 years ago

ysmanman commented 2 years ago

Topo: t2 Failure: AssertionError: Interface not found in SNMP facts

@pytest.mark.bsl
def test_snmp_interfaces(localhost, creds_all_duts, duthosts, enum_rand_one_per_hwsku_hostname, enum_asic_index):
    """compare the snmp facts between observed states and target state"""
    duthost = duthosts[enum_rand_one_per_hwsku_hostname]
    if duthost.is_supervisor_node():
        pytest.skip("interfaces not present on supervisor node")
    hostip = duthost.host.options['inventory_manager'].get_host(duthost.hostname).vars['ansible_host']

    namespace = duthost.get_namespace_from_asic_id(enum_asic_index)
    config_facts  = duthost.config_facts(host=duthost.hostname, source="persistent", namespace=namespace)['ansible_facts']
    snmp_facts = get_snmp_facts(localhost, host=hostip, version="v2c", community=creds_all_duts[duthost]["snmp_rocommunity"], wait=True)['ansible_facts']

    snmp_ifnames = [ v['name'] for k, v in snmp_facts['snmp_interfaces'].items() ]
    print snmp_ifnames

    # Verify all physical ports in snmp interface list
    for _, alias in config_facts['port_name_to_alias_map'].items():

> assert alias in snmp_ifnames, "Interface not found in SNMP facts." E AssertionError: Interface not found in SNMP facts.

_ = 'Ethernet-Rec0' alias = u'Recirc0/0' config_facts = {'BGP_NEIGHBOR': {'10.0.0.101': {'admin_status': u'up', 'asn': u'65011', 'holdtime': u'10', 'keepalive': u'3', ...}, '...alhost': {'asic_name': u'Asic0', 'bgp_asn': u'65100', 'buffer_model': u'traditional', 'cloudt ype': u'None', ...}}, ...} creds_all_duts = {<MultiAsicSonicHost> cmp210: {'ansible_become_pass': 'password', 'ansible_ssh_pass': 'arastra', 'ansible_ssh_user': '... &a pos;password', 'ansible_ssh_pass': 'arastra', 'ansible_ssh_user': 'root', 'bgp_slb_passive_range': '10.255.0.0/25', ...}} duthost = <MultiAsicSonicHost> cmp210-4 duthosts = <tests.common.devices.duthosts.DutHosts object at 0x7f36027f8510> enum_asic_index = None enum_rand_one_per_hwsku_hostname = 'cmp210-4' hostip = '10.240.76.58' k = '125' localhost = <tests.common.devices.local.Localhost object at 0x7f36014a10d0> namespace = None snmp_facts = {'ansible_all_ipv4_addresses': [], 'ansible_sysCachedMemory': 1024424, 'ansible_sysTotalBuffMemory': 169208, 'ansible_sysTotalFreeMemery': 11132844, ...} snmp_ifnames = [u'Ethernet39/1', u'eth0', u'Ethernet40/1', u'Ethernet34/1', u'Ethernet16/1', u'Ethernet30/1', ...] v = {'adminstatus': u'up', 'cpfcIfIndications': u'0', 'cpfcIfRequests': u'0', 'description': u'ARISTA22T1:Ethernet1&ap os;, ...}

Description

Steps to reproduce the issue: 1. 2. 3.

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)
```
abdosi commented 2 years ago

cc @SuvarnaMeenakshi

sanmalho-git commented 2 years ago

FYI - similar to https://github.com/Azure/sonic-mgmt/issues/5157 this might be because of https://github.com/Azure/sonic-snmpagent/issues/242