Skip to content

Commit

Permalink
Template + test (networktocode#1506)
Browse files Browse the repository at this point in the history
  • Loading branch information
PavloSkliarenko authored and cppmonkey committed Oct 25, 2023
1 parent 9214598 commit f09d934
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions ntc_templates/templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ mikrotik_routeros_system_routerboard_print.textfsm, .*, mikrotik_routeros, [[/]]
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]]
mikrotik_routeros_user_active_print.textfsm, .*, mikrotik_routeros, [[/]]us[[er]] ac[[tive]] p[[rint]]
mikrotik_routeros_ip_address_print.textfsm, .*, mikrotik_routeros, [[/]]ip ad[[dress]] p[[rint]]

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
Expand Down
20 changes: 20 additions & 0 deletions ntc_templates/templates/mikrotik_routeros_ip_address_print.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Value NUM (\d+)
Value FLAGS (X|I|D)
Value COMMENT (.*)
Value IP (\S+)
Value SUBNET (\d+)
Value NETWORK (\S+)
Value INTERFACE (.*)

Start
^\s*Flags:\s+X\s+-\s+disabled,\s+I\s+-\s+invalid,\s+D\s+-\s+dynamic\s*$$
^\s*#\s+ADDRESS\s+NETWORK\s+INTERFACE\s*$$ -> IPsTable
^\s*$$
^. -> Error

IPsTable
^\s*${NUM}\s+(?:${FLAGS}\s+)?${IP}/${SUBNET}\s+${NETWORK}\s+${INTERFACE}\s*$$ -> Record
^\s*${NUM}\s+(?:${FLAGS}\s+)?;;;\s+${COMMENT}\s*$$
^\s*${IP}/${SUBNET}\s+${NETWORK}\s+${INTERFACE}\s*$$ -> Record
^\s*$$
^. -> Error
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK INTERFACE
0 1.2.3.6/30 1.2.3.4 ether1
1 ;;; test ip1
192.167.1.5/27 192.167.1.0 eth2_vlan1
2 D 192.168.1.53/24 192.168.1.0 lte1
3 X ;;; test ip2
192.167.1.99/27 192.167.1.0 eth2_vlan2
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
parsed_sample:
- num: "0"
flags: ""
comment: ""
ip: "1.2.3.6"
subnet: "30"
network: "1.2.3.4"
interface: "ether1"
- num: "1"
flags: ""
comment: "test ip1"
ip: "192.167.1.5"
subnet: "27"
network: "192.167.1.0"
interface: "eth2_vlan1"
- num: "2"
flags: "D"
comment: ""
ip: "192.168.1.53"
subnet: "24"
network: "192.168.1.0"
interface: "lte1"
- num: "3"
flags: "X"
comment: "test ip2"
ip: "192.167.1.99"
subnet: "27"
network: "192.167.1.0"
interface: "eth2_vlan2"

0 comments on commit f09d934

Please sign in to comment.