Telnet/ssh connection to network devices and snmp

The thing I like about JSON is it has become a lingua franca of messaging between languages, and it’s very easy to pass data between SWI Prolog and JavaScript. I don’t know anything about protobufs. Is it easily usable with browser-based JavaScript?

I do a fair amount of extracting text from network devices. Knowing telnet/ssh is just the surface.
You need to deal with timeouts, different responses, knowing when it wants input …
I pretty much always write expect scripts to do the hard work and then parse the output.
expect is really smart and nothing else I’ve seen comes close, old school though it may be.
It can adapt to different devices and selectively decide what to output.
Possibly even works on that Windows thing.

Example:
$ net-talk router1 “get vlan topology” | prolog-prog-to-construct-topology-db

SNMP is a whole other ball game - lots and lots of cases to handle (particularly tables), try to avoid!
Again I would use an existing client, unless you need to do millions of ops per second.

Some newer devices have NETCONF and ReST APIs but support seems a bit spotty.

3 Likes

For those like me hearing of these for the first time.

2 Likes

+1 to expect (if tools such as netcat and socat aren’t sufficient). There’s also an O’Reilly book: Exploring Expect [Book] (my local library has a subscription, so I can access the online version for free).