From e53d649007b5cabe60060af4512415b8ded07dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Ribot?= <98583408+k-ribot@users.noreply.github.com> Date: Mon, 11 Nov 2024 20:07:45 +0100 Subject: [PATCH] fix: Corrected Ubiquiti EdgeRouter show_ip_route template (#1895) --- .../ubiquiti_edgerouter_show_ip_route.textfsm | 11 ++-- .../ubiquiti_edgerouter_show_ip_route2.raw | 15 +++++ .../ubiquiti_edgerouter_show_ip_route2.yml | 58 +++++++++++++++++++ 3 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 tests/ubiquiti_edgerouter/show_ip_route/ubiquiti_edgerouter_show_ip_route2.raw create mode 100644 tests/ubiquiti_edgerouter/show_ip_route/ubiquiti_edgerouter_show_ip_route2.yml diff --git a/ntc_templates/templates/ubiquiti_edgerouter_show_ip_route.textfsm b/ntc_templates/templates/ubiquiti_edgerouter_show_ip_route.textfsm index 5cf0ed279a..e6128989b9 100644 --- a/ntc_templates/templates/ubiquiti_edgerouter_show_ip_route.textfsm +++ b/ntc_templates/templates/ubiquiti_edgerouter_show_ip_route.textfsm @@ -10,11 +10,12 @@ Start ^.*IP\sRoute\sTable -> IP IP - ^\s+\*>\s+\[${DISTANCE}/${METRIC}\]\svia\s${NEXTHOP_IP}\s\(recursive is directly connected,\s${INTERFACE}\)\s* -> Record - ^${CODE}\s+\*>\s${IP_ADDRESS}/${PREFIX_LENGTH}\sis\sdirectly\sconnected,\s${INTERFACE}\s* -> Record - ^${CODE}\s+\*>\s${IP_ADDRESS}/${PREFIX_LENGTH}\sis\sdirectly\sconnected\s* -> Record - ^${CODE}\s+\*>\s${IP_ADDRESS}/${PREFIX_LENGTH}\s\[${DISTANCE}/${METRIC}\]\sis\sdirectly\sconnected,\s${INTERFACE}\s* -> Record - ^${CODE}\s+\*>\s${IP_ADDRESS}/${PREFIX_LENGTH}\s\[${DISTANCE}/${METRIC}\]\svia\s${NEXTHOP_IP}\s\(recursive is directly connected,\s${INTERFACE}\)\s* -> Record + ^\s+(\*>)?\s+\[${DISTANCE}/${METRIC}\]\svia\s${NEXTHOP_IP}\s\(recursive is directly connected,\s${INTERFACE}\)\s* -> Record + ^${CODE}\s+(\*>)?\s${IP_ADDRESS}/${PREFIX_LENGTH}\sis\sdirectly\sconnected,\s${INTERFACE}\s* -> Record + ^${CODE}\s+(\*>)?\s${IP_ADDRESS}/${PREFIX_LENGTH}\sis\sdirectly\sconnected\s* -> Record + ^${CODE}\s+(\*>)?\s${IP_ADDRESS}/${PREFIX_LENGTH}\s\[${DISTANCE}/${METRIC}\]\sis\sdirectly\sconnected,\s${INTERFACE}\s* -> Record + ^${CODE}\s+(\*>)?\s${IP_ADDRESS}/${PREFIX_LENGTH}\s\[${DISTANCE}/${METRIC}\]\svia\s${NEXTHOP_IP}\s\(recursive is directly connected,\s${INTERFACE}\)\s* -> Record + ^${CODE}\s+(\*>)?\s${IP_ADDRESS}/${PREFIX_LENGTH}\s\[${DISTANCE}/${METRIC}\]\svia\s${NEXTHOP_IP},\s${INTERFACE}\s* -> Record ^. -> Error EOF diff --git a/tests/ubiquiti_edgerouter/show_ip_route/ubiquiti_edgerouter_show_ip_route2.raw b/tests/ubiquiti_edgerouter/show_ip_route/ubiquiti_edgerouter_show_ip_route2.raw new file mode 100644 index 0000000000..00b2dfc263 --- /dev/null +++ b/tests/ubiquiti_edgerouter/show_ip_route/ubiquiti_edgerouter_show_ip_route2.raw @@ -0,0 +1,15 @@ +Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP + 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 + > - selected route, * - FIB route, p - stale info + +IP Route Table for VRF "default" +S *> 0.0.0.0/0 [50/0] via 100.100.34.45, eth9 +C *> 100.100.34.44/30 is directly connected, eth9 +B *> 100.100.34.48/30 [20/0] via 100.100.34.45, eth9, 1d05h38m +C *> 127.0.0.0/8 is directly connected, lo +B *> 192.168.2.0/24 [20/0] via 100.100.34.45, eth9, 01:16:38 +C *> 192.168.6.0/24 is directly connected, switch0.1 +C 192.168.6.0/24 is directly connected, switch0.1 +B *> 100.100.34.32/30 [20/0] via 100.100.34.45, eth9, 03w0d00h diff --git a/tests/ubiquiti_edgerouter/show_ip_route/ubiquiti_edgerouter_show_ip_route2.yml b/tests/ubiquiti_edgerouter/show_ip_route/ubiquiti_edgerouter_show_ip_route2.yml new file mode 100644 index 0000000000..83519fb2c6 --- /dev/null +++ b/tests/ubiquiti_edgerouter/show_ip_route/ubiquiti_edgerouter_show_ip_route2.yml @@ -0,0 +1,58 @@ +--- +parsed_sample: + - code: "S" + distance: "50" + interface: "eth9" + ip_address: "0.0.0.0" + metric: "0" + nexthop_ip: "100.100.34.45" + prefix_length: "0" + - code: "C" + distance: "" + interface: "eth9" + ip_address: "100.100.34.44" + metric: "" + nexthop_ip: "" + prefix_length: "30" + - code: "B" + distance: "20" + interface: "eth9" + ip_address: "100.100.34.48" + metric: "0" + nexthop_ip: "100.100.34.45" + prefix_length: "30" + - code: "C" + distance: "" + interface: "lo" + ip_address: "127.0.0.0" + metric: "" + nexthop_ip: "" + prefix_length: "8" + - code: "B" + distance: "20" + interface: "eth9" + ip_address: "192.168.2.0" + metric: "0" + nexthop_ip: "100.100.34.45" + prefix_length: "24" + - code: "C" + distance: "" + interface: "switch0" + ip_address: "192.168.6.0" + metric: "" + nexthop_ip: "" + prefix_length: "24" + - code: "C" + distance: "" + interface: "switch0" + ip_address: "192.168.6.0" + metric: "" + nexthop_ip: "" + prefix_length: "24" + - code: "B" + distance: "20" + interface: "eth9" + ip_address: "100.100.34.32" + metric: "0" + nexthop_ip: "100.100.34.45" + prefix_length: "30"