Network Automation Ebook Part1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Nautobot Navigators

Introduction to Network
Automation
A Network Engineer’s Guide to
Tools, Tips, and Techniques

Part 1: The Basics


Introduction

In today's rapidly evolving digital landscape, the demand for efficient, scalable, and agile network infrastructure has
never been greater. Network engineers, entrusted with delivering seamless connectivity and optimal performance, are
increasingly turning to automation as a means to streamline operations and adapt to the dynamic demands of
modern networks.

However, for many network engineers and IT professionals alike, the prospect of diving into network automation can
be both exciting and intimidating. The journey often begins with similar questions:

What aspects of my network should I automate to enhance efficiency and productivity?


Where do I get started with network automation tools and technologies?
What reliable resources and guides are available to facilitate my learning journey?

Our aim is not only to demystify network automation but also to empower you to harness its full potential to
transform your network infrastructure. Whether you're seeking to automate routine tasks, optimize network
performance, or orchestrate complex workflows, this eBook will serve as your comprehensive guide to navigating the
exciting world of network automation.

So, if you're ready to start on your journey of discovery and innovation, let's dive into the transformative power of
network automation together. In Part 1, we start off by focusing on the basics to get you started.

The Differences Between Networking Roles


In the complex workflows of modern networking, each role plays a vital part in ensuring the seamless
operation and evolution of digital infrastructures. As technology advances at a continuously growing
pace, the importance of specialized professionals becomes increasingly pronounced. Let's explore the
significance of three pivotal roles: the traditional Network Engineer, the Software Developer, and the
emerging Network Automation Engineer.

The traditional Network Engineer is the backbone of any network infrastructure. These professionals are

1 adept at designing, implementing, and maintaining networks to ensure seamless connectivity and
optimal performance. Historically, their primary tool has been the Command Line Interface (CLI), though
the shift toward user-friendly Graphical User Interfaces (GUIs) is gaining momentum.

A Software Developer is a master at crafting solutions through code. Proficient in various programming
languages, they create applications, scripts, and tools tailored to specific needs. Their expertise lies in

2 conceptualizing and implementing algorithms, data structures, and software architectures to address
complex challenges.

A Network Automation Engineer seamlessly merges the skills of both these roles. They possess an in-
depth understanding of network protocols, architectures, and devices akin to traditional Network

3
Engineers. Simultaneously, they leverage their coding acumen to automate mundane tasks, streamline
workflows, and enhance overall network efficiency. This unique combination empowers them to bridge
the gap between traditional networking and modern software-centric approaches, driving innovation and
agility in network management.

2 Introduction to Network Automation - Part 1


Copyright © 2024 | Network to Code, LLC | networktocode.com
Where Do I Begin?

Getting started with network automation has never been easier. The number of open source tools available, along
with the vast array of knowledge and documentation, make it a great time to get into network automation. However,
with the vast number of choices available, it can become overwhelming very quickly.

Where should you start? Automate something small to start. And choose something that doesn’t directly impact an
operating network device so there are limited downside risks to the network if the automation doesn’t work as
intended. Don’t look at an overly complex problem and try to solve it all at once. Start with writing a basic script for
one quick, easy and very simple task. Then move up from there, building on what you already wrote and expanding its
capabilities as you learn.

An Example

Everyone’s journey into scripting and network


automation starts differently. Let’s take a look at
an example with a very basic Python script.
Imagine you are configuring new switches and
routers multiple times a week for various remote
locations, and the configuration settings for each
device are created based on a text file template.

If you are generating a configuration for a new


site, “Dallas01”, without automation, you may
find/replace all instances of “$HOSTNAME” with
“Dallas01” in the text file. You may also repeat the
same thing for IP addresses, usernames, SNMP
strings, interfaces, etc. Because this is all done
manually, typos and overlooking settings happen
frequently.

With network automation, you start by writing a


small script to automatically create the router's
running configuration file based on a few settings.
From there, you can expand it to apply the
configuration, support different templates, and
add some validation. Suddenly, what started as a
30–60 minute process was reduced to less than
a minute.

Picture yourself engaging in this task and


subsequently sharing it with fellow engineers. Not
only would you all collectively save time every
week, but you would also have the assurance that
your configuration settings would be uniform and
free from typos or omissions.

3 Introduction to Network Automation - Part 1


Copyright © 2024 | Network to Code, LLC | networktocode.com
Figuring Out What to Automate

Think about your current environment. Your first attempt at automation does not have to be fully redundant. It does
not have to be executed automatically, cover all scenarios, or include any testing and validation.

Disclaimer: While some organizations use Excel for storing information about the network (as in the example below),
a better approach is using a dedicated Network Source of Truth tool with a database, such as Nautobot with
PostgreSQL.

Here is a step-by-step guide to get you started with considering where to


start with network automation:

1 Identify tasks that are performed frequently.

Estimate how much time it takes to perform one of those tasks one time, and then time
2 yourself doing that task.

If anyone else performs this task, estimate how often they do it, and how long it takes
3 them. Add everyone’s time together.

4 Break down the steps to the task into the smallest chunks possible.

Here’s an example of configuring a device with a template:

1. Open up template text file


2. Open site information file in Excel
3. Identify location being configured
4. Based on info found in Excel spreadsheet, determine settings for device
5. For each dynamic variable found in template file, replace with determined value
6. Save file
7. Copy contents of file
8. Paste contents of file into device
9. Save config
10. Spot-check config

Bonus: This can be a great way to demonstrate ROI to management and your peers, highlighting the benefits of
network automation. Once a task is automated, record how long it takes to run and compare it to how long it takes to
run manually and how often it’s run.

4 Introduction to Network Automation - Part 1


Copyright © 2024 | Network to Code, LLC | networktocode.com
When broken down, we can start to see it in smaller,
more manageable chunks. Sometimes you will need
to break a step down even further. For example, the
step about looking up info in Excel can be broken
down like this:

Based on info found in the Excel spreadsheet,


determine the settings for the device.
Name of device
SNMP settings
IP address/range of device
BGP ASN
Static routes
etc.

Which can be broken down even further:


Open file in Excel
Read contents of file in Excel
For each item/row/value/etc. in file, determine
if it is needed
If needed, figure out what to do with it
Name of device
SNMP settings
IP address/range of device
BGP ASN
Static routes
etc.
Do something with each determined value, such
as plug into text file template
Close file in Excel

From here, start thinking about how to write each


individual step in Python, one piece at a time.
How do I open a file?
How do I read what’s in the file?
How do I separate lines and words in the file
when importing?
How do I save this information efficiently?
How can I apply these settings to my template
where required?

5 Introduction to Network Automation - Part 1


Copyright © 2024 | Network to Code, LLC | networktocode.com
Rethink How You Think!

The world of network automation opens up amazing possibilities, but it requires a shift in the traditional network
engineer's problem-solving approach. Moving from manual configurations and device-based scripts to automated
processes demands a mindset that prioritizes systematic, proactive solutions over reactive fixes. This shift fosters a
culture of innovation and collaboration, paving the way for transformative changes in network infrastructure.

Network Engineer

For example, a Network Engineer making a VLAN change on an access switch port, depending on how complex the
change is and the change control process, may normally:

Review the ticket (or submit one if needed)


1. Write up changes in the ticket
2. Have them peer-reviewed and approved
3. Depending on the change, submit the change for approval with the change board
4. At the approved time, log into the switch
5. Make the change
6. Save the config
7. Validate the change
8. Update and close the ticket

Work Intake

Is there a Write up Submit changes Peer


ticket? changes in ticket for peer review approved?

Create a Fix changes


ticket

Execute Log into Require


Save config network device change
change board?

Validate Submit changes


config Update ticket Approved? for change board
approval

6 Introduction to Network Automation - Part 1


Copyright © 2024 | Network to Code, LLC | networktocode.com
Network Automation Engineer

As a Network Automation Engineer, you may see this process in automation a bit differently:

1. Review the ticket (or submit one if needed).


2. Update the VLAN in a structured data file (e.g., YAML or JSON) in a Git repository.
3. Submit the changes for peer review as a pull request.
4. The continuous integration (CI) pipeline automatically tests and validates the requested change. It then marks
the pull request as a Success or Failure.
5. A peer approves and merges the PR.
6. The continuous delivery (CD) pipeline automatically deploys the change at a specific time (if necessary).
7. The CD pipeline validates the change and updates the ticket with the results, then closes the ticket.

Work Intake

Is there a Update YAML/ Submit changes CI test &


ticket? JSON file in Git for peer review validation

Create a Fix changes


ticket

CD CD CD Peer
updates validates deploys approved?
ticket change change

This can be automated even further, but it gives a good idea of how a process as simple as an interface VLAN
change would look to a Network Engineer compared to a Network Automation Engineer.

Looking further out, think about what the above automation accomplished once the foundation of your automation is
established.

You’ve greatly reduced the likelihood You and your peers can deploy the VLAN
of human error impacting the network change to any number of devices with little
(e.g., mistyping the wrong VLAN, additional time required.
configuring the wrong interface).

You and your peers can leverage the Tickets are always updated, keeping the
automation for additional changes customer and compliance happy!
without much more work.

The foundation used in the above example can be easily built on to add additional automation tasks to the network
with significantly less time to set up.

7 Introduction to Network Automation - Part 1


Copyright © 2024 | Network to Code, LLC | networktocode.com
Closing

As we wrap up this introductory journey into network automation, it's essential to reflect on its transformative power
for network engineers and IT professionals worldwide. From simplifying mundane tasks to orchestrating complex
workflows, network automation empowers us to embrace innovation and adaptability in managing modern network
infrastructures.

As you explore network automation, remember that every journey begins with a single step. Start small, automate
something manageable, and gradually expand your capabilities as you gain confidence and expertise. Embrace the
mindset shift from reactive fixes to proactive solutions and foster a culture of collaboration and innovation within
your organization.

The road ahead may be challenging at times, but with dedication, curiosity, and a willingness to learn, you'll uncover
endless possibilities for enhancing the efficiency, productivity, and reliability of your network. So, equip yourself with
the knowledge, tools, and techniques shared in this eBook series, and set sail into the exciting world of network
automation.

Thank you for joining us on this journey.


Stay tuned for Part 2, where we’ll explore an expansive tool overview,
and for Part 3, where we’ll dive deep into Git!

8 Introduction to Network Automation - Part 1


Copyright © 2024 | Network to Code, LLC | networktocode.com

You might also like