Skip to content

Commit

Permalink
Add MikroTik ip dhcp-server lease print terse without-paging template (
Browse files Browse the repository at this point in the history
…#1500)

Co-authored-by: pskliarenko <“[email protected]”>
  • Loading branch information
PavloSkliarenko and pskliarenko authored Jul 22, 2024
1 parent 59f39f7 commit 605fa01
Show file tree
Hide file tree
Showing 6 changed files with 129 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 @@ -695,6 +695,7 @@ linux_ip_vrf_show.textfsm, .*, linux, ip v[[rf]] [[show]]
linux_arp_-a.textfsm, .*, linux, arp -a

mikrotik_routeros_routing_ospf_neighbor_print_terse_without-paging.textfsm, .*, mikrotik_routeros, [[/]]r[[outing]] o[[spf]] nei[[ghbor]] p[[rint]] t[[erse]] wi[[thout-paging]]
mikrotik_routeros_ip_dhcp-server_lease_print_terse_without-paging.textfsm, .*, mikrotik_routeros, [[/]]ip dh[[cp-server]] l[[ease]] pr[[int]] t[[erse]] wi[[thout-paging]]
mikrotik_routeros_routing_bgp_peer_print_status_without-paging.textfsm, .*, mikrotik_routeros, [[/]]r[[outing]] bg[[p]] p[[eer]] p[[rint]] s[[tatus]] wi[[thout-paging]]
mikrotik_routeros_interface_ethernet_poe_print_without-paging.textfsm, .*, mikrotik_routeros, [[/]]in[[terface]] et[[hernet]] po[[e]] pr[[int]] wi[[thout-paging]]
mikrotik_routeros_ip_firewall_filter_print_all_without-paging.textfsm, .*, mikrotik_routeros, [[/]]ip(v6)? firewall filter print( all)? without-paging
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Value INDEX (\d+)
Value FLAG ([XRDB]+)
Value COMMENT (.*)
Value ADDRESS (\S+)
Value MAC_ADDRESS ((?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})
Value CLIENT_ID (\S+)
Value ADDRESS_LISTS (\S+)
Value SERVER (\S+)
Value ALWAYS_BROADCAST (yes|no)
Value DHCP_OPTION (\S+)
Value STATUS (\S+)
Value EXPIRES_AFTER (\S+)
Value LAST_SEEN (\S+)
Value ACTIVE_ADDRESS (\S+)
Value ACTIVE_MAC_ADDRESS ((?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})
Value ACTIVE_CLIENT_ID (\S+)
Value ACTIVE_SERVER (\S+)
Value HOST_NAME (\S+)
Value SRC_MAC_ADDRESS ((?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})

Start
^\s*${INDEX}(?:\s+${FLAG})?(?:\s+comment=${COMMENT})?\s+address=${ADDRESS}(?:\s+mac-address=${MAC_ADDRESS})?(?:\s+client-id=(?:\"?(\b${CLIENT_ID}\b)?\"?))?(?:\s+address-lists=(?:\"?(\b${ADDRESS_LISTS}\b)?\"?))?(?:\s+server=${SERVER})?(?:\s+dhcp-option=(?:\"?(\b${DHCP_OPTION}\b)?\"?))?(?:\s+status=${STATUS})?(?:\s+expires-after=${EXPIRES_AFTER})?(?:\s+last-seen=${LAST_SEEN})?(?:\s+active-address=${ACTIVE_ADDRESS})?(?:\s+active-mac-address=${ACTIVE_MAC_ADDRESS})?(?:\s+active-client-id=(?:\"?(\b${ACTIVE_CLIENT_ID}\b)?\"?))?(?:\s+active-server=${ACTIVE_SERVER})?(?:\s+host-name=(?:\"?(\b${HOST_NAME}\b)?\"?))?(?:\s+src-mac-address=${SRC_MAC_ADDRESS})?\s*$$ -> Record
^\s*$$
^. -> Error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0 D address=192.168.69.254 address-lists="" server=*1 dhcp-option="" status=conflict expires-after=6m59s last-seen=35w12h24m42s active-address=192.168.69.254 active-server=*1 src-mac-address=12:34:56:78:90:AB
1 address=172.16.16.120 mac-address=30:07:4D:F5:07:49 client-id="1:30:7:4d:f5:7:49" address-lists="" server=defconf dhcp-option="" status=bound expires-after=8m55s last-seen=1m5s active-address=172.16.16.120 active-mac-address=30:07:4D:F5:07:49 active-client-id="1:30:7:4d:f5:7:49" active-server=defconf host-name="Galaxy-S8"
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
parsed_sample:
- active_address: "192.168.69.254"
active_client_id: ""
active_mac_address: ""
active_server: "*1"
address: "192.168.69.254"
address_lists: ""
always_broadcast: ""
client_id: ""
comment: ""
dhcp_option: ""
expires_after: "6m59s"
flag: "D"
host_name: ""
index: "0"
last_seen: "35w12h24m42s"
mac_address: ""
server: "*1"
src_mac_address: "12:34:56:78:90:AB"
status: "conflict"
- active_address: "172.16.16.120"
active_client_id: "1:30:7:4d:f5:7:49"
active_mac_address: "30:07:4D:F5:07:49"
active_server: "defconf"
address: "172.16.16.120"
address_lists: ""
always_broadcast: ""
client_id: "1:30:7:4d:f5:7:49"
comment: ""
dhcp_option: ""
expires_after: "8m55s"
flag: ""
host_name: "Galaxy-S8"
index: "1"
last_seen: "1m5s"
mac_address: "30:07:4D:F5:07:49"
server: "defconf"
src_mac_address: ""
status: "bound"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
0 comment=UniFi1 address=10.124.3.199 mac-address=74:83:C2:36:5A:6E client-id=1:74:83:c2:36:5a:6e address-lists="" server=dhcp1 dhcp-option=unifi status=bound expires-after=6m51s last-seen=3m9s active-address=10.164.1.199 active-mac-address=74:83:C2:36:5A:6E active-client-id=1:74:83:c2:36:5a:6e active-server=dhcp1 host-name=Unifi3B
1 comment=PC address=10.124.3.252 mac-address=00:50:56:88:80:EE client-id=1:0:50:56:88:80:ee address-lists="" server=dhcp1 dhcp-option="" status=bound expires-after=6m18s last-seen=3m42s active-address=10.164.1.252 active-mac-address=00:50:56:88:80:EE active-client-id=1:0:50:56:88:80:ee active-server=dhcp1 host-name=RSNC-CLIENT1-VM
2 comment=SPA address=10.124.3.222 mac-address=C4:0A:CB:BC:65:C8 address-lists="" server=dhcp1 dhcp-option="" status=bound expires-after=5m56s last-seen=4m4s active-address=10.164.1.222 active-mac-address=C4:0A:CB:BC:65:C8 active-client-id=1:c4:a:cb:bc:65:c8 active-server=dhcp1 host-name=SPA122
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
parsed_sample:
- index: "0"
flag: ""
comment: "UniFi1"
address: "10.124.3.199"
mac_address: "74:83:C2:36:5A:6E"
client_id: "1:74:83:c2:36:5a:6e"
address_lists: ""
server: "dhcp1"
always_broadcast: ""
dhcp_option: "unifi"
status: "bound"
expires_after: "6m51s"
last_seen: "3m9s"
active_address: "10.164.1.199"
active_mac_address: "74:83:C2:36:5A:6E"
active_client_id: "1:74:83:c2:36:5a:6e"
active_server: "dhcp1"
host_name: "Unifi3B"
src_mac_address: ""
- index: "1"
flag: ""
comment: "PC"
address: "10.124.3.252"
mac_address: "00:50:56:88:80:EE"
client_id: "1:0:50:56:88:80:ee"
address_lists: ""
server: "dhcp1"
always_broadcast: ""
dhcp_option: ""
status: "bound"
expires_after: "6m18s"
last_seen: "3m42s"
active_address: "10.164.1.252"
active_mac_address: "00:50:56:88:80:EE"
active_client_id: "1:0:50:56:88:80:ee"
active_server: "dhcp1"
host_name: "RSNC-CLIENT1-VM"
src_mac_address: ""
- index: "2"
flag: ""
comment: "SPA"
address: "10.124.3.222"
mac_address: "C4:0A:CB:BC:65:C8"
client_id: ""
address_lists: ""
server: "dhcp1"
always_broadcast: ""
dhcp_option: ""
status: "bound"
expires_after: "5m56s"
last_seen: "4m4s"
active_address: "10.164.1.222"
active_mac_address: "C4:0A:CB:BC:65:C8"
active_client_id: "1:c4:a:cb:bc:65:c8"
active_server: "dhcp1"
host_name: "SPA122"
src_mac_address: ""

0 comments on commit 605fa01

Please sign in to comment.