Skip to content

Commit

Permalink
adds warning about possible wrongly assigne VRF to an IP address #357
Browse files Browse the repository at this point in the history
  • Loading branch information
bb-Ricardo committed Dec 22, 2023
1 parent d1f52b0 commit cad23c5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion module/sources/common/source_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,20 @@ def add_update_interface(self, interface_object, device_object, interface_data,
# continue if
# * both are in global scope
# * both are part of the same vrf
if possible_ip_vrf != grab(ip, "data.vrf"):
current_vrf = grab(ip, "data.vrf")
if possible_ip_vrf != current_vrf:
if not isinstance(possible_ip_vrf, NetBoxObject):
possible_ip_vrf = str(possible_ip_vrf)
else:
possible_ip_vrf = possible_ip_vrf.get_display_name()
if not isinstance(current_vrf, NetBoxObject):
current_vrf = str(current_vrf)
else:
current_vrf = current_vrf.get_display_name()

log.warning(f"Possibly wrongly assigned VRF for {current_ip_nic.get_display_name()} IP "
f"'{ip_address_string}'. Current VRF '{current_vrf}' and "
f"possible VRF '{possible_ip_vrf}'")
continue

# IP address is not assigned to any interface
Expand Down

0 comments on commit cad23c5

Please sign in to comment.