diff --git a/test/integration/targets/eos_l3_interface/tests/cli/basic.yaml b/test/integration/targets/eos_l3_interface/tests/cli/basic.yaml index cd3d75d5d4..56b96541aa 100644 --- a/test/integration/targets/eos_l3_interface/tests/cli/basic.yaml +++ b/test/integration/targets/eos_l3_interface/tests/cli/basic.yaml @@ -1,22 +1,31 @@ --- -- debug: msg="START eos_l3_interface cli/basic.yaml on connection={{ ansible_connection }}" +- debug: + msg: "START eos_l3_interface cli/basic.yaml on connection={{ ansible_connection }}" - name: Set test interface set_fact: test_interface_1: ethernet1 test_interface_2: ethernet2 + ipv4_addr_1: 192.0.2.5/24 + ipv4_addr_2: 198.51.100.15/24 + ipv4_addr_3: 203.0.113.25/28 + ipv4_addr_4: 203.0.113.225/28 + ipv6_addr_1: 2001:DB8:123::/64 + ipv6_addr_2: 2001:DB8:ABC::/64 + ipv6_addr_3: 2001:DB8::/48 + ipv6_addr_4: 2001:DB8:FFFF::/90 - name: Delete interface ipv4 and ipv6 address(setup) - eos_l3_interface: + eos_l3_interface: &clear name: "{{ test_interface_1 }}" state: absent become: yes register: result - name: Configure interface ipv4 address - eos_l3_interface: + eos_l3_interface: &ipv4 name: "{{ test_interface_1 }}" - ipv4: 192.108.1.1/24 + ipv4: "{{ ipv4_addr_1 }}" state: present become: yes register: result @@ -25,24 +34,21 @@ that: - 'result.changed == true' - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address 192.108.1.1/24" in result.commands' + - '"ip address {{ ipv4_addr_1 }}" in result.commands' - name: Configure interface ipv4 address (idempotent) - eos_l3_interface: - name: "{{ test_interface_1 }}" - ipv4: 192.108.1.1/24 - state: present + eos_l3_interface: *ipv4 become: yes register: result -- assert: +- assert: &unchanged that: - 'result.changed == false' - name: Change interface ipv4 address eos_l3_interface: name: "{{ test_interface_1 }}" - ipv4: 197.108.0.1/24 + ipv4: "{{ ipv4_addr_2 }}" state: present become: yes register: result @@ -51,12 +57,12 @@ that: - 'result.changed == true' - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address 197.108.0.1/24" in result.commands' + - '"ip address {{ ipv4_addr_2 }}" in result.commands' - name: Configure interface ipv6 address - eos_l3_interface: + eos_l3_interface: &ipv6 name: "{{ test_interface_1 }}" - ipv6: fd5d:12c9:2201:1::1/64 + ipv6: "{{ ipv6_addr_1 }}" state: present become: yes register: result @@ -65,24 +71,19 @@ that: - 'result.changed == true' - '"interface {{ test_interface_1 }}" in result.commands' - - '"ipv6 address fd5d:12c9:2201:1::1/64" in result.commands' + - '"ipv6 address {{ ipv6_addr_1 }}" in result.commands' - name: Configure interface ipv6 address (idempotent) - eos_l3_interface: - name: "{{ test_interface_1 }}" - ipv6: fd5d:12c9:2201:1::1/64 - state: present + eos_l3_interface: *ipv6 become: yes register: result -- assert: - that: - - 'result.changed == false' +- assert: *unchanged - name: Change interface ipv6 address eos_l3_interface: name: "{{ test_interface_1 }}" - ipv6: fd58:12c9:2201:1::1/64 + ipv6: "{{ ipv6_addr_2 }}" state: present become: yes register: result @@ -91,12 +92,10 @@ that: - 'result.changed == true' - '"interface {{ test_interface_1 }}" in result.commands' - - '"ipv6 address fd58:12c9:2201:1::1/64" in result.commands' + - '"ipv6 address {{ ipv6_addr_2 }}" in result.commands' - name: Delete interface ipv4 and ipv6 address - eos_l3_interface: - name: "{{ test_interface_1 }}" - state: absent + eos_l3_interface: *clear become: yes register: result @@ -108,12 +107,12 @@ - '"no ipv6 address" in result.commands' - name: Delete interface ipv4 and ipv6 address (idempotent) - eos_l3_interface: - name: "{{ test_interface_1 }}" - state: absent + eos_l3_interface: *clear become: yes register: result +- assert: *unchanged + - name: Delete second interface ipv4 and ipv6 address (setup) eos_l3_interface: name: "{{ test_interface_2 }}" @@ -122,10 +121,10 @@ register: result - name: Configure ipv4 and ipv6 address using aggregate - eos_l3_interface: + eos_l3_interface: &aggregate aggregate: - - { name: "{{ test_interface_1 }}", ipv4: 192.108.1.1/24, ipv6: "fd5d:12c9:2201:2::2/64" } - - { name: "{{ test_interface_2 }}", ipv4: 192.109.1.2/16, ipv6: "fd5e:12c9:2201:3::3/32" } + - { name: "{{ test_interface_1 }}", ipv4: "{{ ipv4_addr_3 }}", ipv6: "{{ ipv6_addr_3 }}" } + - { name: "{{ test_interface_2 }}", ipv4: "{{ ipv4_addr_1 }}", ipv6: "{{ ipv6_addr_1 }}" } become: yes register: result @@ -133,29 +132,24 @@ that: - 'result.changed == true' - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address 192.108.1.1/24" in result.commands' - - '"ipv6 address fd5d:12c9:2201:2::2/64" in result.commands' + - '"ip address {{ ipv4_addr_3 }}" in result.commands' + - '"ipv6 address {{ ipv6_addr_3 }}" in result.commands' - '"interface {{ test_interface_2 }}" in result.commands' - - '"ip address 192.109.1.2/16" in result.commands' - - '"ipv6 address fd5e:12c9:2201:3::3/32" in result.commands' + - '"ip address {{ ipv4_addr_1 }}" in result.commands' + - '"ipv6 address {{ ipv6_addr_1 }}" in result.commands' - name: Configure ipv4 and ipv6 address using aggregate (idempotent) - eos_l3_interface: - aggregate: - - { name: "{{ test_interface_1 }}", ipv4: 192.108.1.1/24, ipv6: "fd5d:12c9:2201:2::2/64" } - - { name: "{{ test_interface_2 }}", ipv4: 192.109.1.2/16, ipv6: "fd5e:12c9:2201:3::3/32" } + eos_l3_interface: *aggregate become: yes register: result -- assert: - that: - - 'result.changed == false' +- assert: *unchanged - name: Change ipv4 and ipv6 address using aggregate eos_l3_interface: aggregate: - - { name: "{{ test_interface_1 }}", ipv4: 193.118.1.1/8, ipv6: "fd5a:12c9:2201:4::4/32" } - - { name: "{{ test_interface_2 }}", ipv4: 192.119.2.2/24, ipv6: "fd5b:12c9:2201:5::5/90" } + - { name: "{{ test_interface_1 }}", ipv4: "{{ ipv4_addr_2 }}", ipv6: "{{ ipv6_addr_2 }}" } + - { name: "{{ test_interface_2 }}", ipv4: "{{ ipv4_addr_4 }}", ipv6: "{{ ipv6_addr_4 }}" } become: yes register: result @@ -163,15 +157,15 @@ that: - 'result.changed == true' - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address 193.118.1.1/8" in result.commands' - - '"ipv6 address fd5a:12c9:2201:4::4/32" in result.commands' + - '"ip address {{ ipv4_addr_2 }}" in result.commands' + - '"ipv6 address {{ ipv6_addr_2 }}" in result.commands' - '"interface {{ test_interface_2 }}" in result.commands' - - '"ip address 192.119.2.2/24" in result.commands' - - '"ipv6 address fd5b:12c9:2201:5::5/90" in result.commands' + - '"ip address {{ ipv4_addr_4 }}" in result.commands' + - '"ipv6 address {{ ipv6_addr_4 }}" in result.commands' - name: Delete ipv4 and ipv6 address using aggregate - eos_l3_interface: + eos_l3_interface: &clear_both aggregate: - { name: "{{ test_interface_1 }}" } - { name: "{{ test_interface_2 }}" } @@ -190,16 +184,11 @@ - '"no ipv6 address" in result.commands' - name: Delete ipv4 and ipv6 address using aggregate (idempotent) - eos_l3_interface: - aggregate: - - { name: "{{ test_interface_1 }}" } - - { name: "{{ test_interface_2 }}" } - state: absent + eos_l3_interface: *clear_both become: yes register: result -- assert: - that: - - 'result.changed == false' +- assert: *unchanged -- debug: msg="END eos_l3_interface cli/basic.yaml on connection={{ ansible_connection }}" +- debug: + msg: "END eos_l3_interface cli/basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/eos_l3_interface/tests/eapi/basic.yaml b/test/integration/targets/eos_l3_interface/tests/eapi/basic.yaml index 21d31f6d87..1918950ca7 100644 --- a/test/integration/targets/eos_l3_interface/tests/eapi/basic.yaml +++ b/test/integration/targets/eos_l3_interface/tests/eapi/basic.yaml @@ -1,22 +1,31 @@ --- -- debug: msg="START eos_l3_interface eapi/basic.yaml on connection={{ ansible_connection }}" +- debug: + msg: "START eos_l3_interface eapi/basic.yaml on connection={{ ansible_connection }}" - name: Set test interface set_fact: test_interface_1: ethernet1 test_interface_2: ethernet2 + ipv4_addr_1: 192.0.2.5/24 + ipv4_addr_2: 198.51.100.15/24 + ipv4_addr_3: 203.0.113.25/28 + ipv4_addr_4: 203.0.113.225/28 + ipv6_addr_1: 2001:DB8:123::/64 + ipv6_addr_2: 2001:DB8:ABC::/64 + ipv6_addr_3: 2001:DB8::/48 + ipv6_addr_4: 2001:DB8:FFFF::/90 - name: Delete interface ipv4 and ipv6 address(setup) - eos_l3_interface: + eos_l3_interface: &clear name: "{{ test_interface_1 }}" state: absent become: yes register: result - name: Configure interface ipv4 address - eos_l3_interface: + eos_l3_interface: &ipv4 name: "{{ test_interface_1 }}" - ipv4: 192.168.1.1/24 + ipv4: "{{ ipv4_addr_1 }}" state: present become: yes register: result @@ -25,24 +34,21 @@ that: - 'result.changed == true' - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address 192.168.1.1/24" in result.commands' + - '"ip address {{ ipv4_addr_1 }}" in result.commands' - name: Configure interface ipv4 address (idempotent) - eos_l3_interface: - name: "{{ test_interface_1 }}" - ipv4: 192.168.1.1/24 - state: present + eos_l3_interface: *ipv4 become: yes register: result -- assert: +- assert: &unchanged that: - 'result.changed == false' - name: Change interface ipv4 address eos_l3_interface: name: "{{ test_interface_1 }}" - ipv4: 197.168.0.1/24 + ipv4: "{{ ipv4_addr_2 }}" state: present become: yes register: result @@ -51,12 +57,12 @@ that: - 'result.changed == true' - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address 197.168.0.1/24" in result.commands' + - '"ip address {{ ipv4_addr_2 }}" in result.commands' - name: Configure interface ipv6 address - eos_l3_interface: + eos_l3_interface: &ipv6 name: "{{ test_interface_1 }}" - ipv6: fd5d:12c9:2201:1::1/64 + ipv6: "{{ ipv6_addr_1 }}" state: present become: yes register: result @@ -65,24 +71,19 @@ that: - 'result.changed == true' - '"interface {{ test_interface_1 }}" in result.commands' - - '"ipv6 address fd5d:12c9:2201:1::1/64" in result.commands' + - '"ipv6 address {{ ipv6_addr_1 }}" in result.commands' - name: Configure interface ipv6 address (idempotent) - eos_l3_interface: - name: "{{ test_interface_1 }}" - ipv6: fd5d:12c9:2201:1::1/64 - state: present + eos_l3_interface: *ipv6 become: yes register: result -- assert: - that: - - 'result.changed == false' +- assert: *unchanged - name: Change interface ipv6 address eos_l3_interface: name: "{{ test_interface_1 }}" - ipv6: fd58:12c9:2201:1::1/64 + ipv6: "{{ ipv6_addr_2 }}" state: present become: yes register: result @@ -91,12 +92,10 @@ that: - 'result.changed == true' - '"interface {{ test_interface_1 }}" in result.commands' - - '"ipv6 address fd58:12c9:2201:1::1/64" in result.commands' + - '"ipv6 address {{ ipv6_addr_2 }}" in result.commands' - name: Delete interface ipv4 and ipv6 address - eos_l3_interface: - name: "{{ test_interface_1 }}" - state: absent + eos_l3_interface: *clear become: yes register: result @@ -108,12 +107,12 @@ - '"no ipv6 address" in result.commands' - name: Delete interface ipv4 and ipv6 address (idempotent) - eos_l3_interface: - name: "{{ test_interface_1 }}" - state: absent + eos_l3_interface: *clear become: yes register: result +- assert: *unchanged + - name: Delete second interface ipv4 and ipv6 address (setup) eos_l3_interface: name: "{{ test_interface_2 }}" @@ -122,10 +121,10 @@ register: result - name: Configure ipv4 and ipv6 address using aggregate - eos_l3_interface: + eos_l3_interface: &aggregate aggregate: - - { name: "{{ test_interface_1 }}", ipv4: 192.161.0.1/24, ipv6: "fd5d:12c9:2201:2::2/64" } - - { name: "{{ test_interface_2 }}", ipv4: 192.162.0.2/16, ipv6: "fd5e:12c9:2201:3::3/32" } + - { name: "{{ test_interface_1 }}", ipv4: "{{ ipv4_addr_3 }}", ipv6: "{{ ipv6_addr_3 }}" } + - { name: "{{ test_interface_2 }}", ipv4: "{{ ipv4_addr_1 }}", ipv6: "{{ ipv6_addr_1 }}" } become: yes register: result @@ -133,29 +132,24 @@ that: - 'result.changed == true' - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address 192.161.0.1/24" in result.commands' - - '"ipv6 address fd5d:12c9:2201:2::2/64" in result.commands' + - '"ip address {{ ipv4_addr_3 }}" in result.commands' + - '"ipv6 address {{ ipv6_addr_3 }}" in result.commands' - '"interface {{ test_interface_2 }}" in result.commands' - - '"ip address 192.162.0.2/16" in result.commands' - - '"ipv6 address fd5e:12c9:2201:3::3/32" in result.commands' + - '"ip address {{ ipv4_addr_1 }}" in result.commands' + - '"ipv6 address {{ ipv6_addr_1 }}" in result.commands' - name: Configure ipv4 and ipv6 address using aggregate (idempotent) - eos_l3_interface: - aggregate: - - { name: "{{ test_interface_1 }}", ipv4: 192.161.0.1/24, ipv6: "fd5d:12c9:2201:2::2/64" } - - { name: "{{ test_interface_2 }}", ipv4: 192.162.0.2/16, ipv6: "fd5e:12c9:2201:3::3/32" } + eos_l3_interface: *aggregate become: yes register: result -- assert: - that: - - 'result.changed == false' +- assert: *unchanged - name: Change ipv4 and ipv6 address using aggregate eos_l3_interface: aggregate: - - { name: "{{ test_interface_1 }}", ipv4: 193.167.1.1/8, ipv6: "fd5a:12c9:2201:4::4/32" } - - { name: "{{ test_interface_2 }}", ipv4: 192.169.2.2/24, ipv6: "fd5b:12c9:2201:5::5/90" } + - { name: "{{ test_interface_1 }}", ipv4: "{{ ipv4_addr_2 }}", ipv6: "{{ ipv6_addr_2 }}" } + - { name: "{{ test_interface_2 }}", ipv4: "{{ ipv4_addr_4 }}", ipv6: "{{ ipv6_addr_4 }}" } become: yes register: result @@ -163,15 +157,15 @@ that: - 'result.changed == true' - '"interface {{ test_interface_1 }}" in result.commands' - - '"ip address 193.167.1.1/8" in result.commands' - - '"ipv6 address fd5a:12c9:2201:4::4/32" in result.commands' + - '"ip address {{ ipv4_addr_2 }}" in result.commands' + - '"ipv6 address {{ ipv6_addr_2 }}" in result.commands' - '"interface {{ test_interface_2 }}" in result.commands' - - '"ip address 192.169.2.2/24" in result.commands' - - '"ipv6 address fd5b:12c9:2201:5::5/90" in result.commands' + - '"ip address {{ ipv4_addr_4 }}" in result.commands' + - '"ipv6 address {{ ipv6_addr_4 }}" in result.commands' - name: Delete ipv4 and ipv6 address using aggregate - eos_l3_interface: + eos_l3_interface: &clear_both aggregate: - { name: "{{ test_interface_1 }}" } - { name: "{{ test_interface_2 }}" } @@ -190,16 +184,11 @@ - '"no ipv6 address" in result.commands' - name: Delete ipv4 and ipv6 address using aggregate (idempotent) - eos_l3_interface: - aggregate: - - { name: "{{ test_interface_1 }}" } - - { name: "{{ test_interface_2 }}" } - state: absent + eos_l3_interface: *clear_both become: yes register: result -- assert: - that: - - 'result.changed == false' +- assert: *unchanged -- debug: msg="END eos_l3_interface eapi/basic.yaml on connection={{ ansible_connection }}" +- debug: + msg: "END eos_l3_interface eapi/basic.yaml on connection={{ ansible_connection }}"