Skip to content

Commit

Permalink
fix: Mikrotik ip address print (#1868)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwood92 authored Oct 10, 2024
1 parent d234429 commit 20f82f6
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ 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*Flags:\s*(?:X\s*-\s*disabled,)?\s*(?:I\s*-\s*invalid,)?\s*(?:D\s*-\s*(?:DYNAMIC|dynamic))?\s*$$
^\s*Columns:\s*ADDRESS,\s*NETWORK,\s*INTERFACE\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*;{3}\s*${COMMENT}\s*$$
^\s*${NUM}\s+(?:${FLAGS}\s+)?;;;\s+${COMMENT}\s*$$
^\s*${IP}/${SUBNET}\s+${NETWORK}\s+${INTERFACE}\s*$$ -> Record
^\s*$$
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Flags: D - DYNAMIC
Columns: ADDRESS, NETWORK, INTERFACE
# ADDRESS NETWORK INTERFACE
;;; INET Uplink
0 1.1.1.26/30 1.1.1.24 vlan11@vlan975@sfp-sfpplus1
;;; MGMT Uplink
1 100.65.255.138/30 100.65.255.136 vlan10@vlan975@sfp-sfpplus1
;;; MGMT Loopback
2 100.100.0.106/32 100.100.0.106 Lo0
;;; Cust
3 1.1.1.49/30 1.1.1.48 vlan4050@sfp-sfpplus11
;;; MGMT Link
4 100.64.5.1/30 100.64.5.0 vlan1@bond1
;;; INET Link
5 1.1.1.121/30 1.1.1.120 vlan2@bond1
;;; INET Loopback
6 1.1.1.1/32 1.1.1.1 Lo1
;;; INET Uplink
7 1.1.1.30/30 1.1.1.28 vlan12@vlan975@sfp-sfpplus1
;;; INET
8 1.1.1.66/25 1.1.1.0 vlan111@sfp-sfpplus1
9 D 100.64.247.75/32 100.64.1.248 pppoe-out1
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
parsed_sample:
- comment: "INET Uplink"
flags: ""
interface: "vlan11@vlan975@sfp-sfpplus1"
ip: "1.1.1.26"
network: "1.1.1.24"
num: "0"
subnet: "30"
- comment: "MGMT Uplink"
flags: ""
interface: "vlan10@vlan975@sfp-sfpplus1"
ip: "100.65.255.138"
network: "100.65.255.136"
num: "1"
subnet: "30"
- comment: "MGMT Loopback"
flags: ""
interface: "Lo0"
ip: "100.100.0.106"
network: "100.100.0.106"
num: "2"
subnet: "32"
- comment: "Cust"
flags: ""
interface: "vlan4050@sfp-sfpplus11"
ip: "1.1.1.49"
network: "1.1.1.48"
num: "3"
subnet: "30"
- comment: "MGMT Link"
flags: ""
interface: "vlan1@bond1"
ip: "100.64.5.1"
network: "100.64.5.0"
num: "4"
subnet: "30"
- comment: "INET Link"
flags: ""
interface: "vlan2@bond1"
ip: "1.1.1.121"
network: "1.1.1.120"
num: "5"
subnet: "30"
- comment: "INET Loopback"
flags: ""
interface: "Lo1"
ip: "1.1.1.1"
network: "1.1.1.1"
num: "6"
subnet: "32"
- comment: "INET Uplink"
flags: ""
interface: "vlan12@vlan975@sfp-sfpplus1"
ip: "1.1.1.30"
network: "1.1.1.28"
num: "7"
subnet: "30"
- comment: "INET"
flags: ""
interface: "vlan111@sfp-sfpplus1"
ip: "1.1.1.66"
network: "1.1.1.0"
num: "8"
subnet: "25"
- comment: ""
flags: "D"
interface: "pppoe-out1"
ip: "100.64.247.75"
network: "100.64.1.248"
num: "9"
subnet: "32"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Columns: ADDRESS, NETWORK, INTERFACE
# ADDRESS NETWORK INTERFACE
0 100.64.3.207/27 100.64.3.192 vlan906
1 100.64.1.207/27 100.64.1.192 vlan991
;;; MGMT Loopback
2 100.64.1.135/32 100.64.1.135 Lo0
;;; INET Loopback
3 1.1.1.1/32 1.1.1.1 Lo1
;;; INET
4 1.1.1.82/30 1.1.1.80 vlan203
;;; INET
5 1.1.1.86/30 1.1.1.84 vlan204
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
parsed_sample:
- comment: ""
flags: ""
interface: "vlan906"
ip: "100.64.3.207"
network: "100.64.3.192"
num: "0"
subnet: "27"
- comment: ""
flags: ""
interface: "vlan991"
ip: "100.64.1.207"
network: "100.64.1.192"
num: "1"
subnet: "27"
- comment: "MGMT Loopback"
flags: ""
interface: "Lo0"
ip: "100.64.1.135"
network: "100.64.1.135"
num: "2"
subnet: "32"
- comment: "INET Loopback"
flags: ""
interface: "Lo1"
ip: "1.1.1.1"
network: "1.1.1.1"
num: "3"
subnet: "32"
- comment: "INET"
flags: ""
interface: "vlan203"
ip: "1.1.1.82"
network: "1.1.1.80"
num: "4"
subnet: "30"
- comment: "INET"
flags: ""
interface: "vlan204"
ip: "1.1.1.86"
network: "1.1.1.84"
num: "5"
subnet: "30"

0 comments on commit 20f82f6

Please sign in to comment.