Forum Discussion

speedbird_86757's avatar
speedbird_86757
Icon for Nimbostratus rankNimbostratus
Mar 20, 2014

APM VPE: Matching multiple values against a session variable

Within APM 11.4.0, I'm using an expression to check if the user's domain matches a value with the syntax:

 

expr { [string tolower [mcget {session.logon.last.domain}]] equals "domain.com" }

 

If I wanted to check against multiple values, is this the only correct expression:

 

expr { [string tolower [mcget {session.logon.last.domain}]] equals "domain.com" || [string tolower [mcget {session.logon.last.domain}]] equals "domain.corp"}

 

Is there a 'simpler' way to represent this? For example:

 

expr { [string tolower [mcget {session.logon.last.domain}]] equals "domain.com" or “domain.corp” }

 

I've tried multiple combinations, but it always results in a parsing error.

 

Thanks!

 

3 Replies

  • wonsoo_41223's avatar
    wonsoo_41223
    Historic F5 Account

    It is possible to use set command, and it can reduce long iterating command.

     

    set d [string tolower [mcget {session.logon.last.domain}]]

     

    expr { $d eq "domain1.com" || $d eq "domain2.com" || $d eq "domain3.com"}

     

  • Hi wonsoo,

     

    Thanks for the reply, but it does not seem to work.

     

    This works fine:

     

    set d [string tolower [mcget {session.logon.last.domain}]] expr {$d eq "domain1.com"}

     

    But, if I try with:

     

    set d [string tolower [mcget {session.logon.last.domain}]] expr {$d eq "domain1.com" || $d eq "domain2.com"}

     

    The APM does not match the logon attempt with either domain1.com or domain2.com

     

    Thanks!

     

  • Came across this thread rather late but I hope I can be forgiven as I am still very new to the f5. This snippet worked for me on 12.1.2 when used in a VPE branch rule:

    set d [string tolower [mcget {session.logon.last.domain}]]

    expr {($d eq "domain1") or ($d eq "domain2")}

    Maybe each

    $d eq "text"
    needs to have it's own brackets.