Forum Discussion
PeteWhite
Nov 18, 2020Employee
I'm confused why your filter ends with $destination+eq+vip
Take a look at https://www.odata.org/documentation/odata-version-2-0/uri-conventions/#FilterSystemQueryOption for the odata syntax
Your string handling is also not correct
My thinking is that from a Python perspective you want:
partition = "myPartition"
destination="1.2.3.4:443"
virtuals = mgmt.tm.ltm.virtuals.get_collection(requests_params={ 'params': 'expandSubcollections=true&$filter=partition+eq+' + partition + 'and+destination+eq+' + vip)}
A good way to test this is to create the filter string and then insert it into the command, so you can print it out first
eg
partition = "myPartition"
destination="1.2.3.4:443"
filterString = 'expandSubcollections=true&$filter=partition+eq+' + partition + 'and+destination+eq+' + vip
print("filterString:" + filterString)
virtuals = mgmt.tm.ltm.virtuals.get_collection(requests_params={ 'params': filterString)}
You can also use my iCR python module for a simple script