[Twisted-Python] Cisco-style hierarchial CLI

Phil Mayers p.mayers at imperial.ac.uk
Sat Mar 20 13:43:36 EST 2004


I'm putting together some glue-ware for a system, and would like to hide
the underlying nature of it. It's a bit of software that fits in and
around routers / switches etc. and there's a pretty common CLI for those
these days, which consists of a hierarchial context-based set of
commands, plus completion, e.g. on Cisco, although I suspect everyone is
familiar with the concept:

client: sh <question mark>
server:     ip - show IP items
server:     foo - show Foo items
server:     bar - show Bar items
client: sh f <question mark>
server:     ver - show foo version
server:     connections - show foo connections
client: sh f c <question mark>
server:     <cr> - show connection summary
server:     <int> - show connection detail
client: sh f c 3
server: <some stuff>

Similarly, for configure mode:

client: configure
server: ok
client: subsystem
server(subsystem): ok
client: <question mark>
server(subsystem): trusted - configure trusted ports
server(subsystem): untrusted - configure untrusted ports
server(subsystem): map - map from trusted to untrusted
client: trust
server(subsystem-trusted): ok
client: <question mark>
server(subsystem-trusted): ip - add a trusted port by IP
server(subsystem-trusted): phys - add a trusted physical port
server(subsystem-trusted): vlan - add a trusted vlan
client: vlan 1

The hiearchial configure mode is mapped onto a hierarchial configuration
file, e.g. the above would generate:

    vlan 1

It's main features are:

1) Tab completion and partial -> full conversion
2) Nested modes

Relevant to twisted is I want to replace the manhole interactive

Any such beast exist?



| Phil Mayers                              |
| Network & Infrastructure Group           |
| Information & Communication Technologies |
| Imperial College                         |

More information about the Twisted-Python mailing list