Skip to content

Instantly share code, notes, and snippets.

@jeremyschulman
Last active August 29, 2015 14:06
Show Gist options
  • Save jeremyschulman/0ecd0f1a9afe6dfbcef2 to your computer and use it in GitHub Desktop.
Save jeremyschulman/0ecd0f1a9afe6dfbcef2 to your computer and use it in GitHub Desktop.
Ethernet Link Checker (multi-vendor/using Schprokits Table output)
# for hosts wtih _os = 'junos'
---
eth_nei_table:
rpc: get-lldp-neighbors-information
item: lldp-neighbor-information
key: lldp-local-interface
view: eth_nei_record
eth_nei_record:
fields:
device: lldp-remote-system-name
port: lldp-remote-port-description
# for hosts with _os = 'nxos'
---
eth_nei_table:
command: show cdp neighbors
item: .//ROW_cdp_neighbor_brief_info
key: intf_id
view: eth_nei_record
eth_nei_record:
fields:
device: device_id
port: port_id
---
- info: Retrieve Ethernet port neighbor information, store to files
actions:
- info: Get ethernet neighbor data
get_table: name=eth_nei_table file="tables/{{ _os }}/eth_nei_table.yml"
opipe_file: file=eth_nei.json indent=2
jeremy@Jeremys-MacBook-Pro-2$ py checker.py
------------------------------------------------------------------------------
OK: n9k2 ethernet1/1 <-----> n9k1 ethernet1/48
FAIL: n9k1 ethernet2/11 <-!!!-> n9k2 ethernet2/21
FOUND n9k1 ethernet2/11 <-----> n9k2 ethernet2/2
OK: n9k2 ethernet2/1 <-----> n9k1 ethernet2/12
OK: ex2 ge-0/0/24.0 <-----> ex1 ge-1/0/24.0
OK: ex2 ge-0/0/38.0 <-----> ex1 ge-0/0/30.0
OK: ex2 ge-0/0/2.0 <-----> ex1 ge-2/0/8.0
------------------------------------------------------------------------------
6 LINKS CHECKED: OK=5, FAIL=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment