Posted on June 5, 2019 6:19 pm
 |  Asked by Maen zakkar
Print Friendly, PDF & Email

Hi there

I’m using cvprac client to make API calls to lab switches through CVP
when I generate this call:
remove_image = client.api.delete_image_bundle(‘imagebundle_1554828184260588159’, ‘EOS-4.20.11M’)
I’m getting an error ” cvprac.cvp_client_errors.CvpApiError: POST: : Request Error: Imagebundle assigned to device/container cannot be deleted”
(for obvious reasons, this image is already assigned to a container)

My question is what is the API call that returns the “Applied containers” when I send the image Key, or image name?

Thanx in advance

Posted by Hugh Adams
Answered on June 6, 2019 8:31 am


Looking at the available calls in cvprac there appears to be no direct method for getting this information, instead you will need to use two API calls.

First use get_containers to get a list of all containers in the CVP topology then parse this list to get the “key” for each container. Once you have the key use this in the second call. The list will comprise of a set of data elements:

“Key”: “string”,
“Name”: “string”,
“CreatedBy”: “string”,
“CreatedOn”: 0,
“Mode”: “expand”

The second API call is get_container_by_id this will return the following:

“associatedConfiglets”: 0,
“associatedSwitches”: 0,
“bundleName”: “string”,
“danzEnabledSwitches”: 0,
“date”: 0,
“name”: “string”,
“parentName”: “string”,
“userId”: “string”

The “bundleName” will have the name of the image bundle applied to that container, you can then use this to match against the image bundle you are looking for.

I hope this helps
Best Regards

Thank you Hugh

(Maen zakkar at June 12, 2019 3:16 pm)

Post your Answer

You must be logged in to post an answer.