Forum Discussion

2 Replies

  • I assume you have a virtual already and would like to add the

    fastL4
    profile to it (see iControl REST Cookbook - Virtual Server for how to create a virtual).

    Generally speaking, you can add a profile to a virutal using

    POST
    method to the virtual's
    profiles
    endpoint. For example, to add the
    http
    profile to the virtual
    vs
    :

     curl -sku admin:pass https://mgmtIP/mgmt/tm/ltm/virtual/vs/profiles \
     -H "Content-type: application/json" -X POST -d '{"name":"http"}'
    

    where admin:pass is the userID/password pair, and mgmtIP is the management IP address of the BIG-IP.

    However, adding the

    fastL4
    profile isn't that straight forward as the profile may conflict with the existing profile. For example, if you attempt to add it to a virtual with the
    tcp
    profile using tmsh, you will get the following error.

     modify ltm virtual vs profiles add { fastL4 }
    01070095:3: Virtual server /Common/vs lists incompatible profiles.
    

    You need to replace all the profiles just like the

    replace-all-with
    tmsh command (verb?). Here's the step.

    1) Get the configuration of the virtual. You need the

    ?expandSubcollections=true
    .

     curl -sku admin:pass https://mgmtIP/mgmt/tm/ltm/virtual/vs?expandSubcollections=true \
     | python -m json.tool > sat 
    

    2) Edit the

    profilesReference
    section of the file. If the virtual had only
    tcp
    profile, it looks like this:

        "profilesReference": {
            "isSubcollection": true,
            "items": [
                {
                    "context": "all",
                    "fullPath": "/Common/tcp",
                    "generation": 493,
                    "kind": "tm:ltm:virtual:profiles:profilesstate",
                    "name": "tcp",
                    "nameReference": {
                        "link": "https://localhost/mgmt/tm/ltm/profile/tcp/~Common~tcp?ver=13.1.0"
                    },
                    "partition": "Common",
                    "selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~vs/profiles/~Common~tcp?ver=13.1.0"
                }
            ],
            "link": "https://localhost/mgmt/tm/ltm/virtual/~Common~vs/profiles?ver=13.1.0"
        },
    

    Replace everything related to the

    tcp
    profile. You can remove unnecessary fields: The system will populate the default values. e.g.,

        "profilesReference": {
            "isSubcollection": true,
            "items": [
                {
                    "context": "all",
                    "name": "fastL4",
                    "partition": "Common"
                }
            ],
            "link": "https://localhost/mgmt/tm/ltm/virtual/~Common~vs/profiles?ver=13.1.0"
        },
    

    3) Put the file there.

     curl -sku admin:pass https://mgmtIP/mgmt/tm/ltm/virtual/vs \
     -H "Content-type: application/json" -X PUT -d@sat
    

    There could be a better way to achieve this, but this is the best I could do so far.

    I hope this helps.