Header Only - DO NOT REMOVE - Extreme Networks

Script UPM to trigger ports

  • 16 August 2019
  • 3 replies

Scenario is:
if all port A,B,C, are UP than enable port D

If one of port A,B,C are Down do anything

create upm profile MnLinkUp
enable cli scripting
enable port 1:15

create log filter MnLinkUp
configure log filter MnLinkUp add events vlan.msgs.PortLinkStateUp
configure log filter MnLinkUp add events vlan.msgs.PortLinkState
create log target upm MnLinkUp
enable log target upm MnLinkUp
configure log target upm MnLinkUp filter MnLinkup severity info

scritp run with out error, but never enable port 1:15

3 replies

Userlevel 3

It seems you used && believing it was a logical OR, but it means logical AND. Change this to ||, which is logical OR. You can try it like this first (unless you already have):

create upm profile MnLinkUp
enable cli scripting
IF (!$MATCH($http://EVENT.LOG_COMPONENT_SUBCOMPONENT,http://vlan.msgs) && !$MATCH($http://EVENT.LOG_EVENT,portLinkStateUp)) THEN
IF (!$MATCH($http://EVENT.LOG_PARAM_0,1:9)) THEN
enable port 1:15

If downing port 1:9 brings up 1:15, the script works on a basic level. From there, you can add more ports and see if the script still works.

I saw the IF was incorrectly formatted with the ending parenthesis (violation ")" highlighted with space):

IF (!$MATCH($http://EVENT.LOG_PARAM_0,1:9) ) && !$MATCH($http://EVENT.LOG_PARAM_0,2:9) && !$MATCH($http://EVENT.LOG_PARAM_0,2:10) THEN

change to:

IF (!$MATCH($http://EVENT.LOG_PARAM_0,1:9) && !$MATCH($http://EVENT.LOG_PARAM_0,2:9) && !$MATCH($http://EVENT.LOG_PARAM_0,2:10)) THEN

You need to move one parenthesis from (!$MATCH($http://EVENT.LOG_PARAM_0,1:9)) to just before THEN.

Hi Fred! thanks a lot..
I recieved the following details when Upm profile was running....
Really I need to make the condition: if port 1:9 and 2:9 and 2:10 status are UP then enable port 1:15 if no don't do anything.
OR condition already done by another UPM profile (MnLinkDn) without script, I mean it is enough filter just the 3 ports and when upm profile will run just read "disable port 1:15" into the script..Easy... Problem still in AND condition!!!!!!

Really what I don't understand where take the other 2 ports status. I mean in the UPM's log target I can find the setted var just related to the event begin the UPM profile (point 2--> 15 below) but in the script I need to put a "path" for port 2:9 and 2:10

UPM Profile: MnLinkUp
Event: Log-Message(MnLinkUp)
Profile Execution start time: 2019-08-17 04:28:58
Profile Execution Finish time: 2019-08-17 04:28:59
Execution Identifier: 1385 Execution Status: Fail

Execution Information:
2 # enable cli scripting
3 # configure cli mode non-persistent
5 # set var EVENT.LOG_FILTER_NAME "MnLinkUp"
6 # set var EVENT.LOG_DATE "08/17/2019"
7 # set var EVENT.LOG_TIME "04:28:58.96"
9 # set var EVENT.LOG_EVENT "portLinkStateUp"
10 # set var EVENT.LOG_SEVERITY "Info"
11 # set var EVENT.LOG_MESSAGE "Port %0% link UP at speed %1% and %2%"
12 # set var EVENT.LOG_PARAM_0 "1:9"
13 # set var EVENT.LOG_PARAM_1 "1 Gbps"
14 # set var EVENT.LOG_PARAM_2 "full-duplex"
15 # set var EVENT.PROFILE MnLinkUp
16 # enable cli scripting
17 # IF (!$MATCH($http://EVENT.LOG_COMPONENT_SUBCOMPONENT,http://vlan.msgs) && !$MATCH($http://EVENT.LOG_EVENT,portLinkStateUp)) THEN
Error: Match syntax
18 # IF (!$MATCH($http://EVENT.LOG_PARAM_0,1:9)) THEN
$http://EVENT.LOG_PARAM_0 not found
Error: Match syntax
19 # enable port 1:15
20 # ENDIF
Error: Mismatched ENDIF
21 # ENDIF
Error: Mismatched ENDIF
22 # ENDIF
Error: Mismatched ENDIF
Userlevel 3

I'm not sure about the syntax in the UPM scripting. Perhaps you cannot use && for and, so try this:

if [something] then
if [something else] then
bla bla

This will be equal to AND-ing all the port statuses.

Another thought: If you only apply a script to the ports you want to monitor, you only need to check the status of the three ports. If the condition is met, you enable or disable the fourth port.

configure cli mode scripting abort-on-error
set var CLI.OUT 0
# Execute the command
show ports 1:9,2:9,2:10 information | include ready
# Read the CLI text output from the command
set var input $TCL(split ${CLI.OUT} "\n")
# Search for the text ready within the CLI output
set var ready $TCL(lsearch -glob $input "*ready*")
# If no ports (of 1:9, 2:9, and 2:10) are in state ready, disable port 1:15
if ($ready == -1) then
disable port 1:15
enable port 1:15

Not tested, but try it out if you like!