cancel
Showing results for 
Search instead for 
Did you mean: 

Using EDP output in scripting

Using EDP output in scripting

Davor
New Contributor
I would like to use sh edp ports all in script to indentify trunk ports.
Created script, loaded it and got error in that line. Is there some limitation to this?

"
...

set var CLI.OUT " "
show edp ports all
set var inputA $TCL(list ${CLI.OUT})
set var listA $TCL(split $inputA "\n")
set var countA $TCL(llength $listA)

....

"

BR
Davor
18 REPLIES 18

Gaspard_W
New Contributor
With your script and after some investigation, I did

enable cli scripting
set var CLI.OUT 0
set var PORT 22 ( that's for testing)
show edp ports $PORT | i $PORT
set var gigi $TCL(lrange ${CLI.OUT} 7 7)
show edp ports $PORT | i $PORT
set var gigi2 $TCL(lrange ${CLI.OUT} 0 0)

if ($gigi == $PORT || $gigi2 == $PORT) then (Depends on CLI or netsight application)
create log message "IF statement"
Else
create log message "ELSE statement"
endif

Thanks 🙂

Kevin_Kim
Extreme Employee
This is simply to check if any edp neighbor exists.

set var cli.out 0
show edp ports all | in "^[0-9]+"
set var t $tcl(split ${cli.out} "\n")
set var n $tcl(llength $t)

if ($n > 1) then
.....
else
.....
endif

Gaspard_W
New Contributor
Hello,

I've been reading all the posts and I'm still confused.

What is the simplest way to basically get the output of the show edp

My case is :
- Check if there is a switch connected on that port
- if there is, execute the if part, otherwise execute the else part.

If you can help me quickly, that'd be great

thanks

Davor
New Contributor
Hello,

I have tested script but it does not work.

I nested piece of scrip in right position?

***************

disable clipset var cli.out 0
show port no
set var s $TCL(split ${cli.out} "\n")
set var i 4
set var e $TCL(lsearch $s *D-Disabled*)
set var e ($e - 1)
while ($i < $e) do
set var l $TCL(lindex $s $i)
set var p $TCL(lindex $l 0)
set var cli.out 0
show edp port $p
set var se $TCL(split ${cli.out} "\n")
set var le $TCL(llength $se)
if ($le < 7) then
disable edp port $p
endif
set var cli.out 0
show port $p info detail
set var sp $TCL(split ${cli.out} "\n")
set var l $TCL(lsearch $sp *Trunking:*)
set var ln $TCL(lindex $sp $l)
set var t $TCL(regexp {Master} $ln)
if ($t == 1) then
config trusted-port $p trust-for dhcp-server
set var iv $TCL(lsearch $sp *VLAN\ cfg:*)
set var iv ($iv + 1)
set var ev $TCL(lsearch $sp *STP\ cfg:*)
set var ev ($ev - 1)
while ($iv < $ev) do
set var l $TCL(lindex $sp $iv)
set var v $TCL(lindex $l 1)
set var v $TCL(string map {, ""} $v)
enable ip-security dhcp-snooping vlan $v port $p violation-action none
set var iv ($iv + 2)
endwhile
else
set var t $TCL(regexp {Cfg} $l)
if ($t != 1) then
set var iv $TCL(lsearch $sp *VLAN\ cfg:*)
set var iv ($iv + 1)
set var ev $TCL(lsearch $sp *STP\ cfg:*)
set var ev ($ev - 1)
while ($iv <$ev) do
set var l $TCL(lindex $sp $iv)
set var v $TCL(lindex $l 1)
set var v $TCL(string map {, ""} $v)
enable ip-security dhcp-snooping vlan $v port $p violation-action drop-packet block-mac permane
set var iv ($iv + 2)
endwhile
endif
endif
set var i ($i + 1)
endwhile
delete var cli.out
delete var s
delete var i
delete var e
delete var l
delete var p
delete var se
delete var le
delete var sp
delete var ln
delete var t
delete var iv
delete var ev
delete var v
disable clip

****************

I have on my LINK / TRUNK ports one untag network (Vlan Default) that i use as my control/admin vlan for accesing switches. Script is adding "drop-packet block-mac permane" to that vlan and it should not.
Script should detect Trunk ports and all vlan that are defined on that port should have "enable ip-security dhcp-snooping vlaxxx port xx violation-action none". Also on that port i would like to have port description "Trunk-(remote sw name)", so i can use that later on for grouping in RIdgeline"

BR
Davor

PS

Thanks for your help..

GTM-P2G8KFN