Forum Discussion
JRahm
Feb 10, 2012Admin
your code appears to work for me, however, the monitor state and the session state need to be disabled. Also, this interface is deprecated, so if you are on v11+, please use the NodeAddressV2 interface instead.
>>> na = b.LocalLB.NodeAddress
>>> def enable_node():
... enable_disable_node('STATE_ENABLED')
...
>>> def disable_node():
... enable_disable_node('STATE_DISABLED')
...
>>> def enable_disable_node(target_state):
... nodes = ['10.10.10.10']
... states = []
... states.append(target_state)
... na.set_session_enabled_state(nodes=nodes, states = states)
...
>>>
>>> def enable_disable_node(target_state):
... nodes = ['10.10.10.10']
... states = []
... states.append(target_state)
... na.set_session_enabled_state(node_addresses = nodes, states = states)
... na.set_monitor_state(node_addresses = nodes, states = states)
...
>>> enable_node()
>>> na.get_monitor_status(node_addresses = ['10.10.10.10'])
[MONITOR_STATUS_UNCHECKED]
>>> na.get_session_status(node_addresses = ['10.10.10.10'])
[SESSION_STATUS_ENABLED]
>>> disable_node()
>>> na.get_monitor_status(node_addresses = ['10.10.10.10'])
[MONITOR_STATUS_FORCED_DOWN]
>>> na.get_session_status(node_addresses = ['10.10.10.10'])
[SESSION_STATUS_FORCED_DISABLED]