Created
December 25, 2019 05:57
-
-
Save bearice/ccdf12cfd0905ccc0fb9f9e1e80c1c57 to your computer and use it in GitHub Desktop.
ssh your_junos 'show isis database extensive | disp json ' | jq -f isis.jq -r | dot -Tpng | imgcat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def strip_isis_id: .|match("([-\\w]+).00").captures[0].string|gsub("-";"_") ; | |
def to_dot: ["\(.id) -- {",(.n|join(" ")),"}"]|join("") ; | |
["strict graph {", | |
"node [overlap=false]", | |
(."isis-database-information"[]|."isis-database"[]|select(.level[0].data=="2")|."isis-database-entry"[]|{ | |
id:(."lsp-id"[0].data|strip_isis_id), | |
n:[."isis-neighbor"[]|."is-neighbor-id"[0].data|strip_isis_id], | |
p:[."isis-prefix"[]|."address-prefix"[0].data], | |
rid:."isis-header"[0]."router-id"[0].data | |
}|to_dot), | |
"}"] | join("\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment