Forum Discussion

Ichnafi's avatar
Ichnafi
Icon for Cirrostratus rankCirrostratus
Feb 12, 2025
Solved

BIG-IQ REST - Is it possible to expandSubcollections=true

Hi,

I try to get a List of all virtual servers with all of their configurer objects from out BIG-IQ.

A request on https:///mgmt/cm/adc-core/working-config/ltm/virtual will give me a list of all virtual servers that the BIG-IQ knows about, but several parts like pools, vlans etc. are just a reference link.

 

On BIG-IP API LTM there is a expandSubcollections Parameter that will (if set =true) resolve such references and get you the hole story. I tried https:///mgmt/cm/adc-core/working-config/ltm/virtual?$top=2&expandSubcollections=true, but still only got reflinks in the result, instead of the resolved data.

 

This seems not be possible on a BIG-IQ, right?

In the end all I want is a JSON Representation of all the configurerd virtual servers (wich are thousands in numbers). Querying the LTM itself is no option.

  • Hi Ichnafi,

    How many LTMs do you have reporting to BIGIQ.

     

    It appears that the expandSubcollections=true parameter, which works on the BIG-IP API, does not function the same way on the BIG-IQ API. This parameter is intended to resolve references and provide detailed information, but it seems that BIG-IQ does not support this feature in the same manner.

    Alternative Approach

    To achieve your goal of obtaining a JSON representation of all configured virtual servers with their detailed configurations, you might need to make additional API calls to resolve the references manually. Here’s a step-by-step approach:

    1. Get the List of Virtual Servers:
      • Make a request to get the list of all virtual servers.
    2.  curl -sk -u admin:password "https://<BIG-IQ-IP>/mgmt/cm/adc-core/working-config/ltm/virtual"
    3. Iterate Over Each Virtual Server:
      • For each virtual server, extract the reference links for pools, VLANs, etc.
    4. Make Additional API Calls:
      • For each reference link, make an additional API call to retrieve the detailed information.
    5.  curl -sk -u admin:password "https://<BIG-IQ-IP>/mgmt/cm/adc-core/working-config/ltm/pool/<pool-id>"
    6. Combine the Data:
      • Combine the data from the initial virtual server list with the detailed information from the additional API calls to create a comprehensive JSON representation.

    Example Script

    Here’s a simplified example script in Python to illustrate the process:

    import requests

    import json

     

    # BIG-IQ credentials and URL

    bigiq_url = "https://<BIG-IQ-IP>/mgmt/cm/adc-core/working-config/ltm/virtual"

    auth = ('admin', 'password')

     

    # Get the list of virtual servers

    response = requests.get(bigiq_url, auth=auth, verify=False)

    virtual_servers = response.json().get('items', [])

     

    # Function to get detailed information

    def get_details(url):

        response = requests.get(url, auth=auth, verify=False)

        return response.json()

     

    # Iterate over each virtual server and get detailed information

    for vs in virtual_servers:

        vs_id = vs['id']

        vs_details_url = f"{bigiq_url}/{vs_id}"

        vs_details = get_details(vs_details_url)

     

        # Get pool details if available

        if 'poolReference' in vs_details:

            pool_url = vs_details['poolReference']['link']

            pool_details = get_details(pool_url)

            vs_details['poolDetails'] = pool_details

     

        # Add more details as needed (e.g., VLANs, profiles)

        # ...

     

        # Print or store the detailed virtual server information

        print(json.dumps(vs_details, indent=2))

     

    # Note: You may need adjustments for your specific use case.

    This approach ensures you get a comprehensive JSON representation of all configured virtual servers with their detailed configurations.

     

    Let me know for additional help if you want to extract the list of all the F5 LTM VIPs config , in BASH mode on each LTM you can run this commands to obtain list of all the VIPs on all partition on a Particular LTM:

     

    tmsh -q -c "cd / ; show ltm virtual recursive all-properties detail" | grep -i -e 'LTM\|Destination'

     

    Kindly rate 

    HTH

    F5 Design Engineer

  • Hi Ichnafi,

    How many LTMs do you have reporting to BIGIQ.

     

    It appears that the expandSubcollections=true parameter, which works on the BIG-IP API, does not function the same way on the BIG-IQ API. This parameter is intended to resolve references and provide detailed information, but it seems that BIG-IQ does not support this feature in the same manner.

    Alternative Approach

    To achieve your goal of obtaining a JSON representation of all configured virtual servers with their detailed configurations, you might need to make additional API calls to resolve the references manually. Here’s a step-by-step approach:

    1. Get the List of Virtual Servers:
      • Make a request to get the list of all virtual servers.
    2.  curl -sk -u admin:password "https://<BIG-IQ-IP>/mgmt/cm/adc-core/working-config/ltm/virtual"
    3. Iterate Over Each Virtual Server:
      • For each virtual server, extract the reference links for pools, VLANs, etc.
    4. Make Additional API Calls:
      • For each reference link, make an additional API call to retrieve the detailed information.
    5.  curl -sk -u admin:password "https://<BIG-IQ-IP>/mgmt/cm/adc-core/working-config/ltm/pool/<pool-id>"
    6. Combine the Data:
      • Combine the data from the initial virtual server list with the detailed information from the additional API calls to create a comprehensive JSON representation.

    Example Script

    Here’s a simplified example script in Python to illustrate the process:

    import requests

    import json

     

    # BIG-IQ credentials and URL

    bigiq_url = "https://<BIG-IQ-IP>/mgmt/cm/adc-core/working-config/ltm/virtual"

    auth = ('admin', 'password')

     

    # Get the list of virtual servers

    response = requests.get(bigiq_url, auth=auth, verify=False)

    virtual_servers = response.json().get('items', [])

     

    # Function to get detailed information

    def get_details(url):

        response = requests.get(url, auth=auth, verify=False)

        return response.json()

     

    # Iterate over each virtual server and get detailed information

    for vs in virtual_servers:

        vs_id = vs['id']

        vs_details_url = f"{bigiq_url}/{vs_id}"

        vs_details = get_details(vs_details_url)

     

        # Get pool details if available

        if 'poolReference' in vs_details:

            pool_url = vs_details['poolReference']['link']

            pool_details = get_details(pool_url)

            vs_details['poolDetails'] = pool_details

     

        # Add more details as needed (e.g., VLANs, profiles)

        # ...

     

        # Print or store the detailed virtual server information

        print(json.dumps(vs_details, indent=2))

     

    # Note: You may need adjustments for your specific use case.

    This approach ensures you get a comprehensive JSON representation of all configured virtual servers with their detailed configurations.

     

    Let me know for additional help if you want to extract the list of all the F5 LTM VIPs config , in BASH mode on each LTM you can run this commands to obtain list of all the VIPs on all partition on a Particular LTM:

     

    tmsh -q -c "cd / ; show ltm virtual recursive all-properties detail" | grep -i -e 'LTM\|Destination'

     

    Kindly rate 

    HTH

    F5 Design Engineer

    • Ichnafi's avatar
      Ichnafi
      Icon for Cirrostratus rankCirrostratus

      Hi,

      thank you for your elaborated answer.

      How many LTMs do you have reporting to BIGIQ.

      Well...let me put is this way: you might need 3 digits to count them. 🤐

       

      I'm seriously afraid iterating over all objects to get them. This will be endless loops of request, since in pools, members are also reflinked, same for vlans, profiles, you name it. It's a rabbit hole.

      I roughly calculated the necessary API calls to BIG-IQ, if I wanted to resolve all the reflinks and ended up with 20-25k. I'm certain this will not only take forerver, it will kill the device as well. 

      It's a shame, that tools like BIG-IP Automation Config Converter or F5 Corkscrew are abandoned and/or don't work with Version 17.1. It sounds like they would have given me exactly what I needed. 

      I'm no python expert, but I think I will have a look into pyparser to maybe write a parser for bigip.conf, so I can use the UCS Files as a source.

      Cheers

      Ichnafi

  • To list all virtual servers along with their configuration objects on an F5 BIG-IP system, you can use the Traffic Management Shell (tmsh) commands. Here are the steps and commands you can use:

    1. Login to the BIG-IP CLI:
      • Access your BIG-IP system via SSH.
    2. Run the following command to list the details of all virtual servers in all partitions and sub-folders:

    tmsh -c 'cd /; list ltm virtual recursive' > /var/tmp/virtual_servers_config.txt

    This command will save the output to a text file located at /var/tmp/virtual_servers_config.txt[1].

    If you prefer to see the output directly on the screen, you can use:

    tmsh -q -c 'cd /; show running-config recursive'

    This will display the running configuration for all partitions, including the /Common partition[2].

    These commands will help you retrieve a comprehensive list of all virtual servers and their configuration objects on your F5 BIG-IP system.

    References

    [1] How to get details of the virtual servers in all partitions ... - F5, Inc.

    [2] How to show configuration objects in the running-config for all ...

  • This looks promising. 

    Main Problem stays: No easy format to parse. Oh well...what would we do if things were easy 😄

    I never the less mark your 1st answer es solution, because my question was about expandSubcollections in Big-IQ and this is sadly not implemented.

    Cheers

    Ichnafi