def getIPRangeListUrlForNetworkObj(connection, networkUrl): ''' This method will return the IP Ranges associated with an IxLoad Network component. Args: - connection is the connection object that manages the HTTP data transfers between the client and the REST API - networkUrl is the REST address of the network object for which the network ranges will be provided. ''' networkObj = connection.httpGet(networkUrl) if isinstance(networkObj, list): for obj in networkObj: url = "%s/%s" % (networkUrl, obj.objectID) rangeListUrl = getIPRangeListUrlForNetworkObj(connection, url) if rangeListUrl: return rangeListUrl else: for link in networkObj.links: if link.rel == 'rangeList': rangeListUrl = normalizeLink(link.href) return rangeListUrl for link in networkObj.links: if link.rel == 'childrenList': #remove the 'api/v0' elements of the url, since they are not needed for connection http get childrenListUrl = normalizeLink(link.href) return getIPRangeListUrlForNetworkObj(connection, childrenListUrl) return None