Skip to content

Commit

Permalink
Adding VTY Service to onepk notes
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbyers committed Oct 16, 2014
1 parent 706099c commit 3d13ade
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions onepk/onepk_notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,34 @@ InterfaceStatistics:
ONEP_IF_STAT_RX_PKTS: 306708
ONEP_IF_STAT_TX_PKTS: 252870


###
### Using VTY Service (cli commands wrapped in onePK
### VTY Service must be enabled on the router
###
>>> from onep.vty import VtyService
>>> vty_service = VtyService(rtr1_obj.net_element)
>>> vty_service.open()
>>>
>>> CMD = "show ip int brief"
>>> cli = vty_service.write(CMD)
>>> print cli

Interface IP-Address OK? Method Status Protocol
FastEthernet0 unassigned YES unset down down
FastEthernet1 unassigned YES unset down down
FastEthernet2 unassigned YES unset down down
FastEthernet3 unassigned YES unset down down
FastEthernet4 10.220.88.20 YES manual up up
Vlan1 unassigned YES unset down down

# Make a config change
>>> CMD = 'conf t'
>>> cli = vty_service.write(CMD)
>>> cli
'\r\nEnter configuration commands, one per line. End with CNTL/Z.'
>>> CMD = 'logging buffered 30000'
>>> cli = vty_service.write(CMD)
>>> cli
''
>>> cli = vty_service.write('end')

0 comments on commit 3d13ade

Please sign in to comment.