Automate your Network Operation

In this blog article I would like to introduce you to Network Automation, available on several Cisco platforms. Network Automation is a general name for a group of functionalities, helping automate how your network behaves, how you perform daily network operations or even create your own features. The Nework Automation consists of two general parts: Device Manageability Instrumentation (DMI) and Embedded Automation Systems (EASy), each again with a complete range of functionalities.

To understand the Network Automation you could compare the network to an airplane. An airplane consists for example out of 21000 sensors sending their information to the instrumentation board. Within the network the sensors would become the Object Identifiers (OIDs) in the Management Information Bases (MIBs). The instruments are the ‘Embedded Automations’. As a pilot can’t read 21000 different sensors, he needs a system in the airplane to consolidate this information and analyse if values are normal or if the pilot needs to perform an action.

Airplane Router
Instruments Embedded Automations
21000 sensors OIDs in MIBs

With this analogy in mind we see today that an airplane could take control itself to avoid for example a mid-air collision. The same starts to happen in the networks today as well. It is of a great benefit if you can build in smarter logic and decision capabilities in your network so it can react on its own to events. Wouldn’t it for example be great if you could transform a server only having a ‘cold standby’ backup functionality into a system with a sort of ‘hot standby’? Well, the Network Automation could detect a link down from your primary server and react to it to enable the interface of your ‘cold standby’ backup server automatically. It may look scary at first to let your network take decisions but it gives a lot of benefits and saves you a lot of management hours.

Let’s take 2 simple examples to give you a first glimpse of what’s possible. This is actually the beauty of the Network Automation. You can create from very simple things up to real complex automations.

To perform the two following examples you would need a Cisco switch or router with an IOS containing Embedded Event Manager v3.1. For a Cisco router this would be 15.0(1)M or later.

Note: EEM is also available on L3 cisco switches, Catalyst 4500 and Catalyst 6500. Please check your IOS release notes to know the exact support.

c1812-easy# conf t
Enter configuration commands, one per line. End with CNTL/Z.
c1812-easy(config)# event manager applet hello-world
c1812-easy(config-applet)# description “My first EEM 3.x applet”
c1812-easy(config-applet)# event none
c1812-easy(config-applet)# action 000 puts “Hello,”
c1812-easy(config-applet)# end

The above example will print the word ‘Hello,’ to the Command Line Interface (CLI). To achieve this, you first use the command ‘event manager applet <name>’ in the configuration mode to create and name your applet. As you don’t have an event to trigger this upon you can use ‘Event none’ so the application only runs when you manually launch it. On the third line you use the general command ‘action’ which executes the general command ‘puts’ to write some text to the CLI. The ‘000’ after the ‘action’ is a line number which you are free to chose and which defines the position in the script. It’s a best practice to increment each line with 10. If for any reason you would like to insert a line afterwards in-between your script you can do this using for example line 002 which will be inserted between line 000 and 010.

To run your first application you go back to the ‘enable’ mode and type the below command.

c1812-easy# event manager run hello-world

Another more advanced option could be for example the extraction of some specific information from a show command. In the next example I’m looking for a single line reporting for the uptime of my system.

c1812-easy# conf t
Enter configuration commands, one per line. End with CNTL/Z.
c1812-easy(config)# event manager applet hello-world
c1812-easy(config-applet)# action 100 cli command “show version | include ptime”
c1812-easy(config-applet)# action 110 regexp “ptime is ([0-9]+.*inutes)” $_cli_result ignore myuptime
c1812-easy(config-applet)# action 120 puts “… my uptime is: $myuptime”

With the above example I will add some additional lines to my previous script. First of all, I would need to collect my information from the ‘show version | include ptime’ command which will return only the line with the uptime from my show command. The result of this action will be stored in the global argument $_cli_result which I can use later in my script. On the next line I will use a regular expression to get only the part of the information I’m interested in.  I will also tell regexp to store my result in the variable ‘myuptime’. In the last line I use the general command ‘puts’ again to write my output to the CLI. Within this output I now use the variable ‘$myuptime’ to insert the variable information I extracted before from my show command.

When I run my application hello-world again you will get an output comparable to the one below.

c1812-easy# event manager run hello-world
… my uptime is: 5 weeks, 5 days, 2 hours, 15 minutes

This last example concludes my first article in a series to unleash to you the capabilities of our Network Automation. As closing I would like to show you as well this demo twitter page where a router is regularly posting its operation data like fan status, board temperature etc. This is something else that you could achieve using Network Automation.

Virtually the Network Automation capabilities stop where your creativity and imagination ends.

Read more:



Regular Expression:

%d bloggers like this: