Forum Discussion
mihaic
Jan 27, 2015MVP
Http class to irule conversion?
Does anyone know how to convert a http class to an irule.
Starting with version 11.4 it seems http classes do not exist anymore.
I need to convert a lot of http classes to an irule for a new device w...
Jan 27, 2015
Hi mihaic,
just copy all classes (section from previous /config/bigip.conf) into a single file on your /shared directory and name it i.e. ./classes, please:cat ./classes | tr -d "\r\n" | sed -r "s/(\})/\1\n/g" | \
sed -r -e 's/^[[:blank:]]+//g' -e 's/\}$/ }/g' | tr -s '[[:blank:]]' | \
sed -r 's/^profile httpclass ([^ ]+) \{ defaults from httpclass pool ([^ ]+) paths regex ([^ ]+) \}/ltm rule rule_\1 {\n if { [string tolower [HTTP::uri]] starts_with \3 } {\n pool \2\n }\n}\n/g'
The one-liner above should convert the existing classes into iRules.
Instead of putting the classes into file and to "cat" you can try as well a tmsh command to list all classes:tmsh list ltm httpclass | tr -d "\r\n" | sed -r "s/(\})/\1\n/g" | \
sed -r -e 's/^[[:blank:]]+//g' -e 's/\}$/ }/g' | tr -s '[[:blank:]]' | \
sed -r 's/^profile httpclass ([^ ]+) \{ defaults from httpclass pool ([^ ]+) paths regex ([^ ]+) \}/ltm rule rule_\1 {\n if { [string tolower [HTTP::uri]] starts_with \3 } {\n pool \2\n }\n}\n/g'
Output can be merged into running configuration.
Thanks, StephanRecent 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