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

Fix templates #53

Merged
merged 3 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions netdoc/ingestors/netmiko_cisco_ios_show_ip_arp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ def ingest(log):

for item in log.parsed_output:
# See https://github.com/networktocode/ntc-templates/tree/master/tests/cisco_ios/show_ip_arp # pylint: disable=line-too-long
if utils.incomplete_mac(item.get("mac")):
if utils.incomplete_mac(item.get("mac_address")):
continue
interface_name = item.get("interface")
label = utils.normalize_interface_label(interface_name)
ip_address = item.get("address")
mac_address = utils.normalize_mac_address(item.get("mac"))
mac_address = utils.normalize_mac_address(item.get("mac_address"))

interface_o = interface.get(device_id=device_o.id, label=label)
if not interface_o:
Expand Down
4 changes: 2 additions & 2 deletions netdoc/ingestors/netmiko_cisco_ios_show_ip_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ def ingest(log):
if item.get("link_status") == "deleted":
# Skip deleted interfaces
continue
interface_name = item.get("intf")
interface_name = item.get("interface")
label = utils.normalize_interface_label(interface_name)
vrf_name = item.get("vrf")
ip_list = item.get("ipaddr")
mask_list = item.get("mask")
mask_list = item.get("prefix_length")
ip_addresses = [
f"{ipaddr}/{mask_list[index]}" for index, ipaddr in enumerate(ip_list)
]
Expand Down
7 changes: 6 additions & 1 deletion netdoc/ingestors/netmiko_cisco_ios_show_ip_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ def ingest(log):
distance = int(item.get("distance")) if item.get("distance") else None
metric = int(item.get("metric")) if item.get("metric") else None
destination = (
f"{item.get('network')}/{item.get('mask')}" if item.get("network") else None
f"{item.get('network')}/{item.get('prefix_length')}"
if item.get("network")
else None
)
protocol = utils.normalize_route_type(item.get("protocol"))
nexthop_ip = item.get("nexthop_ip") if item.get("nexthop_ip") else None
if not nexthop_if_name and not nexthop_ip:
# Skipping routes without nexthop IP / interface
continue

# Get or create interface
nexthop_if_id = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def ingest(log):
continue
interface_name = item.get("destination_port")[0]
label = utils.normalize_interface_label(interface_name)
vlan_id = int(item.get("vlan"))
vlan_id = int(item.get("vlan_id"))
mac_address = utils.normalize_mac_address(item.get("destination_address"))

interface_o = interface.get(device_id=device_o.id, label=label)
Expand Down
2 changes: 1 addition & 1 deletion netdoc/ingestors/netmiko_cisco_ios_show_vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def ingest(log):
for item in log.parsed_output:
# See https://github.com/networktocode/ntc-templates/tree/master/tests/cisco_ios/show_vlan # pylint: disable=line-too-long
vlan_id = int(item.get("vlan_id"))
vlan_name = item.get("name")
vlan_name = item.get("vlan_name")

vlan_o = vlan.get(vlan_id, vlan_name)
if not vlan_o:
Expand Down
4 changes: 2 additions & 2 deletions netdoc/ingestors/netmiko_cisco_nxos_show_ip_arp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ def ingest(log):

for item in log.parsed_output:
# See https://github.com/dainok/ntc-templates/tree/master/tests/cisco_nxos/show_ip_arp # pylint: disable=line-too-long
if utils.incomplete_mac(item.get("mac")):
if utils.incomplete_mac(item.get("mac_address")):
continue
interface_name = item.get("interface")
label = utils.normalize_interface_label(interface_name)
ip_address = item.get("address")
mac_address = utils.normalize_mac_address(item.get("mac"))
mac_address = utils.normalize_mac_address(item.get("mac_address"))

interface_o = interface.get(device_id=device_o.id, label=label)
if not interface_o:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def ingest(log):
distance = int(item.get("distance")) if item.get("distance") else None
metric = int(item.get("metric")) if item.get("metric") else None
destination = (
f"{item.get('network')}/{item.get('mask')}" if item.get("network") else None
f"{item.get('network')}/{item.get('prefix_length')}"
if item.get("network")
else None
)
protocol = item.get("protocol")
if item.get("type"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def ingest(log):
device_o = log.discoverable.device

for item in log.parsed_output:
# See https://github.com/networktocode/ntc-templates/tree/master/tests/cisco_nxos/show_mac_address-table # pylint: disable=line-too-long
# See # pylint: disable=line-too-long
interface_name = item.get("ports")
label = utils.normalize_interface_label(interface_name)
vlan_id = int(item.get("vlan"))
mac_address = utils.normalize_mac_address(item.get("mac"))
vlan_id = int(item.get("vlan_id"))
mac_address = utils.normalize_mac_address(item.get("mac_address"))

interface_o = interface.get(device_id=device_o.id, label=label)
if not interface_o:
Expand Down
2 changes: 1 addition & 1 deletion netdoc/ingestors/netmiko_cisco_nxos_show_vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def ingest(log):
for item in log.parsed_output:
# See https://github.com/networktocode/ntc-templates/tree/master/tests/cisco_nxos/show_vlan # pylint: disable=line-too-long
vlan_id = int(item.get("vlan_id"))
vlan_name = item.get("name")
vlan_name = item.get("vlan_name")

vlan_o = vlan.get(vlan_id, vlan_name)
if not vlan_o:
Expand Down