diff --git a/plugins/modules/sonic_vrrp.py b/plugins/modules/sonic_vrrp.py index aaed82ae5..151051deb 100644 --- a/plugins/modules/sonic_vrrp.py +++ b/plugins/modules/sonic_vrrp.py @@ -138,379 +138,379 @@ # Before State: # ------------- # -#sonic# show running-configuration interface -#! -#interface Eth1/1 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 81.1.1.1/24 -# ipv6 address 81::1/24 +# sonic# show running-configuration interface # ! -# vrrp 1 address-family ipv4 -# preempt -# vip 81.1.1.3 -# vip 81.1.1.4 +# interface Eth1/1 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 81.1.1.1/24 +# ipv6 address 81::1/24 +# ! +# vrrp 1 address-family ipv4 +# preempt +# vip 81.1.1.3 +# vip 81.1.1.4 +# ! +# vrrp 10 address-family ipv6 +# priority 10 +# advertisement-interval 4 +# vip 81::3 +# vip 81::4 # ! -# vrrp 10 address-family ipv6 -# priority 10 -# advertisement-interval 4 -# vip 81::3 -# vip 81::4 -#! -#interface Eth1/3 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 61.1.1.1/24 +# interface Eth1/3 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 61.1.1.1/24 +# ! +# vrrp 5 address-family ipv4 +# priority 20 +# vip 61.1.1.3 +# ! +# vrrp 15 address-family ipv4 +# priority 20 +# preempt +# vip 61.1.1.4 # ! -# vrrp 5 address-family ipv4 -# priority 20 -# vip 61.1.1.3 -# ! -# vrrp 15 address-family ipv4 -# priority 20 -# preempt -# vip 61.1.1.4 -#! - - name: Delete VRRP and VRRP6 relay configurations - sonic_vrrp: - config: - - name: 'Eth1/1' - group: - - virtual_router_id: 1 - afi: ipv4 - virtual_address: - - address: 81.1.1.4 - preempt: true - - virtual_router_id: 10 - afi: ipv6 - advertisement_interval: 4 - priority: 10 - - name: 'Eth1/3' - group: - - virtual_router_id: 5 - afi: ipv4 - virtual_address: - - address: 61.1.1.3 - priority: 20 - - virtual_router_id: 15 - afi: ipv4 - state: deleted +- name: Delete VRRP and VRRP6 relay configurations + sonic_vrrp: + config: + - name: 'Eth1/1' + group: + - virtual_router_id: 1 + afi: ipv4 + virtual_address: + - address: 81.1.1.4 + preempt: true + - virtual_router_id: 10 + afi: ipv6 + advertisement_interval: 4 + priority: 10 + - name: 'Eth1/3' + group: + - virtual_router_id: 5 + afi: ipv4 + virtual_address: + - address: 61.1.1.3 + priority: 20 + - virtual_router_id: 15 + afi: ipv4 + state: deleted # After State: # ------------ # -#sonic# show running-configuration interface -#! -#interface Eth1/1 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 81.1.1.1/24 -# ipv6 address 81::1/24 +# sonic# show running-configuration interface +# ! +# interface Eth1/1 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 81.1.1.1/24 +# ipv6 address 81::1/24 +# ! +# vrrp 1 address-family ipv4 +# vip 81.1.1.3 +# ! +# vrrp 10 address-family ipv6 +# vip 81::3 +# vip 81::4 # ! -# vrrp 1 address-family ipv4 -# vip 81.1.1.3 +# interface Eth1/3 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 61.1.1.1/24 # ! -# vrrp 10 address-family ipv6 -# vip 81::3 -# vip 81::4 -#! -#interface Eth1/3 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 61.1.1.1/24 -#! # Using merged # # Before State: # ------------- # -#sonic# show running-configuration interface -#! -#interface Eth1/1 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 81.1.1.1/24 -# ipv6 address 81::1/24 -#! -#interface Eth1/3 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 61.1.1.1/24 -#! - - name: Add VRRP and VRRP6 configurations - sonic_vrrp: - config: - - name: 'Eth1/1' - group: - - virtual_router_id: 1 - afi: ipv4 - virtual_address: - - address: 81.1.1.3 - - address: 81.1.1.4 - preempt: true - - virtual_router_id: 10 - afi: ipv6 - virtual_address: - - address: 81::3 - - address: 81::4 - advertisement_interval: 4 - priority: 10 - - name: 'Eth1/3' - group: - - virtual_router_id: 5 - afi: ipv4 - virtual_address: - - address: 61.1.1.3 - priority: 20 - - virtual_router_id: 15 - afi: ipv4 - virtual_address: - - address: 61.1.1.4 - preempt: true - priority: 20 - state: merged +# sonic# show running-configuration interface +# ! +# interface Eth1/1 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 81.1.1.1/24 +# ipv6 address 81::1/24 +# ! +# interface Eth1/3 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 61.1.1.1/24 +# ! +- name: Add VRRP and VRRP6 configurations + sonic_vrrp: + config: + - name: 'Eth1/1' + group: + - virtual_router_id: 1 + afi: ipv4 + virtual_address: + - address: 81.1.1.3 + - address: 81.1.1.4 + preempt: true + - virtual_router_id: 10 + afi: ipv6 + virtual_address: + - address: 81::3 + - address: 81::4 + advertisement_interval: 4 + priority: 10 + - name: 'Eth1/3' + group: + - virtual_router_id: 5 + afi: ipv4 + virtual_address: + - address: 61.1.1.3 + priority: 20 + - virtual_router_id: 15 + afi: ipv4 + virtual_address: + - address: 61.1.1.4 + preempt: true + priority: 20 + state: merged # After State: # ------------ # -#sonic# show running-configuration interface -#! -#interface Eth1/1 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 81.1.1.1/24 -# ipv6 address 81::1/24 +# sonic# show running-configuration interface # ! -# vrrp 1 address-family ipv4 -# preempt -# vip 81.1.1.3 -# vip 81.1.1.4 +# interface Eth1/1 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 81.1.1.1/24 +# ipv6 address 81::1/24 +# ! +# vrrp 1 address-family ipv4 +# preempt +# vip 81.1.1.3 +# vip 81.1.1.4 +# ! +# vrrp 10 address-family ipv6 +# priority 10 +# advertisement-interval 4 +# vip 81::3 +# vip 81::4 # ! -# vrrp 10 address-family ipv6 -# priority 10 -# advertisement-interval 4 -# vip 81::3 -# vip 81::4 -#! -#interface Eth1/3 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 61.1.1.1/24 +# interface Eth1/3 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 61.1.1.1/24 +# ! +# vrrp 5 address-family ipv4 +# priority 20 +# vip 61.1.1.3 +# ! +# vrrp 15 address-family ipv4 +# priority 20 +# preempt +# vip 61.1.1.4 # ! -# vrrp 5 address-family ipv4 -# priority 20 -# vip 61.1.1.3 -# ! -# vrrp 15 address-family ipv4 -# priority 20 -# preempt -# vip 61.1.1.4 -#! # Using replaced # # Before State: # ------------- # -#sonic# show running-configuration interface -#! -#interface Eth1/1 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 81.1.1.1/24 -# ipv6 address 81::1/24 -# ! -# vrrp 1 address-family ipv4 -# preempt -# vip 81.1.1.3 -# vip 81.1.1.4 +# sonic# show running-configuration interface # ! -# vrrp 10 address-family ipv6 -# priority 10 -# advertisement-interval 4 -# vip 81::3 -# vip 81::4 -#! -#interface Eth1/3 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 61.1.1.1/24 +# interface Eth1/1 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 81.1.1.1/24 +# ipv6 address 81::1/24 +# ! +# vrrp 1 address-family ipv4 +# preempt +# vip 81.1.1.3 +# vip 81.1.1.4 +# ! +# vrrp 10 address-family ipv6 +# priority 10 +# advertisement-interval 4 +# vip 81::3 +# vip 81::4 # ! -# vrrp 5 address-family ipv4 -# priority 20 -# vip 61.1.1.3 +# interface Eth1/3 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 61.1.1.1/24 +# ! +# vrrp 5 address-family ipv4 +# priority 20 +# vip 61.1.1.3 +# ! +# vrrp 15 address-family ipv4 +# priority 20 +# preempt +# vip 61.1.1.4 # ! -# vrrp 15 address-family ipv4 -# priority 20 -# preempt -# vip 61.1.1.4 -#! - - name: Replace VRRP and VRRP6 relay configurations - sonic_vrrp: - config: - - name: 'Eth1/1' - group: - - virtual_router_id: 10 - afi: ipv6 - priority: 20 - - name: 'Eth1/3' - group: - - virtual_router_id: 5 - afi: ipv4 - virtual_address: - - address: 61.1.1.5 - preempt: false - track_interface: - - interface: Eth1/1 - priority_increment: 10 - state: replaced +- name: Replace VRRP and VRRP6 relay configurations + sonic_vrrp: + config: + - name: 'Eth1/1' + group: + - virtual_router_id: 10 + afi: ipv6 + priority: 20 + - name: 'Eth1/3' + group: + - virtual_router_id: 5 + afi: ipv4 + virtual_address: + - address: 61.1.1.5 + preempt: false + track_interface: + - interface: Eth1/1 + priority_increment: 10 + state: replaced # After State: # ------------ # -#sonic# show running-configuration interface -#! -#interface Eth1/1 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 81.1.1.1/24 -# ipv6 address 81::1/24 +# sonic# show running-configuration interface # ! -# vrrp 1 address-family ipv4 -# vip 81.1.1.3 -# vip 81.1.1.4 +# interface Eth1/1 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 81.1.1.1/24 +# ipv6 address 81::1/24 +# ! +# vrrp 1 address-family ipv4 +# vip 81.1.1.3 +# vip 81.1.1.4 +# ! +# vrrp 10 address-family ipv6 +# priority 20 # ! -# vrrp 10 address-family ipv6 -# priority 20 -#! -#interface Eth1/3 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 61.1.1.1/24 +# interface Eth1/3 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 61.1.1.1/24 +# ! +# vrrp 5 address-family ipv4 +# no preempt +# vip 61.1.1.5 +# track-interface Eth1/1 weight 10 +# ! +# vrrp 15 address-family ipv4 +# priority 20 +# preempt +# vip 61.1.1.4 # ! -# vrrp 5 address-family ipv4 -# no preempt -# vip 61.1.1.5 -# track-interface Eth1/1 weight 10 -# ! -# vrrp 15 address-family ipv4 -# priority 20 -# preempt -# vip 61.1.1.4 -#! # Using overridden # # Before State: # ------------- # -#sonic# show running-configuration interface -#! -#interface Eth1/1 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 81.1.1.1/24 -# ipv6 address 81::1/24 -# ! -# vrrp 1 address-family ipv4 -# preempt -# vip 81.1.1.3 -# vip 81.1.1.4 +# sonic# show running-configuration interface # ! -# vrrp 10 address-family ipv6 -# priority 10 -# advertisement-interval 4 -# vip 81::3 -# vip 81::4 -#! -#interface Eth1/3 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 61.1.1.1/24 +# interface Eth1/1 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 81.1.1.1/24 +# ipv6 address 81::1/24 +# ! +# vrrp 1 address-family ipv4 +# preempt +# vip 81.1.1.3 +# vip 81.1.1.4 +# ! +# vrrp 10 address-family ipv6 +# priority 10 +# advertisement-interval 4 +# vip 81::3 +# vip 81::4 # ! -# vrrp 5 address-family ipv4 -# priority 20 -# vip 61.1.1.3 +# interface Eth1/3 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 61.1.1.1/24 +# ! +# vrrp 5 address-family ipv4 +# priority 20 +# vip 61.1.1.3 +# ! +# vrrp 15 address-family ipv4 +# priority 20 +# preempt +# vip 61.1.1.4 # ! -# vrrp 15 address-family ipv4 -# priority 20 -# preempt -# vip 61.1.1.4 -#! - - name: Overwrite the VRRP and VRRP6 relay configurations - sonic_vrrp: - config: - - name: 'Eth1/1' - group: - - virtual_router_id: 15 - afi: ipv4 - virtual_address: - - address: 81.1.1.15 - preempt: false - - name: 'Eth1/3' - group: - - virtual_router_id: 5 - afi: ipv4 - - virtual_router_id: 15 - afi: ipv4 - virtual_address: - - address: 61.1.1.5 - state: overridden +- name: Overwrite the VRRP and VRRP6 relay configurations + sonic_vrrp: + config: + - name: 'Eth1/1' + group: + - virtual_router_id: 15 + afi: ipv4 + virtual_address: + - address: 81.1.1.15 + preempt: false + - name: 'Eth1/3' + group: + - virtual_router_id: 5 + afi: ipv4 + - virtual_router_id: 15 + afi: ipv4 + virtual_address: + - address: 61.1.1.5 + state: overridden # After State: # ------------ # -#sonic# show running-configuration interface -#! -#interface Eth1/1 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 81.1.1.1/24 -# ipv6 address 81::1/24 +# sonic# show running-configuration interface # ! -# vrrp 15 address-family ipv4 -# no preempt -# vip 81.1.1.15 -#! -#interface Eth1/3 -# mtu 9100 -# speed 400000 -# fec RS -# no shutdown -# ip address 61.1.1.1/24 +# interface Eth1/1 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 81.1.1.1/24 +# ipv6 address 81::1/24 +# ! +# vrrp 15 address-family ipv4 +# no preempt +# vip 81.1.1.15 # ! -# vrrp 5 address-family ipv4 +# interface Eth1/3 +# mtu 9100 +# speed 400000 +# fec RS +# no shutdown +# ip address 61.1.1.1/24 +# ! +# vrrp 5 address-family ipv4 +# ! +# vrrp 15 address-family ipv4 +# vip 61.1.1.5 # ! -# vrrp 15 address-family ipv4 -# vip 61.1.1.5 -#! """ RETURN = """ before: diff --git a/tests/regression/roles/sonic_vrrp/defaults/main.yml b/tests/regression/roles/sonic_vrrp/defaults/main.yml index 70ab584ba..42159c644 100644 --- a/tests/regression/roles/sonic_vrrp/defaults/main.yml +++ b/tests/regression/roles/sonic_vrrp/defaults/main.yml @@ -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 @@ -36,28 +35,28 @@ 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 @@ -65,7 +64,7 @@ preparations_tests: addresses: - address: 102::1/64 -tests: +sonic_vrrp_tests: - name: test_case_01 description: Add VRRP and VRRP6 configuration state: merged @@ -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: @@ -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 @@ -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: @@ -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 @@ -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 @@ -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 @@ -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: @@ -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 @@ -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 @@ -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 @@ -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 @@ -279,7 +278,7 @@ tests: group: - virtual_router_id: 10 afi: ipv4 - preempt: False + preempt: false priority: 20 - virtual_router_id: 13 afi: ipv6 @@ -287,16 +286,16 @@ tests: 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 @@ -304,20 +303,20 @@ tests: - 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 diff --git a/tests/regression/roles/sonic_vrrp/meta/main.yml b/tests/regression/roles/sonic_vrrp/meta/main.yml index 78f79f8ca..d0ceaf6f5 100644 --- a/tests/regression/roles/sonic_vrrp/meta/main.yml +++ b/tests/regression/roles/sonic_vrrp/meta/main.yml @@ -2,4 +2,4 @@ collections: - dellemc.enterprise_sonic dependencies: - - { role: common } \ No newline at end of file + - { role: common } diff --git a/tests/regression/roles/sonic_vrrp/tasks/cleanup_tests.yaml b/tests/regression/roles/sonic_vrrp/tasks/cleanup_tests.yaml index 62ad2507c..a67e721fd 100644 --- a/tests/regression/roles/sonic_vrrp/tasks/cleanup_tests.yaml +++ b/tests/regression/roles/sonic_vrrp/tasks/cleanup_tests.yaml @@ -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 \ No newline at end of file + failed_when: false diff --git a/tests/regression/roles/sonic_vrrp/tasks/main.yml b/tests/regression/roles/sonic_vrrp/tasks/main.yml index 0cacd7760..9ecd00b3f 100644 --- a/tests/regression/roles/sonic_vrrp/tasks/main.yml +++ b/tests/regression/roles/sonic_vrrp/tasks/main.yml @@ -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 diff --git a/tests/regression/roles/sonic_vrrp/tasks/preparation_tests.yaml b/tests/regression/roles/sonic_vrrp/tasks/preparation_tests.yaml index d387b68cb..d9d4489a0 100644 --- a/tests/regression/roles/sonic_vrrp/tasks/preparation_tests.yaml +++ b/tests/regression/roles/sonic_vrrp/tasks/preparation_tests.yaml @@ -3,7 +3,7 @@ dellemc.enterprise_sonic.sonic_vrrp: config: [] state: deleted - ignore_errors: yes + failed_when: false - name: Initialize default interfaces vars: @@ -11,28 +11,28 @@ 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 \ No newline at end of file + failed_when: false diff --git a/tests/regression/roles/sonic_vrrp/tasks/tasks_template.yaml b/tests/regression/roles/sonic_vrrp/tasks/tasks_template.yaml index 1b7f868cb..b5f156221 100644 --- a/tests/regression/roles/sonic_vrrp/tasks/tasks_template.yaml +++ b/tests/regression/roles/sonic_vrrp/tasks/tasks_template.yaml @@ -1,22 +1,25 @@ --- -- name: "{{ item.name }} , {{ item.description }}" + +- name: "{{ item.name ~ ' , ' ~ item.description }}" dellemc.enterprise_sonic.sonic_vrrp: config: "{{ item.input }}" state: "{{ item.state }}" register: action_task_output - ignore_errors: yes + ignore_errors: true -- ansible.builtin.import_role: +- name: "Update test report" + ansible.builtin.import_role: name: common tasks_from: action.facts.report.yaml -- name: "{{ item.name }} , {{ item.description }} Idempotent" +- name: "{{ item.name ~ ' , ' ~ item.description ~ ' Idempotent' }}" dellemc.enterprise_sonic.sonic_vrrp: config: "{{ item.input }}" state: "{{ item.state }}" register: idempotent_task_output - ignore_errors: yes + ignore_errors: true -- ansible.builtin.import_role: +- name: "Update test report" + ansible.builtin.import_role: name: common - tasks_from: idempotent.facts.report.yaml \ No newline at end of file + tasks_from: idempotent.facts.report.yaml diff --git a/tests/unit/modules/network/sonic/fixtures/sonic_vrrp.yaml b/tests/unit/modules/network/sonic/fixtures/sonic_vrrp.yaml index 1dfe2dd21..7fc2adfe3 100644 --- a/tests/unit/modules/network/sonic/fixtures/sonic_vrrp.yaml +++ b/tests/unit/modules/network/sonic/fixtures/sonic_vrrp.yaml @@ -9,7 +9,7 @@ merged_01: virtual_address: - address: 80.1.1.3 - address: 80.1.1.4 - preempt: True + preempt: true - virtual_router_id: 10 afi: ipv6 virtual_address: @@ -31,7 +31,7 @@ merged_01: afi: ipv4 virtual_address: - address: 90.1.1.4 - preempt: True + preempt: true priority: 20 state: merged existing_vrrp_config: @@ -67,7 +67,7 @@ merged_01: - path: 'data/openconfig-interfaces:interfaces/interface=Eth1%2f5/subinterfaces/subinterface=0/openconfig-if-ip:ipv4/addresses/address=1.1.1.1/vrrp/vrrp-group=1/config/preempt' method: 'patch' data: - openconfig-if-ip:preempt: True + openconfig-if-ip:preempt: true - path: 'data/openconfig-interfaces:interfaces/interface=Eth1%2f5/subinterfaces/subinterface=0/openconfig-if-ip:ipv6/addresses/address=1::1/vrrp' method: 'patch' data: @@ -147,7 +147,7 @@ deleted_01: afi: ipv4 virtual_address: - address: 80.1.1.3 - preempt: True + preempt: true - virtual_router_id: 10 afi: ipv6 advertisement_interval: 4 @@ -166,7 +166,7 @@ deleted_01: afi: ipv4 virtual_address: - address: 90.1.1.4 - preempt: True + preempt: true priority: 20 state: deleted existing_vrrp_config: @@ -188,7 +188,7 @@ deleted_01: - config: virtual-router-id: 1 advertisement-interval: 1 - preempt: True + preempt: true priority: 100 openconfig-interfaces-ext:use-v2-checksum: false openconfig-interfaces-ext:version: 2 @@ -204,7 +204,7 @@ deleted_01: virtual-router-id: 10 advertisement-interval: 4 priority: 10 - preempt: True + preempt: true virtual-address: - 80::3 - 80::4 @@ -220,7 +220,7 @@ deleted_01: - config: advertisement-interval: virtual-router-id: 5 - preempt: True + preempt: true priority: 20 openconfig-interfaces-ext:use-v2-checksum: false openconfig-interfaces-ext:version: 2 @@ -236,7 +236,7 @@ deleted_01: virtual-router-id: 15 advertisement-interval: 1 priority: 20 - preempt: True + preempt: true openconfig-interfaces-ext:use-v2-checksum: false openconfig-interfaces-ext:version: 2 virtual-address: @@ -282,7 +282,7 @@ deleted_02: - config: virtual-router-id: 1 advertisement-interval: 1 - preempt: True + preempt: true priority: 100 openconfig-interfaces-ext:use-v2-checksum: false openconfig-interfaces-ext:version: 2 @@ -298,7 +298,7 @@ deleted_02: virtual-router-id: 10 advertisement-interval: 4 priority: 10 - preempt: True + preempt: true virtual-address: - 80::3 - 80::4 @@ -314,7 +314,7 @@ deleted_02: - config: advertisement-interval: virtual-router-id: 5 - preempt: True + preempt: true priority: 20 openconfig-interfaces-ext:use-v2-checksum: false openconfig-interfaces-ext:version: 2 @@ -330,7 +330,7 @@ deleted_02: virtual-router-id: 15 advertisement-interval: 1 priority: 20 - preempt: True + preempt: true openconfig-interfaces-ext:use-v2-checksum: false openconfig-interfaces-ext:version: 2 virtual-address: @@ -356,7 +356,7 @@ replaced_01: afi: ipv6 virtual_address: - address: 90::2 - preempt: False + preempt: false track_interface: - priority_increment: 10 interface: 'Eth1/11' @@ -380,7 +380,7 @@ replaced_01: - config: virtual-router-id: 1 advertisement-interval: 1 - preempt: True + preempt: true priority: 100 openconfig-interfaces-ext:use-v2-checksum: false openconfig-interfaces-ext:version: 2 @@ -396,7 +396,7 @@ replaced_01: virtual-router-id: 10 advertisement-interval: 4 priority: 10 - preempt: True + preempt: true virtual-address: - 80::3 - 80::4 @@ -418,7 +418,7 @@ replaced_01: - config: advertisement-interval: virtual-router-id: 5 - preempt: True + preempt: true priority: 20 openconfig-interfaces-ext:use-v2-checksum: false openconfig-interfaces-ext:version: 2 @@ -434,7 +434,7 @@ replaced_01: virtual-router-id: 15 advertisement-interval: 1 priority: 20 - preempt: True + preempt: true openconfig-interfaces-ext:use-v2-checksum: false openconfig-interfaces-ext:version: 2 virtual-address: @@ -475,7 +475,7 @@ replaced_01: - path: 'data/openconfig-interfaces:interfaces/interface=Eth1%2f5/subinterfaces/subinterface=0/openconfig-if-ip:ipv6/addresses/address=1::1/vrrp/vrrp-group=10/config/preempt' method: 'patch' data: - openconfig-if-ip:preempt: False + openconfig-if-ip:preempt: false overridden_01: module_args: @@ -486,7 +486,7 @@ overridden_01: afi: ipv6 virtual_address: - address: 90::2 - preempt: False + preempt: false state: overridden existing_vrrp_config: - path: 'data/openconfig-interfaces:interfaces' @@ -507,7 +507,7 @@ overridden_01: - config: virtual-router-id: 1 advertisement-interval: 1 - preempt: True + preempt: true priority: 100 openconfig-interfaces-ext:use-v2-checksum: false openconfig-interfaces-ext:version: 2 @@ -523,7 +523,7 @@ overridden_01: virtual-router-id: 10 advertisement-interval: 4 priority: 10 - preempt: True + preempt: true virtual-address: - 80::3 - 80::4 @@ -539,7 +539,7 @@ overridden_01: - config: advertisement-interval: virtual-router-id: 5 - preempt: True + preempt: true priority: 20 openconfig-interfaces-ext:use-v2-checksum: false openconfig-interfaces-ext:version: 2 @@ -555,7 +555,7 @@ overridden_01: virtual-router-id: 15 advertisement-interval: 1 priority: 20 - preempt: True + preempt: true openconfig-interfaces-ext:use-v2-checksum: false openconfig-interfaces-ext:version: 2 virtual-address: @@ -593,4 +593,4 @@ overridden_01: - path: 'data/openconfig-interfaces:interfaces/interface=Eth1%2f5/subinterfaces/subinterface=0/openconfig-if-ip:ipv6/addresses/address=1::1/vrrp/vrrp-group=10/config/preempt' method: 'patch' data: - openconfig-if-ip:preempt: False + openconfig-if-ip:preempt: false