I'm confused about Cisco IOS, and I have some question about that.

Cisco IOS is used in routers and other devices.

Is it possible to write code (like PHP) for that?

If it's possible, what language can I use?

The thing that confuses me is not how to work with Cisco IOS; it's about whether I can develop and change my router or other devices according to what I need for the network or not?

1 Answer 1

  1. Almost everyNote 1 Cisco IOS system running at least IOS 12.2 has built-in tcl shell programmability. You can store tcl scripts in flash and run them.

  2. Cisco IOS also has a light native programming environment called EEM (Embedded Event Manager). EEM events can be triggered by a wide variety of inputs, such as packets on a certain port (via Netflow), log messages, or interface up/down. Think of EEM as a subset of tclsh capabilities in IOS; EEM sucks less than programming in TCL, but you also get spotty feature support depending on the IOS mix you are dealing with. EEM can be run on a cron schedule if that suits your needs. At the bottom of this answer, I included an example EEM script; keep in mind that EEM is best for small-ish numbers of "if-this, do-that" statements... when you want to start defining functions and such, just bite the bullet and use tclsh.

  3. New Cisco products support a special set of canned SDN APIs which are broader than I can explain while typing on my mobile phone; one example from this family includes Cisco APIC, but that's just scratching the surface of what they have available.

  4. I would be remiss if I didn't point out that most of the Cisco scripting done in the last 20 years has been via screen-scraping, snmp, and (these-days) NETCONF. Anything you can do from the CLI, can be automated via screen-scraping; I have spent a large portion of my career doing just this. Screen-scrapers usually host their scripts on an external linux system and connect to a router with the weapon of their own choice... usually that's one of these languages:

  5. Finally, the newer Cisco Nexus products have a Python API (such as this one for the Nexus 9K); python APIs are typically easier to deal with than TCL APIs, but at this point you're restricted to the Nexus family.

Note 1 The only exception I know of is the Cisco 3550, which doesn't have tclsh in 12.2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.