Skip to content

Instantly share code, notes, and snippets.

@bearice
Created December 25, 2019 05:57
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 bearice/ccdf12cfd0905ccc0fb9f9e1e80c1c57 to your computer and use it in GitHub Desktop.
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
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