diff --git a/helpers/create-parsed.yml b/helpers/create-parsed.yml index ec2d0c5a38..c5cb18b606 100644 --- a/helpers/create-parsed.yml +++ b/helpers/create-parsed.yml @@ -25,7 +25,7 @@ - name: SET FACT FOR ROOT DIR set_fact: - root_directory: "{{ root_dir | default('..') }}" + root_directory: "{{ playbook_dir | dirname }}" - name: OFFLINE NTC SHOW COMMAND ntc_show_command: diff --git a/templates/cisco_xr_show_ip_route.template b/templates/cisco_xr_show_ip_route.template new file mode 100644 index 0000000000..87a8955ca6 --- /dev/null +++ b/templates/cisco_xr_show_ip_route.template @@ -0,0 +1,30 @@ +Value Filldown PROTOCOL (\S+) +Value Filldown NETWORK (\d+\.\d+\.\d+\.\d+) +Value Filldown MASK (\d+) +Value DISTANCE (\d+|is) +Value METRIC (\d+) +Value TYPE (directly|via) +Value Required NEXT_HOP (connected|\d+\.\d+\.\d+\.\d+) +Value INTERFACE (\S+) + +Start + ^Codes: C - connected, -> Route + +Route + ^ D - EIGRP, EX + ^ N1 - OSPF NSSA + ^ E1 - OSPF exte + ^ i - ISIS, L1 - + ^ ia - IS-IS int + ^ U - per-user s + ^ A - access/sub + ^ M - mobile rou + ^Gateway of last resort + ^${PROTOCOL}\s+${NETWORK}\/${MASK}\s+(?:\[${DISTANCE}\/${METRIC}\]|is)\s+${TYPE}\s+${NEXT_HOP},\s+(\d+:\d+:\d+),\s+${INTERFACE} -> Record + ^\s+(?:\[${DISTANCE}\/${METRIC}\]|is)\s+${TYPE}\s+${NEXT_HOP},\s+(\d+:\d+:\d+),\s+${INTERFACE} -> Record + ^${PROTOCOL}\s+${NETWORK}\/${MASK}\s+(?:\[${DISTANCE}\/${METRIC}\]|is)\s+${TYPE}\s+${NEXT_HOP},\s+(\d+:\d+:\d+) -> Record + ^\s+(?:\[${DISTANCE}\/${METRIC}\]|is)\s+${TYPE}\s+${NEXT_HOP},\s+(\d+:\d+:\d+) -> Record + ^\s+$$ + ^$$ + ^.* -> Error "LINE NOT FOUND" + diff --git a/templates/cisco_xr_show_lldp_neighbors.template b/templates/cisco_xr_show_lldp_neighbors.template new file mode 100644 index 0000000000..c480c1b206 --- /dev/null +++ b/templates/cisco_xr_show_lldp_neighbors.template @@ -0,0 +1,15 @@ +Value Required NEIGHBOR (\S+) +Value Required LOCAL_INTERFACE (\S+) +Value Required NEIGHBOR_INTERFACE (\S+) + +Start + ^Device.*ID -> LLDP + +LLDP + ^${NEIGHBOR}\s+${LOCAL_INTERFACE}\s+\d+\s+(.+?)\s+${NEIGHBOR_INTERFACE}$$ -> Record + ^${NEIGHBOR} + ^\s+${LOCAL_INTERFACE}\s+\d+\s+(.*?)\s+${NEIGHBOR_INTERFACE} -> Record + ^Total entries + ^\s+$$ + ^$$ + ^.* -> Error "LINE NOT FOUND" diff --git a/templates/index b/templates/index index bedb75e73d..2ae2af4848 100644 --- a/templates/index +++ b/templates/index @@ -184,6 +184,7 @@ cisco_xr_show_interface_brief.template, .*, cisco_xr, sh[[ow]] int[[erface]] br[ cisco_xr_admin_show_platform.template, .*, cisco_xr, adm[[in]] sh[[ow]] pla[[tform]] cisco_xr_show_ip_bgp_summary.template, .*, cisco_xr, sh[[ow]] ip b[[gp]] s[[ummary]] cisco_xr_show_isis_neighbors.template, .*, cisco_xr, sh[[ow]] isis ne[[ighbors]] +cisco_xr_show_lldp_neighbors.template, .*, cisco_xr, sh[[ow]] lld[[p]] neig[[hbors]] cisco_xr_show_rsvp_neighbors.template, .*, cisco_xr, sh[[ow]] rs[[vp]] neigh[[bors]] cisco_xr_show_ospf_neighbor.template, .*, cisco_xr, sh[[ow]] ospf nei[[ghbor]] cisco_xr_show_processes_cpu.template, .*, cisco_xr, sh[[ow]] proc[[esses]] c[[pu]] @@ -191,6 +192,7 @@ cisco_xr_show_bfd_sessions.template, .*, cisco_xr, sh[[ow]] bf[[d]] sess[[ions]] cisco_xr_show_pim_neighbor.template, .*, cisco_xr, sh[[ow]] pi[[m]] neigh[[bor]] cisco_xr_show_controllers.template, .*, cisco_xr, sh[[ow]] contr[[ollers]] (\S+) phy cisco_xr_show_interfaces.template, .*, cisco_xr, sh[[ow]] inte[[rfaces]] +cisco_xr_show_ip_route.template, .*, cisco_xr, sh[[ow]] ip ro[[ute]] dell_force10_show_vlan_brief.template, .*, dell_force10, sh[[ow]] vl[[an]] br[[ief]] dell_force10_show_version.template, .*, dell_force10, sh[[ow]] ver[[sion]] diff --git a/tests/cisco_xr/show_ip_route/cisco_xr_show_ip_route.parsed b/tests/cisco_xr/show_ip_route/cisco_xr_show_ip_route.parsed new file mode 100644 index 0000000000..3cc6fae29c --- /dev/null +++ b/tests/cisco_xr/show_ip_route/cisco_xr_show_ip_route.parsed @@ -0,0 +1,275 @@ +--- +parsed_sample: + +- distance: '1' + interface: '' + mask: '0' + metric: '0' + network: 0.0.0.0 + next_hop: 172.16.1.1 + protocol: S* + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/0 + mask: '32' + metric: '0' + network: 1.1.1.1 + next_hop: 10.1.1.9 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/3 + mask: '32' + metric: '9164' + network: 1.1.1.1 + next_hop: 10.1.1.34 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/0 + mask: '32' + metric: '0' + network: 1.1.1.3 + next_hop: 10.1.1.9 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/3 + mask: '32' + metric: '6564' + network: 1.1.1.3 + next_hop: 10.1.1.34 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/0 + mask: '32' + metric: '0' + network: 1.1.2.1 + next_hop: 10.1.1.9 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/3 + mask: '32' + metric: '9163' + network: 1.1.2.1 + next_hop: 10.1.1.34 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/0 + mask: '32' + metric: '0' + network: 1.1.2.3 + next_hop: 10.1.1.9 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/3 + mask: '32' + metric: '6563' + network: 1.1.2.3 + next_hop: 10.1.1.34 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/0 + mask: '32' + metric: '0' + network: 1.1.2.5 + next_hop: 10.1.1.9 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/3 + mask: '32' + metric: '639' + network: 1.1.2.5 + next_hop: 10.1.1.34 + protocol: O + type: via +- distance: '' + interface: Loopback0 + mask: '32' + metric: '' + network: 1.1.2.6 + next_hop: connected + protocol: L + type: directly +- distance: '110' + interface: GigabitEthernet0/0/0/0 + mask: '30' + metric: '0' + network: 10.1.0.0 + next_hop: 10.1.1.9 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/3 + mask: '30' + metric: '9163' + network: 10.1.0.0 + next_hop: 10.1.1.34 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/0 + mask: '30' + metric: '0' + network: 10.1.0.8 + next_hop: 10.1.1.9 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/3 + mask: '30' + metric: '6563' + network: 10.1.0.8 + next_hop: 10.1.1.34 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/0 + mask: '30' + metric: '0' + network: 10.1.1.0 + next_hop: 10.1.1.9 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/3 + mask: '30' + metric: '11762' + network: 10.1.1.0 + next_hop: 10.1.1.34 + protocol: O + type: via +- distance: '' + interface: GigabitEthernet0/0/0/1 + mask: '30' + metric: '' + network: 10.1.1.4 + next_hop: connected + protocol: C + type: directly +- distance: '' + interface: GigabitEthernet0/0/0/1 + mask: '32' + metric: '' + network: 10.1.1.6 + next_hop: connected + protocol: L + type: directly +- distance: '' + interface: GigabitEthernet0/0/0/0 + mask: '30' + metric: '' + network: 10.1.1.8 + next_hop: connected + protocol: C + type: directly +- distance: '' + interface: GigabitEthernet0/0/0/0 + mask: '32' + metric: '' + network: 10.1.1.10 + next_hop: connected + protocol: L + type: directly +- distance: '110' + interface: GigabitEthernet0/0/0/0 + mask: '30' + metric: '0' + network: 10.1.1.12 + next_hop: 10.1.1.9 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/3 + mask: '30' + metric: '9162' + network: 10.1.1.12 + next_hop: 10.1.1.34 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/0 + mask: '30' + metric: '0' + network: 10.1.1.20 + next_hop: 10.1.1.9 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/3 + mask: '30' + metric: '6562' + network: 10.1.1.20 + next_hop: 10.1.1.34 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/0 + mask: '30' + metric: '0' + network: 10.1.1.24 + next_hop: 10.1.1.9 + protocol: O + type: via +- distance: '110' + interface: GigabitEthernet0/0/0/3 + mask: '30' + metric: '709' + network: 10.1.1.24 + next_hop: 10.1.1.34 + protocol: O + type: via +- distance: '' + interface: GigabitEthernet0/0/0/2 + mask: '30' + metric: '' + network: 10.1.1.28 + next_hop: connected + protocol: C + type: directly +- distance: '' + interface: GigabitEthernet0/0/0/2 + mask: '32' + metric: '' + network: 10.1.1.30 + next_hop: connected + protocol: L + type: directly +- distance: '' + interface: GigabitEthernet0/0/0/3 + mask: '30' + metric: '' + network: 10.1.1.32 + next_hop: connected + protocol: C + type: directly +- distance: '' + interface: GigabitEthernet0/0/0/3 + mask: '32' + metric: '' + network: 10.1.1.33 + next_hop: connected + protocol: L + type: directly +- distance: '' + interface: MgmtEth0/0/CPU0/0 + mask: '24' + metric: '' + network: 172.16.1.0 + next_hop: connected + protocol: C + type: directly +- distance: '' + interface: MgmtEth0/0/CPU0/0 + mask: '32' + metric: '' + network: 172.16.1.120 + next_hop: connected + protocol: L + type: directly diff --git a/tests/cisco_xr/show_ip_route/cisco_xr_show_ip_route.raw b/tests/cisco_xr/show_ip_route/cisco_xr_show_ip_route.raw new file mode 100644 index 0000000000..bed6413ae6 --- /dev/null +++ b/tests/cisco_xr/show_ip_route/cisco_xr_show_ip_route.raw @@ -0,0 +1,48 @@ +Mon Jan 29 19:00:32.892 UTC + +Codes: C - connected, S - static, R - RIP, B - BGP, (>) - Diversion path + D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area + N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 + E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP + i - ISIS, L1 - IS-IS level-1, L2 - IS-IS level-2 + ia - IS-IS inter area, su - IS-IS summary null, * - candidate default + U - per-user static route, o - ODR, L - local, G - DAGR, l - LISP + A - access/subscriber, a - Application route + M - mobile route, r - RPL, (!) - FRR Backup path + +Gateway of last resort is 172.16.1.1 to network 0.0.0.0 + +S* 0.0.0.0/0 [1/0] via 172.16.1.1, 04:43:54 +O 1.1.1.1/32 [110/0] via 10.1.1.9, 04:43:27, GigabitEthernet0/0/0/0 (!) + [110/9164] via 10.1.1.34, 04:43:27, GigabitEthernet0/0/0/3 +O 1.1.1.3/32 [110/0] via 10.1.1.9, 04:43:21, GigabitEthernet0/0/0/0 (!) + [110/6564] via 10.1.1.34, 04:43:21, GigabitEthernet0/0/0/3 +O 1.1.2.1/32 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!) + [110/9163] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3 +O 1.1.2.3/32 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!) + [110/6563] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3 +O 1.1.2.5/32 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!) + [110/639] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3 +L 1.1.2.6/32 is directly connected, 04:43:54, Loopback0 +O 10.1.0.0/30 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!) + [110/9163] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3 +O 10.1.0.8/30 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!) + [110/6563] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3 +O 10.1.1.0/30 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!) + [110/11762] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3 +C 10.1.1.4/30 is directly connected, 04:43:54, GigabitEthernet0/0/0/1 +L 10.1.1.6/32 is directly connected, 04:43:54, GigabitEthernet0/0/0/1 +C 10.1.1.8/30 is directly connected, 04:43:54, GigabitEthernet0/0/0/0 +L 10.1.1.10/32 is directly connected, 04:43:54, GigabitEthernet0/0/0/0 +O 10.1.1.12/30 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!) + [110/9162] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3 +O 10.1.1.20/30 [110/0] via 10.1.1.9, 04:43:41, GigabitEthernet0/0/0/0 (!) + [110/6562] via 10.1.1.34, 04:43:41, GigabitEthernet0/0/0/3 +O 10.1.1.24/30 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!) + [110/709] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3 +C 10.1.1.28/30 is directly connected, 04:43:54, GigabitEthernet0/0/0/2 +L 10.1.1.30/32 is directly connected, 04:43:54, GigabitEthernet0/0/0/2 +C 10.1.1.32/30 is directly connected, 04:43:54, GigabitEthernet0/0/0/3 +L 10.1.1.33/32 is directly connected, 04:43:54, GigabitEthernet0/0/0/3 +C 172.16.1.0/24 is directly connected, 04:43:54, MgmtEth0/0/CPU0/0 +L 172.16.1.120/32 is directly connected, 04:43:54, MgmtEth0/0/CPU0/0 diff --git a/tests/cisco_xr/show_lldp_neighbors/cisco_xr_show_lldp_neighbors.parsed b/tests/cisco_xr/show_lldp_neighbors/cisco_xr_show_lldp_neighbors.parsed new file mode 100644 index 0000000000..f9387dba2b --- /dev/null +++ b/tests/cisco_xr/show_lldp_neighbors/cisco_xr_show_lldp_neighbors.parsed @@ -0,0 +1,9 @@ +--- +parsed_sample: + +- local_interface: Gi0/0/0/0 + neighbor: ASR-OCC-P1 + neighbor_interface: Gi0/0/0/2 +- local_interface: Gi0/0/0/3 + neighbor: ASR-LON-P1 + neighbor_interface: Gi0/0/0/2 diff --git a/tests/cisco_xr/show_lldp_neighbors/cisco_xr_show_lldp_neighbors.raw b/tests/cisco_xr/show_lldp_neighbors/cisco_xr_show_lldp_neighbors.raw new file mode 100644 index 0000000000..2c55c1936e --- /dev/null +++ b/tests/cisco_xr/show_lldp_neighbors/cisco_xr_show_lldp_neighbors.raw @@ -0,0 +1,10 @@ +Mon Jan 29 19:06:33.768 UTC +Capability codes: + (R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device + (W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other + +Device ID Local Intf Hold-time Capability Port ID +ASR-OCC-P1 Gi0/0/0/0 120 R Gi0/0/0/2 +ASR-LON-P1 Gi0/0/0/3 120 R Gi0/0/0/2 + +Total entries displayed: 2