Skip to content

Commit

Permalink
Fix ansible-lint failures
Browse files Browse the repository at this point in the history
  • Loading branch information
santhosh-kt committed Sep 25, 2024
1 parent b7bf90f commit bd8aa00
Show file tree
Hide file tree
Showing 8 changed files with 426 additions and 427 deletions.
646 changes: 323 additions & 323 deletions plugins/modules/sonic_vrrp.py

Large diffs are not rendered by default.

89 changes: 44 additions & 45 deletions tests/regression/roles/sonic_vrrp/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
ansible_connection: httpapi
module_name: vrrp

vrf1: "VrfReg1"
vrf2: "VrfReg2"
sonic_vrrp_test_vars:
vrf1: "VrfReg1"
vrf2: "VrfReg2"
po1: "PortChannel100"
po2: "PortChannel101"
vlan1: "vlan100"
vlan2: "vlan101"

po1: "PortChannel100"
po2: "PortChannel101"

vlan1: "Vlan100"
vlan2: "Vlan101"

preparations_tests:
sonic_vrrp_preparation_task_input:
vrfs:
- name: '{{ vrf1 }}'
- name: '{{ vrf2 }}'
- name: '{{ sonic_vrrp_test_vars.vrf1 }}'
- name: '{{ sonic_vrrp_test_vars.vrf2 }}'
lag_interfaces:
- name: '{{ po1 }}'
- name: '{{ po2 }}'
- name: '{{ sonic_vrrp_test_vars.po1 }}'
- name: '{{ sonic_vrrp_test_vars.po2 }}'
vlans:
- vlan_id: 100
- vlan_id: 101
Expand All @@ -36,36 +35,36 @@ preparations_tests:
ipv6:
addresses:
- address: 90::1/64
- name: '{{ vlan1 }}'
- name: '{{ sonic_vrrp_test_vars.vlan1 }}'
ipv4:
addresses:
- address: 81.1.1.1/24
ipv6:
addresses:
- address: 81::1/64
- name: '{{ vlan2 }}'
- name: '{{ sonic_vrrp_test_vars.vlan2 }}'
ipv4:
addresses:
- address: 91.1.1.1/24
ipv6:
addresses:
- address: 91::1/64
- name: '{{ po1 }}'
- name: '{{ sonic_vrrp_test_vars.po1 }}'
ipv4:
addresses:
- address: 101.1.1.1/24
ipv6:
addresses:
- address: 101::1/64
- name: '{{ po2 }}'
- name: '{{ sonic_vrrp_test_vars.po2 }}'
ipv4:
addresses:
- address: 102.1.1.1/24
ipv6:
addresses:
- address: 102::1/64

tests:
sonic_vrrp_tests:
- name: test_case_01
description: Add VRRP and VRRP6 configuration
state: merged
Expand All @@ -77,7 +76,7 @@ tests:
virtual_address:
- address: 80.1.1.3
- address: 80.1.1.4
preempt: True
preempt: true
- virtual_router_id: 10
afi: ipv6
virtual_address:
Expand All @@ -96,7 +95,7 @@ tests:
afi: ipv4
virtual_address:
- address: 90.1.1.4
preempt: True
preempt: true
priority: 20
- name: test_case_02
description: Modify VRRP and VRRP6 configuration
Expand All @@ -108,8 +107,8 @@ tests:
afi: ipv4
virtual_address:
- address: 80.1.1.5
preempt: False
use_v2_checksum: True
preempt: false
use_v2_checksum: true
- virtual_router_id: 10
afi: ipv6
virtual_address:
Expand All @@ -134,7 +133,7 @@ tests:
virtual_address:
- address: 90::10
priority: 20
- name: '{{ vlan1 }}'
- name: '{{ sonic_vrrp_test_vars.vlan1 }}'
group:
- virtual_router_id: 12
afi: ipv6
Expand All @@ -148,18 +147,18 @@ tests:
description: Update VRRP and VRRP6 configuration
state: merged
input:
- name: '{{ vlan1 }}'
- name: '{{ sonic_vrrp_test_vars.vlan1 }}'
group:
- virtual_router_id: 1
afi: ipv4
virtual_address:
- address: 81.1.1.4
- address: 81.1.1.5
preempt: False
preempt: false
track_interface:
- interface: '{{ interface5 }}'
priority_increment: 25
- name: '{{ po1 }}'
- name: '{{ sonic_vrrp_test_vars.po1 }}'
group:
- virtual_router_id: 25
afi: ipv4
Expand All @@ -170,7 +169,7 @@ tests:
afi: ipv6
virtual_address:
- address: 101::3
- name: '{{ po2 }}'
- name: '{{ sonic_vrrp_test_vars.po2 }}'
group:
- virtual_router_id: 20
afi: ipv4
Expand All @@ -181,14 +180,14 @@ tests:
virtual_address:
- address: 102::3
advertisement_interval: 10
- name: '{{ vlan2 }}'
- name: '{{ sonic_vrrp_test_vars.vlan2 }}'
group:
- virtual_router_id: 1
afi: ipv4
virtual_address:
- address: 91.1.1.3
- address: 91.1.1.5
preempt: True
preempt: true
- virtual_router_id: 2
afi: ipv6
virtual_address:
Expand All @@ -200,14 +199,14 @@ tests:
description: Delete VRRP and VRRP6 configuration
state: deleted
input:
- name: '{{ vlan1 }}'
- name: '{{ sonic_vrrp_test_vars.vlan1 }}'
group:
- virtual_router_id: 1
afi: ipv4
virtual_address:
- address: 81.1.1.5
preempt: False
- name: '{{ po2 }}'
preempt: false
- name: '{{ sonic_vrrp_test_vars.po2 }}'
group:
- virtual_router_id: 20
afi: ipv4
Expand All @@ -231,7 +230,7 @@ tests:
afi: ipv4
virtual_address:
- address: 90.1.1.4
preempt: True
preempt: true
- name: test_case_05
description: Delete VRRP and VRRP6 configuration
state: deleted
Expand All @@ -247,7 +246,7 @@ tests:
track_interface:
- interface: '{{ interface5 }}'
priority_increment: 10
- name: '{{ vlan1 }}'
- name: '{{ sonic_vrrp_test_vars.vlan1 }}'
group:
- virtual_router_id: 12
afi: ipv6
Expand All @@ -258,15 +257,15 @@ tests:
description: Replace VRRP and VRRP6 configuration by VRRP/VRRP6 groups
state: replaced
input:
- name: '{{ vlan2 }}'
- name: '{{ sonic_vrrp_test_vars.vlan2 }}'
group:
- virtual_router_id: 2
afi: ipv6
preempt: False
preempt: false
- virtual_router_id: 10
afi: ipv4
version: 2
use_v2_checksum: True
use_v2_checksum: true
- name: '{{ interface1 }}'
group:
- virtual_router_id: 15
Expand All @@ -279,45 +278,45 @@ tests:
group:
- virtual_router_id: 10
afi: ipv4
preempt: False
preempt: false
priority: 20
- virtual_router_id: 13
afi: ipv6
- name: test_case_over_01
description: Override VRRP and VRRP6 configuration
state: overridden
input:
- name: '{{ po1 }}'
- name: '{{ sonic_vrrp_test_vars.po1 }}'
group:
- virtual_router_id: 11
afi: ipv6
virtual_address:
- address: 101::11
track_interface:
- interface: '{{ po2 }}'
- interface: '{{ sonic_vrrp_test_vars.po2 }}'
priority_increment: 10
- name: '{{ po2 }}'
- name: '{{ sonic_vrrp_test_vars.po2 }}'
group:
- virtual_router_id: 15
afi: ipv6
virtual_address:
- address: 102::15
- address: 102::16
advertisement_interval: 20
- name: '{{ vlan2 }}'
- name: '{{ sonic_vrrp_test_vars.vlan2 }}'
group:
- virtual_router_id: 20
afi: ipv4
virtual_address:
- address: 91.1.1.4
preempt: False
preempt: false
- name: test_case_06
description: Delete all VRRP and VRRP6 configurations for specified interface
state: deleted
input:
- name: '{{ po1 }}'
- name: '{{ sonic_vrrp_test_vars.po1 }}'
group: []
- name: '{{ po2 }}'
- name: '{{ sonic_vrrp_test_vars.po2 }}'
group: []
- name: test_case_07
description: Delete all VRRP and VRRP6 configurations
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/roles/sonic_vrrp/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
collections:
- dellemc.enterprise_sonic
dependencies:
- { role: common }
- { role: common }
18 changes: 9 additions & 9 deletions tests/regression/roles/sonic_vrrp/tasks/cleanup_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
dellemc.enterprise_sonic.sonic_vrrp:
config: []
state: deleted
ignore_errors: yes
failed_when: false

- name: Delete l3 configurations on test interfaces
dellemc.enterprise_sonic.sonic_l3_interfaces:
config: "{{ preparations_tests.l3_interfaces }}"
config: "{{ sonic_vrrp_preparation_task_input.l3_interfaces }}"
state: deleted
ignore_errors: yes
failed_when: false

- name: Delete test VRFs
dellemc.enterprise_sonic.sonic_vrfs:
config: "{{ preparations_tests.vrfs }}"
config: "{{ sonic_vrrp_preparation_task_input.vrfs }}"
state: deleted
ignore_errors: yes
failed_when: false

- name: Delete test VLANs
dellemc.enterprise_sonic.sonic_vlans:
config: "{{ preparations_tests.vlans }}"
config: "{{ sonic_vrrp_preparation_task_input.vlans }}"
state: deleted
ignore_errors: yes
failed_when: false

- name: Delete test lag interfaces
dellemc.enterprise_sonic.sonic_lag_interfaces:
config: "{{ preparations_tests.lag_interfaces }}"
config: "{{ sonic_vrrp_preparation_task_input.lag_interfaces }}"
state: deleted
ignore_errors: yes
failed_when: false
11 changes: 4 additions & 7 deletions tests/regression/roles/sonic_vrrp/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
---
- ansible.builtin.debug:
msg: "sonic_vrrp Test started ..."

- name: "Preparations for {{ module_name }}"
- name: "Preparations for test"
ansible.builtin.include_tasks: preparation_tests.yaml

- name: "Test {{ module_name }} started"
- name: "Test started ..."
ansible.builtin.include_tasks: tasks_template.yaml
loop: "{{ tests }}"
loop: "{{ sonic_vrrp_tests }}"

- name: "Cleanup of {{ module_name }}"
- name: "Cleanup started ..."
ansible.builtin.include_tasks: cleanup_tests.yaml
20 changes: 10 additions & 10 deletions tests/regression/roles/sonic_vrrp/tasks/preparation_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,36 @@
dellemc.enterprise_sonic.sonic_vrrp:
config: []
state: deleted
ignore_errors: yes
failed_when: false

- name: Initialize default interfaces
vars:
ansible_connection: network_cli
dellemc.enterprise_sonic.sonic_config:
commands: "{{ default_interface_cli }}"
register: output
ignore_errors: yes
failed_when: false

- name: Create VRFs
dellemc.enterprise_sonic.sonic_vrfs:
config: "{{ preparations_tests.vrfs }}"
config: "{{ sonic_vrrp_preparation_task_input.vrfs }}"
state: merged
ignore_errors: yes
failed_when: false

- name: Create lag interfaces
dellemc.enterprise_sonic.sonic_lag_interfaces:
config: "{{ preparations_tests.lag_interfaces }}"
config: "{{ sonic_vrrp_preparation_task_input.lag_interfaces }}"
state: merged
ignore_errors: yes
failed_when: false

- name: Create VLANs
dellemc.enterprise_sonic.sonic_vlans:
config: "{{ preparations_tests.vlans }}"
config: "{{ sonic_vrrp_preparation_task_input.vlans }}"
state: merged
ignore_errors: yes
failed_when: false

- name: Configure l3 interfaces
dellemc.enterprise_sonic.sonic_l3_interfaces:
config: "{{ preparations_tests.l3_interfaces }}"
config: "{{ sonic_vrrp_preparation_task_input.l3_interfaces }}"
state: merged
ignore_errors: yes
failed_when: false
Loading

0 comments on commit bd8aa00

Please sign in to comment.