From b890275467ef8991d8dafb551c1ed11aa8549f2e Mon Sep 17 00:00:00 2001 From: guillaume-mbali <77588596+guillaume-mbali@users.noreply.github.com> Date: Fri, 2 Dec 2022 17:22:35 +0100 Subject: [PATCH] Add Cisco ipv6 route template (#1220) --- .../cisco_ios_show_ipv6_route.textfsm | 20 ++++++++ ntc_templates/templates/index | 1 + .../cisco_ios_show_ipv6_route.raw | 19 +++++++ .../cisco_ios_show_ipv6_route.yml | 50 +++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 ntc_templates/templates/cisco_ios_show_ipv6_route.textfsm create mode 100644 tests/cisco_ios/show_ipv6_route/cisco_ios_show_ipv6_route.raw create mode 100644 tests/cisco_ios/show_ipv6_route/cisco_ios_show_ipv6_route.yml diff --git a/ntc_templates/templates/cisco_ios_show_ipv6_route.textfsm b/ntc_templates/templates/cisco_ios_show_ipv6_route.textfsm new file mode 100644 index 0000000000..13ae834fef --- /dev/null +++ b/ntc_templates/templates/cisco_ios_show_ipv6_route.textfsm @@ -0,0 +1,20 @@ +Value Filldown PROTOCOL (\w{1,4}) +Value Filldown NETWORK ([A-Za-z0-9:]+/\d{1,3}(?:/\d{2})?) +Value Filldown DISTANCE (\d+) +Value Filldown METRIC (\d+) +Value NEXTHOP_IP ([A-F0-9:]+) +Value NEXTHOP_IF ([\w\d\s/]+) + + +Start + # Match regular ipv6 routes + ^IPv6[\d\w\-\s,:]\s* + ^Codes:[\d\w\-\s,]\s* + ^\s{7}[\d\w\-\s,]\s* + ^${PROTOCOL}\s+${NETWORK}\s+(\[${DISTANCE}/${METRIC}])\s*$$ + ^\s*via\s+${NEXTHOP_IP}(,\s+${NEXTHOP_IF}.*)?\s*$$ -> Record + ^\s*via\s+${NEXTHOP_IF}.*$$ -> Record + ^\s* -> Clearall + ^.*$$ -> Error + +EOF \ No newline at end of file diff --git a/ntc_templates/templates/index b/ntc_templates/templates/index index 38e23a9600..0f14da789b 100644 --- a/ntc_templates/templates/index +++ b/ntc_templates/templates/index @@ -260,6 +260,7 @@ cisco_ios_show_access-list.textfsm, .*, cisco_ios, sh[[ow]] acc[[ess-list]] cisco_ios_show_isdn_status.textfsm, .*, cisco_ios, sh[[ow]] isd[[n]] st[[atus]] cisco_ios_show_dhcp_lease.textfsm, .*, cisco_ios, sh[[ow]] dh[[cp]] l[[ease]] cisco_ios_show_interfaces.textfsm, .*, cisco_ios, sh[[ow]] int[[erfaces]] +cisco_ios_show_ipv6_route.textfsm, .*, cisco_ios, sh[[ow]] ipv6 r[[oute]] cisco_ios_show_redundancy.textfsm, .*, cisco_ios, sh[[ow]] redu[[ndancy]] cisco_ios_show_snmp_group.textfsm, .*, cisco_ios, sh[[ow]] snm[[p]] g[[roup]] cisco_ios_show_vrrp_brief.textfsm, .*, cisco_ios, sh[[ow]] vrr[[p]] b[[rief]] diff --git a/tests/cisco_ios/show_ipv6_route/cisco_ios_show_ipv6_route.raw b/tests/cisco_ios/show_ipv6_route/cisco_ios_show_ipv6_route.raw new file mode 100644 index 0000000000..a507851f56 --- /dev/null +++ b/tests/cisco_ios/show_ipv6_route/cisco_ios_show_ipv6_route.raw @@ -0,0 +1,19 @@ +IPv6 Routing Table - default - 6 entries +Codes: C - Connected, L - Local, S - Static, U - Per-user Static route + B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP + H - NHRP, D - EIGRP, EX - EIGRP external, ND - ND Default + NDp - ND Prefix, DCE - Destination, NDr - Redirect, O - OSPF Intra + OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1 + ON2 - OSPF NSSA ext 2, l - LISP +C 2A05:C100:2A::/64 [0/0] + via Vlan1, directly connected +B 2001:DB8:4::2/48 [20/0] + via FE80::A8BB:CCFF:FE02:8B00, Serial6/0 + via A8BB::FE80:CCFF:FE02:8B00, Serial4/0 +L FF00::/8 [0/0] + via Null0, receive +S 5555:4444::4/128 [1/0] + via 2A05:C100:2A::56 + via 2A05:C100:2A::5765 + via 2A05:C100:2A::3:344, Vlan1 + via Vlan1, directly connected diff --git a/tests/cisco_ios/show_ipv6_route/cisco_ios_show_ipv6_route.yml b/tests/cisco_ios/show_ipv6_route/cisco_ios_show_ipv6_route.yml new file mode 100644 index 0000000000..c9f3376c92 --- /dev/null +++ b/tests/cisco_ios/show_ipv6_route/cisco_ios_show_ipv6_route.yml @@ -0,0 +1,50 @@ +--- +parsed_sample: + - network: "2A05:C100:2A::/64" + protocol: "C" + distance: "0" + metric: "0" + nexthop_ip: "" + nexthop_if: "Vlan1" + - network: "2001:DB8:4::2/48" + protocol: "B" + distance: "20" + metric: "0" + nexthop_ip: "FE80::A8BB:CCFF:FE02:8B00" + nexthop_if: "Serial6/0" + - network: "2001:DB8:4::2/48" + protocol: "B" + distance: "20" + metric: "0" + nexthop_ip: "A8BB::FE80:CCFF:FE02:8B00" + nexthop_if: "Serial4/0" + - network: "FF00::/8" + protocol: "L" + distance: "0" + metric: "0" + nexthop_ip: "" + nexthop_if: "Null0" + - network: "5555:4444::4/128" + protocol: "S" + distance: "1" + metric: "0" + nexthop_ip: "2A05:C100:2A::56" + nexthop_if: "" + - network: "5555:4444::4/128" + protocol: "S" + distance: "1" + metric: "0" + nexthop_ip: "2A05:C100:2A::5765" + nexthop_if: "" + - network: "5555:4444::4/128" + protocol: "S" + distance: "1" + metric: "0" + nexthop_ip: "2A05:C100:2A::3:344" + nexthop_if: "Vlan1" + - network: "5555:4444::4/128" + protocol: "S" + distance: "1" + metric: "0" + nexthop_ip: "" + nexthop_if: "Vlan1"