From 8288a4de98beed0541ef302ed30805796dd118b1 Mon Sep 17 00:00:00 2001 From: pskliarenko <“pskliarenko@bsh.ru”> Date: Sun, 10 Sep 2023 23:22:07 +0400 Subject: [PATCH] Template +test --- ntc_templates/templates/index | 1 + .../mikrotik_routeros_tool_profile.textfsm | 15 +++++++++++ .../mikrotik_routeros_tool_profile.raw | 9 +++++++ .../mikrotik_routeros_tool_profile.yml | 26 +++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 ntc_templates/templates/mikrotik_routeros_tool_profile.textfsm create mode 100644 tests/mikrotik_routeros/tool_profile/mikrotik_routeros_tool_profile.raw create mode 100644 tests/mikrotik_routeros/tool_profile/mikrotik_routeros_tool_profile.yml diff --git a/ntc_templates/templates/index b/ntc_templates/templates/index index 3a5b516184..8a9d74b117 100644 --- a/ntc_templates/templates/index +++ b/ntc_templates/templates/index @@ -575,6 +575,7 @@ mikrotik_routeros_ipv6_neighbor_print_without-paging.textfsm, .*, mikrotik_route mikrotik_routeros_ip_arp_print_without-paging.textfsm, .*, mikrotik_routeros, [[/]]ip arp print without-paging 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_tool_profile.textfsm, .*, mikrotik_routeros, [[/]]too[[l]] pr[[ofile]] paloalto_panos_show_running_security-policy.textfsm, .*, paloalto_panos, sh[[ow]] runn[[ing]] security[[-policy]] paloalto_panos_show_high-availability_all.textfsm, .*, paloalto_panos, sh[[ow]] high[[-availability]] all diff --git a/ntc_templates/templates/mikrotik_routeros_tool_profile.textfsm b/ntc_templates/templates/mikrotik_routeros_tool_profile.textfsm new file mode 100644 index 0000000000..9ac1c7b7f8 --- /dev/null +++ b/ntc_templates/templates/mikrotik_routeros_tool_profile.textfsm @@ -0,0 +1,15 @@ +Value NAME (\S+) +Value CPU (\S+) +Value USAGE (\d+|\d+.\d+) + +Start + ^\s*NAME\s+CPU\s+USAGE\s*$$ -> ProfilingTable + ^\s*$$ + ^. -> Error + +ProfilingTable + ^\s*${NAME}\s*(\s+${CPU})?\s+${USAGE}%\s*$$ -> Record + ^\s*--\s+\[Q\s+quit\|D\s+dump\|C-z\s+pause\]\s*$$ + ^\s*--\s+\[Q\s+quit\|C-z\s+pause\]\s*$$ + ^\s*$$ + ^. -> Error diff --git a/tests/mikrotik_routeros/tool_profile/mikrotik_routeros_tool_profile.raw b/tests/mikrotik_routeros/tool_profile/mikrotik_routeros_tool_profile.raw new file mode 100644 index 0000000000..04d7c9b79e --- /dev/null +++ b/tests/mikrotik_routeros/tool_profile/mikrotik_routeros_tool_profile.raw @@ -0,0 +1,9 @@ +NAME CPU USAGE +spi 1% +console 0% +firewall 0.5% +networking 0% +management 0.5% +profiling 0% +unclassified 0.5% +total 2.5% diff --git a/tests/mikrotik_routeros/tool_profile/mikrotik_routeros_tool_profile.yml b/tests/mikrotik_routeros/tool_profile/mikrotik_routeros_tool_profile.yml new file mode 100644 index 0000000000..5fa5a3d3c9 --- /dev/null +++ b/tests/mikrotik_routeros/tool_profile/mikrotik_routeros_tool_profile.yml @@ -0,0 +1,26 @@ +--- +parsed_sample: + - name: "spi" + cpu: "" + usage: "1" + - name: "console" + cpu: "" + usage: "0" + - name: "firewall" + cpu: "" + usage: "0.5" + - name: "networking" + cpu: "" + usage: "0" + - name: "management" + cpu: "" + usage: "0.5" + - name: "profiling" + cpu: "" + usage: "0" + - name: "unclassified" + cpu: "" + usage: "0.5" + - name: "total" + cpu: "" + usage: "2.5"