nautobot_ssot_ipfabric.utilities.nbutils

Utility functions for Nautobot ORM.

Module Contents

Functions

create_site(site_name[, site_id])

Creates a specified site in Nautobot.

create_manufacturer(vendor_name)

Create specified manufacturer in Nautobot.

create_device_type_object(device_type, vendor_name)

Create a specified device type in Nautobot.

create_device_role_object(role_name, role_color)

Create specified device role in Nautobot.

create_status(status_name, status_color[, ...])

Verify status object exists in Nautobot. If not, creates specified status. Defaults to dcim | device.

create_ip(ip_address, subnet_mask[, status, object_pk])

Verify ip address exists in Nautobot. If not, creates specified ip.

create_interface(device_obj, interface_details)

Verify interface exists on specified device. If not, creates interface.

create_vlan(vlan_name, vlan_id, vlan_status, site_obj, ...)

Creates or obtains VLAN object.

tag_object(nautobot_object, custom_field[, tag_name])

Apply the given tag and custom field to the identified object.

Attributes

CONFIG

ALLOW_DUPLICATE_IPS

nautobot_ssot_ipfabric.utilities.nbutils.CONFIG
nautobot_ssot_ipfabric.utilities.nbutils.ALLOW_DUPLICATE_IPS
nautobot_ssot_ipfabric.utilities.nbutils.create_site(site_name, site_id=None)

Creates a specified site in Nautobot.

Args:

site_name (str): Name of the site. site_id (str): ID of the site.

nautobot_ssot_ipfabric.utilities.nbutils.create_manufacturer(vendor_name)

Create specified manufacturer in Nautobot.

nautobot_ssot_ipfabric.utilities.nbutils.create_device_type_object(device_type, vendor_name)

Create a specified device type in Nautobot.

Args:

device_type (str): Device model gathered from DiffSync model. vendor_name (str): Vendor Name

nautobot_ssot_ipfabric.utilities.nbutils.create_device_role_object(role_name, role_color)

Create specified device role in Nautobot.

Args:

role_name (str): Role name. role_color (str): Role color.

nautobot_ssot_ipfabric.utilities.nbutils.create_status(status_name, status_color, description='', app_label='dcim', model='device')

Verify status object exists in Nautobot. If not, creates specified status. Defaults to dcim | device.

Args:

status_name (str): Status name. status_color (str): Status color. description (str): Description app_label (str): App Label (“DCIM”) model (str): Django Model (“DEVICE”)

nautobot_ssot_ipfabric.utilities.nbutils.create_ip(ip_address, subnet_mask, status='Active', object_pk=None)

Verify ip address exists in Nautobot. If not, creates specified ip.

Utility behavior is manipulated by settings if duplicate ip’s are allowed.

Args:

ip_address (str): IP address. subnet_mask (str): Subnet mask used for IP Address. status (str): Status to assign to IP Address. object_pk: Object primary key

nautobot_ssot_ipfabric.utilities.nbutils.create_interface(device_obj, interface_details)

Verify interface exists on specified device. If not, creates interface.

Args:

device_obj (Device): Device object to check interface against. interface_details (dict): interface details.

nautobot_ssot_ipfabric.utilities.nbutils.create_vlan(vlan_name: str, vlan_id: int, vlan_status: str, site_obj: nautobot.dcim.models.Site, description: str)

Creates or obtains VLAN object.

Args:

vlan_name (str): VLAN Name vlan_id (int): VLAN ID vlan_status (str): VLAN Status site_obj (Site): Site Django Model description (str): VLAN Description

Returns:

(VLAN): Returns created or obtained VLAN object.

nautobot_ssot_ipfabric.utilities.nbutils.tag_object(nautobot_object: Any, custom_field: str, tag_name: Optional[str] = 'SSoT Synced from IPFabric')

Apply the given tag and custom field to the identified object.

Args:

nautobot_object (Any): Nautobot ORM Object custom_field (str): Name of custom field to update tag_name (Optional[str], optional): Tag name. Defaults to “SSoT Synced From IPFabric”.