cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4549
Views
10
Helpful
5
Replies

APIC APIs

imharishd
Level 1
Level 1

Hi I have been trying to work with APIC API to bring the interface down. I went through different documents and found two APIs which do the same. However, i cannot see the link going down when i hit those APIs. I'm posting the APIs and the xml which i tried below. Please provide valuable inputs. 

 

API1-->

 

https://<IPOfApic>/api/node/mo/uni/fabric/outofsvc.xml

 

Data:

<fabricRsOosPath>

          <attributes>

             <tDn>topology/pod-1/paths-101/pathep-[eth1/49]</tDn>

             <lc>blacklist</lc>

          </attributes>

</fabricRsOosPath>

I get the following response from this API when i fire it.

 

<?xml version="1.0" encoding="UTF-8"?><imdata><error code="106" text="Cannot contain mo class attributes; unknown mo class"/></imdata>

I get a status code:400 for this

API2-->

https://<IpOfApic>/api/mo/uni/fabric.xml

 

Data:

  

<fabricOOServicePol>

    <fabricRsOosPath tDn=" topology/pod-1/paths-101/pathep-[eth1/49]"/>

</fabricOOServicePol>

 

I get the following response for this:

<?xml version="1.0" encoding="UTF-8"?><imdata></imdata>

   I get a status code:200 for this

 

Can anybody help me ? 

 

Thanks. 

1 Accepted Solution

Accepted Solutions

mtimm
Cisco Employee
Cisco Employee

For your first example:

 

<fabricRsOosPath>
          <attributes>
             <tDn>topology/pod-1/paths-101/pathep-[eth1/49]</tDn>
             <lc>blacklist</lc>
          </attributes>
</fabricRsOosPath>

 

This is not properly formed XML for the APIC.  Did you take the json from the API inspector and run it through some sort of JSON to XML converter?  

 

The attributes tag is invalid here, the tDn is an attribute of the fabricRsOosPath tag and so is the lc, so properly formed it should probably look like this:

 

<fabricRsOosPath tDn="topology/pod-1/paths-101/pathep-[eth1/49]" lc="blacklist" />
 

You can then query the following to see the policy:

 

/api/node/mo/uni/fabric/outofsvc.xml?rsp-subtree=children

 

To set it back to enabled you delete the fabricRsOosPath object.

 

<fabricRsOosPath tDn="topology/pod-1/paths-101/pathep-[eth1/49]" status="deleted" />

 

View solution in original post

5 Replies 5

mtimm
Cisco Employee
Cisco Employee

For your first example:

 

<fabricRsOosPath>
          <attributes>
             <tDn>topology/pod-1/paths-101/pathep-[eth1/49]</tDn>
             <lc>blacklist</lc>
          </attributes>
</fabricRsOosPath>

 

This is not properly formed XML for the APIC.  Did you take the json from the API inspector and run it through some sort of JSON to XML converter?  

 

The attributes tag is invalid here, the tDn is an attribute of the fabricRsOosPath tag and so is the lc, so properly formed it should probably look like this:

 

<fabricRsOosPath tDn="topology/pod-1/paths-101/pathep-[eth1/49]" lc="blacklist" />
 

You can then query the following to see the policy:

 

/api/node/mo/uni/fabric/outofsvc.xml?rsp-subtree=children

 

To set it back to enabled you delete the fabricRsOosPath object.

 

<fabricRsOosPath tDn="topology/pod-1/paths-101/pathep-[eth1/49]" status="deleted" />

 

imharishd
Level 1
Level 1

Thanks it worked! 

imharishd
Level 1
Level 1

Is there any api which helps me find the uptime or downtime of a particular interface like eth-1/20 or eth-1/21 ? 

 

If yes, could you please tell me what's the API and how it works ? 

Hello,

 

I don't believe we have any way of showing this but I have found an alternative that may work for what you are looking for:

 

http://<APIC IP>/api/node/mo/topology/pod-1/node-101/sys/phys-[eth1/2].json?rsp-subtree-include=fault-records,no-scoped,subtree&order-by=faultRecord.created|desc&page=0&page-size=15

 

This is the fault record for the specific interface. Anytime the interface goes down we will raise a fault so you would need to correlate the latest interface going down fault to the current time and that would be the interface uptime. 

 

Here is some example output:

 

{
  "totalCount": "4",
  "imdata": [
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "lastLinkStChg (New: 2015-10-08T12:48:12.471+00:00), operBitset (New: 3-4), operSt (New: up), operStQual (New: none), resetCtr (New: 2)",
          "childAction": "",
          "code": "F0546",
          "created": "2015-10-08T12:50:32.750+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:notconnect(connected), used by:Discovery",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590501708",
          "domain": "access",
          "highestSeverity": "warning",
          "id": "8590501708",
          "ind": "modification",
          "lc": "retaining",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "warning",
          "prevSeverity": "warning",
          "rule": "ethpm-if-port-down-no-infra",
          "severity": "cleared",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    },
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "bundleBupId (New: 3), lastLinkStChg (New: 2015-10-08T12:48:12.471+00:00), operSt (New: up)",
          "childAction": "",
          "code": "F0546",
          "created": "2015-10-08T12:48:12.473+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:notconnect(connected), used by:Discovery",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590501706",
          "domain": "access",
          "highestSeverity": "warning",
          "id": "8590501706",
          "ind": "modification",
          "lc": "soaking-clearing",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "warning",
          "prevSeverity": "warning",
          "rule": "ethpm-if-port-down-no-infra",
          "severity": "warning",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    },
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "lastLinkStChg (New: 2015-10-08T12:48:05.747+00:00), operSt (New: down), operStQual (New: link-failure)",
          "childAction": "",
          "code": "F0546",
          "created": "2015-10-08T12:48:05.751+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:notconnect(connected), used by:Discovery",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590501704",
          "domain": "access",
          "highestSeverity": "warning",
          "id": "8590501704",
          "ind": "creation",
          "lc": "soaking",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "warning",
          "prevSeverity": "warning",
          "rule": "ethpm-if-port-down-no-infra",
          "severity": "warning",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    },
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "lastLinkStChg (New: 2015-09-15T14:46:35.651+00:00), operBitset (New: 3-4), operSt (New: up), operStQual (New: none), resetCtr (New: 7)",
          "childAction": "",
          "code": "F0546",
          "created": "2015-09-15T15:48:41.681+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:notconnect(connected), used by:Discovery",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590390136",
          "domain": "access",
          "highestSeverity": "warning",
          "id": "8590390136",
          "ind": "deletion",
          "lc": "",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "warning",
          "prevSeverity": "warning",
          "rule": "ethpm-if-port-down-no-infra",
          "severity": "cleared",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    }
  ]
}

 

I then reset the port and flapped it getting the output below:

 

The it is in descending order so the latest is first.

 

{
  "totalCount": "12",
  "imdata": [
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "bundleBupId (New: 4), lastLinkStChg (New: 2015-10-26T14:30:37.873+00:00), operBitset (New: 3-4,35), operSt (New: link-up)",
          "childAction": "",
          "code": "F0546",
          "created": "2015-10-26T14:30:37.877+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:notconnect(connected), used by:Discovery",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590884535",
          "domain": "access",
          "highestSeverity": "warning",
          "id": "8590884535",
          "ind": "modification",
          "lc": "soaking-clearing",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "warning",
          "prevSeverity": "warning",
          "rule": "ethpm-if-port-down-no-infra",
          "severity": "warning",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    },
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "operBitset (New: 4,7,35), operStQual (New: link-failure)",
          "childAction": "",
          "code": "F0546",
          "created": "2015-10-26T14:30:35.923+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:notconnect(connected), used by:Discovery",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590884534",
          "domain": "access",
          "highestSeverity": "warning",
          "id": "8590884534",
          "ind": "modification",
          "lc": "soaking",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "warning",
          "prevSeverity": "warning",
          "rule": "ethpm-if-port-down-no-infra",
          "severity": "warning",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    },
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "operBitset (New: 35), usage (New: blacklist)",
          "childAction": "",
          "code": "F0532",
          "created": "2015-10-26T14:29:49.682+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:disabled(connected), used by:Controller,EPG,Infra",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590884520",
          "domain": "access",
          "highestSeverity": "critical",
          "id": "8590884520",
          "ind": "modification",
          "lc": "soaking-clearing",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "critical",
          "prevSeverity": "critical",
          "rule": "ethpm-if-port-down-infra-epg",
          "severity": "critical",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    },
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "lastLinkStChg (New: 2015-10-26T14:29:49.550+00:00), operBitset (New: 4,7,35), operSt (New: down), operStQual (New: admin-config-change), userCfgdFlags (New: 5)",
          "childAction": "",
          "code": "F0532",
          "created": "2015-10-26T14:29:49.572+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:adminCfgChng(connected), used by:Controller,EPG,Infra",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590884519",
          "domain": "access",
          "highestSeverity": "critical",
          "id": "8590884519",
          "ind": "modification",
          "lc": "soaking",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "critical",
          "prevSeverity": "critical",
          "rule": "ethpm-if-port-down-infra-epg",
          "severity": "critical",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    },
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "bundleBupId (New: 3), lastLinkStChg (New: 2015-10-26T14:29:19.541+00:00), operBitset (New: 4,35), operSt (New: link-up)",
          "childAction": "",
          "code": "F0546",
          "created": "2015-10-26T14:29:19.544+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:notconnect(connected), used by:Discovery",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590884510",
          "domain": "access",
          "highestSeverity": "warning",
          "id": "8590884510",
          "ind": "modification",
          "lc": "soaking-clearing",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "warning",
          "prevSeverity": "warning",
          "rule": "ethpm-if-port-down-no-infra",
          "severity": "warning",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    },
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "operBitset (New: 4,7,35), usage (New: discovery)",
          "childAction": "",
          "code": "F0546",
          "created": "2015-10-26T14:29:17.608+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:notconnect(connected), used by:Discovery",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590884507",
          "domain": "access",
          "highestSeverity": "warning",
          "id": "8590884507",
          "ind": "creation",
          "lc": "soaking",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "warning",
          "prevSeverity": "warning",
          "rule": "ethpm-if-port-down-no-infra",
          "severity": "warning",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    },
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "operBitset (New: 4,7,35), usage (New: discovery)",
          "childAction": "",
          "code": "F0532",
          "created": "2015-10-26T14:29:17.597+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:notconnect(connected), used by:Controller,EPG,Infra",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590884506",
          "domain": "access",
          "highestSeverity": "critical",
          "id": "8590884506",
          "ind": "modification",
          "lc": "soaking-clearing",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "critical",
          "prevSeverity": "critical",
          "rule": "ethpm-if-port-down-infra-epg",
          "severity": "critical",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    },
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "lastLinkStChg (New: 2015-10-26T14:29:17.304+00:00), operSt (New: down), operStQual (New: initializing)",
          "childAction": "",
          "code": "F0532",
          "created": "2015-10-26T14:29:17.310+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:init(connected), used by:Controller,EPG,Infra",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590884505",
          "domain": "access",
          "highestSeverity": "critical",
          "id": "8590884505",
          "ind": "creation",
          "lc": "soaking",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "critical",
          "prevSeverity": "critical",
          "rule": "ethpm-if-port-down-infra-epg",
          "severity": "critical",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    },
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "lastLinkStChg (New: 2015-10-08T12:48:12.471+00:00), operBitset (New: 3-4), operSt (New: up), operStQual (New: none), resetCtr (New: 2)",
          "childAction": "",
          "code": "F0546",
          "created": "2015-10-08T12:50:32.750+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:notconnect(connected), used by:Discovery",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590501708",
          "domain": "access",
          "highestSeverity": "warning",
          "id": "8590501708",
          "ind": "modification",
          "lc": "retaining",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "warning",
          "prevSeverity": "warning",
          "rule": "ethpm-if-port-down-no-infra",
          "severity": "cleared",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    },
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "bundleBupId (New: 3), lastLinkStChg (New: 2015-10-08T12:48:12.471+00:00), operSt (New: up)",
          "childAction": "",
          "code": "F0546",
          "created": "2015-10-08T12:48:12.473+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:notconnect(connected), used by:Discovery",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590501706",
          "domain": "access",
          "highestSeverity": "warning",
          "id": "8590501706",
          "ind": "modification",
          "lc": "soaking-clearing",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "warning",
          "prevSeverity": "warning",
          "rule": "ethpm-if-port-down-no-infra",
          "severity": "warning",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    },
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "lastLinkStChg (New: 2015-10-08T12:48:05.747+00:00), operSt (New: down), operStQual (New: link-failure)",
          "childAction": "",
          "code": "F0546",
          "created": "2015-10-08T12:48:05.751+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:notconnect(connected), used by:Discovery",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590501704",
          "domain": "access",
          "highestSeverity": "warning",
          "id": "8590501704",
          "ind": "creation",
          "lc": "soaking",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "warning",
          "prevSeverity": "warning",
          "rule": "ethpm-if-port-down-no-infra",
          "severity": "warning",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    },
    {
      "faultRecord": {
        "attributes": {
          "ack": "no",
          "affected": "topology/pod-1/node-101/sys/phys-[eth1/2]/phys",
          "cause": "interface-physical-down",
          "changeSet": "lastLinkStChg (New: 2015-09-15T14:46:35.651+00:00), operBitset (New: 3-4), operSt (New: up), operStQual (New: none), resetCtr (New: 7)",
          "childAction": "",
          "code": "F0546",
          "created": "2015-09-15T15:48:41.681+00:00",
          "delegatedFrom": "",
          "descr": "Port is down, reason:notconnect(connected), used by:Discovery",
          "dn": "subj-[topology/pod-1/node-101/sys/phys-[eth1/2]/phys]/fr-8590390136",
          "domain": "access",
          "highestSeverity": "warning",
          "id": "8590390136",
          "ind": "deletion",
          "lc": "",
          "modTs": "never",
          "occur": "1",
          "origSeverity": "warning",
          "prevSeverity": "warning",
          "rule": "ethpm-if-port-down-no-infra",
          "severity": "cleared",
          "status": "",
          "subject": "port-down",
          "type": "communications"
        }
      }
    }
  ]
}

 

Let me see if we have any other way of querying for interface uptime so I can get back to you.

 

Thanks,

 

Mike Ripley

 

Thanks it helped! 

Is there any mechanism to calculate the switchover time in APIC ? As in, i shut down the port 1/n in a leaf node and the traffic switches over to another port in the leaf node. So is there any way i can find out how to measure this switchover time in Leaf/Spine Nodes ? 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

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