Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for virtual #68

Open
freedge opened this issue Jul 18, 2021 · 2 comments
Open

Support for virtual #68

freedge opened this issue Jul 18, 2021 · 2 comments

Comments

@freedge
Copy link

freedge commented Jul 18, 2021

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!

@landro
Copy link
Owner

landro commented Jul 18, 2021 via email

@freedge
Copy link
Author

freedge commented Jul 18, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants