cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1163
Views
5
Helpful
10
Replies

Programmatic approach to IOS Configuration Changes.

gsporton
Level 1
Level 1

Hi everyone,

Is there a true API approach to interacting with Cisco ISR routers, in particular the 1841? From what I've been reading everyone seems to be using expect scripts, which are not going to work for the application I have in mind. It looks like onePK is dead and buried, are there any other options, or is "expect" the best I'm going to get?

Thanks.

10 Replies 10

Philip D'Ath
VIP Alumni
VIP Alumni

SNMP?

Personally I prefer the telnet/ssh/expect approach.

I'd prefer a true API, but I think I'm dreaming about that one. Not very SDN at the moment, unless you class the console software as the "S" :)

In reality, Cisco is a software company, so a true API approach should be achievable. I guess it all comes down to willingness on their part.

Never used it and perhaps it is out of date but as far as an API goes Cisco have the Application eXtension platform for ISRs with a number of APIs.

Just do a search for ISRs and API.

Like I say, may not be what you want and personally I used to use either Expect natively or Perl which has an Expect version or the simpler Net::Telnet::Cisco module which simplifies connecting to IOS devices. 

As Giuseppe mentions think Python may well be the language of choice for SDN.

Jon

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello gsporton,

the use of expect scripts is consolidated over the years but the free library Expect 5.21 for Windows NT is not supported (at least is not supposed to be) over Windows systems 64 bits.

I have used Expect 5.21 with Windows 7 32 bit to collect log information from a campus of 100 switches two years ago. I have to say that I wasn't totally satisfied, because my attempts to change configuration of ports led to some errors like loops ending one or two ports before the correct end.

Activestate at www.activestate.com sell a non free expect library package for their activetcl.

Recently I have been informed of some libraries in Python like NAPALM, that should have just added support for IOS devices.

see 

https://github.com/napalm-automation/napalm

Addition of IOS devices is very recent and not documented in ufficial documentation.

I couldn't try this approach up to now because I'm a newbie of python. However, I think this library is focused on data center environments providing utilities to get the LLDP neighbors on each switch port and eventually to change automatically the port description with the found hostname of the LLDP neighbor.

Another possible option is to use tcl with EEM scripts that you can find support in EEM scripting forum.

Hope to help

Giuseppe

Thanks Giuseppe.

I'll be taking a 100% Linux approach to this so hopefully expect versions shouldn't be to much of an issue. Python via NAPAM sounds interesting, I'll definitely give it a look.

EEM is another option, but I'm not sure how it works with variables passed in to reflect external changes, again, some additional reading for me!

Joseph W. Doherty
Hall of Fame
Hall of Fame

Disclaimer

The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.

Liability Disclaimer

In no event shall Author be liable for any damages wha2tsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.

Posting

As far a I know, for most ISRs (running classical IOS), they don't support a direct API.  So, you're left with some form of CLI scripting (as already mentioned by Giuseppe and Phillip) or the SNMP approach (as also mentioned by Phillip).

Going forward, new devices and IOSs, may support something like Netconf or Cisco's competitive solutions to SDN.  Of course, those don't help you here-and-now with an 1841.

Thanks Joseph.

I've never used SNMP for anything other than basic monitoring, I better do some reading and see just what sort of configuration changes I can orchestrate using SNMP.

I believe you can pull or push the whole config, via SNMP.  (I've done that with one of SolarWinds tools.  Which can be very useful, when you've misconfigured remote telnet access [which is what you're using for access].)

Yep, you're quite right. I found this useful blog post:

http://www.ciscozine.com/send-cisco-commands-via-snmp/

I'm going to use AWS Lambda to configure the router, so I can use SNMP (via java) to pull down the config to S3, parse the config, identify the necessary lines and make the necessary changes, then push the config back to the router.....sounds easy right :)

Christopher Wetzel
Cisco Employee
Cisco Employee

Did you check out tail-f?

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card