Class/DN
The difference

One important concept to understand from the ACI object model tree (MIT) is the distinction between what is a class and what is a dn of that class. Lets take a look at this from a couple of examples.

In the last example you did a query into the APIC to list you the endpoints that the fabric has learned. The object that has contains this information in the fabric is called fvCEp. If you wanted to find out all the endpoints in the fabric, you would ask the APIC to list you all the objects of type fvCEp. You can do the for many different object types.

  • Tenant: fvTenant
  • Application Profile: fvAp
  • Application End Point Group(EPG): fvAEPg
  • Bridge domain: fvBD
  • Subnet: fvSubnet

In the tree of objects that is ACI, you would see this as follows:

When you do a class query into the fabric you are asking the fabric to provide all the objects that are of the type you are requesting. So if you are to query the ACI fabric for the class of type fvTenant then the query would return all the objects of type fvTenant:

Step 1 - Class query for fvTenant

You will create a new request in POSTMAN for the fvTenant class.

  1. In your aci-lab Collection, click the 3-dots
  2. In the dropdown menu, click Add request

Create the new request:

  1. Name it Tenants
  2. Add the destination URL: https://{{apic}}/api/class/fvTenant.json
  3. The request type is going to be GET.
  4. Save

Don't forget

Remember to hit save and re-run the APIC Login request if enough time has passed and your token may have expired

When you execute the query you will get the list of all the tenants in the fabric:


{
    "totalCount": "73",
    "imdata": [
        {
            "fvTenant": {
                "attributes": {
                    "annotation": "orchestrator:msc",
                    "childAction": "",
                    "descr": "Pod22 MSite Tenant",
                    "dn": "uni/tn-msite_p22_tenant",
                    "extMngdBy": "msc",
                    "lcOwn": "local",
                    "modTs": "2019-04-05T00:11:15.323+00:00",
                    "monPolDn": "uni/tn-common/monepg-default",
                    "name": "msite_p22_tenant",
                    "nameAlias": "",
                    "ownerKey": "",
                    "ownerTag": "",

Specific object

So if you want to query the fabric and hit a specific object, then you are going to want to query a specific object. Each object in the ACI fabric has a DN. Think of this as the address of the object in the tree (management information tree, MIT).

So using an example, you would want to query the fabric for a specific object. Let's say that you want to query the common tenant. We can request the specific DN or we can still do a class query but with filters.

Step 2 - Query specific tenant

Start by creating a new request in POSTMAN.

  1. In your aci-lab Collection, click the 3-dots
  2. In the dropdown menu, click Add request

Create the new request:

<<<<<<< HEAD
    =======
    1. Name it Common Tenant
    2. >>>>>>> ed75728489b90e3b107aec4aa1e180febcc1bedb
    3. Name it Common Tenant
    4. <<<<<<< HEAD Add the destination URL: https://{{apic}}/api/mo/uni/tn-common.json
    5. Click Save
    6. Click Send
    ======= The request type is going to be GET.
  1. Save
>>>>>>> ed75728489b90e3b107aec4aa1e180febcc1bedb

With the return data of the APIC be:


{
    "totalCount": "1",
    "imdata": [
        {
            "fvTenant": {
                "attributes": {
                    "annotation": "orchestrator:",
                    "childAction": "",
                    "descr": "",
                    "dn": "uni/tn-common",
                    "extMngdBy": "",
                    "lcOwn": "local",
                    "modTs": "2021-08-22T14:22:04.428+00:00",
                    "monPolDn": "uni/tn-common/monepg-default",
                    "name": "common",
                    "nameAlias": "",
                    "ownerKey": "",
                    "ownerTag": "",
                    "status": "",
                    "uid": "0",
                    "userdom": ""
                }
            }
        }
    ]
}

As you can see the APIC return a single object, because that is the URL that we requested.

Step 3 - Query specific tenant and the complete sub-tree

So in this step, you are going to see how you can query the complete sub-tree of an object. In the case of the Tenant object, there are many configuration objects that make the whole tenant. These include bridge domains, application profiles, contracts and many other objects.

So a query that is requesting the children objects of the parent object would look like:

In the same request that we did before for the common tenant you will now then configure the request with what is known as a query modifier. The URL will now look as:

  • https://{{apic}}/api/mo/uni/tn-common.json?rsp-subtree=children

And now when you execute on this request, you will see the common tenant object and all it's children objects. What you are seeing is the complete configuration of the common tenant in ACI for this fabric.

Step 4 - Connect to the APIC via the CLI

Click on the following ICON that is a browser link to connect to the APIC controller via the web browser SSH extensions for Chrome.

  • Password: cisco.123

Connecting to aciproglab04@10.0.226.41...
Application Policy Infrastructure Controller
aciproglab04@10.0.226.41's password: 
Last login: 2022-12-25T00:00:00.000+00:00 UTC

Step 5 - Run first moquery command

In the APIC CLI you can issue the command moquery. This command simply makes a call to the REST interface of the APIC but simplifies things for you because it knows how to invoke the class easier.

On the APIC CLI issue the following command:


moquery -c fvTenant

This will output all the Tenants configured on the fabric:


    # fv.Tenant
    name         : mgmt
    annotation   : 
    childAction  : 
    descr        : 
    dn           : uni/tn-mgmt
    extMngdBy    : 
    lcOwn        : local
    modTs        : 2015-05-18T18:08:24.589+00:00
    monPolDn     : uni/tn-common/monepg-default
    nameAlias    : 
    ownerKey     : 
    ownerTag     : 
    rn           : tn-mgmt
    status       : 
    uid          : 0
    userdom      : 

    [CUT CUT CUT CUT CUT]
    
    # fv.Tenant
    name         : aciproglab23
    annotation   : 
    childAction  : 
    descr        : LTRACI-3225 Programming Lab Student 23 Tenant
    dn           : uni/tn-aciproglab23
    extMngdBy    : 
    lcOwn        : local
    modTs        : 2022-04-30T15:12:54.987+00:00
    monPolDn     : uni/tn-common/monepg-default
    nameAlias    : 
    ownerKey     : 
    ownerTag     : 
    rn           : tn-aciproglab23
    status       : 
    uid          : 15698
    userdom      : :all:common:

You can run the same command to get all the fabric endpoints with the object fvCEp.


moquery -c fvCEp

Which will output a long list of endpoints.


[CUT] [CUT] [CUT] [CUT]
    # fv.CEp
    name                     : FC:99:47:4A:0C:F4
    annotation               : 
    baseEpgDn                : 
    bdDn                     : uni/tn-mgmt/BD-inb
    childAction              : 
    contName                 : 
    dn                       : uni/tn-mgmt/l2out-l2out-1/instP-l2outEPG/cep-FC:99:47:4A:0C:F4
    encap                    : vlan-336
    esgUsegDn                : 
    extMngdBy                : 
    fabricPathDn             : topology/pod-1/paths-205/pathep-[inbL2Out]
    hostingServer            : 
    id                       : 0
    idepdn                   : 
    lcC                      : learned
    lcOwn                    : local
    mac                      : FC:99:47:4A:0C:F4
    mcastAddr                : not-applicable
    modTs                    : 2022-05-11T17:14:52.176+00:00
    monPolDn                 : uni/tn-common/monepg-default
    nameAlias                : 
    reportingControllerName  : 
    rn                       : cep-FC:99:47:4A:0C:F4
    status                   : 
    uid                      : 0
    userdom                  : all
    uuid                     : 
    vmmSrc                   : 
    vrfDn                    : uni/tn-mgmt/ctx-inb

You can also use moquery to do specific queries to object DN's like we have done in POSTMAN.


moquery -d uni/tn-common

And the APIC controller will now just present you the output of the common tenant:


Total Objects shown: 1

# fv.Tenant
name         : common
annotation   : orchestrator:
childAction  : 
descr        : 
dn           : uni/tn-common
extMngdBy    : 
lcOwn        : local
modTs        : 2021-08-22T14:22:04.428+00:00
monPolDn     : uni/tn-common/monepg-default
nameAlias    : 
ownerKey     : 
ownerTag     : 
rn           : tn-common
status       : 
uid          : 0
userdom      : 

So now you have performed a class query and a dn query from the APIC cli.