dainok / netdoc

Automatic Network Documentation plugin for NetBox
GNU General Public License v3.0
89 stars 13 forks source link

Cisco IOS issue: static routes pointing to Null0 interface not ingested, script errors out. #51

Closed svestenik closed 1 year ago

svestenik commented 1 year ago

While trying to ingest vrf routing table, ingest script errors out when encountering a static route pointing to Null0 device.

An exception occurred: ValueError: Even one of nexthop_ip or nexthop_if_id should have a value.

Traceback (most recent call last):
  File "/opt/netbox/netbox/extras/scripts.py", line 476, in _run_script
    script.output = script.run(data=data, commit=commit)
  File "/opt/netbox/netbox/scripts/NetDoc.py", line 290, in run
    log_ingest(log)
  File "/opt/netbox/venv/lib/python3.9/site-packages/netdoc/utils.py", line 381, in log_ingest
    module.ingest(log)
  File "/opt/netbox/venv/lib/python3.9/site-packages/netdoc/ingestors/netmiko_cisco_ios_show_ip_route.py", line 72, in ingest
    routetableentry.create(**data)
  File "/opt/netbox/venv/lib/python3.9/site-packages/netdoc/schemas/routetableentry.py", line 70, in create
    raise ValueError("Even one of nexthop_ip or nexthop_if_id should have a value.")
ValueError: Even one of nexthop_ip or nexthop_if_id should have a value.

Route entry looks like this:

S        111.222.3.0/27 is directly connected

12764.json.txt

Raw log file attached.

dainok commented 1 year ago

This is curious because I expect at least interface or next hop to be set:

https://github.com/networktocode/ntc-templates/blob/master/tests/cisco_ios/show_ip_route/cisco_ios_show_ip_route.raw

Which router model / OS version are you using?

svestenik commented 1 year ago

Next hop is Null0 interface, set up like this:

ip route vrf aws-interco 111.222.3.0 255.255.255.224 Null0 250

Its Cisco ASR1002 with ios-xe version 9.03.16.

dainok commented 1 year ago

Agree, but I expect as following:

S        11.1.0.0/17 [1/0], 2w0d, Null0

I'll make a patch dropping the line.

dainok commented 1 year ago

Fixed on https://github.com/dainok/netdoc/pull/53