Forum Discussion
L4L7_53191
Oct 09, 2011Nimbostratus
Feedback request: pyControl v11 session support
Hi everyone: if you use pycontrol, I'd like your feedback on how you'd like session support implemented. As of right now I'm thinking about keeping it as simple as possible and exposing the internals so you can modify things if you want.
For example, it seems sensible to add a keyword arg to the BIGIP class constructor so you can do something like: sessions=True, which will send the pycontrol BIGIP class into "v11 mode" and fetch the session ID for you and stuff it into the request headers automatically for you on subsequent calls.
Questions:
1) Would this work for you? If not, is there a better alternative that I am missing?
2) How should I handle situations where you load multiple WSDLs into the pycontrol BIGIP class? I ask because each actual client object is unique per WSDL, so theoretically you could have a unique session ID for each.
For now, I'm thinking of simply setting that header to the same session_id for each client object. As usual, I'll expose a way to override it via suds.set_options() or a similar helper function. Would that be OK for you?
Thanks in advance, and thanks for using pycontrol!
-- Matt Cauthorn
- George_Watkins_Historic F5 AccountHi Matt,
- L4L7_53191NimbostratusHad a chat with Joe and Jason about it today, and I think I've got my head around the initial implementation, barring any other suggestions here. I've got the multi-wsdl bit figured out, so I'm going to go with a constructor argument and handle the basics for the user (i.e. getting a session and passing that value in a custom header for subsequent calls).
- George_Watkins_Historic F5 AccountNice. I'll work on getting something similar in the Ruby library.
- mhite_60883CirrocumulusHey L4L7,
- L4L7_53191NimbostratusI forgot to point out that it'll work today, but just with extra steps if you want to use the session magic. I'm working it out now, and I think the code is pretty well done but I need to do some testing and then I'll release it to my old pycontrol bud Jason to test out with me :)
- mhite_60883CirrocumulusI'm a little unclear: are you saying we can utilize V11 API with Pycontrol v2?
- L4L7_53191NimbostratusAbsolutely. There's nothing really special here; if you want to utilize sessions just load that wsdl, then set the X-iControl-Session header to the session value you get back and pass it into the client object's headers via suds.set_options(headers={'X-iControl-Session': 1234321}) for example.
- L4L7_53191NimbostratusI wrapped it up and did some testing last night; it seems to be working. I've sent it over to Jason, who'll do some testing as well. Mhite if you're interested in helping to test let me know and we'll sync up offline.
- mhite_60883CirrocumulusSorry if this is a dumb question, but if I am using the API in the following manner:
- mhite_60883CirrocumulusOk, just some poking around... but does this look like I'm on the right track? Every item I have in wsdl_list has a separate suds client setup for it, correct? (Sorry, I know very little about the suds library). So I need to apply the set_options to each one of those clients, ie.
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