Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

BIG-IP APM Variables

Hi,

From the following iRule:

when ACCESS_POLICY_AGENT_EVENT {
    set m1 [ACCESS::session data get "session.machine_info.last.net_adapter.list.\[0\].mac_address"]
    set m2 [ACCESS::session data get "session.machine_info.last.net_adapter.list.\[1\].mac_address"]
    set c class
    set m match
    set a ACCESS::session
    set d data
    set t set
    set s "session.logon.cstm.chk"
if {[$c $m $m1 eq DG1]||[$c $m $m2 eq DG1]} { $a $d $t $s 1 }
elseif {[$c $m $m1 eq DG2]||[$c $m $m2 eq DG2]} {$a $d $t $s 1}
else {$a $d $t $s 1}
}

How can I concat/merge the $c and $m variables into one?

How could concat/merge the variables $a, $d, $t and $s into one?

My goal is to get as few characters as possible.

Thanks!

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hi,

Why do you want to create these variables?

You can try this code

when ACCESS_POLICY_AGENT_EVENT {
    set m1 [ACCESS::session data get "session.machine_info.last.net_adapter.list.\[0\].mac_address"]
    set m2 [ACCESS::session data get "session.machine_info.last.net_adapter.list.\[1\].mac_address"]
    Set cstm_chk [expr {[class match $m1 eq DG1]||[class match $m2 eq DG1]||[class match $m1 eq DG2]||[class match $m2 eq DG2]}]
    ACCESS::session data set session.logon.cstm.chk $cstm_chk        
    unset cstm_chk m1 m2
}
0
Comments on this Answer
Comment made 03-Jul-2017 by Pedro Haoa

Hi,

I'm looking to reduce the amount of data (characters) that I need to put in an iRule that maps a very long data group list. If I use the get command(m1 variable), I can put all the data in one local variable. But when i try to use the "set" command I get a formatting command error. So in the meantime, I splitted the command in multiple variables to accomplish my goal which is reduce the amount of characters that i need to use (It's beyond the 65520 limit so i used 2 rules).

0
Comment made 03-Jul-2017 by Stanislas Piron 10641

If you want to evaluate a command stored in a variable, you can use eval

set command "ACCESS::session data set session.logon.cstm.chk"    
eval $command 1
0
Comment made 04-Jul-2017 by Stanislas Piron 10641
0
Comment made 07-Jul-2017 by Pedro Haoa

Hi Stanislas,

Yes, the resultant rule exceed that limit and the DG list has almost 1000 groups (Not my idea). In order to reduce the data in the iRule because of this limit, I splitted the rule in 3 pieces and then using variables I reduced that number to 2 rules. After compare performance in both scenaries, the second one won the contest.

0
Comment made 08-Jul-2017 by Stanislas Piron 10641

Hi,

I think you can optimize the code of your irule instead of trying to reduce some characters by creating variable of commands.

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hi Stanislas,

For some reason, I couldn't see your reply post. Can you send it again?

0