Sinan
Feb 25, 2020Ret. Employee
f5 sdk can't load pool objects after create pool.
Hi experts:
I can't load a pool object after I created it.
from f5.bigip import ManagementRoot
from f5.bigip.contexts import TransactionContextManager
if __name__ == "__main__":
for x in range(1, 50):
mgmt = ManagementRoot('10.5.10.23', 'admin', 'XXXXX', token=True)
tx = mgmt.tm.transactions.transaction
with TransactionContextManager(tx) as api:
name = 'pool' + str(x)
api.tm.ltm.pools.pool.create(name=name, partition='Common')
p = api.tm.ltm.pools.pool.load(name=name, partition='Common')
p.delete()
api.tm.util.bash.exec_cmd(
command='run',
utilCmdArgs="-c 'tmsh save sys config'"
)
I got this error:
Traceback (most recent call last):
File "/Users/sinwang/PycharmProjects/Suzhou_Beer_CMCC/f5_sdk_transaction.py", line 31, in <module>
p = api.tm.ltm.pools.pool.load(name=name, partition='Common')
File "/Users/sinwang/PycharmProjects/Suzhou_Beer_CMCC/venv/lib/python2.7/site-packages/f5/bigip/resource.py", line 1110, in load
return self._load(**kwargs)
File "/Users/sinwang/PycharmProjects/Suzhou_Beer_CMCC/venv/lib/python2.7/site-packages/f5/bigip/resource.py", line 1084, in _load
response = refresh_session.get(base_uri, **kwargs)
File "/Users/sinwang/PycharmProjects/Suzhou_Beer_CMCC/venv/lib/python2.7/site-packages/icontrol/session.py", line 295, in wrapper
raise iControlUnexpectedHTTPError(error_message, response=response)
icontrol.exceptions.iControlUnexpectedHTTPError: 404 Unexpected Error: Not Found for uri: https://10.5.10.23:443/mgmt/tm/ltm/pool/~Common~pool1
Text: u'{"code":404,"message":"01020036:3: The requested Pool (/Common/pool1) was not found.","errorStack":[],"apiError":3}'