Skip to content

Commit

Permalink
[snmp] test_snmp_interfaces_mibs fix KEY_ERROR issue on L2 config (#4058
Browse files Browse the repository at this point in the history
)

Changed the way value was extracted from dict by using get('description', '') function, in order to fix test case fail with L2 config deployed on DUT.

Signed-off-by: Andrii-Yosafat Lozovyi <andrii-yosafatx.lozovyi@intel.com>
  • Loading branch information
AndriiLozovyi committed Aug 18, 2021
1 parent 469a2e2 commit f50ae15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/snmp/test_snmp_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def collect_all_facts(duthost, ports_list, namespace=None):
result[portname].update({'adminstatus': admin})
oper = duthost.shell('{} APPL_DB HGET "PORT_TABLE:{}" "oper_status"'.format(sonic_db_cmd, name), module_ignore_errors=False)['stdout']
result[portname].update({'operstatus': oper})
result[portname].update({'description': config_facts.get('PORT', {})[name]['description']})
result[portname].update({'description': config_facts.get('PORT', {})[name].get('description', '')})
elif name.startswith("PortChannel"):
result.setdefault(name, {})
key_word = "PORTCHANNEL"
Expand All @@ -52,7 +52,7 @@ def collect_all_facts(duthost, ports_list, namespace=None):
result[name].update({'operstatus': oper['stdout']})
result[name].update({'description': config_facts.get(key_word, {})[name].get('description', '')})
else:
key_word = "MGMT_PORT"
key_word = "MGMT_PORT"
result.setdefault(name, {})
result[name].update({'mtu': str(setup[key]['mtu'])})
result[name].update({'type': if_type})
Expand Down

0 comments on commit f50ae15

Please sign in to comment.