Package onep :: Package vty :: Module util :: Class VtyHelper
[frames] | no frames]

Class VtyHelper



VTY helper for any presentation service to VtyService handling

Contains helper functions that mimic IOS parser.  Is useful for
cases where applications running in different threads share the same
connection.  Flask REST frontend is a good example.

- Automatically opens VtyService and leaves it open

- If platform supports it, sets idle timeout of VtyService to infinite

- Manages NetworkElement to ensure only one VtyService is instantiated
  per connection/application.

- Evaluates parser errors

- commit method automatically does retries if resource busy
  is returned

Instance Methods
 
__init__(self, elm)
Constructor takes a connected network element Throws on error: OnepConnectionException - Connection to element failed.
 
prepare(self)
 
config(self, cmd)
Send a configuration command to Network Element "config t " will be prepended if not in config_submode " end" appended Throws on error: OnepConnectionException - Connection to element failed.
 
no_config(self, cmd)
Removes a configuration command from a Network Element "config t " and "no" will be prepended and " end" appended Throws on error: OnepConnectionException - Connection to element failed.
 
rollback(self, start, end)
NOT IMPLEMENTED!!
 
show(self, cmd)
Send a show command to Network Element "show " will be prepended Throws on error: OnepConnectionException - Connection to element failed.
 
vty_exec(self, cli)
Send an executable command to Network Element Throws on error: OnepConnectionException - Connection to element failed.
 
debug(self, cmd)
Activate debug on Network Element "debug " will be prepended Throws on error: OnepConnectionException - Connection to element failed.
 
no_debug(self, cmd)
Deactivate debug on Network Element "no debug " will be prepended Throws on error: OnepConnectionException - Connection to element failed.
 
commit(self)
Preform a write command to save running-config to startup-config
 
destroy(self)

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, elm)
(Constructor)

 

Constructor takes a connected network element
Throws on error:
         OnepConnectionException - Connection to element failed.

Keyword argument:
class NetworkElement()

Overrides: object.__init__

config(self, cmd)

 

Send a configuration command to Network Element
  "config t " will be prepended if not in config_submode
  " end" appended
Throws on error:
         OnepConnectionException - Connection to element failed.
         OnepRemoteProcedureException - call to RPC failed

Keyword argument:
string -- CLI command

no_config(self, cmd)

 

Removes a configuration command from a Network Element
  "config t " and "no" will be prepended and " end" appended
Throws on error:
         OnepConnectionException - Connection to element failed.
         OnepRemoteProcedureException - call to RPC failed

Keyword argument:
string -- CLI command

rollback(self, start, end)

 

NOT IMPLEMENTED!!

Rollback configuration commands stored in trasaction dict from start time to end time associated to command

Keyword arguments: real -- start time real -- end time

show(self, cmd)

 

Send a show command to Network Element
  "show " will be prepended
Throws on error:
         OnepConnectionException - Connection to element failed.
         OnepRemoteProcedureException - call to RPC failed

Keyword argument:
string -- CLI command

vty_exec(self, cli)

 

Send an executable command to Network Element
Throws on error:
         OnepConnectionException - Connection to element failed.
         OnepRemoteProcedureException - call to RPC failed

Keyword argument:
string -- CLI command

debug(self, cmd)

 

Activate debug on Network Element
  "debug " will be prepended
Throws on error:
         OnepConnectionException - Connection to element failed.
         OnepRemoteProcedureException - call to RPC failed

Keyword argument:
string -- CLI command

no_debug(self, cmd)

 

Deactivate debug on Network Element
  "no debug " will be prepended
Throws on error:
         OnepConnectionException - Connection to element failed.
         OnepRemoteProcedureException - call to RPC failed

Keyword argument:
string -- CLI command

commit(self)

 

Preform a write command to save running-config to startup-config

WARNING: Not supported on all platforms