Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(cv_device_v3): device decommissioning fails if a device is not streaming and not provisioned #700

Merged
merged 5 commits into from
Jul 24, 2024

Conversation

noredistribution
Copy link
Contributor

Change Summary

Sometimes devices can go offline and be deleted from Network Provisioning,currently we only check provisioned devices when getting their facts instead of checking devices are in the inventory (that contains both provisioned and unprovisioned devices)

With this change instead of getting each device data with single gets (that's only fetching provisioned devices), I get the full inventory (both provisioned and unprovisioned devices) and then figure out the serialNumber from there and decommission that

Related Issue(s)

Fixes #657

Component(s) name

arista.cvp.cv_device_v3

Proposed changes

How to test

Pick a device that is not streaming (shutdown TerminAttr to test if you don't have one), go to Network Provisioning, right click on the device and select remove, click save and then run the below playbook

- name: Decommission device
  hosts: cv_server
  connection: local
  gather_facts: no
  vars:
    CVP_DEVICES:
      - fqdn: "leaf1"
        parentContainerName: ""

  tasks:
  - name: decommission device
    arista.cvp.cv_device_v3:
        devices: '{{CVP_DEVICES}}'
        state: absent

Checklist

User Checklist

  • N/A

Repository Checklist

  • [x ] My code has been rebased from devel before I start
  • [ x] I have read the CONTRIBUTING document.
  • My change requires a change to the documentation and documentation have been updated accordingly. (check the box if not applicable)
  • I have updated molecule CI testing accordingly. (check the box if not applicable)

@github-actions github-actions bot added module: cv_device_v3 Issue related to cv_device module in v3 module_utils: cv_client cv_client implementation issue labels Jul 5, 2024
@sugetha24 sugetha24 marked this pull request as ready for review July 16, 2024 18:07
Copy link
Contributor

@sugetha24 sugetha24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tested on ATD environment

@alexeygorbunov
Copy link
Contributor

Tested against ATD and custom on-prem CVP (2024.1.2). Worked OK in both environments

@sugetha24 sugetha24 merged commit 32bd1eb into aristanetworks:devel Jul 24, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: cv_device_v3 Issue related to cv_device module in v3 module_utils: cv_client cv_client implementation issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug(cv_device_v3): device decommissioning fails if a device is not streaming and not provisioned
3 participants