diff options
Diffstat (limited to 'tests/integration/targets/vyos_lag_interfaces')
10 files changed, 190 insertions, 189 deletions
diff --git a/tests/integration/targets/vyos_lag_interfaces/meta/main.yaml b/tests/integration/targets/vyos_lag_interfaces/meta/main.yaml index f88bce5..7413320 100644 --- a/tests/integration/targets/vyos_lag_interfaces/meta/main.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/meta/main.yaml @@ -1,2 +1,3 @@ +--- dependencies: - prepare_vyos_tests diff --git a/tests/integration/targets/vyos_lag_interfaces/tasks/main.yaml b/tests/integration/targets/vyos_lag_interfaces/tasks/main.yaml index 415c99d..d4cf26f 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tasks/main.yaml +++ b/tests/integration/targets/vyos_lag_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_lag_interfaces/tests/cli/_add_bond.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_add_bond.yaml index c479f79..adacb0c 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_add_bond.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_add_bond.yaml @@ -4,5 +4,5 @@ config: "{{ lines }}" vars: lines: | - set interfaces bonding bond0 - set interfaces bonding bond1 + set interfaces bonding bond0 + set interfaces bonding bond1 diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml index 1d7ee69..29085bd 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml @@ -4,5 +4,5 @@ config: "{{ lines }}" vars: lines: | - delete interfaces bonding bond0 - delete interfaces bonding bond1 + delete interfaces bonding bond0 + delete interfaces bonding bond1 diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml index db6fb88..af6e632 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml @@ -5,42 +5,42 @@ - include_tasks: _populate.yaml - block: - - name: Delete attributes of given LAG interfaces. - vyos.vyos.vyos_lag_interfaces: &deleted - config: - - name: bond0 - - name: bond1 - 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_lag_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 }}" - + - name: Delete attributes of given LAG interfaces. + vyos.vyos.vyos_lag_interfaces: &deleted + config: + - name: bond0 + - name: bond1 + 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_lag_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_lag_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml index c222354..74d3466 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml @@ -1,13 +1,13 @@ --- - debug: - msg: "START vyos_lag_interfaces empty_config integration tests on connection={{ ansible_connection }}" + msg: "START vyos_lag_interfaces empty_config integration tests on connection={{ ansible_connection }}" - name: Merged with empty config should give appropriate error message vyos.vyos.vyos_lag_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_lag_interfaces/tests/cli/merged.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/merged.yaml index 78c9de1..7b1931f 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/merged.yaml @@ -1,6 +1,6 @@ --- - debug: - msg: "START vyos_lag_interfaces merged integration tests on connection={{ ansible_connection }}" + msg: "START vyos_lag_interfaces merged integration tests on connection={{ ansible_connection }}" - include_tasks: _remove_config.yaml @@ -9,52 +9,52 @@ - include_tasks: _add_bond.yaml - block: - - name: Merge the provided configuration with the exisiting running configuration - vyos.vyos.vyos_lag_interfaces: &merged + - name: Merge the provided configuration with the exisiting running configuration + vyos.vyos.vyos_lag_interfaces: &merged config: - - name: bond0 - hash_policy: "layer2" - mode: "active-backup" - members: - - member: eth1 - primary: eth1 - - - name: bond1 - hash_policy: "layer2+3" - mode: "active-backup" - members: - - member: eth2 - primary: eth2 + - name: bond0 + hash_policy: "layer2" + mode: "active-backup" + members: + - member: eth1 + primary: eth1 + + - name: bond1 + hash_policy: "layer2+3" + mode: "active-backup" + members: + - member: eth2 + primary: eth2 state: merged - register: result + register: result - - name: Assert that before dicts were correctly generated - assert: + - 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: + - name: Assert that correct set of commands were generated + assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - name: Assert that after dicts was correctly generated - assert: + - name: Assert that after dicts was correctly generated + assert: that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) - vyos.vyos.vyos_lag_interfaces: *merged - register: result + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) + vyos.vyos.vyos_lag_interfaces: *merged + register: result - - name: Assert that the previous task was idempotent - assert: + - name: Assert that the previous task was idempotent + assert: that: - - "result['changed'] == false" + - "result['changed'] == false" - - name: Assert that before dicts were correctly generated - assert: + - name: Assert that before dicts were correctly generated + assert: that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" + - "{{ 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_lag_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml index 6139d9f..c44cc33 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml @@ -1,6 +1,6 @@ --- - debug: - msg: "START vyos_lag_interfaces overridden integration tests on connection={{ ansible_connection }}" + msg: "START vyos_lag_interfaces overridden integration tests on connection={{ ansible_connection }}" - include_tasks: _remove_config.yaml @@ -9,46 +9,46 @@ - include_tasks: _populate.yaml - block: - - name: Overrides all device configuration with provided configuration - vyos.vyos.vyos_lag_interfaces: &overridden + - name: Overrides all device configuration with provided configuration + vyos.vyos.vyos_lag_interfaces: &overridden config: - - name: bond1 - mode: "active-backup" - members: - - member: eth2 - primary: eth2 - hash_policy: layer2 + - name: bond1 + mode: "active-backup" + members: + - member: eth2 + primary: eth2 + hash_policy: layer2 state: overridden - register: result + register: result - - name: Assert that before dicts were correctly generated - assert: + - name: Assert that before dicts were correctly generated + assert: that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" + - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - name: Assert that correct commands were generated - assert: + - name: Assert that correct commands were generated + assert: that: - - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" + - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - name: Assert that after dicts were correctly generated - assert: + - name: Assert that after dicts were correctly generated + assert: that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: Overrides all device configuration with provided configurations (IDEMPOTENT) - vyos.vyos.vyos_lag_interfaces: *overridden - register: result + - name: Overrides all device configuration with provided configurations (IDEMPOTENT) + vyos.vyos.vyos_lag_interfaces: *overridden + register: result - - name: Assert that the previous task was idempotent - assert: + - name: Assert that the previous task was idempotent + assert: that: - - "result['changed'] == false" + - "result['changed'] == false" - - name: Assert that before dicts were correctly generated - assert: + - name: Assert that before dicts were correctly generated + assert: that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" + - "{{ 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_lag_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml index ce469e0..894d505 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml @@ -1,51 +1,51 @@ --- - debug: - msg: "START vyos_lag_interfaces replaced integration tests on connection={{ ansible_connection }}" + msg: "START vyos_lag_interfaces replaced integration tests on connection={{ ansible_connection }}" - include_tasks: _remove_config.yaml - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed LAG interfaces with provided configurations - vyos.vyos.vyos_lag_interfaces: &replaced + - name: Replace device configurations of listed LAG interfaces with provided configurations + vyos.vyos.vyos_lag_interfaces: &replaced config: - - name: bond1 - mode: "802.3ad" - hash_policy: "layer2" - members: - - member: eth2 + - name: bond1 + mode: "802.3ad" + hash_policy: "layer2" + members: + - member: eth2 state: replaced - register: result + register: result - - name: Assert that correct set of commands were generated - assert: + - name: Assert that correct set of commands were generated + assert: that: - - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" + - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - name: Assert that before dicts are correctly generated - assert: + - name: Assert that before dicts are correctly generated + assert: that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" + - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - name: Assert that after dict is correctly generated - assert: + - name: Assert that after dict is correctly generated + assert: that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" + - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: Replace device configurations of listed LAG interfaces with provided configurarions (IDEMPOTENT) - vyos.vyos.vyos_lag_interfaces: *replaced - register: result + - name: Replace device configurations of listed LAG interfaces with provided configurarions (IDEMPOTENT) + vyos.vyos.vyos_lag_interfaces: *replaced + register: result - - name: Assert that task was idempotent - assert: + - name: Assert that task was idempotent + assert: that: - - "result['changed'] == false" + - "result['changed'] == false" - - name: Assert that before dict is correctly generated - assert: + - name: Assert that before dict is correctly generated + assert: that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" + - "{{ 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_lag_interfaces/tests/cli/rtt.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml index eb3814e..3095a12 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml @@ -7,63 +7,63 @@ - include_tasks: _remove_bond.yaml - block: - - name: Apply the provided configuration (base config) - vyos.vyos.vyos_lag_interfaces: - config: - - name: bond0 - hash_policy: "layer2" - mode: "active-backup" - members: - - member: eth1 - primary: eth1 + - name: Apply the provided configuration (base config) + vyos.vyos.vyos_lag_interfaces: + config: + - name: bond0 + hash_policy: "layer2" + mode: "active-backup" + members: + - member: eth1 + primary: eth1 - - name: bond1 - hash_policy: "layer2+3" - mode: "active-backup" - members: - - member: eth2 - primary: eth2 + - name: bond1 + hash_policy: "layer2+3" + mode: "active-backup" + members: + - member: eth2 + primary: eth2 - state: merged - register: base_config + state: merged + register: base_config - - name: Gather lag_interfaces facts - vyos.vyos.vyos_facts: - gather_subset: - - default - gather_network_resources: - - lag_interfaces + - name: Gather lag_interfaces facts + vyos.vyos.vyos_facts: + gather_subset: + - default + gather_network_resources: + - lag_interfaces - - name: Apply the provided configuration (config to be reverted) - vyos.vyos.vyos_lag_interfaces: - config: - - name: bond0 - hash_policy: "layer2+3" - mode: "802.3ad" - members: - - member: eth1 + - name: Apply the provided configuration (config to be reverted) + vyos.vyos.vyos_lag_interfaces: + config: + - name: bond0 + hash_policy: "layer2+3" + mode: "802.3ad" + members: + - member: eth1 - - name: bond1 - hash_policy: "layer2" - mode: "xor-hash" - members: - - member: eth2 - state: merged - register: result + - name: bond1 + hash_policy: "layer2" + mode: "xor-hash" + members: + - member: eth2 + state: merged + register: result - - name: Assert that changes were applied - assert: - that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" + - name: Assert that changes were applied + assert: + that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: Revert back to base config using facts round trip - vyos.vyos.vyos_lag_interfaces: - config: "{{ ansible_facts['network_resources']['lag_interfaces'] }}" - state: overridden - register: revert + - name: Revert back to base config using facts round trip + vyos.vyos.vyos_lag_interfaces: + config: "{{ ansible_facts['network_resources']['lag_interfaces'] }}" + state: overridden + register: revert - - name: Assert that config was reverted - assert: - that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" + - name: Assert that config was reverted + assert: + that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" always: - - include_tasks: _remove_config.yaml + - include_tasks: _remove_config.yaml |