⚡
FLASH SALE
— 30% OFF Yearly Network Automation Memberships! Use code
SALE30
at checkout. Offer ends August 20th.
➜ Sign up here
Training
Bootcamp
Courses
Tech Sessions
Resources
Blog
Tips
GitHub
YouTube
Newsletter
Playgrounds
Pricing
Sign In
Become Member
TTP Parser
Validate and test the parsing of your TTP templates
Tools
J2 Renderer
TTP Parser
TextFSM Parser
XPath Tester
Members Only
JMESPath Validator
JSON Schema Validator
Data Format Converter
TTP Template
################################################################################## CHECK 9 - QUEDE AUI ################################################################################## ## INPUT HOST-NAME#show running-config | section aaa accounting aaa accounting exec default start-stop group TEST-TACACS aaa accounting commands 0 default start-stop group TEST-TACACS aaa accounting commands 1 default start-stop group TEST-TACACS aaa accounting commands 15 default start-stop group TEST-TACACS aaa accounting connection default start-stop group TEST-TACACS aaa accounting system default start-stop group TEST-TACACS ## TEMPLATE <group name="aaa" itemize="output"> {{ output | re("aaa accounting exec default start-stop group \S+") | default([]) }} </group> <group name="aaa" itemize="output"> {{ output | re("aaa accounting commands \d+ default start-stop group \S+") | default([]) }} </group> <group name="aaa" itemize="output"> {{ output | re("aaa accounting connection default start-stop group \S+") | default([]) }} </group> <group name="aaa" itemize="output"> {{ output | re("aaa accounting system default start-stop group \S+") | default([]) }} </group> ## OUTPUT <doc> This template will check if any of the following commands are configured aaa accounting exec default start-stop group tacacs_server_name_var aaa accounting commands 0 default start-stop group tacacs_server_name_var aaa accounting commands 1 default start-stop group tacacs_server_name_var aaa accounting commands 15 default start-stop group tacacs_server_name_var aaa accounting connection default start-stop group tacacs_server_name_var aaa accounting system default start-stop group tacacs_server_name_var If any of the commands above are configured --> It will return a list with the commands if none of the commands above are configured --> It will return an "aaa" key containing an empty list Example Output: 1 - When all the commands are configured: [ { "aaa": [ "aaa accounting exec default start-stop group NETMAN-TACACS", "aaa accounting commands 0 default start-stop group NETMAN-TACACS", "aaa accounting commands 1 default start-stop group NETMAN-TACACS", "aaa accounting commands 15 default start-stop group NETMAN-TACACS", "aaa accounting connection default start-stop group NETMAN-TACACS", "aaa accounting system default start-stop group NETMAN-TACACS" ] } ] 2 - When some of the commands are configured: [ { "aaa": [ "aaa accounting exec default start-stop group NETMAN-TACACS", "aaa accounting connection default start-stop group NETMAN-TACACS" ] } ] 3 - When none of the commands are configured: [ { "aaa": [] } ] </doc> ################################################################################## CHECK 8 ################################################################################## ## INPUT HOST-NAME#show running-config | include username username test1 secret 5 $Password String$ username test2 secret 6 $Password String$ username test3 secret 9 $Password String$ username test4 password 5 $Password String$ username test5 password 6 $Password String$ username test6 password 9 $Password String$ username test7 privilege 15 password 5 $Password String$ username test8 privilege 15 password 6 $Password String$ username test9 privilege 15 password 9 $Password String$ username test10 privilege 15 secret 5 $Password String$ username test11 privilege 15 secret 6 $Password String$ username test12 privilege 15 secret 9 $Password String$ ## TEMPLATE <group name="user_accounts" itemize="output"> {{ output | re("username \w+ secret \d{1} .+") | strip() | default([]) }} </group> <group name="user_accounts" itemize="output"> {{ output | re("username \w+ password \d{1} .*") | strip() | default([]) }} </group> <group name="user_accounts" itemize="output"> {{ output | re("username \w+ privilege \d{0,2} password \d{1} .+") | strip() | default([]) }} </group> <group name="user_accounts" itemize="output"> {{ output | re("username \w+ privilege \d{0,2} secret \d{1} .+") | strip() | default([]) }} </group> ## OUTPUT <doc> This template will check if any of the following commands are configured: username USERNAME secret 5|6|9 $PASSWORD_STRING username USERNAME password 5|6|9 $PASSWORD_STRING username USERNAME privilege [0-15] password 5|6|9 $PASSWORD_STRING username USERNAME privilege [0-15] secret 5|6|9 $PASSWORD_STRING If any of the commands are configured --> It will return a list with all the user commands configured if not configured --> It will return an "user_accounts" key containing an empty list Example Outputs: [ { "user_accounts": [ "username test1 secret 5 $Password String$", "username test2 secret 6 $Password String$", "username test3 secret 9 $Password String$", "username test4 password 5 $Password String$", "username test5 password 6 $Password String$", "username test6 password 9 $Password String$", "username test7 privilege 15 password 5 $Password String$", "username test8 privilege 15 password 6 $Password String$", "username test9 privilege 15 password 9 $Password String$", "username test10 privilege 15 secret 5 $Password String$", "username test11 privilege 15 secret 6 $Password String$", "username test12 privilege 15 secret 9 $Password String$" ] } ] [ { "user_accounts": [] } ] </doc> ################################################################################## CHECK 7 ################################################################################## ## INPUT HOST-NAME#show running-config | include snmp-server host snmp-server host 1.1.1.10 FAKE-COMMUNITY mac-notification snmp-server host 1.1.1.11 FAKE-COMMUNITY mac-notification snmp-server host 1.1.1.12 FAKE-COMMUNITY mac-notification snmp-server host 1.1.1.13 FAKE-COMMUNITY mac-notification snmp-server host 1.1.1.14 version 3 priv FAKE-DATA snmp-server host 1.1.1.1 public snmp-server host 1.1.1.2 public snmp-server host 1.1.1.3 public snmp-server host 1.1.1.4 public snmp-server host 1.1.1.5 public snmp-server host 10.10.1.1 private ## TEMPLATE <group name="snmp_server_private_public" itemize="output"> {{ output | re("snmp-server host.*") | strip() | default([]) }} </group> ## OUTPUT <doc> This template will check if there is an snmp host called private or public if configured --> It will return the full list of snmp-server host.* commands if not configured --> It will return an "snmp_server_private_public" key containing an empty list Example Outputs: [ { "snmp_server_private_public": [ "snmp-server host 157.83.211.1 test mac-notification", "snmp-server host 157.83.211.244 test mac-notification", "snmp-server host 157.83.211.252 test mac-notification", "snmp-server host 157.83.211.33 test mac-notification", "snmp-server host 157.83.225.12 version 3 priv testaa", "snmp-server host 10.10.0.1 public", "snmp-server host 10.10.0.65 public", "snmp-server host 157.10.224.1 public", "snmp-server host 157.10.224.4 public", "snmp-server host 157.10.224.68 public", "snmp-server host 157.10.1.1 private" ] } ] [ { "snmp_server_private_public": [] } ] </doc> ################################################################################## CHECK 6 ################################################################################## ## INPUT show running-config | include snmp-server community snmp-server community FAKE-COMMUNITY1 RO 98 snmp-server community FAKE-COMMUNITY2 RO 41 snmp-server community FAKE-COMMUNITY3 RO 41 snmp-server community FAKE-COMMUNITY3 RW 41 ## TEMPLATE <group name="snmp_server_communities" itemize="output"> {{ output | re("snmp-server community.*") | strip() | default([]) }} </group> ## OUTPUT <doc> This template will check if there are any snmp-server communities configured if configured --> It will return a list of full snmp-server community commands if not configured --> It will return an "snmp_server_communities" key containing an empty list Example Outputs: [ { "snmp_server_communities": [ "snmp-server community FAKE-COMMUNITY1 RO 98", "snmp-server community FAKE-COMMUNITY2 RO 41", "snmp-server community FAKE-COMMUNITY3 RO 41", "snmp-server community FAKE-COMMUNITY3 RW 41" ] } ] [ { "snmp_server_communities": [] } ] </doc> ################################################################################## CHECK 5 ################################################################################## ## INPUT HOST-NAME#show running-config | include service password service password-encryption ## TEMPLATE <group name="password_encryption"> {{ output | re("service password-encryption") | default("") }} </group> ## OUTPUT <doc> This template will check if "password service-encryption" is enabled or disabled. if configured --> It will return the string "service password-encryption" if not configured --> It will return an "output" key containing an empty string Example Outputs: [ { "password_encryption": { "output": "service password-encryption" } } ] [ { "password_encryption": { "output": "" } } ] </doc> ################################################################################## CHECK 4 ################################################################################## ## INPUT HOST-NAME#show running-config | include ntp ntp source Loopback0 ntp server 157.83.224.1 prefer ntp server 157.83.224.65 ## TEMPLATE <group name="ntp" itemize="output"> {{ output | re("ntp source \S+") | strip() | default([]) }} </group> <group name="ntp" itemize="output"> {{ output | re("ntp server \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}") | strip() | default([]) }} </group> <group name="ntp" itemize="output"> {{ output | re("ntp access-group peer 95") | strip() | default([]) }} </group> ## OUTPUT <doc> This template will check if any of the following commands are configured ntp server NTP_SERVER ntp source MGMT_INTERFACE ntp access-group peer 95 If any of the commands above are configured --> It will return a list with the commands if none of the commands above are configured --> It will return a "ntp" key containing an empty list Example Output: 1 - When all the commands are configured: [ { "ntp": [ "ntp source Loopback0", "ntp server 157.83.224.65", "ntp access-group peer 95" ] } ] 2 - When some of the commands are configured: [ { "ntp": [ "ntp source Loopback0", "ntp server 157.83.224.65" ] } ] 3 - When none of the commands are configured: [ { "ntp": [] } ] </doc> ################################################################################## CHECK 3 ################################################################################## ## INPUT HOST-NAME#show running-config | include logging logging buffered 128000 logging rate-limit console 10 logging console informational no logging event link-status no logging event link-status no logging event power-inline-status no logging event link-status no logging event power-inline-status no logging event link-status no logging event power-inline-status no logging event link-status no logging event power-inline-status logging source-interface Loopback0 logging host 10.250.32.1 logging host 157.83.224.2 logging host 157.83.224.1 logging host 10.250.32.2 logging synchronous logging synchronous logging synchronous ## TEMPLATE <group name="logging" itemize="output"> {{ output | re("logging \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}") | strip() | default([]) }} </group> <group name="logging" itemize="output"> {{ output | re("logging host \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}") | strip() | default([]) }} </group> ## OUTPUT <doc> This template will check if any of the following commands are configured logging SERVER_IP logging host SERVER_IP If any of the commands above are configured --> It will return a list with the commands if none of the commands above are configured --> It will return a "logging" key containing an empty list Example Output: 1 - When all the commands are configured: [ { "logging": [ "logging 172.192.73.3", "logging host 10.250.32.1", "logging host 157.83.224.2", "logging host 157.83.224.66", "logging host 10.250.32.65" ] } ] 2 - When some of the commands are configured: [ { "logging": [ "logging 172.192.73.3" ] } ] 3 - When none of the commands are configured: [ { "logging": [] } ] </doc> ################################################################################## CHECK 2 ################################################################################## ## INPUT HOST-NAME#show running-config | include ip dhcp pool ip dhcp pool EXAMPLE-POOL ## TEMPLATE <group name="dhcp_server"> {{ output | re("ip dhcp pool.*") | default("") }} </group> ## OUTPUT <doc> This template will check if a DHCP Pool is configured if configured --> It will return the "ip dhcp pool POOL_NAME" command if not configured --> It will return an "output" key containing an empty string Example Outputs: [ { "dhcp_server": { "output": "ip dhcp pool EXAMPLE-POOL" } } ] [ { "dhcp_server": { "output": "" } } ] </doc> ################################################################################## CHECK 1 ################################################################################## ## INPUT HOST-NAME#show running-config | include domain name ip domain name net.global ## TEMPLATE <group name="ip_domain_name"> {{ output | re("ip domain name.*") | strip() | default("") }} </group> ## OUTPUT <doc> This template will check if there is an ip domain name configured if configured --> It will return the full domain name command configured for the device if not configured --> It will return an "output" key containing an empty string Example Outputs: [ { "ip_domain_name": { "output": "ip domain name net.global" } } ] [ { "ip_domain_name": { "output": "" } } ] </doc> DDD
0
/ 20000
Raw Text
DMLss
0
/ 20000
Result
[ { "aaa": [], "dhcp_server": { "output": "" }, "ip_domain_name": { "output": "" }, "logging": [], "ntp": [], "password_encryption": { "output": "" }, "snmp_server_communities": [], "snmp_server_private_public": [], "user_accounts": [] } ]
Parse
Share
Auto-Sync