Skip to content

Lab 04 - Nautobot Organization Models

Lab Overview

In this lab we will explore Nautobot organization models. There are a number of ways to enter data into Nautobot, and we will practice using web based forms, manual CSV data entry and uploading CSV files. Additionally, we will discuss some standards that can be found across all Nautobot menus and forms.

Table of Contents

Lab 04 - Nautobot Organization Models

Task 1 - Getting familiar with menus and list views

Step 1-1 - Login via the web browser to Nautobot

If you have not already, use a web browser to navigate to your instance of Nautobot at https://{{ your pod }}. We will be using the Nautobot GUI for the remainder of this lab so there won't be a need for a terminal. Log into Nautobot by using the login option in the upper right of the Nautobot homepage. You can log in as the superuser you created in a previous lab or the superuser account included with your lab environment, the credentials for this account will be provided by the instructor.

Step 1-2 - Open the Sites list from the Organization Menu

At the top of the Nautobot homepage there is a row of drop down menus, some are included with Nautobot and some are being provided by apps, such as Device Lifecycle and Golden Config.

image01-1

In this lab we will be focused on the Organization menu, so click on Organization.

The Organization menu is broken up into subsections including: - Sites - Locations - Racks - Tenancy - Tags - Statuses - Dynamic Groups

Next to each model in the list is a green plus button and a blue disk button. The green button opens the web form to add a new instance of a given model while the blue disk icon opens the web form for bulk imports. This is a standard pattern in Nautobot, you will see it on most models in the drop-down menus.

image01-2

Click on the word Sites in the Organization menu (not the green or blue buttons) to open the Sites list. If you install your own instance of Nautobot or are using Nautobot Lab, this list will be empty, for this course some data has been included.

image01-3

Step 1-3 - Customize a list view

In the upper right there is a search bar and some action buttons. These options are common throughout most of Nautobot's list views.

The list includes a default set of columns, but these can be customized with the Configure action button. Click Configure to open the Table Configuration modal. Here you can add and remove columns and change the order of columns. Hold Ctrl when selecting and deselecting columns from the list. When you're satisfied with the result, click Save or if you want to go back to the default settings, click Reset.

The Add and Import action buttons will go to the forms for adding a new Site and bulk uploading Site data respectively. The green Export button will export the Site list as a csv file. It is possible to customize the csv export format and we will cover this later the lab dealing with extensibility.

image01-4

Step 1-4 - Search and filter a list view

The search box can be used to search the text fields of some, but not all, of the objects in the list view. For example, if you search for "Los Angeles", 2 Sites match the search based on the Facility column. However, if you search for "Nautobot", nothing matches despite the word "Nautobot" appearing frequently in the Tenant column. Why? Nautobot uses a relational database and the various models are related to each other in a web of interconnectivity. The search box is not searching the fields on models related to Sites, just the text fields in the Site itself. So instead of searching, let's filter!

Click on the Filter action button which opens the Filter modal. From here, click on the Tenant box and add Nautobot Airport and Nautobot Baseball Stadiums. Click Apply in the lower right hand corer of the filter modal. Now the Sites list has been filtered to include only Sites assigned a Tenant of either Nautobot Airports or Nautobot Baseball Stadiums.

image01-5

Task 2 - Add a new Site, and then some more Sites!

Step 2-1 - Enter data into the Site form

Now that we're familiar with the list views, let's manually add a new Site using the site form. Click on Organization drop down menu at the top of the page and select the green button next to Sites to open the Add a new site form.

Some of the field labels are bold and some are not, some of the fields have dashes while others contain light grey text. The fields with bold labels are required and attempting to save a Site without data in those fields will result in an error message.

The text fields (except comments) have light grey text mirroring the field label text. In some cases, such as longitude and latitude, there are restrictions to the format of the data the field will accept.

The fields with dashes are linked to other Nautobot objects and will only have options available if you have previously input instances of those other objects. For example, the Status field contains Active, Decommissioning, Planned, Retired, and Staging by default in Nautobot. However, if you were to go to the Status list and delete all the available statuses, then nothing would appear in the Status form field, and you would not be able to create a Site.

image02-1

Let's create a Site for the Sacramento International Airport. Enter the following data in the Site form:

  • Name: SMF01
  • Slug: smf01
  • Status: Active
  • Region: United States
  • Time zone: US/Pacific
  • Tenant: Nautobot Airports
  • Physical Address: 6900 Airport Blvd, North Natomas, CA 95837
  • Latitude: 38.695975
  • Longitude: -121.586313

Click the blue Create button at the bottom of the form after entering the data. If all the data is valid, you should see the detail page for the new Site. This is another common Nautobot pattern, after saving a new object, the detail page for the object will be displayed. Each detail page is different and will display additional data relevant to the object type. In this case, there are boxes for Stats, Rack Groups and Images on the right. We haven't created any Racks, Devices, Prefixes, VLANS, Circuits or Virtual Machines for this Site, so all the count boxes have a 0.

On the left side of the page, there is a Contact Info box. Next to the GPS Coordinates and Physical Address there are Map it buttons, try them out!

image02-2

Step 2-2 - Bulk upload Sites

The preloaded demo data has data for the Airports and Baseball Stadiums Tenants, we are going to be entering data for a new Tenant, Football Stadiums.

While entering Sites one at a time works, let's save some time by uploading several at once with the bulk upload option. Click on the Organization drop down menu at the top of the page and select the blue disk button next to Sites, this will open the Sites bulk import page.

image02-3

There are two tabs at the top, and the CSV Data option opens by default. We will come back to this but for now click on CSV File Uploaad and scroll down to the CSV Field Options table. From left to right there are four columns: Field, Required, Accessor and Description. The Field column lists all the data fields available for bulk import, you will notice these are in snake case and vary slightly from the field labels on the Site form. This is because the field names here on the bulk import page match the actual model field names in code that defines the Site object. These are the field names that must be used when bulk importing data for a Site.

Next, is the Required column. A checkmark means the field is required and an X means the field is optional. You may wonder why the slug field is optional here but required on the Site form. If a slug is not provided when doing bulk imports, it is created automatically. The name is "slugified". That's a fun way to say the name is turned into one long word containing nothing but lower case ASCII characters and hyphens (-).

What is a slug? Slug is a newspaper term used as a label for an article. Nautobot is built on the Django framework, born from a newspaper, which generally uses slugs in URLs. Here in Nautobot slugs are URL friendly designations for objects.

The Accessor column details how a related object will be looked up when attempting the bulk import. As mentioned previously, Nautobot uses a relational database and many database columns reference other objects. For example, when bulk importing a Site, what value should be entered for Status? The Accessor column says to use "slug". So if I want to include a status of Active for a Site that I am bulk importing, the correct value to use is active because the slug will be all lower case. However, if I want to include a Region or Tenant, then those objects are referenced by their name.

The Description column on the right provides a short description of type of data the field holds, and in some cases additional information, the available time zones for example.

image02-4

Time to upload some Sites, click on the Choose File button, select 02_nautobot_sites.csv and click Submit. The files for this course are included in the repo and can be accessed by either downloading or cloning the repo content.

After clicking Submit you should see the following:

image02-5

Hmmm, Well that didn't work.

The bulk import failed because the Tenant for our new football stadiums doesn't exist yet and Nautobot was not able to look up the object. We could delete the tenant column from the CSV file and clock out early, but let's try to fix this.

Time to...

Step 2-3 - Create a Tenant

Click on the Organization drop down menu at the top of the page and click on the green button next to Tenants, this will open the Add a new tenant form. A tenant represents a discrete grouping of resources used for administrative purposes. Typically, tenants are used to represent individual customers or internal departments within an organization. Tenants can be grouped into a Tenant Group, but for this lab we will simply create a single new Tenant. Enter the following data into the Add a new tenant form and click the blue Create button at the bottom.

  • Name: Nautobot Football Stadiums
  • Slug: nautobot-football-stadiums

image02-6

Step 2-4 - Bulk upload Sites...again

Click on the Organization drop down menu at the top of the page and select the blue disk button next to Sites to return to the Sites bulk import page. Before uploading the CSV file take a look at the large text field under the CSV Data tab. Instead of uploading a file, you can type (or copy/paste) CSV data right into the form. The first row specifies which fields should be included and each additional row is added as a new Site.

The image below depicts the Site data from 02_nautobot_sites.csv entered on the CSV Data form. You are free to do this or click on the CSV File Upload tab and upload 02_nautobot_sites.csv.

image02-7

After a success bulk import operation a list of the imported items is displayed. From here you can click on the name of an item to go to its detail page, import more or simply view all the Sites.

image02-8

Step 2-5 - Create a Football Stadium Site

Now that we have a new Tenant and some Sites, let's create our own football stadium Site. You can name this whatever you like, but it is a good idea to follow the format of the other data we've already entered. I'm going to create a Houston Site. Enter as much data as you like, but for the purposes of this lab only a Name, Slug, Region Status and Tenant are required. After you've created the Site, the Site detail page will be displayed.

  • Name: HOU01
  • Slug: hou01
  • Status: Active
  • Region: United States
  • Tenant: Nautobot Football Stadiums

image02-9

Step 2-6 - Review data entry progress

Now that some Sites have been associated with the "Nautobot Football Stadiums" Tenant, lets check on our progress by reviewing the detail page for the "Nautobot Football Stadiums" Tenant. lick on the Organization drop down menu at the top of the page and select Tenants. Click on the "Nautobot Football Stadiums" Tenant.

On the right side of the page there is a "Stats" box that breaks down number of objects associated with this Tenant. Right now we only have 6 sites, but we'll be adding more data and coming back to this detail page to see our progress.

image02-10

Task 3 - Reviewing Regions

Step 3-1 - Create a new Region

What about 01_nautobot_regions.csv?! As you've likely noticed already, the CSV files are numbered in the order they need to be imported, and we skipped the first file. 01_nautobot_regions.csv is included for completeness, but there is already a full complement of Regions in the sample data, so there isn't a need to upload more. But we should stop here and talk about how Regions work.

In upcoming tasks and labs we will be adding data not included in the CSV files, so please refrain from attempting to upload them all now, tempting as I know it is.

Regions are administrative domains, used to organize Sites and other Regions. They can be nested recursively. A Region might represent a continent, country, city, campus, or other area. A Region can contain Sites and other Regions.

Click on the Organization drop down menu at the top of the page and select the green button next to Regions. A Region requires only a unique name and slug, a parent Region and description can optionally be added. The new stadium created in a previous step is in the city of Houston located in the state of Texas. To provide a more precise Region for this stadium create a Region with these attributes:

  • Parent: United States
  • Name: Texas
  • Slug: texas

Step 3-2 - Associate a Site with the new Region

Click on the Organization drop down menu at the top of the page and select Sites. From the Sites list, type HOU01 into the search box at the top of the list. If you named your stadium something else, search for the name used.

The list should be filtered and only your new site should be displayed. Click on the checkbox next to the Site name and click the Edit Selected button just below the site. This button allows for bulk updates and can be found at the bottom of list views.

A form wil open on the right side of the page named Attributes, change the Region to Texas and save the form by clicking Apply(you wil have to scroll down).

image03-1

If the Site attributes have been successfully updated, a banner will appear at the top of the page with a confirmation and the new Region name will appear in the Region column of the Sites list.

image03-2

Task 4 - Add a Location

Step 4-1 - Create Location Types

Country and state are not granular enough you say? Let's get more specific and create a Location. To get started we will need a few Location Types first. You could define a Location Type of "Building" and then create instances of that Location Type for each physical building.

Why bother with Location Types at all? Location Types define the hierarchy of the Locations themselves. For example, if you created a Location Type of "Floor" and assigned Location Type "Building" as the parent, then the Locations instances created using those types will maintain that structure.

Click on the Organization drop down menu at the top of the page and select the green button next to Location Types. The only required fields are Name and Slug. You can also specify the type of objects that can be associated directly with this Location Type. Create a location type with these attributes:

  • Name: Building
  • slug: building
  • Content types: dcim|device, dcim|rack

image03-2

Follow the same process again to create another Location Type with these attributes:

  • Name: Floor
  • slug: floor
  • Content types: dcim|device, dcim|rack

Step 4-2 - Create Locations

Now that we have some Location Types, it is time to create Location instances based on those Location Types. Click on the Organization drop down menu at the top of the page and select the green button next to Locations. Create a Location with the following attributes:

  • Location Type: Building
  • Site: HOU01
  • Name: Building A
  • Slug: building-a
  • Status: Active
  • Tenant: Nautobot Football Stadiums

If the new Location was successfully created the Location detail page will be displayed. In the Location box on the left you will be able to see the Hierarchy based on the Region, Site and Location Types we defined.

Follow the same process to create another location with these attributes:

  • Location Type: Building --> Floor
  • Parent: Building A
  • Name: Floor 1
  • Slug: floor-1
  • Status: Active
  • Tenant: Nautobot Football Stadiums

You may notice that a Site cannot be added to a child location. Sites can only be added to the top level Location in the Hierarchy.

After the floor Location is created, the detail page should contain the following hierarchy:

image04-2

Task 5 - Add Racks

Step 5-1 - Import Rack data

In addition to manually adding data for our new football stadiums, we are also populating data for a number of other football stadiums. So, lets start this task off with a bulk import. Click on the Organization drop down menu at the top of the page and select the blue button (bulk import) next to Racks.

Upload the file 03_nautobot_racs.csv. You can either upload the file directly or copy the data into the CSV Data form. Once the data is successfully imported, you should see a list of the imported Racks.

image05-1

Step 5-2 - Create a new Rack

The rack model represents a physical two-post or four-post equipment rack in which devices can be installed. Each rack must be assigned to a Site, and may optionally be assigned to a Location, Rack Group, and/or Tenant. Racks can also be organized by user-defined functional roles.

Click on the Organization drop down menu at the top of the page and select the green button next to Racks to open the Add a new rack form. These forms should look quite familiar by now, and you can probably guess what data we are going to enter. Create a Rack object using the attributes below. The name was derived by looking at the name format of other Racks. While this is not required, data quality is extremely important, and you should strive to maintain high quality data.

Before saving the Rack, click on the Location field. The Locations we created earlier appear in this dropdown because we specified the Rack content type as valid for association. So now this rack may be optionally associated directly with the Location.

  • Site: HOU01
  • Name: hou01-101
  • Status: Planned
  • Tenant: Nautobot Football Stadiums
  • Type: 4-post frame
  • Width: 19 inches
  • Height (U): 48

After the Rack is successfully the detail page shown below will be displayed. In the right hand column the Rack elevations are visible. These will automatically populate as we create devices and assign them to a Rack position.

image05-2