TesTcl
TesTcl copied to clipboard
Support for virtual
As documented here:
https://clouddocs.f5.com/api/irules/virtual.html
Currently I am using
on virtual name return foo
on virtual foo return ""
But then I cannot check that the virtual server is set properly. Ideally I would like to do something like
verify "Final virtual is the expected one after a match" "foo" eq { endstate_virtual }
(if it was possible to verify the value of a variable it would be great too) Thanks for the great tool!
Do you have a simple irule that illustrates how it is typically used?
- jul. 2021 kl. 08:48 skrev frigo @.***>:
As documented here:
https://clouddocs.f5.com/api/irules/virtual.html
Currently I am using
on virtual name return foo on virtual foo return "" But then I cannot check that the virtual server is set properly. Ideally I would like to do something like
verify "Final virtual is the expected one after a match" "foo" eq { endstate_virtual } (if it was possible to verify the value of a variable it would be great too) Thanks for the great tool!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
on the rules I am working with, the virtual name is used to deduce the partition of the server (it's also a suggestion from https://devcentral.f5.com/s/question/0D51T00006j36DJ/irule-access-to-partition-name) the virtual remoteserver is used to send traffic to a remote location.
Some variable is also shared between CLIENT_ACCEPTED and HTTP_REQUEST. While I know how to inject variables, I don't know how to validate the curpartition variable content in the example below:
when CLIENT_ACCEPTED priority 500 {
set curpartition [lindex [split [virtual name] /] 1]
}
when HTTP_REQUEST priority 500 {
HTTP::header insert X-Test-Partition $curpartition
if { [HTTP::uri] contains "foobar" } {
virtual myremoteserver
HTTP::header insert X-Test-Request [virtual name]
} else {
HTTP::header insert X-Test-Request local
}
}
EDIT btw the value of virtual name
is identical before and after the call to virtual myremoteserver