Skip to content

Instantly share code, notes, and snippets.

@kwbales
Last active December 29, 2015 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwbales/7671382 to your computer and use it in GitHub Desktop.
Save kwbales/7671382 to your computer and use it in GitHub Desktop.
py-junos-eznc Issue 45 - MX80 Testing
>>>
>>> from pprint import pprint
>>> from jnpr.junos.op.phyport import *
>>> from jnpr.junos import Device
>>>
>>> dev = Device( ##### )
>>>
>>> dev.open()
Device(10.99.90.30)
>>>
>>> pprint( dev.facts )
{'2RE': False,
'RE0': {'last_reboot_reason': 'Router rebooted after a normal shutdown.',
'model': 'RE-MX80',
'status': 'OK',
'up_time': '4 minutes, 46 seconds'},
'ifd_style': 'CLASSIC',
'model': 'MX80',
'personality': 'MX',
'switch_style': 'BRIDGE_DOMAIN',
'version': '13.2R2.4',
'version_info': junos.versino_info(major=(13, 2), type=R, minor=2, build=4)}
>>>
>>>
>>> ports = PhyPortStatsTable(dev)
>>> ports.get()
RunstatGetTable.get-interface-information:10.99.90.30: 24 items
>>>
>>> pprint( ports.items() )
[('xe-0/0/0',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('xe-0/0/1',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('xe-0/0/2',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('xe-0/0/3',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/2/0',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/2/1',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/2/2',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/2/3',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/2/4',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/2/5',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/2/6',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/2/7',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/2/8',
[('rx_err_drops', 0),
('rx_packets', 106),
('rx_bytes', 6724),
('tx_bytes', 3998),
('rx_err_input', 0),
('tx_packets', 40)]),
('ge-1/2/9',
[('rx_err_drops', 0),
('rx_packets', 103),
('rx_bytes', 6554),
('tx_bytes', 3908),
('rx_err_input', 0),
('tx_packets', 39)]),
('ge-1/3/0',
[('rx_err_drops', 0),
('rx_packets', 49),
('rx_bytes', 3718),
('tx_bytes', 6374),
('rx_err_input', 0),
('tx_packets', 59)]),
('ge-1/3/1',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/3/2',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/3/3',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/3/4',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/3/5',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/3/6',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/3/7',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/3/8',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-1/3/9',
[('rx_err_drops', 0),
('rx_packets', 100),
('rx_bytes', 6386),
('tx_bytes', 4883),
('rx_err_input', 0),
('tx_packets', 49)])]
>>>
>>> dev.close()
>>>
>>>
>>>
>>> from pprint import pprint
>>> from jnpr.junos.op.phyport import *
>>> from jnpr.junos import Device
>>>
>>>
>>> dev = Device( ####### )
>>> dev.open()
Device(172.30.0.40)
>>>
>>> pprint( dev.facts )
{'2RE': True,
'RE0': {'last_reboot_reason': '0x1:power cycle/failure ',
'mastership_state': 'master',
'model': 'RE-SRX1400',
'up_time': '7 minutes, 3 seconds'},
'ifd_style': 'CLASSIC',
'master': 'RE0',
'model': 'SRX 1400',
'personality': 'SRX_HIGHEND',
'switch_style': 'BRIDGE_DOMAIN',
'version': '12.1X44-D10.4',
'version_RE0': '12.1X44-D10.4',
'version_info': junos.versino_info(major=(12, 1), type=X, minor=(44, 'D', 10), build=4)}
>>>
>>> ports = PhyPortStatsTable(dev)
>>> ports.get()
RunstatGetTable.get-interface-information:172.30.0.40: 10 items
>>>
>>> pprint( ports.items() )
[('ge-0/0/0',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-0/0/1',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-0/0/2',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-0/0/3',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-0/0/4',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-0/0/5',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-0/0/6',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-0/0/7',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-0/0/8',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)]),
('ge-0/0/9',
[('rx_err_drops', 0),
('rx_packets', 0),
('rx_bytes', 0),
('tx_bytes', 0),
('rx_err_input', 0),
('tx_packets', 0)])]
>>>
>>> dev.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment