Forum Discussion

Jae_Hong_Kim_32's avatar
Jae_Hong_Kim_32
Icon for Nimbostratus rankNimbostratus
May 25, 2017

Getting subcollection under policy

I am trying write up an equivalent of the REST API below using the F5 SDK

https://{{big_ip_a_mgmt}}/mgmt/tm/asm/policies/RkBxoJgqcNy6Nub2tIGnqg/blocking-settings/violations/qbKXRjHFpE888EG_KIf-Gw?ver=12.1.0

I was able to load up the resource but I can't figure out how to load the sub collection below the resource import requests

from requests.packages.urllib3.exceptions import InsecureRequestWarning

requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

from import ManagementRoot

mgmt = ManagementRoot("70.60.207.94", "admin", "admin")

collection = mgmt.tm.asm.get_collection()

for anobject in collection:

print anobject

p_collections = mgmt.tm.asm.policies_s.get_collection()

for p_object in p_collections:

policy=mgmt.tm.asm.policies_s.policy.load(id=p_object.id)