Script to find untagged Vlan and what port it's on.

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered
  • (Edited)
Hi peeps

 I was given this script by the kind guys at Extreme, but i now want to modify it to find untagged Vlans and which port they are on so i can feed it into a limit-learning command.

My scripting knowledge is very basic so was wondering if there is any scripty guys out there that could give me a few pointers.

#This script updates the interval on eljrp-client sessions
# set the variable below
#This only works on EXOS 16.1 forward
set var int 3
disable clip
show elrp
set var CLI.OUT 0
show elrp 
set var s $TCL(split ${CLI.OUT} "\n")
set var i $TCL(lsearch $s *----*)
set var i ($i + 1)
set var e $TCL(lsearch $s *Print\,*)
set var e ($e - 1)
while ($i < $e) do
   set var l $TCL(lindex $s $i)
   set var v $TCL(lindex $l 1)
   set var p $TCL(lindex $l 2)
   set var n $TCL(lindex $l 3)
   set var a $TCL(lindex $l 8)
   set var d $TCL(lindex $l 9)
   set var t $TCL(regexp {\-} $d)
   set var t1 $TCL(regexp {L} $a)
   set var t2 $TCL(regexp {T} $a)
   set var t3 $TCL(regexp {E} $a)
   set var t4 $TCL(regexp {I} $a)
   set var t5 $TCL(expr $t1 && $t2)
   set var lt "log"
   set var ie ''
   if ($t2) then
      set var lt "trap"
   if ($t5) then
      set var lt "log-and-trap"
   if ($t3) then
      set var ie "egress"
   if ($t4) then
      set var ie "ingress"
   set var recmd $TCL(concat "config elrp-client periodic" $v "ports" $p "interval" $int $lt)
   if (!$t) then
      set var recmd $TCL(concat $recmd "disable-port" $ie)
      set var t $TCL(regexp {\d+} $d)
      if ($t) then
         set var d $TCL(concat "duration" $d)
      set var recmd $TCL(concat $recmd $d)
   unconfig elrp $v
   set var i ($i + 1)

Any pointers would be gratelly appreciated.
Photo of Justsomebodi


  • 1,572 Points 1k badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of Joseph Burnsworth

Joseph Burnsworth

  • 2,328 Points 2k badge 2x thumb
I know in 16.x i use grep to find what I need on most things

show config vlan | grep <vlan id>

Doing the above command will show you the VLAN you are looking for and will also show you them both tagged and untagged