diff options
Diffstat (limited to 'tests/integration/targets/vyos_l3_interfaces')
9 files changed, 183 insertions, 182 deletions
diff --git a/tests/integration/targets/vyos_l3_interfaces/meta/main.yml b/tests/integration/targets/vyos_l3_interfaces/meta/main.yml index e380a13..7413320 100644 --- a/tests/integration/targets/vyos_l3_interfaces/meta/main.yml +++ b/tests/integration/targets/vyos_l3_interfaces/meta/main.yml @@ -1,2 +1,3 @@ +--- dependencies: - - prepare_vyos_tests
\ No newline at end of file + - prepare_vyos_tests diff --git a/tests/integration/targets/vyos_l3_interfaces/tasks/main.yaml b/tests/integration/targets/vyos_l3_interfaces/tasks/main.yaml index 415c99d..d4cf26f 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tasks/main.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tasks/main.yaml @@ -1,2 +1,2 @@ --- -- { include: cli.yaml, tags: ['cli'] } +- {include: cli.yaml, tags: ['cli']} diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/_populate.yaml index fc0bbb2..d598c42 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/_populate.yaml @@ -8,4 +8,4 @@ set interfaces ethernet eth2 address '192.0.2.10/24' set interfaces ethernet eth2 address '192.0.2.11/24' set interfaces ethernet eth2 address '2001:db8::10/32' - set interfaces ethernet eth2 address '2001:db8::12/32'
\ No newline at end of file + set interfaces ethernet eth2 address '2001:db8::12/32' diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml index a40901c..b95bcdb 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml @@ -5,44 +5,44 @@ - include_tasks: _remove_config.yaml - block: - - include_tasks: _populate.yaml - - - name: Delete attributes of given interfaces - vyos.vyos.vyos_l3_interfaces: &deleted - config: - - name: eth1 - - name: eth2 - state: deleted - register: result - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that the correct set of commands were generated - assert: - that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that the after dicts were correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Delete attributes of given interfaces (IDEMPOTENT) - vyos.vyos.vyos_l3_interfaces: *deleted - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result.changed == false" - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" + - include_tasks: _populate.yaml + + - name: Delete attributes of given interfaces + vyos.vyos.vyos_l3_interfaces: &deleted + config: + - name: eth1 + - name: eth2 + state: deleted + register: result + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" + + - name: Assert that the correct set of commands were generated + assert: + that: + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" + + - name: Assert that the after dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" + + - name: Delete attributes of given interfaces (IDEMPOTENT) + vyos.vyos.vyos_l3_interfaces: *deleted + register: result + + - name: Assert that the previous task was idempotent + assert: + that: + - "result.changed == false" + + - name: Assert that the before dicts were correctly generated + assert: + that: + - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - - include_tasks: _remove_config.yaml + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml index 530df88..7b1f100 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml @@ -1,13 +1,13 @@ --- - debug: - msg: "START vyos_l3_interfaces empty_config integration tests on connection={{ ansible_connection }}" + msg: "START vyos_l3_interfaces empty_config integration tests on connection={{ ansible_connection }}" - name: Merged with empty config should give appropriate error message vyos.vyos.vyos_l3_interfaces: config: state: merged register: result - ignore_errors: True + ignore_errors: true - assert: that: @@ -18,7 +18,7 @@ config: state: replaced register: result - ignore_errors: True + ignore_errors: true - assert: that: @@ -29,7 +29,7 @@ config: state: overridden register: result - ignore_errors: True + ignore_errors: true - assert: that: diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/merged.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/merged.yaml index 64724ef..1b3b9ea 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/merged.yaml @@ -5,54 +5,54 @@ - include_tasks: _remove_config.yaml - block: - - name: Merge the provided configuration with the exisiting running configuration - vyos.vyos.vyos_l3_interfaces: &merged - config: - - name: eth1 - ipv4: - - address: 192.0.2.10/24 - ipv6: - - address: 2001:db8::10/32 - - - name: eth2 - ipv4: - - address: 198.51.100.10/24 - vifs: - - vlan_id: 101 - ipv4: - - address: 198.51.100.130/25 - ipv6: - - address: 2001:db8::20/32 - state: merged - register: result - - - name: Assert that before dicts were correctly generated - assert: - that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that after dicts was correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) - vyos.vyos.vyos_l3_interfaces: *merged - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - - name: Assert that before dicts were correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" + - name: Merge the provided configuration with the exisiting running configuration + vyos.vyos.vyos_l3_interfaces: &merged + config: + - name: eth1 + ipv4: + - address: 192.0.2.10/24 + ipv6: + - address: 2001:db8::10/32 + + - name: eth2 + ipv4: + - address: 198.51.100.10/24 + vifs: + - vlan_id: 101 + ipv4: + - address: 198.51.100.130/25 + ipv6: + - address: 2001:db8::20/32 + state: merged + register: result + + - name: Assert that before dicts were correctly generated + assert: + that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" + + - name: Assert that after dicts was correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" + + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) + vyos.vyos.vyos_l3_interfaces: *merged + register: result + + - name: Assert that the previous task was idempotent + assert: + that: + - "result['changed'] == false" + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - - include_tasks: _remove_config.yaml + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/overridden.yaml index 6a9b013..06d6fc7 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/overridden.yaml @@ -5,48 +5,48 @@ - include_tasks: _remove_config.yaml - block: - - include_tasks: _populate.yaml - - - name: Overrides all device configuration with provided configuration - vyos.vyos.vyos_l3_interfaces: &overridden - config: - - name: eth0 - ipv4: - - address: dhcp - - name: eth1 - ipv4: - - address: "192.0.2.15/24" - state: overridden - register: result - - - name: Assert that before dicts were correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that correct commands were generated - assert: - that: - - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that after dicts were correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Overrides all device configuration with provided configurations (IDEMPOTENT) - vyos.vyos.vyos_l3_interfaces: *overridden - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - - name: Assert that before dicts were correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" + - include_tasks: _populate.yaml + + - name: Overrides all device configuration with provided configuration + vyos.vyos.vyos_l3_interfaces: &overridden + config: + - name: eth0 + ipv4: + - address: dhcp + - name: eth1 + ipv4: + - address: "192.0.2.15/24" + state: overridden + register: result + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" + + - name: Assert that correct commands were generated + assert: + that: + - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" + + - name: Assert that after dicts were correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" + + - name: Overrides all device configuration with provided configurations (IDEMPOTENT) + vyos.vyos.vyos_l3_interfaces: *overridden + register: result + + - name: Assert that the previous task was idempotent + assert: + that: + - "result['changed'] == false" + + - name: Assert that before dicts were correctly generated + assert: + that: + - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - - include_tasks: _remove_config.yaml + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/replaced.yaml index 4d44983..6f1228a 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/replaced.yaml @@ -5,48 +5,48 @@ - include_tasks: _remove_config.yaml - block: - - include_tasks: _populate.yaml - - - name: Replace device configurations of listed interfaces with provided configurations - vyos.vyos.vyos_l3_interfaces: &replaced - config: - - name: eth1 - ipv4: - - address: 192.0.2.19/24 - - name: eth2 - ipv6: - - address: 2001:db8::11/32 - state: replaced - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) - vyos.vyos.vyos_l3_interfaces: *replaced - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" + - include_tasks: _populate.yaml + + - name: Replace device configurations of listed interfaces with provided configurations + vyos.vyos.vyos_l3_interfaces: &replaced + config: + - name: eth1 + ipv4: + - address: 192.0.2.19/24 + - name: eth2 + ipv6: + - address: 2001:db8::11/32 + state: replaced + register: result + + - name: Assert that correct set of commands were generated + assert: + that: + - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" + + - name: Assert that before dicts are correctly generated + assert: + that: + - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" + + - name: Assert that after dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" + + - name: Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) + vyos.vyos.vyos_l3_interfaces: *replaced + register: result + + - name: Assert that task was idempotent + assert: + that: + - "result['changed'] == false" + + - name: Assert that before dict is correctly generated + assert: + that: + - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - - include_tasks: _remove_config.yaml + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/vars/main.yaml b/tests/integration/targets/vyos_l3_interfaces/vars/main.yaml index f908d2c..1241763 100644 --- a/tests/integration/targets/vyos_l3_interfaces/vars/main.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/vars/main.yaml @@ -20,7 +20,7 @@ merged: - name: "eth0" ipv4: - address: "dhcp" - + - name: "eth1" ipv4: - address: "192.0.2.10/24" |