Cover....1
Title Page....2
Copyright and credits....3
Foreword....5
Contributors....6
Table of Contents....10
Preface....20
Part 1: Introduction to Source of Truth and Nautobot....26
Chapter 1: Introduction to Nautobot....28
Introduction to network automation....28
What is network automation?....29
Network automation use cases....30
Why automate your network?....32
Persona-driven network automation....34
Industry trends....35
Understanding SoT....38
Defining SoT....40
Approaches to SoT....42
SoT tools and products....43
Nautobot overview....44
Nautobot use cases....45
Network SoT....45
Network automation platform....48
Nautobot ecosystem....51
Summary....53
Chapter 2: Nautobot Data Models....54
Nautobot data models overview....55
Data model summary....55
Network device inventory data models....56
Devices....56
Device components....57
Device types....65
Manufacturer....67
Roles and statuses....67
Platform....68
Virtual chassis....68
Device redundancy groups....68
Interface redundancy groups....69
Racks....70
Locations....72
Location type....73
Tenants....74
IPAM data models....74
Namespaces....75
Prefixes....76
IP addresses....77
RIRs....78
VRFs....78
Route targets....79
VLANs and VLAN groups....79
Circuits data models....79
Circuits....80
Circuit terminations....81
Circuit types....82
Circuit providers....82
Provider networks....83
Data model extensibility....83
Custom fields....84
Computed fields....85
Relationships....87
Config contexts....88
Custom data models....89
Summary....89
Part 2: Getting Started with Nautobot....90
Chapter 3: Installing and Deploying Nautobot....92
Nautobot architecture overview....93
Installing Nautobot....94
Getting Nautobot up and ready on Ubuntu....95
Installing dependencies....95
Installing the Nautobot application....99
Launching Nautobot....104
Nautobot worker....109
Nautobot web service....111
Running Nautobot as Linux services....113
Loading data into Nautobot....118
Using the graphical user interface....119
Summary....130
Chapter 4: Understanding the User Interface and Bootstrapping Nautobot....132
Understanding the navigation and UI....133
Navigation menu....133
Nautobot home page and panels....136
Footer navigation....143
Table views....147
Detailed views....152
Managing inventory and bootstrapping your first installation....153
Identifying your data....154
Organizational data....154
Device data....164
Summary....170
Chapter 5: Configuring Nautobot Core Data Models....172
IP address management in Nautobot....172
IP addresses....173
Prefixes....174
Namespaces....174
VRFs....174
VLANs....174
RIRs....174
Configuring IP address management in Nautobot....175
IPAM configuration for Wayne Enterprises....176
Modeling HA and virtual devices....181
Device Redundancy Groups....182
Virtual chassis....183
Key differences between device redundancy and virtual chassis....184
Setting up a firewall redundancy group for Wayne Enterprises in Nautobot....185
Interface Redundancy Groups....188
Cabling and power management....188
Cables....189
Incorporating power management with cabling....191
Power panels....192
Power feeds....192
Understanding the blast radius through comprehensive data....194
Secrets management....195
Why use secrets?....195
Core concepts....195
Secrets versus Secrets Groups in Nautobot....195
Security considerations....199
Accessing secrets in code....199
Nautobot Secrets Providers app (plugin) overview....200
Using Notes, Tags, Changelog, and Filter forms....201
Notes....202
Tags....203
Change log....204
Filter forms....207
Best practices for inventory management....209
Summary....211
Chapter 6: Using Nautobots Extensibility Features....212
Statuses....213
Managing statuses....214
Applying a status....216
Use cases for statuses....217
Best practices for statuses....218
Tags....218
Managing tags....219
Applying a tag....221
Use cases for tags....221
Best practices for tags....223
Custom fields....223
Managing custom fields....225
Diving into custom field attributes....225
Validation rules....228
Custom field choices....228
Applying a custom field....231
Use cases for custom fields....231
Best practices for custom fields....233
Computed fields....233
Managing and applying computed fields....234
Computed field template context....235
Use cases for computed fields....237
Best practices for computed fields....238
Custom links....238
Managing and applying custom links....239
Use cases for custom links....244
Best practices for custom links....244
Export templates....244
Default export templates....244
Use cases for export templates....246
Managing and applying export templates....246
Best practices for export templates....249
Config contexts....249
Exploring the config context hierarchy....251
Managing and applying config contexts....252
Use cases for config contexts....257
Config context schemas....257
Git as a data source....260
Managing and applying Git data sources....260
Use cases for data sources....263
Best practices for data sources....264
Relationships....264
Use cases for relationships....264
Managing and applying relationships....265
Creating a relationship....269
Dynamic groups....272
Use cases for dynamic groups....272
Managing and applying dynamic groups....273
Best practices for dynamic groups....276
Summary....276
Chapter 7: Managing and Administering Nautobot....278
Administration with the Admin UI....278
User, group, and permissions management....281
Groups....282
Users....283
Permissions enforcement....286
Exploring Nautobots settings....298
Understanding setting precedence....298
Setting banner and support messages....299
Adding your companys logos and branding....303
Customizing pagination....310
Preferred primary IP version....311
Handling logs....313
Customizing sanitizer patterns....314
Common settings....315
Advanced settings....315
Setting up and using NAPALM integration....316
Exploring nautobot-server CLI commands....320
Creating a superuser account....320
Exporting and importing data....321
Cleaning up old scheduled jobs....321
Retracing corruptedmissing cable paths....322
Getting help....322
Exploring the Nautobot Shell....322
Working with objects....323
Monitoring Nautobot metrics....324
Upgrading Nautobot....325
Troubleshooting Nautobot....328
Performing a health check....328
Troubleshooting the configuration....329
Debugging Nautobot....329
Summary....332
Part 3: Network Automation with Nautobot....334
Chapter 8: Learning about Nautobot APIs – REST, GraphQL, and Webhooks....336
Technical requirements ....337
Nautobot REST APIs....337
Nautobots interactive API documentation....337
Understanding Nautobot APIs....344
API authentication....349
Using the API with Python....351
API tips....366
pynautobot....371
GraphQL with Nautobot....371
GraphQL primer....371
GraphiQL....372
GraphQL queries with Python....383
GraphQL versus REST....388
Webhooks....389
Exploring webhooks....389
Example – using a Webhook to trigger an Ansible AWX playbook....390
Summary....395
Chapter 9: Understanding Nautobot Integrations for NetDevOps Pipelines....396
Technical requirements ....396
Exploring pynautobot....397
Installing pynautobot....397
Getting started....398
Retrieving objects....399
Updating an object....411
Deleting an object....414
Creating an object....414
Working with Nautobot Apps....415
Using GraphQL with pynautobot....417
Using pynautobot to get the next available IP address....418
Exploring the Nautobot Ansible Collection....421
Installing the collection....423
Reading data with Ansible....424
Ansible write operations....427
Exploring Ansible inventory sources....429
Using Nornir Nautobot....437
Installing Nornir Nautobot....437
Exploring Nautobot Docker containers....440
Exploring the Nautobot Go library....443
Introducing the Nautobot Terraform provider....446
Summary....446
Chapter 10: Embracing Infrastructure as Code with Nautobot, Git, and Ansible....448
Technical requirements ....448
Setting up the environment....449
Network topology....449
Linux host....451
Ansible....451
Nautobot....452
The books Git repo....456
Adding data to Nautobot with Ansible....457
Setting up a dynamic inventory....460
Backing up network devices....462
Performing a config replace with Nautobot, NAPALM, and Ansible on Arista and Juniper devices....463
Performing config changes with Nautobot and Ansible for Cisco IOS devices....465
Performing config changes with Nautobot and Ansible for Cisco NX-OS devices....474
Managing data with config contexts and using Git....475
Nautobot jobs versus Ansible playbooks....476
Summary....477
Chapter 11: Automating Networks with Nautobot Jobs....478
Technical requirements ....478
Nautobot Jobs overview....479
Introduction to the Django ORM....479
Learning about the Nautobot Shell and ORM....481
Reading data....483
Adding and updating data....486
Deleting data....491
Adding Jobs to Nautobot....491
Synchronizing Jobs into Nautobot from a Git repository....492
Distributing Jobs as part of a Nautobot app....492
Mounting or placing Jobs directly in JOBS_ROOT....492
Creating your first Nautobot Job....492
Hello World Nautobot Job....493
Breaking down and building a Nautobot Job....500
Adding dynamic dropdowns to your job....506
Using Jobs to populate data in Nautobot....520
Converting Python scripts into Nautobot Jobs....521
Diving into even more Job features....524
Job buttons....524
Job Hooks....530
Job scheduling....532
Job approvals....534
The Jobs API....535
Job permissions....538
Summary....538
Chapter 12: Data-Driven Network Automation Architecture....540
Data-driven network automation architecture....540
Evolution of managed networks....541
Manually managed networks....542
Power tool automated networks....542
Legacy and domain network management managed networks....542
Infrastructure as Code (IaC) automated networks....543
Nautobot automated networks....545
SoT with Nautobot....547
Integrations and extensibility....547
SoT life cycle....548
Nautobot enablers for SoT....549
Automation and orchestration....561
Understanding workflows....562
Nautobot enablers for automation and orchestration....566
APIs – REST, GraphQL, and Webhooks....566
Modern network monitoring – telemetry and observability....567
Data enrichment....568
Data normalization....569
Data collection....569
Closed loop network automation....570
User interactions....571
Summary....572
Part 4: Nautobot Apps....574
Chapter 13: Learning about the Nautobot App Ecosystem....576
Nautobot Apps overview....576
Why Nautobot Apps?....578
Flexibility....579
Access to SoT data....579
Accelerated development....580
Reduced tool sprawl....580
Nautobot Apps ecosystem....581
Golden Config....581
Nornir....583
Device Onboarding app....583
Device Lifecycle Management (DLM)....583
Data Validation Engine....584
Single Source of Truth (SSoT)....585
Network data models....586
Design Builder app....587
Circuit Maintenance app....588
Secrets Providers app....590
Floor Plan app....591
ChatOps....591
Welcome Wizard app....593
Whats possible with Nautobot Apps?....593
Creating data models....593
Creating APIs....595
Creating UI elements to enhance the user experience....596
Distributing jobs....598
Creating network automation solutions....599
Nautobot Apps administration....600
Installing Nautobot Apps....600
Uninstalling Nautobot Apps....605
Summary....607
Chapter 14: Intro to Nautobot App Development....608
Setting up your system for Nautobot App development....608
Installing Docker....609
Installing Python 3, Pip, Cookiecutter, and Poetry....611
Starting a Nautobot App with Cookiecutter....613
Exploring the App structure....615
Exploring pyproject.toml....618
Post-Cookiecutter tasks and Poetry....622
Introducing Invoke....623
Building the Docker image....624
Defining credentials....624
Running Nautobot....625
Exploring the Nautobot Developer API....630
Configuring a Nautobot App....630
Extending the existing Nautobot UI....633
Extending core functionality....643
Adding entirely new functionality....653
Summary....656
Chapter 15: Building Nautobot Data Models....658
A real-world use case for custom Apps....658
Data model design....659
Gathering representative data and requirements....659
Considering composability, reusability, and deduplication of data....661
Considering built-in Nautobot extensibility features....661
When the data model suggests you should build an App....662
Building an App around existing data models....662
Data model based on extensibility features....664
Adding an ACL overview to the Device detail view....667
Adding ACL details as a Device tab....670
Adding a new DevicesACLs view....674
Implementing the data table....675
Adding ACL details as a REST API endpoint....679
Review....683
Building an App with custom data models....684
Designing the ACL data models....684
Implementing the ACL data models....686
Implementing the REST API....694
Implementing the UI....698
Exercises or next steps....711
Summary....711
Chapter 16: Automating with Nautobot Apps....712
A real-world use case for network automation in a Nautobot app....712
Design requirements....713
Building an App for network automation....713
Rendering IP ACL config using Jinja2....713
Writing a job to push config to a device using Netmiko....717
Preparing the device and related data in Nautobot....722
Running the job....725
Adding a job button to enable one-click configuration....726
Next steps on your journey....730
Summary....731
Appendix 1: Nautobot Architecture....732
Nautobot components and services....732
Database: PostgreSQL or MySQL....734
In-memory data store: Redis....734
In-Memory Data Store High-Availability: Redis Sentinel....736
Job execution: Celery Worker(s)....737
Job queues: Celery task queues....737
Job scheduler: Celery Beat....739
Web server: uWSGI....740
Appendix 2: Integrating Distributed Data Sources of Truth with Nautobot....744
Understanding distributed data sources....744
Challenges of distributed data....746
Benefits of aggregating data....746
Approaches to distributed data management....747
Exploring the Nautobot SSoT framework....748
Getting started with the Nautobot SSoT framework....750
Existing SSoT integrations....760
Building your own SSoT integration....765
Defining the data model mappings....765
Creating a data sync job....766
Using the custom SSoT job....771
Appendix 3: Performing Config Compliance and Remediation with Nautobot....774
Why Golden Config....774
Golden Config design....775
Golden Config use cases....776
Performing Config backups....778
Generating intended configurations....780
Performing config compliance....782
Automating config remediation and deployments....789
Best practices and tips....794
Index....796
Other Books You May Enjoy....813
Nautobot enables network teams to build a scalable and extensible network source of truth that provides a foundation to power any network automation stack.
With the help of this guide, you’ll learn how to deploy, manage, and integrate Nautobot as a source of truth and network automation platform. As you progress, you’ll learn what a network source of truth is, the relationship between data and network automation, and network data models. You’ll also gain a broad understanding of Nautobot and its robust features that allow maximum flexibility. A dedicated section will show you how to construct a single source of truth with Nautobot and help you explore its programmatic APIs, including REST APIs, GraphQL, webhooks, and Nautobot Job Hooks. Later, you’ll develop custom data models and custom apps for Nautobot and experience its extensibility and powerful developer API. In the last part of this book, you'll discover how to deploy configuration compliance and automated remediation once Nautobot is deployed as a network source of truth.
By the end of this book, you’ll be able to design and manage Nautobot as a network source of truth, understand its key features, and extend Nautobot by creating custom data models and apps that suit your network and your team.
This book is for network engineers, network automation engineers, and software engineers looking to support their network teams by building custom Nautobot Apps. A basic understanding of networking (e.g. CCNA) and knowledge of the fundamentals of Linux, Python programming, Jinja2, YAML, and JSON are needed to get the most out of this book.