Forum Discussion

jean-marc_14076's avatar
jean-marc_14076
Icon for Nimbostratus rankNimbostratus
Jan 15, 2018

how to delete ramcache of a specific partition with icontrol rest api ?

i need to delete ramache of a specific partition / profile on a 11.6.0 HF 7 big-ip by icontrol rest.

 

In the curl call i have try : curl ... -X DELETE

 

it works fine on the Common folder as show the audit log :

 

folder=/Common module=(tmos) status=[Command OK] cmd_data=delete ltm profile ramcache all

 

the bigip as several partition "mypartition1, mypartition2 ..." , but i did not find example showing how to tell i want to delete on partition1. Any idea ?

 

3 Replies

  • Possibly ~ (tilda)?

     

    The API User Guide says: "When a resource name includes a forward slash (/) in its name, substitute a tilde (~) for the forward slash in the path. For example, a resource name, such as /Common/plist1, should be modified to the format shown here: ;

     

  • TCB_167490's avatar
    TCB_167490
    Historic F5 Account

    The /all syntax in iControl REST applies only to the Common partition. Deleting all profiles from a partition other than the Common partition by using iControl REST is not supported.

     

  • all is a

    tmsh ltm profile ramcache
    option, not a catch-all meta symbol like *. If you specify a ramcache profile /Test/all, for example, BIG-IP (tmsh) looks for the profile named all under the partition /Test. If it does not find it, it reports
    Invalid profile name
    error. This is the reason why an iControl REST request to ~Test~all gets an error.

    The all option is applied to the current partition in

    tmsh show ltm profile ramcache
    command. To change the partition, you need to run
    cd
    command in tmsh. The following example demonstrates the behaviour.

    for part in " " "cd /Test;" "cd /Common;"; do echo --$part && echo "$part; \
    show ltm profile ramcache all" | tmsh | egrep 'URI|Ltm::Ramcache' | grep -v apm-enduser; done
    --                                         <<< default parition = /Common
    Ltm::Ramcaches /Common/webacceleration
    URI : /index.html
    URI : /cookie.html
    URI : /
    --cd /Test;
    Ltm::Ramcaches /Test/myweb
    URI : /index.html
    URI : /cookie.html
    URI : /
    Ltm::Ramcaches /Test/myweb2
    URI : /index.html
    URI : /cookie.html
    URI : /
    --cd /Common;
    Ltm::Ramcaches /Common/webacceleration
    URI : /index.html
    URI : /cookie.html
    URI : /
    

    Unfortunately, we cannot use the tmsh

    cd
    command in iControl REST, hence all can only be used for the default partition /Common: e.g.,

     curl -sku admin:passwd https://localhost/mgmt/tm/ltm/profile/ramcache/all/stats \
    | python -m json.tool | sed 's/\\n/\n/g;' | egrep 'URI|Ltm::Ramcache' | grep -v apm-enduser
            "apiAnonymous": "Ltm::Ramcaches /Common/webacceleration
    URI : /index.html
    URI : /cookie.html
    URI : /
    

    Interestingly, the all option behaves differently when used in

    delete
    command. As you stated, it deletes all the entries in all the profiles under all the partitions. Not just the current partition. Again, you can't specify partition plus all (/Test/all or ~Test~all😞 It's an option, not a wild-card.

    A workaround is to loop around a list of ramcache profiles: e.g.,

     for i in myweb myweb2; do curl -sku admin:passwd \
     https://localhost/mgmt/tm/ltm/profile/ramcache/~Test~$i -X DELETE
    

    I hope this clarifies some myths. Let me know if you have additional questions.

    Cheers, Satoshi

    P.S. Interestingly, although the all option appears in tab completion, it is not explained in the

    tmsh help ltm profile ramcache
    .