Showing results for 
Search instead for 
Did you mean: 

Programmatic approach to IOS Configuration Changes.

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?


Philip D'Ath


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.

Jon Marshall
VIP Community Legend

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.


Giuseppe Larosa
Hall of Fame Master

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 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.


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


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 Expert


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.


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:

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

Did you check out tail-f?