Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding "get route" template for IPv4 for Juniper NetScreen (screenos) #180

Merged
merged 14 commits into from
Jun 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,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
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