Skip to content

Commit

Permalink
Gather vlan names from /interface vlan (#524)
Browse files Browse the repository at this point in the history
thanks!
  • Loading branch information
Tr4sK authored Oct 1, 2024
1 parent b979527 commit 5b59645
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions snmp/Routeros/LNMS_vlans.scr
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@
:foreach i in [/interface bridge vlan find] do={
:local intf [/interface bridge vlan get $i bridge]
:local vlid [/interface bridge vlan get $i vlan-ids]
:local vname

:foreach i in [/interface vlan find where vlan-id=$vlid] do={
:local intname [/interface vlan get $i name]
:set $vname ($intname)
}

:foreach t in [/interface bridge vlan get $i tagged] do={
:set $vlanst ($vlanst, "$vlid,$t")
:set $vlanst ($vlanst, "$vlid,$t,$vname")
}

:foreach u in [/interface bridge vlan get $i current-untagged] do={
:set $vlansu ($vlansu, "$vlid,$u")
:set $vlansu ($vlansu, "$vlid,$u,$vname")
}

:foreach u in [/interface bridge port find where bridge=$intf and pvid=$vlid] do={
Expand All @@ -28,14 +34,15 @@
}
}
:if ( $fl != 1 ) do={
:set $vlansu ($vlansu, "$vlid,$iu")
:set $vlansu ($vlansu, "$vlid,$iu,$vname")
}
}
}

:foreach vl in [/interface vlan find ] do={
:local intf [/interface vlan get $vl interface]
:local vlid [/interface vlan get $vl vlan-id]
:local vname [/interface vlan get $vl name]
:local fl 0

:foreach tmp in $vlanst do={
Expand All @@ -45,7 +52,7 @@
}
}
:if ( $fl != 1 ) do={
:set $vlanst ($vlanst, "$vlid,$intf")
:set $vlanst ($vlanst, "$vlid,$intf,$vname")
}
}

Expand Down

0 comments on commit 5b59645

Please sign in to comment.