From d1a85baaf58b319d1894f4a3927ed3e45d7b5726 Mon Sep 17 00:00:00 2001 From: PavloSkliarenko <78343937+PavloSkliarenko@users.noreply.github.com> Date: Tue, 26 Dec 2023 20:27:02 +0400 Subject: [PATCH] Template + test (#1512) --- ntc_templates/templates/index | 1 + ..._routeros_interface_ethernet_print.textfsm | 17 ++++++++ ...otik_routeros_interface_ethernet_print.raw | 7 ++++ ...otik_routeros_interface_ethernet_print.yml | 42 +++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 ntc_templates/templates/mikrotik_routeros_interface_ethernet_print.textfsm create mode 100644 tests/mikrotik_routeros/interface_ethernet_print/mikrotik_routeros_interface_ethernet_print.raw create mode 100644 tests/mikrotik_routeros/interface_ethernet_print/mikrotik_routeros_interface_ethernet_print.yml diff --git a/ntc_templates/templates/index b/ntc_templates/templates/index index 6a794ead01..e11789967c 100644 --- a/ntc_templates/templates/index +++ b/ntc_templates/templates/index @@ -610,6 +610,7 @@ mikrotik_routeros_snmp_community_print_without-paging.textfsm, .*, mikrotik_rout mikrotik_routeros_ipv6_neighbor_print_without-paging.textfsm, .*, mikrotik_routeros, [[/]]ipv6 neighbor print without-paging mikrotik_routeros_log_print_detail_without-paging.textfsm, .*, mikrotik_routeros, [[/]]log p[[rint]] d[[etail]] wi[[thout-paging]] mikrotik_routeros_ip_arp_print_without-paging.textfsm, .*, mikrotik_routeros, [[/]]ip arp print without-paging +mikrotik_routeros_interface_ethernet_print.textfsm, .*, mikrotik_routeros, [[/]]in[[terface]] et[[hernet]] pr[[int]] mikrotik_routeros_system_routerboard_print.textfsm, .*, mikrotik_routeros, [[/]]system routerboard print mikrotik_routeros_ip_route_print_terse.textfsm, .*, mikrotik_routeros, [[/]]ip(v6)? route print terse mikrotik_routeros_system_clock_print.textfsm, .*, mikrotik_routeros, [[/]]sy[[stem]] cl[[ock]] p[[rint]] diff --git a/ntc_templates/templates/mikrotik_routeros_interface_ethernet_print.textfsm b/ntc_templates/templates/mikrotik_routeros_interface_ethernet_print.textfsm new file mode 100644 index 0000000000..55a6e3abc3 --- /dev/null +++ b/ntc_templates/templates/mikrotik_routeros_interface_ethernet_print.textfsm @@ -0,0 +1,17 @@ +Value ID (\d+) +Value STATUS (X|R) +Value SLAVE (S) +Value NAME (\S+) +Value MTU (\d+) +Value MAC_ADDRESS ([a-zA-Z0-9]{2}(:[a-zA-Z0-9]{2}){5}) +Value ARP (\S+) +Value SWITCH (\S+) + +Start + ^\s*Flags:\s+X\s+-\s+disabled,\s+R\s+-\s+running,\s+S\s+-\s+slave\s*$$ + ^\s*#\s+NAME\s+MTU\s+MAC-ADDRESS\s+ARP\s+SWITCH\s*$$ -> IfacesTable + +IfacesTable + ^\s*${ID}\s+(?:${STATUS})?(?:${SLAVE})?\s+${NAME}\s+${MTU}\s+${MAC_ADDRESS}\s+${ARP}\s+${SWITCH}\s*$$ -> Record + ^\s*$$ + ^. -> Error diff --git a/tests/mikrotik_routeros/interface_ethernet_print/mikrotik_routeros_interface_ethernet_print.raw b/tests/mikrotik_routeros/interface_ethernet_print/mikrotik_routeros_interface_ethernet_print.raw new file mode 100644 index 0000000000..02a5adc9db --- /dev/null +++ b/tests/mikrotik_routeros/interface_ethernet_print/mikrotik_routeros_interface_ethernet_print.raw @@ -0,0 +1,7 @@ +Flags: X - disabled, R - running, S - slave + # NAME MTU MAC-ADDRESS ARP SWITCH + 0 ether1 1500 12:34:56:78:90:AA enabled switch1 + 1 R ether2 1500 12:34:56:78:90:AB enabled switch1 + 2 XS ether3 1500 12:34:56:78:90:AC enabled switch1 + 3 S ether4 1500 12:34:56:78:90:AD enabled switch1 + 4 R ether5 1500 12:34:56:78:90:AE enabled switch1 diff --git a/tests/mikrotik_routeros/interface_ethernet_print/mikrotik_routeros_interface_ethernet_print.yml b/tests/mikrotik_routeros/interface_ethernet_print/mikrotik_routeros_interface_ethernet_print.yml new file mode 100644 index 0000000000..bfc52276b5 --- /dev/null +++ b/tests/mikrotik_routeros/interface_ethernet_print/mikrotik_routeros_interface_ethernet_print.yml @@ -0,0 +1,42 @@ +--- +parsed_sample: + - id: "0" + status: "" + slave: "" + name: "ether1" + mtu: "1500" + mac_address: "12:34:56:78:90:AA" + arp: "enabled" + switch: "switch1" + - id: "1" + status: "R" + slave: "" + name: "ether2" + mtu: "1500" + mac_address: "12:34:56:78:90:AB" + arp: "enabled" + switch: "switch1" + - id: "2" + status: "X" + slave: "S" + name: "ether3" + mtu: "1500" + mac_address: "12:34:56:78:90:AC" + arp: "enabled" + switch: "switch1" + - id: "3" + status: "" + slave: "S" + name: "ether4" + mtu: "1500" + mac_address: "12:34:56:78:90:AD" + arp: "enabled" + switch: "switch1" + - id: "4" + status: "R" + slave: "" + name: "ether5" + mtu: "1500" + mac_address: "12:34:56:78:90:AE" + arp: "enabled" + switch: "switch1"