wrgeorge1983 / Pystol

Collection of network management tools written in Python
GNU Lesser General Public License v2.1
6 stars 0 forks source link

Focus on interactivity #8

Open wrgeorge1983 opened 9 years ago

wrgeorge1983 commented 9 years ago

There's enough modules for specific common tasks. Most of the improvement from this point will be in enabling rapid utilization of the framework for whatever.

Focus on being able to import the modules and use python as an interactive shell for rapid collection and analysis.

wrgeorge1983 commented 9 years ago

def methods(o): ... pprint.pprint([e for e in dir(o) if e[0] != '_'])

wrgeorge1983 commented 9 years ago

New interactive subclass (prefer lowercase for typing, tab completion)

sw = clinteractiveSwitch(ip='10.10.10.1', creds=creds)  # first instance needs to be complete
sw2 =clinteractiveSwitch('10.10.10.2')  # infers credentials
sw3 =clinteractiveSwitch('10.3')  # infers leading octets (however many are needed to make it whole)
sw4 = clinteractiveSwitch(4) # integer assumed to be single trailing octet

sw4.pexecute('sh ip int bri')  # print output, instead of return