Tierney - stock.adobe.com
A network automation lab is valuable to learn network automation skills, as well as create a lab environment in which to verify that automation tasks result in desired network changes.
What is a network automation lab?
A network automation lab is a collection of physical and virtual network devices that emulates the production network for several purposes.
Below are the three main use cases for an automation lab.
- Learn network automation. The topology of a network automation lab isn't particularly important because the main goal is to learn automation tools and processes.
- Test and validate network automation procedures in a copy of the production network. The lab network should replicate the key features of the production network so network changes can be tested before applying them to the production network. Ideally, this test network is instantiated during the test setup, replicating the part of the network to which the proposed change will be applied.
- Train and demonstrate. Network teams can use automation labs to demonstrate a new feature or train staff.
Benefits of a network automation lab
Teams can easily start with a physical lab, provided they have the equipment. However, a virtual network lab has many advantages over using physical devices. We'll focus on building a virtual lab in this article.
The benefits of a virtual network automation lab include the following:
- A virtual network lab is less expensive.
- Multiple developers can test their network automations simultaneously.
- Teams can easily create different network building blocks and interconnect them to mirror the production network's topology.
- The network lab can be created dynamically using VM hosts, even in cloud provider infrastructures, which reduces or eliminates the need to maintain a physical location.
Virtual device licensing varies, so teams should check with their vendor to determine whether the purchase of a license is required.
Using Vagrant to create a virtual automation lab
Vagrant is the most popular tool to automate the instantiation of test environments, using Oracle VM VirtualBox, VMware, AWS, Kernel VM and other virtualization systems. The virtual network lab configuration is described in a series of Vagrantfiles, the settings of which are merged as they are read. The data-driven approach guarantees that the environment is configured consistently across different developers, on different virtualization platforms and at different times.
Maintain a separate Vagrant configuration file for each network building block -- data center pod, internet edge and branch site, for example -- and only instantiate the building blocks that are needed for a specific test. Each Vagrant file can then be maintained separately from that of other building blocks.
Teams should plan to use a well-provisioned VM platform because network devices tend to have high CPU and memory consumption. Note that Vagrant only creates the virtual network and that another system, like Ansible or shell scripting, is required to configure the virtualized network devices.
Teams must follow many steps and variables to create a virtual network test lab. The articles listed below describe different approaches to building a network lab based on Vagrant:
- Vivek Gite on nixCraft: "How to use Vagrant to create small virtual test lab on Linux/OS X/MS-Windows"
- Brian Linkletter on Open-Source Routing and Network Simulation: "Build your own network simulator using open-source DevOps tools"
- Zeroslash.io: "The easiest way to build a network automation lab"
- Ivan Pepelnjak on ipSpace: "Build a network automation lab"
- Matt Oswalt on oswalt.dev: "Open source routing: practical lab"
Making it work
Teams should begin by creating a small network of just two or three devices that give them basic experience with the network test lab. They can then learn how to automate the network testing process with the following steps:
- Create a lab instance.
- Run the tests.
- Destroy the instance.
The result is NetDevOps, a method that provides the ability to develop and test network automation tasks without risk to the production network.