cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
842
Views
4
Helpful
2
Replies

Yang Model/RPC call for "Request Platform Software Package Clean"

BradRenner
Level 1
Level 1

I am trying to automate the upgrading of an IOS XE device using REST/RESTCONF and the accompanying YANG data models. I am trying to find the yang model or RPC call that would accomplish the cleaning (deleting) of unused image files on a device's (9200 switch) flash. Similar to "request platform software package clean switch all" or the older syntax "software clean" Cisco IOS commands.

I would like to accomplish something similar, but via the correct Yang model/RPC call with RESTCONF/NETCONF. I can copy a file to the device with this yang model/RPC call "Cisco-IOS-XE-rpc:copy " & then install/upgrade all in one shot with, "Cisco-IOS-XE-install-rpc:install".

 
I have been using Cisco's YangSuite to parse the many Yang modules available for my IOS XE device, but I am still having trouble finding any that will clean the device's flash similar to "request platform software package clean switch all" after we have upgraded the device.  I am finding very little (to no) documentation or examples for a lot of the Yang modules to use with RESTCONF and was hoping someone smarter than me has already made this discovery. Thanks!
1 Accepted Solution

Accepted Solutions

Marcel Zehnder
Spotlight
Spotlight

Does the remove RPC from Cisco-IOS-XE-install-rpc (/install-ios-xe-rpc:remove/install-ios-xe-rpc:input/install-ios-xe-rpc:inactive) work? Or maybe falling back to Cisco-IOS-XE-cli-rpc may work?

 

View solution in original post

2 Replies 2

Marcel Zehnder
Spotlight
Spotlight

Does the remove RPC from Cisco-IOS-XE-install-rpc (/install-ios-xe-rpc:remove/install-ios-xe-rpc:input/install-ios-xe-rpc:inactive) work? Or maybe falling back to Cisco-IOS-XE-cli-rpc may work?

 

Marcel, again thank you for pointing me in the correct direction! Using CISCO-IOS-XE-install-rpc:remove was the yang model we needed. To correctly construct the body of that POST request took some trial and error, but we have a working RESTCONF API call that will now delete (remove) all inactive software images on an IOS XE device running 17.2.x and later (the CISCO-IOS-XE-install-rpc model was introduced in 17.2.x I believe. Later 17.2+ version of IOS XE code works with that model, but any 16.x or 17.1.x version of IOS XE code do not have this Yang model available for use).

 

If anyone else stumbles across this and wonders how to construct the body of this CISCO-IOS-XE-install-rpc:remove POST call, here is what we used for our use case (note we have no UUID to reference here so we just left it blank, but it seems that value is required). This will remove only the "inactive" software files as we marked "inactive: true":

{
    "Cisco-IOS-XE-install-rpc:input" : {
                "uuid" : "",
                "inactive": "true"
    }
}