Skip to content

Commit

Permalink
Merge pull request #180 from burningnode/master
Browse files Browse the repository at this point in the history
Adding "get route" template for IPv4 for Juniper NetScreen (screenos)
  • Loading branch information
jmcgill298 authored Jun 25, 2018
2 parents 207003c + 654bb41 commit 1150e13
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
2 changes: 2 additions & 0 deletions templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ juniper_junos_show_isis_adjacency.template, .*, juniper_junos, sh[[ow]] is[[is]]
juniper_junos_show_ospf_neighbor.template, .*, juniper_junos, sh[[ow]] ospf n[[eighbor]]
juniper_junos_show_interfaces.template, .*, juniper_junos, sh[[ow]] inte[[rfaces]]

juniper_screenos_get_route.template, .*, juniper_screenos, get route

paloalto_panos_show_running_security-policy.template, .*, paloalto_panos, sh[[ow]] runn[[ing]] security[[-policy]]
paloalto_panos_show_high-availability_all.template, .*, paloalto_panos, sh[[ow]] high[[-availability]] all
paloalto_panos_show_interface_hardware.template, .*, paloalto_panos, sh[[ow]] int[[erface]] hard[[ware]]
Expand Down
28 changes: 28 additions & 0 deletions templates/juniper_screenos_get_route.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Value Filldown VR (\S+)
Value BEST (\S+)
Value ID (\d+)
Value Required PREFIX (\S+)
Value OUTINTERFACE (\S+)
Value NEXTHOP (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})
Value PROTOCOL (\S+)
Value PREF (\d+)
Value METRIC (\d+)
Value VSYS (\S+)

Start
# Match the VR
^IPv\d\s+Dest-Routes\s+for\s+<${VR}>
# Match route line
^${BEST}\s+${ID}\s+${PREFIX}\s+${OUTINTERFACE}\s+${NEXTHOP}\s+${PROTOCOL}\s+${PREF}\s+${METRIC}\s+${VSYS} -> Record
# Match table separator
^-+\s*$$
# Match route type keys
^\S+:\s+
# Match lines that are just space
^\s+$$
# Match table header
^\s+ID\s+IP-Prefix\s+Interface\s+Gateway\s+P\s+Pref\s+Mtr\s+Vsys\s*$$
# Error out if line does not match any expressions
^.+ -> Error "Line not found"

EOF
46 changes: 46 additions & 0 deletions tests/juniper_screenos/get_route/juniper_screenos_get_route.parsed
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
parsed_sample:

- vr: 'trust-vr'
best: '*'
id: '4'
prefix: '1.1.1.2/32'
outinterface: 'eth0/1'
nexthop: '0.0.0.0'
protocol: 'H'
pref: '0'
metric: '0'
vsys: 'Root'

- vr: 'trust-vr'
best: '*'
id: '2'
prefix: '192.168.1.1/32'
outinterface: 'eth0/0'
nexthop: '0.0.0.0'
protocol: 'H'
pref: '0'
metric: '0'
vsys: 'Root'

- vr: 'trust-vr'
best: '*'
id: '1'
prefix: '192.168.1.0/24'
outinterface: 'eth0/0'
nexthop: '0.0.0.0'
protocol: 'C'
pref: '0'
metric: '0'
vsys: 'Root'

- vr: 'trust-vr'
best: '*'
id: '3'
prefix: '1.1.1.0/24'
outinterface: 'eth0/1'
nexthop: '0.0.0.0'
protocol: 'C'
pref: '0'
metric: '0'
vsys: 'Root'
15 changes: 15 additions & 0 deletions tests/juniper_screenos/get_route/juniper_screenos_get_route.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
IPv4 Dest-Routes for <untrust-vr> (0 entries)
----------------------------------------------------------------------
H: Host C: Connected S: Static A: Auto-Exported
I: Imported R: RIP P: Permanent D: Auto-Discovered
iB: IBGP eB: EBGP O: OSPF E1: OSPF external type 1
E2: OSPF external type 2

IPv4 Dest-Routes for <trust-vr> (4 entries)
----------------------------------------------------------------------
ID IP-Prefix Interface Gateway P Pref Mtr Vsys
----------------------------------------------------------------------
* 4 1.1.1.2/32 eth0/1 0.0.0.0 H 0 0 Root
* 2 192.168.1.1/32 eth0/0 0.0.0.0 H 0 0 Root
* 1 192.168.1.0/24 eth0/0 0.0.0.0 C 0 0 Root
* 3 1.1.1.0/24 eth0/1 0.0.0.0 C 0 0 Root

0 comments on commit 1150e13

Please sign in to comment.