Forum Discussion
d_y_gobel_11576
Nimbostratus
Apr 10, 2013APM - Visual policy - Combining session variables in one Branche
I try to understand if the following is possible APM > Visual Policy > Branche > in there in want to achieve to following:
The following two strings (bogus values) belongs to one De...
Kevin_Stewart
Employee
Apr 10, 2013Suppose you have a data group with a set of concatenated MAC-UUID pairs:
ltm-data-group internal /Common/macuuid-list-datagroup {
records {
00:11:22:33:44:55-1234567890123456789012345678901234567890
00:11:22:33:44:56-1234567890123456789012345678901234567891
00:11:22:33:44:57-1234567890123456789012345678901234567892
}
}
Then create an iRule event agent in your policy and give it a unique ID (example: CLIENTINFO)
Your iRule would then look something like this:
when ACCESS_POLICY_AGENT_EVENT {
switch [ACCESS::policy agent_id] {
"CLIENTINFO" {
set clientinfo "[ACCESS::session data get session.client.mac_address]-[ACCESS::session data get session.client.unique_id]"
if { [class match $clientinfo equals macuuid-list-datagroup] } {
ACCESS::session data set session.custom.clientfound 1
}
}
}
}
So you trigger the iRule event based on the event ID, concatenate the MAC and UUID values into a single string, then look that string up in the data group using the class match command. If the key exists, create a new session value (ex. session.custom.clientfound) and set it to 1 (or any value). Then in your visual policy after the iRule event, create an empty agent and create a branch rule that evaluates the custom variable:
expr { [mcget session.custom.clientfound] }. If it's true (exists), then take one branch, otherwise take another. This way you can maintain your client list in a MUCH easier format that doesn't require re-applying the policy every time you make a change.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects