I've built a little bit of intelligence into NTCI in the form of the harmonizeInts() method.

The harmonizeInts() method is called by every method that takes an interface name as an argument (like getEthSpeed, getIntDesc, etc.) in order to make sure that the user and NTCI are talking about the same interface. What it does it take the user's input (for example, "F0/1") and test it against a number of known "freeform" interface names. If it matches one, the interface name will be converted over to the full Cisco interface name ("FastEthernet0/1"). Since every interface name is harmonized, the programmer can take the input from command-line, web form, or whatnot, and simply push it to a method as an argument. Let's look at an example.

Supposed you write a small app that takes command-line parameters of a hostname and interface name and prints the bandwidth of the port, like so:

./myapp hostname f0/1
With harmonizeInts(), your app can simply take the user's input for the interface name and push it to an NTCI method. This saves you a lot of time by doing all the parsing behind the scenes.

harmonizeInts() works by keeping a number of arrays containing the freeform names of interfaces and working it's way through them. When a match is found, it returns the full Cisco name and exits. The arrays are kept in the harmonizeInt() method and, as of 0.2Beta, only check FastEthernet, GigabitEthernet, Ethernet, Serial, Port-channel, Packet-over-SONET, and VLAN interface types. There are dozens more in the Cisco world, I'm sure, so your interface type may or may not be listed. If you run across one that's not covered, drop me a Support Request, and I'll get it added ASAP. Please be sure to include the full Cisco name as well as any freeform names that users may wish to use.

© 2005-2006 -- Aaron Conaway