diff --git a/module/sources/check_redfish/config.py b/module/sources/check_redfish/config.py index 2c21fff..a4f99be 100644 --- a/module/sources/check_redfish/config.py +++ b/module/sources/check_redfish/config.py @@ -70,6 +70,12 @@ def __init__(self): via check_redfish if False only data which is not preset in NetBox will be added""", default_value=False), + ConfigOption("skip_fhrp_group_ips", + bool, + description="""define if an IP address assigned to a FHRP group (like HSRP, VRRP, GLBP) will be skipped. + If True this IP address will be skipped and not synced to NetBox to prevent incorrect syncing.""", + default_value=False), + ConfigOption(**config_option_ip_tenant_inheritance_order_definition), ] diff --git a/module/sources/common/source_base.py b/module/sources/common/source_base.py index 0e95e5c..7611668 100644 --- a/module/sources/common/source_base.py +++ b/module/sources/common/source_base.py @@ -443,6 +443,12 @@ def add_update_interface(self, interface_object, device_object, interface_data, this_ip_object = None skip_this_ip = False for ip in self.inventory.get_all_items(NBIPAddress): + # stops fhrp group assigned ip addresses from being overridden and assigned to another object type + # if the config skip_fhrp_group_ips is set to True + if grab(ip, "data.assigned_object_type", fallback="") == "ipam.fhrpgroup" and self.settings.skip_fhrp_group_ips: + log.info(f"Ip address {grab(ip, "data.address")} is assigned to an FHRP Group and skip_fhrp_group_ips is set to {self.settings.skip_fhrp_group_ips}, skipping.") + skip_this_ip = True + continue # check if address matches (without prefix length) ip_address_string = grab(ip, "data.address", fallback="") diff --git a/module/sources/vmware/config.py b/module/sources/vmware/config.py index 7e448a2..3e5c731 100644 --- a/module/sources/vmware/config.py +++ b/module/sources/vmware/config.py @@ -258,6 +258,11 @@ def __init__(self): description="""If the VMware Site Recovery Manager is used to can skip syncing placeholder/replicated VMs from fail-over site to NetBox.""", default_value=False), + ConfigOption("skip_fhrp_group_ips", + bool, + description="""If an IP address is assigned to a FHRP group (like HSRP, VRRP, GLBP) + then this IP address will be skipped and not synced to NetBox to prevent incorrect syncing.""", + default_value=False), ConfigOption("strip_host_domain_name", bool, description="strip domain part from host name before syncing device to NetBox",