Forum Discussion

Bas_0_145548's avatar
Bas_0_145548
Icon for Nimbostratus rankNimbostratus
Dec 16, 2014
Solved

custom metadata and icontrol REST

Hi all,

 

We've developed an application that is able to create a load balancer using iControl REST based on "profiles". A profiles basically is a number of settings specifically designed for an application. At this time we have multiple HTTP load balancer profiles and 1 protocol neutral TCP load balancer.

 

Creating a load balancer using these profiles works pretty ok; we can create, delete, read and update a limited set of parameters. We want our systems to be able to determine which - if any - profile was used to create the load balancer and we haven't found a way yet, mainly caused by the variety of load balancers. Probably obvious, but we don't want the manner we're selecting to consume too much system resources. And we don't want to abuse a description field.

 

Is there anyway to store custom metadata, something like a string, in the F5 and link it to a Load Balancer. We're using just one partition at this time.

 

Thanks!

 

  • Bas,

    Since TMOS version 11.2, metadata in the form of name/value pairs can be associated with specific objects in TMOS. One of the objects which supports metadata are LTM virtual server objects. Assuming when you say a 'Load Balancer' you are referencing a specific LTM virtual server, you can simply add a list as a 'metadata' attribute to the virtual server object in your REST calls.

    As an example, let's say we have virtual server named 'lbaas_12345' in folder 'Common' (which by-the-way, if this is multi-tenant you should be building folders per tenant for isolation). When you make the POST request to create the virtual server, include in the request body a JSON attribute that looks like this.

    "metadata": [
        {
            "name": "name1",
            "persist": "true",
            "value": "value1"
        },
        {
            "name": "name2",
            "persist": "true",
            "value": "value2"
        },
        {
            "name": "name3",
            "persist": "true",
            "value": "value3"
        }
      ]
    

    If you want to update the metadata for that virtual server, you would issue a PUT request as follows:

    PUT https://[yourbigip]/mgmt/tm/ltm/virtual/~Common~lbaas_12345

        {
        "metadata": [
            {
                "name": "name1",
                "persist": "true",
                "value": "value1"
            },
            {
                "name": "name2",
                "persist": "true",
                "value": "value2"
            },
            {
                "name": "name3",
                "persist": "true",
                "value": "value3"
            },
            {
                "name": "name4",
                "persist": "true",
                "value": "value4"
            }
        ]
      }
    

    Let me know if that's enough to get you where you need to go..

    John

5 Replies

  • John_Gruber_432's avatar
    John_Gruber_432
    Historic F5 Account

    Bas,

    Since TMOS version 11.2, metadata in the form of name/value pairs can be associated with specific objects in TMOS. One of the objects which supports metadata are LTM virtual server objects. Assuming when you say a 'Load Balancer' you are referencing a specific LTM virtual server, you can simply add a list as a 'metadata' attribute to the virtual server object in your REST calls.

    As an example, let's say we have virtual server named 'lbaas_12345' in folder 'Common' (which by-the-way, if this is multi-tenant you should be building folders per tenant for isolation). When you make the POST request to create the virtual server, include in the request body a JSON attribute that looks like this.

    "metadata": [
        {
            "name": "name1",
            "persist": "true",
            "value": "value1"
        },
        {
            "name": "name2",
            "persist": "true",
            "value": "value2"
        },
        {
            "name": "name3",
            "persist": "true",
            "value": "value3"
        }
      ]
    

    If you want to update the metadata for that virtual server, you would issue a PUT request as follows:

    PUT https://[yourbigip]/mgmt/tm/ltm/virtual/~Common~lbaas_12345

        {
        "metadata": [
            {
                "name": "name1",
                "persist": "true",
                "value": "value1"
            },
            {
                "name": "name2",
                "persist": "true",
                "value": "value2"
            },
            {
                "name": "name3",
                "persist": "true",
                "value": "value3"
            },
            {
                "name": "name4",
                "persist": "true",
                "value": "value4"
            }
        ]
      }
    

    Let me know if that's enough to get you where you need to go..

    John

  • Hi all,

     

    @John: This seems to be exactly what I need.

     

    I assume metadata is included upon GET? I'll give it try asap.

     

    Thanks, Bas

     

  • Exactly what I need, thanks a lot.

     

    Is there a way to show metadata within the F5 BUI?