Forum Discussion

Steve_Howard_14's avatar
Steve_Howard_14
Icon for Nimbostratus rankNimbostratus
May 12, 2014

How to disable a GTM pool member

Hi,

We are struggling with the bigsuds syntax to disable a pool member. Example below...

>>> from bigsuds import *
>>> b = BIGIP(hostname = '1.2.3.4', username = 'foo', password = 'bar')
>>> pool = b.GlobalLB.Pool
>>> pool.get_list()
['/Common/test-pool']
>>> members = pool.get_member(pool.get_list())
>>> print members
[[{'member': {'port': 80, 'address': '172.27.128.110'}, 'order': 1}, {'member': {'port': 80, 'address': '172.24.2.20'}, 'order': 0}]]
>>> pool.set_enabled_state(['/Common/columbus-ecomm-pool'],  [[{'address': '172.28.2.20', 'port': 80}]])
Traceback (most recent call last):
  File "", line 1, in 
  File "build\bdist.win-amd64\egg\bigsuds.py", line 412, in wrapped_method
  File "build\bdist.win-amd64\egg\bigsuds.py", line 472, in process
  File "build\bdist.win-amd64\egg\bigsuds.py", line 478, in _process_args
  File "build\bdist.win-amd64\egg\bigsuds.py", line 540, in _process_arg
  File "build\bdist.win-amd64\egg\bigsuds.py", line 559, in _process_arg
bigsuds.ArgumentError: "[{'port': 80, 'address': '172.28.2.20'}]" is not a valid value for Common.EnabledState, expecting: STATE_DISABLED, STATE_ENABLED

We can't find anything in the API reference for this. It indicates GlobalLB.PoolMember is deprecated, but we can't find any overloaded method to disable a member in a GTM pool.

Are we missing something basic?

2 Replies

  • Brent_West_7733's avatar
    Brent_West_7733
    Historic F5 Account

    Try "getting" before "setting" in order to see the dictionary format? I normally develop in PHP, and in those cases the arrays (dictionaries) need to be identically formatted.

     

  • Thanks, Brent, we finally got it.

     

    >>> b.GlobalLB.PoolMember.get_enabled_state(['/Common/columbus-ecomm-pool'], [[{'address': '172.27.128.110', 'port': 80}]])
    [[{'member': {'port': 80, 'address': '172.27.128.110'}, 'state': 'STATE_DISABLED'}]]
    >>> b.GlobalLB.PoolMember.set_enabled_state(['/Common/columbus-ecomm-pool'], [[{'member': {'port': 80, 'address': '172.27.128.110'}, 'state': 'STATE_ENABLED'}]])
    >>> b.GlobalLB.PoolMember.get_enabled_state(['/Common/columbus-ecomm-pool'], [[{'address': '172.27.128.110', 'port': 80}]])
    [[{'member': {'port': 80, 'address': '172.27.128.110'}, 'state': 'STATE_ENABLED'}]]
    >>>

    Hopefully this helps someone else. Can we add these as code samples in the API reference?

     

    Thanks,

     

    Steve