Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Mikrotik interface print detail #1867

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,31 @@ Value DYNAMIC (D)
Value STATUS (X|R)
Value SLAVE (S)
Value NAME (\S+)
Value List DESCRIPTION ((?!\s*$).+[^\s])
Value List DESCRIPTION (.+?)
Value DEFAULT_NAME (\S+)
Value TYPE (\S+)
Value MTU (\d+|auto)
Value ACTUAL_MTU (\d+)
Value L2MTU (\d+|auto)
Value MAX_L2MTU (\d+)
Value MAC_ADDRESS ([a-zA-Z0-9]{2}(?::[a-zA-Z0-9]{2}){5})
Value LAST_LINK_DOWN_TIME ([a-z]{3}/\d+/\d+\s\d+\:\d+\:\d+)
Value LAST_LINK_UP_TIME ([a-z]{3}/\d+/\d+\s\d+\:\d+\:\d+)
Value LAST_LINK_DOWN_TIME ([a-z]{3}/\d+/\d+\s\d+\:\d+\:\d+|\d+-\d+-\d+\s*\d+:\d+:\d+)
Value LAST_LINK_UP_TIME ([a-z]{3}/\d+/\d+\s\d+\:\d+\:\d+|\d+-\d+-\d+\s*\d+:\d+:\d+)
Value LINK_DOWNS (\d+)
Value VRF (\S+)

Start
^\s*Flags:\s+D\s+-\s+dynamic,\s+X\s+-\s+disabled,\s+R\s+-\s+running,\s+S\s+-\s+slave\s*$$ -> Interface
^\s*Flags:\s+D\s+-\s+dynamic(;|,)\s+X\s+-\s+disabled,\s+R\s+-\s+running(;|,)\s+S\s+-\s+slave(;|,)?\s*(P\s+-\s+passthrough)?\s*$$ -> Interface
^\s*$$
^. -> Error

Interface
^\s*\d+(?:\s+D)?(?:\s*X|R)?(?:\s*S)?\s+ -> Continue.Record
^\s*${ID}(?:\s+${DYNAMIC})?(?:\s*${STATUS})?(?:\s*${SLAVE})?\s+name="${NAME}"(?:\s+default-name="${DEFAULT_NAME}")?\s+type="${TYPE}"(\s+mtu=${MTU})?(?:\s+actual-mtu=${ACTUAL_MTU})?(?:\s+l2mtu=${L2MTU})?(?:\s+max-l2mtu=${MAX_L2MTU})?(?:\s+mac-address=${MAC_ADDRESS})?(?:\s+last-link-down-time=${LAST_LINK_DOWN_TIME})?(?:\s+last-link-up-time=${LAST_LINK_UP_TIME})?(?:\s+link-downs=${LINK_DOWNS})?\s*$$
^\s*name="${NAME}"(?:\s+default-name="${DEFAULT_NAME}")?\s+type="${TYPE}"(\s+mtu=${MTU})?(?:\s+actual-mtu=${ACTUAL_MTU})?(?:\s+l2mtu=${L2MTU})?(?:\s+max-l2mtu=${MAX_L2MTU})?(?:\s+mac-address=${MAC_ADDRESS})?(?:\s+last-link-down-time=${LAST_LINK_DOWN_TIME})?(?:\s+last-link-up-time=${LAST_LINK_UP_TIME})?(?:\s+link-downs=${LINK_DOWNS})?\s*$$
^\s*${ID}+\s*(?:${DYNAMIC})?\s*(?:${STATUS})?\s*(?:${SLAVE})?\s*name="${NAME}"(?:\s*default-name="${DEFAULT_NAME}")?\s*type="${TYPE}"\s*mtu=${MTU}\s*actual-mtu=${ACTUAL_MTU}\s*l2mtu=${L2MTU}\s*(max-l2mtu=${MAX_L2MTU}|vrf=${VRF})?\s*mac-address=${MAC_ADDRESS}\s*ifname="(\S+)"\s*ifindex=(\d+)\s*id=(\d+)(?:\s*last-link-down-time=${LAST_LINK_DOWN_TIME})?(?:\s*last-link-up-time=${LAST_LINK_UP_TIME})?\s*link-downs=${LINK_DOWNS}\s*$$
^\s*name="${NAME}"(?:\s*default-name="${DEFAULT_NAME}")?\s*type="${TYPE}"\s*mtu=${MTU}\s*actual-mtu=${ACTUAL_MTU}\s*l2mtu=${L2MTU}\s*(max-l2mtu=${MAX_L2MTU}|vrf=${VRF})?\s*mac-address=${MAC_ADDRESS}\s*ifname="(\S+)"\s*ifindex=(\d+)\s*id=(\d+)(?:\s*last-link-down-time=${LAST_LINK_DOWN_TIME})?(?:\s*last-link-up-time=${LAST_LINK_UP_TIME})?\s*link-downs=${LINK_DOWNS}\s*$$
^\s*${ID}(?:\s+${DYNAMIC})?(?:\s*${STATUS})?(?:\s*${SLAVE})?\s+;{3}\s+${DESCRIPTION}\s*$$
^${DESCRIPTION}\s*$$
^\s*$$
^\s*${DESCRIPTION}\s*$$
^. -> Error
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
parsed_sample:
- actual_mtu: "1500"
default_name: "ether1"
description: []
dynamic: ""
id: "0"
l2mtu: "1598"
Expand All @@ -12,12 +13,13 @@ parsed_sample:
max_l2mtu: "2028"
mtu: "1500"
name: "ether1"
description: []
slave: ""
status: ""
type: "ether"
vrf: ""
- actual_mtu: "1500"
default_name: "ether2"
description: []
dynamic: "D"
id: "1"
l2mtu: "1598"
Expand All @@ -28,12 +30,13 @@ parsed_sample:
max_l2mtu: "2028"
mtu: "1500"
name: "ether2"
description: []
slave: ""
status: ""
type: "ether"
vrf: ""
- actual_mtu: "1500"
default_name: "ether3"
description: []
dynamic: ""
id: "2"
l2mtu: "1598"
Expand All @@ -44,12 +47,13 @@ parsed_sample:
max_l2mtu: "2028"
mtu: "1500"
name: "ether3"
description: []
slave: ""
status: "R"
type: "ether"
vrf: ""
- actual_mtu: "1500"
default_name: "ether4"
description: []
dynamic: ""
id: "3"
l2mtu: "1598"
Expand All @@ -60,12 +64,13 @@ parsed_sample:
max_l2mtu: "2028"
mtu: "1500"
name: "ether4"
description: []
slave: "S"
status: ""
type: "ether"
vrf: ""
- actual_mtu: "1500"
default_name: "ether5"
description: []
dynamic: "D"
id: "4"
l2mtu: "1598"
Expand All @@ -76,12 +81,13 @@ parsed_sample:
max_l2mtu: "2028"
mtu: "1500"
name: "ether5"
description: []
slave: ""
status: "R"
type: "ether"
vrf: ""
- actual_mtu: "1500"
default_name: "ether6"
description: []
dynamic: ""
id: "5"
l2mtu: "1598"
Expand All @@ -92,12 +98,13 @@ parsed_sample:
max_l2mtu: "2028"
mtu: "1500"
name: "ether6"
description: []
slave: "S"
status: "R"
type: "ether"
vrf: ""
- actual_mtu: "1500"
default_name: ""
description: []
dynamic: "D"
id: "6"
l2mtu: ""
Expand All @@ -108,12 +115,15 @@ parsed_sample:
max_l2mtu: ""
mtu: "1500"
name: "lte1"
description: []
slave: "S"
status: ""
type: "lte"
vrf: ""
- actual_mtu: "1450"
default_name: ""
description:
- "very very long"
- "multiline description"
dynamic: "D"
id: "7"
l2mtu: ""
Expand All @@ -124,14 +134,14 @@ parsed_sample:
max_l2mtu: ""
mtu: "1450"
name: "pptp-out1"
description:
- "very very long"
- "multiline description"
slave: "S"
status: "R"
type: "pptp-out"
vrf: ""
- actual_mtu: "1596"
default_name: ""
description:
- "Free Wi-Fi HTTPS"
dynamic: ""
id: "8"
l2mtu: ""
Expand All @@ -142,8 +152,7 @@ parsed_sample:
max_l2mtu: ""
mtu: "1596"
name: "pptp-to-AH1100-HS"
description:
- "Free Wi-Fi HTTPS"
slave: "S"
status: "R"
type: "pptp-out"
vrf: ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
Flags: D - dynamic; X - disabled, R - running; S - slave; P - passthrough
0 R ;;; Management Port - 4G OOB
name="ether1" default-name="ether1" type="ether" mtu=1500 actual-mtu=1500 l2mtu=1600 max-l2mtu=9586 mac-address=AA:BB:CC:11:22:33 ifname="eth0" ifindex=7 id=1 last-link-down-time=2024-10-08 11:14:27 last-link-up-time=2024-10-08 11:14:36 link-downs=166

1 R ;;; Uplink
name="sfp-sfpplus1" default-name="sfp-sfpplus1" type="ether" mtu=9216 actual-mtu=9216 l2mtu=9216 max-l2mtu=9578 mac-address=AA:BB:CC:11:22:33 ifname="eth1" ifindex=9 id=2 last-link-up-time=2024-07-23 10:13:23 link-downs=0

2 X ;;; Spare Optic
name="sfp-sfpplus2" default-name="sfp-sfpplus2" type="ether" mtu=9216 actual-mtu=9216 l2mtu=9216 max-l2mtu=9578 mac-address=AA:BB:CC:11:22:33 ifname="eth2" ifindex=10 id=3 link-downs=0

3 X name="sfp-sfpplus3" default-name="sfp-sfpplus3" type="ether" mtu=9216 actual-mtu=9216 l2mtu=9216 max-l2mtu=9578 mac-address=AA:BB:CC:11:22:33 ifname="eth3" ifindex=11 id=4 link-downs=0

4 X name="sfp-sfpplus4" default-name="sfp-sfpplus4" type="ether" mtu=9216 actual-mtu=9216 l2mtu=9216 max-l2mtu=9578 mac-address=AA:BB:CC:11:22:33 ifname="eth4" ifindex=12 id=5 link-downs=0

5 X name="sfp-sfpplus5" default-name="sfp-sfpplus5" type="ether" mtu=9216 actual-mtu=9216 l2mtu=9216 max-l2mtu=9578 mac-address=AA:BB:CC:11:22:33 ifname="eth5" ifindex=13 id=6 link-downs=0

6 X name="sfp-sfpplus6" default-name="sfp-sfpplus6" type="ether" mtu=9216 actual-mtu=9216 l2mtu=9216 max-l2mtu=9578 mac-address=AA:BB:CC:11:22:33 ifname="eth6" ifindex=14 id=7 link-downs=0

7 X name="sfp-sfpplus7" default-name="sfp-sfpplus7" type="ether" mtu=9216 actual-mtu=9216 l2mtu=9216 max-l2mtu=9578 mac-address=AA:BB:CC:11:22:33 ifname="eth7" ifindex=15 id=8 link-downs=0

8 X name="sfp-sfpplus8" default-name="sfp-sfpplus8" type="ether" mtu=9216 actual-mtu=9216 l2mtu=9216 max-l2mtu=9578 mac-address=AA:BB:CC:11:22:33 ifname="eth8" ifindex=16 id=9 link-downs=0

9 RS ;;; Link to
name="sfp-sfpplus9" default-name="sfp-sfpplus9" type="ether" mtu=9216 actual-mtu=9216 l2mtu=9216 max-l2mtu=9578 mac-address=AA:BB:CC:11:22:33 ifname="eth9" ifindex=17 id=10 last-link-down-time=2024-08-23 12:53:56 last-link-up-time=2024-08-23 12:53:56 link-downs=4

10 RS ;;; Link to
name="sfp-sfpplus10" default-name="sfp-sfpplus10" type="ether" mtu=9216 actual-mtu=9216 l2mtu=9216 max-l2mtu=9578 mac-address=AA:BB:CC:11:22:33 ifname="eth10" ifindex=18 id=11 last-link-down-time=2024-08-23 12:53:27 last-link-up-time=2024-08-23 12:53:55 link-downs=5

11 R ;;; Cust
name="sfp-sfpplus11" default-name="sfp-sfpplus11" type="ether" mtu=9216 actual-mtu=9216 l2mtu=9216 max-l2mtu=9578 mac-address=AA:BB:CC:11:22:33 ifname="eth11" ifindex=19 id=12 last-link-down-time=2024-08-29 20:57:53 last-link-up-time=2024-09-19 23:00:35 link-downs=1

12 X ;;; Cust
name="sfp-sfpplus12" default-name="sfp-sfpplus12" type="ether" mtu=9216 actual-mtu=9216 l2mtu=9216 max-l2mtu=9578 mac-address=AA:BB:CC:11:22:33 ifname="eth12" ifindex=20 id=13 link-downs=0

13 X name="sfp28-1" default-name="sfp28-1" type="ether" mtu=9216 actual-mtu=9216 l2mtu=9216 max-l2mtu=9578 mac-address=AA:BB:CC:11:22:33 ifname="eth13" ifindex=21 id=14 link-downs=0

14 X name="sfp28-2" default-name="sfp28-2" type="ether" mtu=9216 actual-mtu=9216 l2mtu=9216 max-l2mtu=9578 mac-address=AA:BB:CC:11:22:33 ifname="eth14" ifindex=22 id=15 link-downs=0

15 R ;;; Loopback
name="Lo0" type="bridge" mtu=auto actual-mtu=1500 l2mtu=65535 mac-address=AA:BB:CC:11:22:33 ifname="br0" ifindex=24 id=23 last-link-up-time=2024-07-23 10:13:19 link-downs=0

16 R ;;; INET Loopback
name="Lo1" type="bridge" mtu=auto actual-mtu=1500 l2mtu=65535 vrf=INET mac-address=AA:BB:CC:11:22:33 ifname="br1" ifindex=36 id=27 last-link-up-time=2024-07-23 10:19:01 link-downs=0

17 R ;;; Link to
name="bond1" type="bond" mtu=1500 actual-mtu=1500 l2mtu=9216 mac-address=AA:BB:CC:11:22:33 ifname="bond24" ifindex=23 id=24 last-link-down-time=2024-08-23 12:53:27 last-link-up-time=2024-08-23 12:53:55 link-downs=3

18 R name="pppoe-out1" type="pppoe-out" mtu=1400 actual-mtu=1400 ifname="ppp25889" ifindex=25948 id=20 last-link-down-time=2024-10-08 12:36:57 last-link-up-time=2024-10-08 12:39:16 link-downs=7208

19 R ;;; MGMT
name="vlan1@bond1" type="vlan" mtu=1574 actual-mtu=1574 l2mtu=9212 mac-address=AA:BB:CC:11:22:33 ifname="vlan25" ifindex=27 id=25 last-link-down-time=2024-08-23 12:53:27 last-link-up-time=2024-08-23 12:53:55 link-downs=3

20 R ;;; INET
name="vlan2@bond1" type="vlan" mtu=1574 actual-mtu=1574 l2mtu=9212 vrf=INET mac-address=AA:BB:CC:11:22:33 ifname="vlan26" ifindex=28 id=26 last-link-down-time=2024-08-23 12:53:27 last-link-up-time=2024-08-23 12:53:55 link-downs=3

21 R ;;; MGMT Uplink YDCE-M1
name="vlan10@vlan975@sfp-sfpplus1" type="vlan" mtu=1574 actual-mtu=1574 l2mtu=9208 mac-address=AA:BB:CC:11:22:33 ifname="vlan22" ifindex=33 id=22 last-link-up-time=2024-07-23 10:13:23 link-downs=0

22 R ;;; INET: IX
name="vlan11@vlan975@sfp-sfpplus1" type="vlan" mtu=1500 actual-mtu=1500 l2mtu=9208 vrf=INET mac-address=AA:BB:CC:11:22:33 ifname="vlan21" ifindex=31 id=21 last-link-up-time=2024-07-23 10:13:23 link-downs=0

23 R ;;; INET: IX
name="vlan12@vlan975@sfp-sfpplus1" type="vlan" mtu=1500 actual-mtu=1500 l2mtu=9208 vrf=INET mac-address=AA:BB:CC:11:22:33 ifname="vlan29" ifindex=38 id=29 last-link-up-time=2024-07-23 11:45:31 link-downs=0

24 R ;;; INET: IX
name="vlan111@sfp-sfpplus1" type="vlan" mtu=1500 actual-mtu=1500 l2mtu=9212 vrf=INET mac-address=AA:BB:CC:11:22:33 ifname="vlan18" ifindex=26 id=18 last-link-up-time=2024-07-23 10:13:23 link-downs=0

25 R ;;; Intercap
name="vlan975@sfp-sfpplus1" type="vlan" mtu=1500 actual-mtu=1500 l2mtu=9212 mac-address=AA:BB:CC:11:22:33 ifname="vlan16" ifindex=25 id=16 last-link-up-time=2024-07-23 10:13:23 link-downs=0

26 R name="vlan4050@sfp-sfpplus11" type="vlan" mtu=9212 actual-mtu=9212 l2mtu=9212 vrf=INET mac-address=AA:BB:CC:11:22:33 ifname="vlan30" ifindex=239 id=30 last-link-down-time=2024-08-29 20:57:53 last-link-up-time=2024-09-19 23:00:35 link-downs=1
Loading
Loading