Use Case: Using Regular Expression to Allocate License Counts
Requirement: Allow clients that match a specific hosttype pattern access to a specified named license pool. Allow clients from business units whose name matches a specific pattern access to two specified named license pools.
As before, this scenario features two business units called Sales and Engineering, which have been defined by entries in the vendor dictionary. Using a regular expression in each condition means that the rule can be simplified—instead of creating a separate condition for every valid hostname or vendor dictionary string, a regular expression defines the pattern that a hostname and string must match to gain access to feature counts.
Model Definition Example
model "exampleModel" {
partitions {
partition "engineering" {
"f1" 1.0 50%
}
partition "sales" {
"f1" 1.0 50%
}
on hostname("~/[A-Z]{2}[0-9]{3}/") {
use "engineering"
accept
}
on dictionary("business-unit":"~/Eng[0-9]+/") {
use "engineering", "sales"
accept
}
on any() {
deny
}
Interpreting the Regular Expression
• | Requests from clients with a hostname matching the following pattern get access to the engineering license pool: |
[A-Z] any uppercase letter
{2} matched exactly twice
[0-9] any number
{3} matched exactly three times
Examples for valid hostnames: AB123, CD789
• | Requests from the engineering business unit (as defined in the vendor dictionary) matching the following pattern get access to the engineering and sales license pools: |
Eng must start with “Eng” (matching capitalization)
[0-9] followed by any number
Examples for valid vendor dictionary entries: Eng123, Eng456789