Nautobot SSoT Integration with ServiceNow

Blog Detail

The Nautobot SSoT App provides a general framework for synchronizing data between Nautobot and another Source of Truth (SoT) or System of Record (SoR). In this blog post, we’ll look more closely at a specific example of a Nautobot app built atop this framework – the open-source Nautobot SSoT ServiceNow Data Target App, or Nautobot SSoT ServiceNow App for short. This app allows you to synchronize data from Nautobot into ServiceNow so that the two systems will be in sync about your regions, sites, devices, and interfaces in your network.

In previous blog posts we have discussed how to build your own Nautobot SSoT application and covered some more advanced techniques that you might use in developing such an application. If you’re interested in reading the code of the Nautobot SSoT ServiceNow App and understanding how it is implemented, these posts include useful context to aid you in developing that understanding.

Installing the App

To get started, the Nautobot SSoT ServiceNow App can be installed via pip like most Nautobot apps:

pip install nautobot-ssot-servicenow

You can then enable it in your nautobot_config.py in addition to any other apps/plugins you are using. Since it builds atop the base Nautobot SSoT App, you need to ensure that the base plugin is enabled as well:

# nautobot_config.py
PLUGINS = [
    "nautobot_ssot",
    "nautobot_ssot_servicenow",
]

PLUGINS_CONFIG = {
    "nautobot_ssot": {
        "hide_example_jobs": True,
    },
}

You then need to run the nautobot-server post_upgrade command to ensure that the Nautobot database is updated to include support for this plugin. (Running this command is generally a good practice after installing or updating any Nautobot app, as well as after upgrading Nautobot itself.)

nautobot-server post_upgrade

Configuring the App

In order to use the Nautobot SSoT ServiceNow App, it needs to be configured with the name of your ServiceNow instance and with the credentials to use to connect to this instance. This can be done via the PLUGINS_CONFIG in your nautobot_config.py, or alternatively you can configure this information via the Nautobot GUI, taking advantage of some new Nautobot features introduced in Nautobot 1.2.0. For this blog post, we will follow the latter approach, as it’s a bit more involved but also more powerful and flexible.

To configure the app via the GUI, we must first define Nautobot Secrets corresponding to the ServiceNow username and password.

It’s important to understand that Nautobot does not store secrets in its database, rather it stores how to look up the secrets when they are needed.

Defining Secrets and a Secrets Group

Depending on your specific deployment environment, you might have secrets stored in environment variables, in access-restricted text files, or in a dedicated system such as Hashicorp Vault or AWS Secrets Manager. For this example, we’ll assume that the secrets are stored in environment variables of the Nautobot server process, but the steps to follow will be similar regardless of the details of your environment.

Select Secrets > Secrets > [+] from the Nautobot menu bar to begin defining a new Secret corresponding to the ServiceNow username, and fill in the form fields as appropriate for your environment – for our example of an environment variable, the secret definition may look something like the following:

Defining Secrets and a Secrets Group

Click “Create and Add Another”, and repeat the process to define a second secret, this one describing the ServiceNow password. When done, click “Create” to create this secret as well.

Next, we must define a Secrets Group that collects these two secrets together and assigns them a purpose. Select Secrets > Secret Groups > [+] from the Nautobot menu bar. Because the ServiceNow integration of this app is built around the ServiceNow REST API, you will assign the two previously defined secrets to this group as REST credentials (a secrets group may contain credentials of various types):

Defining Secrets and a Secrets Group

When done, click “Create” to save this new secrets group.

Configuring the App to use the Secrets Group

Now that we have defined how to access these secrets, and how to use them, we can configure the Nautobot SSoT ServiceNow App to connect to ServiceNow. Select Plugins > Installed Plugins from the menu bar. This will bring you to a page listing all installed plugins, including the Nautobot SSoT and Nautobot SSoT ServiceNow apps.

Configuring the App

Here, click the yellow “gear” icon in the “Nautobot SSoT ServiceNow” row. This will take you to the configuration page for this plugin. (In Nautobot 1.2.0 and later, all plugins have the option of registering a “home” page and a “configuration” page that are linked thusly from the Installed Plugins page.) On this page, we can define the ServiceNow instance to connect to, as well as link in the secrets group we just defined as the credentials to use to connect to it.

Configuring the App

When done, click “Update” to save your changes. The app is now configured for use!

Using the App

Like any other SSoT app, the Nautobot SSoT ServiceNow App can be run from the main Nautobot SSoT page accessible at Plugins > Single Source of Truth > Dashboard.

Using the App

Clicking on the “ServiceNow” text on the left will link to a detailed view of this app. As you can see, running this app will synchronize device, interface, and location data from Nautobot to the equivalent data tables in ServiceNow:

Using the App

The app SSoT synchronization can be started by clicking the “Sync Now” button, which will prompt you for various input parameters. The “Debug” and “Log Unchanged” checkboxes can be checked to enable more detailed logging of the sync process, or left unchecked for a quieter log, and the “Site filter” dropdown allows you to narrow the scope of the sync to the contents of a single Site for a faster, smaller sync execution.

Servicenow

Running the synchronization will take you to the familiar Nautobot job result view, and when the job run is completed, you can click the “SSoT Sync Details” button in the top right for the corresponding standard Nautobot SSoT sync result view:

Job Result
Nautobot

You can then log into your ServiceNow instance and confirm that the relevant data was indeed synced as expected:

ServiceNow

Conclusion

Hopefully, this concrete example of a Nautobot SSoT App really helps you see the potential of Nautobot and SSoT for keeping your SoT and SoR all in sync with one another. As a bonus, you’ve also learned about how to use Secrets and Secrets Groups in Nautobot and how other Jobs and Apps can benefit from them.

While it’s fully functional, the Nautobot SSoT ServiceNow App doesn’t necessarily sync everything from Nautobot that you might want in your own ServiceNow instance. We’d love to hear from you about what additional data synchronization you might find useful in this app, or even see a pull request from you adding additional features!

-Glenn



ntc img
ntc img

Contact Us to Learn More

Share details about yourself & someone from our team will reach out to you ASAP!