Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use partitions with BIGREST

rahvee
Altocumulus
Altocumulus

Hi, I'm using BIGREST, and I'm able to create a BIGIP object,

f5 = BIGIP(hostname, username, password...)

I'm able to get a list of partitions:

 

 

def f5_get_partitions(f5_session: BIGIP) -> List[str]:
    result = f5_session.load("/mgmt/tm/sys/folder")  # type: List[RESTObject]
    partitions: List[str] = []
    for r in result:
        if len(r.properties['fullPath']) < 2:
            # The '/' path should be ignored
            continue
        if r.properties['fullPath'].count('/') > 1:
            # Skip things like /Common/foo and /Common/bar
            continue
        partitions.append(r.properties['name'])
    return partitions

 

 

But I haven't figured out how to load something from a partition other than 'Common'. I tried this. It doesn't work:

for partition in partitions:
f5.load("/mgmt/tm/sys/crypto/cert", partition=partition) 

 The error I get is:

 

 

TypeError: load() got an unexpected keyword argument 'partition'

 

 

How do you load from a partition?

5 REPLIES 5

Hello @rahvee,

BigREST is similar to use iControlREST. Have you tried with the same resources available as with iControlREST?

https://support.f5.com/csp/article/K27215222

 

Regards,
Dario.

It seems, by default, I actually am getting all results, so I don't need to use the `options=recursive` setting. In fact, when I try `options=recursive` I get no results. But applying the filter as shown `?\$filter=partition+eq+<partition name>` works, so that's helpful. Thanks

Hi @rahvee 

The partition names are integrated into the object names. Check the examples here https://bigrest.readthedocs.io/examples.html

Hope that helps.

Yes, I noticed the partition name is embedded in the response, but it's only returning results from Common. Not from any other partition. I'll try Dario's answer and see if that helps...

My mistake. By default, all results *are* returned, and I only need to examine the `fullPath` property, as you said.