Getting started with network programmability
Major technology vendors are urging network engineers to adopt new programmability features as a way of addressing and managing the growing complexity of today’s networks. If this is something you’re looking into, consider these three options when you start your network programmability journey:
- The easiest place to start is with a ready-made framework like Ansible. With Ansible you can create automation using snippets of traditional command-line interface (CLI) configuration for each device via a Secure Shell (SSH) login. This is an ideal starting point because you can learn the basics of programming while still using the command line ideas you’ve mastered. With Ansible, you create text files called playbooks that express your automation task. Playbooks are written in a simple text file format called YAML. You’ll also want to explore the Jinja templating language to help programmatically create the configuration snippets sent to the devices.
- At a slightly more complex level, you can start to write Python programs. (Ansible is written in Python, so learning Python is useful even if you want to stay with Ansible.) At this stage, you will continue to work with the CLI, but you will also use a module like Netmiko to log into the device via SSH. This stage in the journey is all about mastering the core ideas of the Python programming language.
- At the most complex level, you can use your programming skills to interact with devices using their application programming interface (API). For most vendors, this means using an API based on NETCONF or RESTCONF. This is the most complex, but also the most powerful level of programming for network automation. In the near future, APIs will likely be the preferred way to configure network devices and CLIs will be secondary. At that point, you’ll primarily be focused on learning how to use APIs and data modeling languages like YANG.
No matter where you are in the automation journey, you will need a good programmer’s editor. Both Python and YAML use indentation levels to group statements together. Another good option is Microsoft’s Visual Studio Code, which is free and available for Windows, Mac OS and Linux. Also, the indent-rainbow highlighting extension makes it easy to see the indentation in your code. (Indentation errors are one of the most common mistakes in Python code and YAML documents.)
If you’re interested in Ansible, email ANM or ask your ANM account manager about the hands-on workshop we provide, including tips on automating several common tasks on Cisco routers. There is also an Ansible Essentials training available through RedHat that will help you get started.
Cisco DevNet is another great resource for all aspects of network programmability, including sandboxes with live equipment to experiment and test your code. The coding and APIs learning path is a great place to start.
Once you jump in, you will quickly see the vast efficiencies gained through network programmability. Take advantage of the tools, resources and technology partners available. It’s worth the journey.
Ian Logan – Senior Systems Engineer
Ian provides pre-sales IT consulting to customers in New Mexico and Texas, focused on Enterprise Networking and Data Center technologies. Prior to joining ANM, he worked in higher education for 20 years in IT operations. Ian truly enjoys the opportunity to meet and work with all of ANM’s customers.