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

Features/cv containers delete configlets #168

Merged
merged 7 commits into from
Apr 22, 2020

Conversation

titom73
Copy link
Contributor

@titom73 titom73 commented Mar 23, 2020

Types of changes

  • New feature (non-breaking change which adds functionality)

Related Issue(s)

Proposed changes

cv_container now support option to remove configlet(s) from container by
using a new optional keyword. Meantime, this keyword allows user to also
filter configlets to attach to container

Module Behavior:

  • Add new optional input: configlet_filter (list)
  • Addition process:
    • if configlet from intended match filter: configlet is attached
    • if configlet from intended does not match filter: configlet is
      ignored
    • configlet_filter = ['none'] filtering is ignored and configlet is
      attached
  • Deletion process:
    • if configlet is not part of intended and filter is not matched: we do
      not remove it
    • if configlet is not part of intended and filter is matched: we
      detach configlet.
    • configlet_filter = ['none'], configet is ignored and not detached

Well knows filter value:

  • none: fallback mechanism to merge (no deletion and add everything from intended)
  • all: match all

Default value: `configlet_filter=['none']

How to test

  • Attach configlets to containers
CVP_CONTAINERS:
  DC1_FABRIC:
    parent_container: Tenant
  DC1_L3LEAFS:
    parent_container: DC1_FABRIC
    configlets:
      - GLOBAL-ALIASES
      - GLOBAL-ALIASES2

With tasks:

---
- name: Rebind configlet based on basic AVD
  hosts: cv_server
  connection: local
  gather_facts: false
  collections:
    - arista.avd
    - arista.cvp
  vars:
    container_root: 'DC1_FABRIC'
    configlets_prefix: 'DC1-AVD'
    device_filter: 'DC1'
    execute_tasks: false
  tasks:
    - name: 'Refreshing facts from CVP {{inventory_hostname}}.'
      arista.cvp.cv_facts:
      register: CVP_FACTS

    - name: "Building Containers topology on {{inventory_hostname}}"
      arista.cvp.cv_container:
        topology: '{{CVP_CONTAINERS}}'
        cvp_facts: '{{CVP_FACTS.ansible_facts}}'
        # configlet_filter: ['all'] == 'none'
  • Remove Container attachement
CVP_CONTAINERS:
  DC1_FABRIC:
    parent_container: Tenant
  DC1_L3LEAFS:
    parent_container: DC1_FABRIC

With tasks:

---
- name: Rebind configlet based on basic AVD
  hosts: cv_server
  connection: local
  gather_facts: false
  collections:
    - arista.avd
    - arista.cvp
  vars:
    container_root: 'DC1_FABRIC'
    configlets_prefix: 'DC1-AVD'
    device_filter: 'DC1'
    execute_tasks: false
  tasks:
    - name: 'Refreshing facts from CVP {{inventory_hostname}}.'
      arista.cvp.cv_facts:
      register: CVP_FACTS

    - name: "Building Containers topology on {{inventory_hostname}}"
      arista.cvp.cv_container:
        topology: '{{CVP_CONTAINERS}}'
        cvp_facts: '{{CVP_FACTS.ansible_facts}}'
        configlet_filter: ['all']

Checklist:

  • All new and existing tests passed (make linting and make sanity-lint).

@titom73
Copy link
Contributor Author

titom73 commented Mar 23, 2020

/rebase

@titom73 titom73 self-assigned this Mar 23, 2020
@titom73 titom73 added module: cv_container Issue related to cv_container module state: accepted Issue is part of the development roadmap status: in-progress Currently under investigation or implementation type: enhancement New feature or request labels Mar 23, 2020
cv_container now support option to remove configlet(s) from container by
using a new optional keyword. Meantime, this keyword allows user to also
filter configlets to attach to container

Module Behavior:
----------------

- Add new optional input: configlet_filter (list)
- Addition process:
  - if configlet from intended match filter: configlet is attached
  - if configlet from intended does not match filter: configlet is
  ignored
  - configlet_filter = ['none'] filtering is ignored and configlet is
  attached
- Deletion process:
  - if configlet is not part of intended and filter is not matched: we do
  not remove it
  - if configlet is not part of intended and filter is matched: we
  detach configlet.
  - configlet_filter = ['none'], configet is ignored and not detached

Well knows filter value:
------------------------

- 'none': fallback mechanism to merge (no deletion and add everything from intended)
- 'all': match all

Default value: `configlet_filter=['none']`
@github-actions github-actions bot force-pushed the features/cv-containers-delete-configlets branch from 1d8b0ab to aab295e Compare March 23, 2020 18:14
@titom73 titom73 added this to the v1.1 milestone Mar 23, 2020
@titom73 titom73 mentioned this pull request Apr 3, 2020
4 tasks
titom73 added a commit that referenced this pull request Apr 3, 2020
- Backport function from #158
- Backport function from #168
- Run Linting
- Ansible Linting

Linting output:
---------------

```
$ make linting
sh .github/pre-commit
Validating PEP8 compliance...
------------------------------------------------------------------------------------------------------------
  - Modules validation
Using config file ansible-cvp/pylintrc

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

------------------------------------------------------------------------------------------------------------
  - Module Utils validation
Using config file ansible-cvp/pylintrc

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
```
@titom73 titom73 marked this pull request as ready for review April 3, 2020 08:46
@titom73 titom73 merged commit 480f256 into releases/v1.1.x Apr 22, 2020
@titom73 titom73 deleted the features/cv-containers-delete-configlets branch April 22, 2020 13:14
@titom73 titom73 mentioned this pull request Apr 22, 2020
@titom73 titom73 added the status: testing PR under testing label Apr 24, 2020
@titom73 titom73 removed state: accepted Issue is part of the development roadmap status: in-progress Currently under investigation or implementation labels May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: cv_container Issue related to cv_container module status: testing PR under testing type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant