Upgrading or Downgrading the Software Using the REST API

You can upgrade the software using the REST API.

Upgrading or Downgrading the Cisco APIC Software Using the REST API

Procedure


Step 1

Download the Cisco APIC image into the repository.

Example:

POST URL: https://<ip address>/api/node/mo/uni/fabric.xml
<firmwareRepoP>
	<firmwareOSource name="APIC_Image_download" proto="http" url="http://<ip address>/<ver-no>"/>
</firmwareRepoP>

Step 2

Post the following policy to set the desired version for controllers:

Example:

POST URL: https://<ip address>/api/node/mo/uni/controller.xml
<firmwareCtrlrFwP
    version="<ver-no>"
    ignoreCompat="true">
</firmwareCtrlrFwP>

Step 3

Post the following policy to trigger the controller upgrade immediately:

Example:

POST URL : https://<ip address>/api/node/mo/uni/controller.xml
<maintCtrlrMaintP
    adminState="up" adminSt="triggered">
</maintCtrlrMaintP>

Upgrading or Downgrading Switches Software Using the REST API

Procedure


Step 1

Download the switch image into the repository.

Example:

POST URL: https://<ip address>/api/node/mo/uni/fabric.xml
<firmwareRepoP>
	<firmwareOSource name="Switch_Image_download" proto="http" url="http://<ip address>/<ver-no>"/>
</firmwareRepoP>

Step 2

Post the appropriate policies to create a firmware group and a maintenance group with the necessary node IDs, depending on your software release:

  • For releases prior to Release 4.0(1), post the following policies to create a firmware group that consists of your switches with node IDs 101, 102, 103, 104, and to create a maintenance group with node IDs 101, 102, 103, 104:

    POST URL : https://<ip address>/api/node/mo/uni/fabric.xml
    <fabricInst>
    <firmwareFwP
        name="AllswitchesFwP"
        version="<ver-no>"
        ignoreCompat="true">
    </firmwareFwP>
    
    <firmwareFwGrp
        name="AllswitchesFwGrp" >
            <fabricNodeBlk name="Blk101"
                from_="101" to_="101">
            </fabricNodeBlk>
            <fabricNodeBlk name="Blk102"
                from_="102" to_="102">
            </fabricNodeBlk>
            <fabricNodeBlk name="Blk103"
                from_="103" to_="103">
            </fabricNodeBlk>
            <fabricNodeBlk name="Blk104"
                from_="104" to_="104">
            </fabricNodeBlk>
    <firmwareRsFwgrpp
        tnFirmwareFwPName="AllswitchesFwP">
    </firmwareRsFwgrpp>
    </firmwareFwGrp>
    
    <maintMaintP
        name="AllswitchesMaintP"
        runMode="pauseOnlyOnFailures" >
    </maintMaintP>
    
    <maintMaintGrp
        name="AllswitchesMaintGrp">
            <fabricNodeBlk name="Blk101"
                from_="101" to_="101">
            </fabricNodeBlk>
            <fabricNodeBlk name="Blk102"
                from_="102" to_="102">
            </fabricNodeBlk>
            <fabricNodeBlk name="Blk103"
                from_="103" to_="103">
            </fabricNodeBlk>
            <fabricNodeBlk name="Blk104"
                from_="104" to_="104">
            </fabricNodeBlk>
    <maintRsMgrpp
        tnMaintMaintPName="AllswitchesMaintP">
    </maintRsMgrpp>
    </maintMaintGrp>
    </fabricInst>
  • For Release 4.0(1) and later, post the following policies to create a firmware group that consists of your switches with node IDs 101, 102, 103, 104, and to create a maintenance group with node IDs 101, 102, 103, 104:

    POST URL : https://<ip address>/api/node/mo/uni/fabric.xml
    <fabricInst>   
           <maintMaintP
                  version="<ver-no>"
                  name="AllswitchesFwP"
                  runMode="pauseOnlyOnFailures">
           </maintMaintP>
           <maintMaintGrp name="AllswitchesMaintGrp">
                  <fabricNodeBlk name="Blk101" from_="101" to_="101">
                  </fabricNodeBlk>
                  <fabricNodeBlk name="Blk102" from_="102" to_="102">
                  </fabricNodeBlk>
                  <fabricNodeBlk name="Blk103" from_="103" to_="103">
                  </fabricNodeBlk>
                  <fabricNodeBlk name="Blk104" from_="104" to_="104">
                  </fabricNodeBlk>
                  <maintRsMgrpp tnMaintMaintPName="AllswitchesMaintGrp">
                  </maintRsMgrpp>
           </maintMaintGrp>
    </fabricInst>
    
  • For Release 5.1(1) and later, post the following policies to create a firmware group that consists of your switches with node IDs 101, 102, 103, 104, and to create a maintenance group with node IDs 101, 102, 103, 104:

    • Pre-upgrade validator (APIC)

      For APIC pre-validation
      GET URL - https://<ip address>/mqapi2/deployment.query.json?mode=validateCtrlrMaintP&targetVersion=
      b. 
      
      For Switch pre-validation
      POST URL - https://<ip address>/mqapi2/deployment.query.xml?mode=validateSwitchMaintPAsync
      <syntheticMaintPSwitchDetails maintPName="
      
    • Pre-Download Images to the Leaf and Spine Switches
      POST URL - https://<ip address>/api/node/mo/uni/fabric.xml
                          <fabricInst>
                      <maintMaintP downloadSt="triggered" name="
                      </maintMaintP>
                      <maintMaintGrp name="
                             <fabricNodeBlk name="blk102" from_="102" to_="102">
                             </fabricNodeBlk>
                             <maintRsMgrpp  tnMaintMaintPName="
                             </maintRsMgrpp>
                      </maintMaintGrp>
              </fabricInst>
      
    • Graceful Upgrade
      POST URL - https://<ip address>/api/node/mo/uni/fabric.xml
                          <fabricInst>
                      <maintMaintP downloadSt="triggered" name="
                      </maintMaintP>
                      <maintMaintGrp name="
                             <fabricNodeBlk name="blk102" from_="102" to_="102">
                             </fabricNodeBlk>
                             <maintRsMgrpp  tnMaintMaintPName="
                             </maintRsMgrpp>
                      </maintMaintGrp>
              </fabricInst>

Step 3

Post the following policy to trigger the upgrade of all switches immediately:

Example:

POST URL : https://<ip address>/api/node/mo/uni/fabric.xml
<maintMaintP
    name="AllswitchesMaintP" adminSt="triggered">
</maintMaintP>
The Cisco APICs are upgraded serially so that the controller cluster is available during the upgrade.

Upgrading or Downgrading the Catalog Software Version Using the REST API

Typically, the catalog image is upgraded or downgraded when an Cisco APIC image is upgraded or downgraded. However occasionally, a catalog image must be upgraded by the administrator.

Procedure


Upgrade the catalog image.

Example:

http://trunk6-ifc1/api/node/mo/uni/fabric.xml
<firmwareCatFwP
    version=“catalog-1.0(1e)”  ignoreCompat=“yes” />
</firmwareCatFwP>

Verifying the Firmware Version and the Upgrade Status Using the API

Verification Description Example URL

For the current running firmware version on controllers

GET URL: https://<ip address>/api/node/class/firmwareCtrlrRunning.xml

For the currently operating firmware version on switches

GET URL: https://<ip address>/api/node/class/firmwareRunning.xml

For the upgrade status of controllers and switches

GET URL: https://<ip address>/api/node/class/maintUpgJob.xml

Upgrade Examples

Controller Upgrade Examples

Download Cisco APIC image into repository

POST URL: http://trunk6-ifc1/api/node/mo/uni/fabric.xml
<firmwareRepoP>
	<firmwareOSource name="APIC_Image_download" proto="http" url="http://172.21.158.190/aci-apic-dk9.1.0.0.72.iso"/>
</firmwareRepoP>

Download switch image into repository

POST URL: http://trunk6-ifc1/api/node/mo/uni/fabric.xml
<firmwareRepoP>
	<firmwareOSource name="Switch_Image_download" proto="http" url="http://172.21.158.190/aci-n9000-dk9.11.0.0.775.bin"/>
</firmwareRepoP>

Controller Firmware Policy - set the desired version for controllers

POST URL: http://trunk6-ifc1/api/node/mo/uni/controller.xml
<firmwareCtrlrFwP
   	 version="apic-1.0(0.72)"
   	 ignoreCompat="true">
</firmwareCtrlrFwP>

Controller Maintenance Policy – trigger upgrade on controllers starting now

POST URL: http://trunk6-ifc1/api/node/mo/uni/controller.xml
<maintCtrlrMaintP
	adminState="up" adminSt="triggered">
</maintCtrlrMaintP>

Get current running version on controllers

(all controllers) GET URL : http://trunk6-ifc1.insieme.local/api/node/class/firmwareCtrlrRunning.xml
(a controller) GET URL : http://trunk6-ifc1.insieme.local/api/node/mo/topology/pod-1/node-1/sys/ctrlrfwstatuscont/ctrlrrunning.xml

Get upgrade status of controllers

(all controllers) GET URL : http://trunk6-ifc1.insieme.local/api/node/class/maintUpgJob.xml
(a controllers) GET URL : http://trunk6-ifc1.insieme.local/api/node/mo/topology/pod-1/node-1/sys/ctrlrfwstatuscont/upgjob.xml

Switch Upgrade Examples

Switch Firmware Group – Group of switches with same firmware policy

POST URL: http://trunk6-ifc1/api/node/mo/uni/fabric.xml
<firmwareFwGrp name="AllswitchesFwGrp" >
        <fabricNodeBlk name="Blk101to104” from_="101" to_="104” />
       <firmwareRsFwgrpp tnFirmwareFwPName="AllswitchesFwP” />
</firmwareFwGrp>

Switch Firmware Firmware Policy – Set desired version

POST URL: http://trunk6-ifc1/api/node/mo/uni/fabric.xml
<firmwareFwP name="AllswitchesFwP” version="n9000-11.0(0.775)” ignoreCompat="true">
</firmwareFwP>

Switch Maintenance Group – Group of switches with same maintenance policy

POST URL: http://trunk6-ifc1/api/node/mo/uni/fabric.xml
<maintMaintGrp name="AllswitchesMaintGrp">
        <fabricNodeBlk name="Blk101to104” from_="101" to_="104” />
        <maintRsMgrpp tnMaintMaintPName="AllswitchesMaintP” />
</maintMaintGrp>

Switch Maintenance Policy – Setup schedule for maitenance

POST URL: http://trunk6-ifc1/api/node/mo/uni/fabric.xml
<maintMaintP name="AllswitchesMaintP” runMode="pauseOnlyOnFailures" >
</maintMaintP>

Trigger upgrade on Maintenance Group – starting now

POST URL: http://trunk6-ifc1/api/node/mo/uni/fabric.xml
<maintMaintP name="AllswitchesMaintP" adminSt="triggered">
</maintMaintP>

Get current running version on switches

(all switches) GET UR : http://trunk6-ifc1.insieme.local/api/node/class/firmwareRunning.xml
(a switch) GET URL: http://trunk6-ifc1.insieme.local/api/node/mo/topology/pod-1/node-101/sys/fwstatuscont/running.xml

Get upgrade status of switches

(all switches) GET URL: http://trunk6-ifc1.insieme.local/api/node/class/maintUpgJob.xml
(a switch) GET URL: http://trunk6-ifc1.insieme.local/api/node/mo/topology/pod-1/node-101/sys/fwstatuscont/upgjob.xml