added junos facts() and interfaces()
and basic bgp and lldp neigh tables/views (<- untested)
This commit is contained in:
1 parent
4f3f5ca69f
commit
4a8884c91a
2 files changed
+70
No files matched your search
Executable
+8
@@ -0,0 +1,8 @@
|
|||||||
|
"""
|
||||||
|
Load tables/views
|
||||||
|
"""
|
||||||
|
from jnpr.junos.factory import loadyaml
|
||||||
|
from os.path import splitext
|
||||||
|
_YAML_ = splitext(__file__)[0] + '.yml'
|
||||||
|
print _YAML_
|
||||||
|
globals().update(loadyaml(_YAML_))
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
####
|
||||||
|
#### Interface table
|
||||||
|
####
|
||||||
|
|
||||||
|
junos_iface_table:
|
||||||
|
rpc: get-interface-information
|
||||||
|
args:
|
||||||
|
extensive: True
|
||||||
|
args_key: interface_name
|
||||||
|
item: physical-interface
|
||||||
|
view: junos_iface_view
|
||||||
|
|
||||||
|
junos_iface_view:
|
||||||
|
fields:
|
||||||
|
is_up: { oper-status: True=up }
|
||||||
|
is_enabled: { admin-status: True=up }
|
||||||
|
description: description
|
||||||
|
last_flapped: { interface-flapped/@seconds: int }
|
||||||
|
mode: logical-interface/address-family/address-family-name
|
||||||
|
speed: speed
|
||||||
|
mac_address: current-physical-address
|
||||||
|
|
||||||
|
|
||||||
|
####
|
||||||
|
#### BGP table
|
||||||
|
####
|
||||||
|
|
||||||
|
junos_bgp_table:
|
||||||
|
rpc: get-bgp-neighbor-information
|
||||||
|
item: bgp-peer
|
||||||
|
key: peer-address
|
||||||
|
view: junos_bgp_view
|
||||||
|
|
||||||
|
junos_bgp_view:
|
||||||
|
fields:
|
||||||
|
is_up: { peer-state: True=Established }
|
||||||
|
is_enabled: { shutdown: True=False }
|
||||||
|
uptime: { elapsed-time/@seconds: int }
|
||||||
|
description: description
|
||||||
|
received_prefixes: { bgp-rib/received-prefix-count: int }
|
||||||
|
accepted_prefixes: { bgp-rib/accepted-prefix-count: int }
|
||||||
|
remote_as: { peer-as: int }
|
||||||
|
|
||||||
|
|
||||||
|
####
|
||||||
|
#### LLDP table
|
||||||
|
####
|
||||||
|
|
||||||
|
junos_lldp_table:
|
||||||
|
rpc: get-lldp-neighbors-information
|
||||||
|
item: lldp-neighbor-information
|
||||||
|
key: lldp-local-interface | lldp-local-port-id
|
||||||
|
view: junos_lldp_view
|
||||||
|
|
||||||
|
junos_lldp_view:
|
||||||
|
fields:
|
||||||
|
hostname: lldp-remote-system-name
|
||||||
|
port: lldp-remote-port-description
|
||||||
|
|
||||||
|
|
||||||
Reference in new issue
Block a user