03-17-2023 11:24 AM
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".
Solved! Go to Solution.
03-18-2023 12:01 AM
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?
03-18-2023 12:01 AM
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?
03-21-2023 02:35 PM - edited 03-21-2023 02:37 PM
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":
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide