Skip to content

Commit

Permalink
If parent_table None call exception (napalm-automation#939)
Browse files Browse the repository at this point in the history
Hi, i have this situation when ipv6 is turned off:
$ napalm --user oxi --password gdfw23 --vendor nxos  10.143.36.8 call get_interfaces_ip
2019-03-07 15:08:10,226 - napalm - ERROR - method - Failed: 'NoneType' object has no attribute 'get'

================= Traceback =================

Traceback (most recent call last):
  File "/opt/py3.6/bin/napalm", line 10, in <module>
    sys.exit(main())
  File "/opt/py3.6/lib/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 309, in main
    run_tests(args)
  File "/opt/py3.6/lib/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 292, in run_tests
    call_getter(device, args.method, **method_kwargs)
  File "/opt/py3.6/lib/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 31, in wrapper
    r = func(*args, **kwargs)
  File "/opt/py3.6/lib/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 256, in call_getter
    r = func(**kwargs)
  File "/opt/py3.6/lib/python3.6/site-packages/napalm/nxos/nxos.py", line 1091, in get_interfaces_ip
    ipv6_command, "TABLE_intf", "ROW_intf"
  File "/opt/py3.6/lib/python3.6/site-packages/napalm/nxos/nxos.py", line 721, in _get_command_table
    return self._get_reply_table(json_output, table_name, row_name)
  File "/opt/py3.6/lib/python3.6/site-packages/napalm/nxos/nxos.py", line 717, in _get_reply_table
    return self._get_table_rows(result, table_name, row_name)
  File "/opt/py3.6/lib/python3.6/site-packages/napalm/nxos/nxos.py", line 706, in _get_table_rows
    _table = parent_table.get(table_name)
AttributeError: 'NoneType' object has no attribute 'get'
  • Loading branch information
VictorPavlushin authored and ExaneServerTeam committed Mar 4, 2020
1 parent ece9a35 commit bede73e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions napalm/nxos/nxos.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,8 @@ def _get_table_rows(parent_table, table_name, row_name):
vs
{'TABLE_vrf': {'ROW_vrf': {'TABLE_adj': {'ROW_adj': {
"""
if parent_table is None:
return []
_table = parent_table.get(table_name)
_table_rows = []
if isinstance(_table, list):
Expand Down

0 comments on commit bede73e

Please sign in to comment.