Forum Discussion
Radim_Bosticka_
Nimbostratus
Jan 23, 2009Server disabling structure
Hi,
I have problems to use function set_session_enabled_state from PoolMember class.
Everywhere is description some object structure as described:
http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=254
Object is called LocalLBPoolMemberMemberMonitorState. After creating of it in description is information about creating of subobject called CommonIPPortDefinition.
Everything is in Java. Problem is, that creating of second object is not working for me and by mistake I guess it is problem in Jython itself. Is there some command which could return whole one object with subobjects? Then problem I guess is in code name "member" which does problem to Jython.
I have tried to create array like this:
oServer = [['10.192.2.196','80'],'STATE_DISABLED=0'];
Sadly got information that is not possible to convert it:
TypeError: set_session_enabled_state(): 2nd arg can't be coerced to iControl.LocalLBPoolMemberMemberSessionState[][]
Is possible to create some array instead of object which could be passed to function without problem?
Thanks
- The java proxies cannot dynamically convert string arrays into native iControl types. You need to create an array of LocalLBPoolMemberMemberSessionState objects, allocate those objects, fill those objects up with their data and pass those along to the method call.
public void setPoolMemberSessionState( String poolname, String memberaddr, long memberport, String state) throws Exception { String [] pool_list = new String [] { poolname }; iControl.LocalLBPoolMemberMemberSessionState [][] statesAofA = new iControl.LocalLBPoolMemberMemberSessionState[ 1 ][]; statesAofA[ 0 ] = new iControl.LocalLBPoolMemberMemberSessionState[1]; statesAofA[ 0 ][ 0 ] = new iControl.LocalLBPoolMemberMemberSessionState(); statesAofA[ 0 ][ 0 ].setMember(new iControl.CommonIPPortDefinition()); statesAofA[ 0 ][ 0 ].getMember().setAddress(memberaddr); statesAofA[ 0 ][ 0 ].getMember().setPort(memberport); if ( state.equals("enable") ) { statesAofA[ 0 ][ 0 ].setSession_state(iControl.CommonEnabledState.STATE_ENABLED); } else { statesAofA[ 0 ][ 0 ].setSession_state(iControl.CommonEnabledState.STATE_DISABLED); } m_interfaces.getLocalLBPoolMember().set_session_enabled_state(pool_list, statesAofA); }
- I understand your pain. In 4.x, we had a flat API structure but it provide completely unusable for large configurations - modifying 100's of objects, required 100's of calls. In v9.x, we opted to make the syntax more expandable by enabling bulk objects for all our methods. This dramatically improved performance for multi-step operations with the consolation that it made the API a bit more complex for those that just want to do a single task.
- Have you looked at the pyControl Python library for iControl? There might be something in there that points you in the right direction. Select pyControl from the Labs menu here on DevCentral for the project homepage.
- Also, look in the iControl CodeShare wiki for pyControl samples that may help you with the array creation problems.
http://devcentral.f5.com/Wiki/default.aspx/iControl/CodeShare.html
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