Forum Discussion
Joel_Breton
May 26, 2017Nimbostratus
Hi Jae,
I was able to modify the ASM policy using the modify method - I use Python 3.6 so my code is slightly different
Here's the code I used
from f5.bigip import ManagementRoot
bigip = ManagementRoot('ipaddress', 'admin', 'admin')
asm = bigip.tm.asm.policies_s
for policy in asm.get_collection():
print('Before policy description change: ' + policy.description)
print('Before policy description change: ' + policy.learningMode)
policy.modify(description='test')
policy.modify(learningMode='manual')
print('After policy description change: ' + policy.description)
print('After policy description change: ' + policy.learningMode)
Here's the output of the script the first time it is run
Before policy description change: myasmpolicy
Before policy description change: automatic
After policy description change: test
After policy description change: manual
Here's the output of the script the second time it is run - You can notice the values in the policy are now different
Before policy description change: test
Before policy description change: manual
After policy description change: test
After policy description change: manual
Hope this helps
Also I would advise not to post public IP Addresses on public forums