cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
270
Views
0
Helpful
1
Replies

Getting tenant contract filters

osakthivel
Level 1
Level 1

I am trying to get Contract and its subject children using this url
/api/node/mo/uni/tn-t01.json?query-target=children&target-subtree-class=vzBrCP&query-target-filter=and(not(wcard(vzBrCP.dn,"__ui_")),not(wcard(vzBrCP.annotation,"shadow:yes")))&query-target=subtree&target-subtree-class=vzBrCP&rsp-subtree-class=vzSubj,tagInst,vzRtIf,vzRsFiltAtt&rsp-subtree=full&order-by=vzBrCP.name|asc

Also, I want to retreive contract subject filters other than default. Below is the url i used to retrive,

/api/node/mo/uni/tn-t05/brc-test-cnt-c12/subj-test-cnt-s12/outtmnl.json?query-target=children&target-subtree-class=vzRsFiltAtt&query-target-filter=not(wcard(vzRsFiltAtt.dn,"__ui_"))&subscription=yes

I want to get the subject filters also in the url which used to retreive contract and its subject.

 

1 Reply 1

RedNectar
VIP
VIP

Hi @osakthivel ,

"I am trying to get Contract and its subject children"

Firstly, understand that you almost certainly understand that you won't need the filter &query-target-filter=and(not(wcard(vzBrCP.dn,"__ui_")),not(wcard(vzBrCP.annotation,"shadow:yes"))) 

The first filter (on __ui_) is there to compensate for stupid design features. E.g. if you are stupid enough to try and configure ACI via the CLI, you may end up with hidden objects that start with __ui_ The second filter (on the shadow annotation) is only relevant for multi-site where shadow objects may get created.

Try this: (I'm using icurl to test - I've stretched it over several lines to make it easier to read.  You should be able to cut and paste the italicised orange text right into the APIC bash command shell)

T17@apic1:~> bash
T17@apic1:~> T=Tenant17 ;# Replace Tenant17 with your Tenant name, eg t01 or t05 from your examples
T17@apic1:~> icurl -s "http://localhost/api/node/class/vzBrCP.json?\
query-target-filter=wcard(vzBrCP.dn,\"${T}\"&query-target=subtree&\
target-subtree-class=vzBrCP,vzSubj&rsp-prop-include=naming-only"

The rsp-prop-include=naming-only  is not strictly necessary - remove it if you don't see the information you want.  Here is the result from my lab for Tenant17 with the output piped to jq to make it readable.

T17@apic1:~> bash
T17@apic1:~> T=Tenant17 ;# Replace Tenant17 with your Tenant name, eg t01 or t05 from your examples
T17@apic1:~> icurl -s "http://localhost/api/node/class/vzBrCP.json?\
query-target-filter=wcard(vzBrCP.dn,\"${T}\"&query-target=subtree&\
target-subtree-class=vzBrCP,vzSubj&rsp-prop-include=naming-only" | jq
Expand to see how it looks on my lab for Tenant17
{
  "totalCount": "6",
  "imdata": [
    {
      "vzBrCP": {
        "attributes": {
          "dn": "uni/tn-Tenant17/brc-AppServices_Ct",
          "name": "AppServices_Ct"
        }
      }
    },
    {
      "vzSubj": {
        "attributes": {
          "dn": "uni/tn-Tenant17/brc-AppServices_Ct/subj-AppServices_Subj",
          "name": "AppServices_Subj"
        }
      }
    },
    {
      "vzBrCP": {
        "attributes": {
          "dn": "uni/tn-Tenant17/brc-MgmtServices_Ct",
          "name": "MgmtServices_Ct"
        }
      }
    },
    {
      "vzSubj": {
        "attributes": {
          "dn": "uni/tn-Tenant17/brc-MgmtServices_Ct/subj-MgmtServices_Subj",
          "name": "MgmtServices_Subj"
        }
      }
    },
    {
      "vzBrCP": {
        "attributes": {
          "dn": "uni/tn-Tenant17/brc-WebServices_Ct",
          "name": "WebServices_Ct"
        }
      }
    },
    {
      "vzSubj": {
        "attributes": {
          "dn": "uni/tn-Tenant17/brc-WebServices_Ct/subj-WebServices_Subj",
          "name": "WebServices_Subj"
        }
      }
    }
  ]
}

"Also, I want to retreive contract subject filters other than default"

[Edit: I overthought this - I've added a simpler answer below but I'll leave this first answer in case you prefer this format]

It looks like you want to retrieve contract subject filters for a specific tenant, specific contract and specific subject.  I'll use bash variables to make the icurl command a little simpler. And like last time, the rsp-prop-include=naming-only  is just to keep the output simplified.

T17@apic1:~> bash
T17@apic1:~> T=Tenant17 ;# Replace Tenant17 with your Tenant name, eg t01 or t05 from your examples
T17@apic1:~> C=WebServices_Ct ;# Replace WebServices_Ct with your contract name
T17@apic1:~> S=WebServices_Subj ;# Replace WebServices_Subj with your subject name
T17@apic1:~> icurl -s "http://localhost/api/node/class/vzRsSubjFiltAtt.json?\
query-target-filter=and(wcard(vzRsSubjFiltAtt.dn,\"${T}\"),\
wcard(vzRsSubjFiltAtt.dn,\"${C}\"),\
wcard(vzRsSubjFiltAtt.dn,\"${S}\"))&\

rsp-prop-include=naming-only" | jq
Expand to see how it looks on my lab for Tenant17 when piped through jq
{
  "totalCount": "1",
  "imdata": [
    {
      "vzRsSubjFiltAtt": {
        "attributes": {
          "dn": "uni/tn-Tenant17/brc-WebServices_Ct/subj-WebServices_Subj/rssubjFiltAtt-WebServices_Fltr",
          "tnVzFilterName": "WebServices_Fltr"
        }
      }
    }
  ]
}

[Edit: This is a simpler answer to the above]

T17@apic1:~> bash
T17@apic1:~> T=Tenant17 ;# Replace Tenant17 with your Tenant name, eg t01 or t05 from your examples
T17@apic1:~> C=WebServices_Ct ;# Replace WebServices_Ct with your contract name
T17@apic1:~> S=WebServices_Subj ;# Replace WebServices_Subj with your subject name
T17@apic1:~> icurl -s "http://localhost/api/node/mo/uni/\
tn-${T}/brc-${C}/subj-${S}.json?query-target=children&\
rsp-prop-include=naming-only" | jq
Expand to see how it looks on my lab for Tenant17 when piped through jq - you'll see it is exactly the same as above
{
  "totalCount": "1",
  "imdata": [
    {
      "vzRsSubjFiltAtt": {
        "attributes": {
          "dn": "uni/tn-Tenant17/brc-WebServices_Ct/subj-WebServices_Subj/rssubjFiltAtt-WebServices_Fltr",
          "tnVzFilterName": "WebServices_Fltr"
        }
      }
    }
  ]
}

 


RedNectar aka Chris Welsh.
Forum Tips: 1. Paste images inline - don't attach. 2. Always mark helpful and correct answers, it helps others find what they need.

Review Cisco Networking for a $25 gift card

Save 25% on Day-2 Operations Add-On License