Forum Discussion
msaunders
Nov 08, 2018Nimbostratus
I got errors from all of the above methods. This works for me.
import requests
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
WhichLTM = '192.168.1.100'
LTMUser = 'admin'
LTMPass = 'admin'
PoolName = 'test.domain.com_pool'
NodePort = '1.2.3.4:80'
Partition = 'Common'
def DisablePoolMember(WhichLTM, LTMUser, LTMPass, PoolName, Partition, NodePort):
headers = {'Content-Type': 'application/json',}
data = '{"session":"user-disabled"}'
response = requests.put('https://' + WhichLTM + '/mgmt/tm/ltm/pool/' + PoolName + '/members/~' + Partition + '~' + NodePort, headers=headers, data=data, verify=False, auth=(LTMUser, LTMPass))
def EnablePoolMember(WhichLTM, LTMUser, LTMPass, PoolName, Partition, NodePort):
headers = {'Content-Type': 'application/json',}
data = '{"session":"user-enabled"}'
response = requests.put('https://' + WhichLTM + '/mgmt/tm/ltm/pool/' + PoolName + '/members/~' + Partition + '~' + NodePort, headers=headers, data=data, verify=False, auth=(LTMUser, LTMPass))
DisablePoolMember(WhichLTM, LTMUser, LTMPass, PoolName, Partition, NodePort)