Merge pull request #47 from fooelisa/0.2
added junos facts() and interfaces()
This commit is contained in:
commit
d334427f9d
3 files changed
+78
No files matched your search
@@ -1 +1,2 @@
|
|||||||
include requirements.txt
|
include requirements.txt
|
||||||
|
include utils/*.yml
|
||||||
Executable
+7
@@ -0,0 +1,7 @@
|
|||||||
|
"""
|
||||||
|
Load tables/views
|
||||||
|
"""
|
||||||
|
from jnpr.junos.factory import loadyaml
|
||||||
|
from os.path import splitext
|
||||||
|
_YAML_ = splitext(__file__)[0] + '.yml'
|
||||||
|
globals().update(loadyaml(_YAML_))
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
####
|
||||||
|
#### 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 tables
|
||||||
|
####
|
||||||
|
|
||||||
|
junos_route_instance_table:
|
||||||
|
rpc: get-instance-information
|
||||||
|
item: instance-core
|
||||||
|
key: instance-name
|
||||||
|
view: junos_route_instance_view
|
||||||
|
|
||||||
|
junos_route_instance_view:
|
||||||
|
fields:
|
||||||
|
name: instance-name
|
||||||
|
|
||||||
|
junos_bgp_table:
|
||||||
|
rpc: get-bgp-summary-information
|
||||||
|
item: bgp-peer
|
||||||
|
key: peer-address
|
||||||
|
view: junos_bgp_view
|
||||||
|
|
||||||
|
junos_bgp_view:
|
||||||
|
fields:
|
||||||
|
remote_as: { peer-as: int }
|
||||||
|
description: description
|
||||||
|
is_up: { peer-state: True=Established }
|
||||||
|
is_enabled: { shutdown: True=False }
|
||||||
|
uptime: { elapsed-time/@seconds: int }
|
||||||
|
received_prefixes: { bgp-rib/received-prefix-count: int }
|
||||||
|
accepted_prefixes: { bgp-rib/accepted-prefix-count: 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