aristanetworks/cvprac

CvpApi.create_change_control_v3() needs cc_id in input

freedge opened this issue · 6 comments

I see CvpApi provides a create_change_control method that works for older version of the API, that uses the documented /changeControl/addOrUpdateChangeControl.do service

However for newer versions of the API we should use create_change_control_v3 method instead. This latter requires a cc_id to be given in input, this is very inconvenient as I need to forge an ID by myself, instead of letting CVP create the change and let me use the ID it generates and return. It uses a service /api/v3/services/ccapi.ChangeControl/Update which is missing from the documentation (it is not in the "CVP API Doc"). For my first try, I called it using cc_id= "" (an empty string). This actually created a change control with ID "", which crashes the UI. I deduce the ccapi.ChangeControl/Update service is also missing input validation.

Can you explain how to use the create_change_control_v3 to create a new change control?

Thanks

I also note that when creating a changecontrol through cvprac, the stage name is empty. Is it possible to provide a name, and maybe choose sequential execution of tasks, instead of parallel?

Hi @freedge

I agree with you about the strange behavior regarding the new formatted change control APIs as of CVP 2019.1.0. I actually raised similar concerns internally with regard to having to provide the ccid when creating a change control.

This is the first I've heard of the issue crashing the UI when creating a change control with ID "". I'll look into this. What version of CVP are you running?

CVP development is in the process of converting all APIs into a new format so the docs being out of sync doesn't surprise me as I believe it is planned for many of the REST APIs to be deprecated in future versions as the new APIs are rolled out. I am also in the process of looking into converting cvprac to start using the new API format and I should be able to resolve the issues you mentioned during that process.

I'll need to review the ccapi formatted APIs a bit and then I will update you and answer the rest of your questions.

I run CVP2020.2.3
UI version: 7.3.0
Build hash: 5b6b821b6
Build time: 2020-11-03 17:44:25 UTC

CVP crashed and logged a "TypeError: Cannot read property 'datasetType' of null" at Tt ... /cv/bundle.....js:1:649446)

I was able to go further with the change control creation (by forging a ccid myself, CVP accepts just anything!) but it would be more usable if CVP could just generate one for me.

(btw my goal is to have EOS automatically updated to the last version on some switches. If you have any inputs I take :) )

@freedge thanks for the info. I am in the process of working with the internal CVP dev team to improve these APIs. I will let you know when updates are in the develop branch for testing.

As for your question about updating EOS versions automatically I can look a bit into this and give feedback.

I will also be on vacation for the next couple of weeks and will resume working these items when I return.

For EOS ugrades I asked my SE and also opened https://eos.arista.com/forum/how-to-download-eos-from-a-script/ - I ended up writing something like this https://github.com/freedge/eosautoupgrade/blob/master/upgrade.py
In real life it is triggered by a Jenkins pipeline that is scheduled every day, and it performs some checks (some promql queries to check for any alert) before creating the change. The only thing missing is the auto generated cc_id

@freedge Gotcha. One suggestion I've heard from CVP dev team is to use a uuid generator. I believe this is built into both Python 2 and Python 3. I understand the oddness of having to provide the cc_id and we are in the process of discussing this internally.

The first step of the process for updating these APIs is merged into develop via #179