diff options
Diffstat (limited to 'tests/integration/targets/vyos_lag_interfaces')
12 files changed, 60 insertions, 102 deletions
diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml index d519d28f..be0d6351 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml @@ -3,12 +3,16 @@ - name: Setup vars: - lines: - "set interfaces bonding bond0\nset interfaces bonding bond0 hash-policy\ - \ 'layer2'\nset interfaces bonding bond0 mode 'active-backup'\nset interfaces\ - \ ethernet eth1 bond-group bond0\nset interfaces bonding bond1\nset interfaces\ - \ bonding bond0 primary 'eth1'\nset interfaces bonding bond1 hash-policy 'layer2+3'\n\ - set interfaces bonding bond1 mode 'active-backup'\nset interfaces ethernet\ - \ eth2 bond-group bond1\nset interfaces bonding bond1 primary 'eth2'\n" + lines: |- + set interfaces bonding bond0 + set interfaces bonding bond0 hash-policy 'layer2' + set interfaces bonding bond0 mode 'active-backup' + set interfaces ethernet eth1 bond-group bond0 + set interfaces bonding bond1 + set interfaces bonding bond0 primary 'eth1' + set interfaces bonding bond1 hash-policy 'layer2+3' + set interfaces bonding bond1 mode 'active-backup' + set interfaces ethernet eth2 bond-group bond1 + set interfaces bonding bond1 primary 'eth2' ansible.netcommon.cli_config: config: "{{ lines }}" 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 017c56a1..e22a6ca7 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 @@ -1,17 +1,21 @@ ---- - name: Remove Config vars: - lines: - "delete interfaces bonding bond0 hash-policy\ndelete interfaces ethernet\ - \ eth1 bond-group bond0\ndelete interfaces bonding bond0 mode\ndelete interfaces\ - \ bonding bond0 primary\ndelete interfaces bonding bond1 hash-policy\ndelete\ - \ interfaces ethernet eth2 bond-group bond1\ndelete interfaces bonding bond1\ - \ mode\ndelete interfaces bonding bond1 primary\n" + lines: |- + delete interfaces bonding bond0 hash-policy + delete interfaces ethernet eth1 bond-group bond0 + delete interfaces bonding bond0 mode + delete interfaces bonding bond0 primary + delete interfaces bonding bond1 hash-policy + delete interfaces ethernet eth2 bond-group bond1 + delete interfaces bonding bond1 mode + delete interfaces bonding bond1 primary ansible.netcommon.cli_config: config: "{{ lines }}" - name: Remove Bond vars: - lines: "delete interfaces bonding bond0\ndelete interfaces bonding bond1\n" + lines: | + delete interfaces bonding bond0 + delete interfaces bonding bond1 ansible.netcommon.cli_config: config: "{{ lines }}" 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 ae15884f..e30be078 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lag_interfaces deleted integration tests ansible_connection={{ - ansible_connection }} + msg: START vyos_lag_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -24,14 +22,12 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ 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 }}" + - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result @@ -45,7 +41,6 @@ - name: Assert that the before dicts were correctly generated assert: that: - - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_bond.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 22ac8a87..efe89369 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,8 +1,6 @@ --- - 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 register: result @@ -46,8 +44,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/gathered.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/gathered.yaml index caa8f305..f6c281f5 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/gathered.yaml @@ -1,23 +1,20 @@ --- - debug: - msg: - START vyos_lag_interfaces gathered integration tests on connection={{ ansible_connection - }} + msg: START vyos_lag_interfaces gathered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - name: Gather the provided configuration with the existing running configuration register: result - vyos.vyos.vyos_lag_interfaces: &id001 + vyos.vyos.vyos_lag_interfaces: config: state: gathered - name: Assert that gathered dicts was correctly generated assert: that: - - "{{ populate | symmetric_difference(result['gathered']) |length == 0\ - \ }}" + - "{{ populate | symmetric_difference(result['gathered']) |length == 0 }}" always: - include_tasks: _remove_bond.yaml 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 8e6c7646..64ac9a4a 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/merged.yaml @@ -1,8 +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: _add_bond.yaml @@ -28,25 +26,19 @@ - name: Assert that before dicts were correctly generated assert: - that: - "{{ merged['before'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + 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 }}" + - "{{ 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 }}" + - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_lag_interfaces: *id001 @@ -58,7 +50,6 @@ - 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_bond.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 93aa7d9c..482d54d1 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml @@ -1,7 +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: _populate.yaml @@ -26,14 +25,12 @@ - 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: 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) register: result @@ -47,7 +44,6 @@ - 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_bond.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml index 412dcaf8..81a7b46d 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lag_interfaces parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_lag_interfaces parsed integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -23,9 +21,7 @@ - name: Assert that correct parsing done assert: - that: - "{{ ansible_facts['network_resources']['lag_interfaces'] | symmetric_difference(result['parsed'])\ - \ |length == 0 }}" + that: "{{ ansible_facts['network_resources']['lag_interfaces'] | symmetric_difference(result['parsed']) |length == 0 }}" always: - include_tasks: _remove_bond.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml index ad051995..7d86a3ae 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lag_interfaces rendered integration tests on connection={{ ansible_connection - }} + msg: START vyos_lag_interfaces rendered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -28,8 +26,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ - \ |length == 0 }}" + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length == 0 }}" always: - include_tasks: _remove_bond.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 2e6de6c7..66e55df7 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml @@ -1,14 +1,11 @@ --- - 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: _populate.yaml - block: - - name: Replace device configurations of listed LAG interfaces with provided - configurations + - name: Replace device configurations of listed LAG interfaces with provided configurations register: result vyos.vyos.vyos_lag_interfaces: &id001 config: @@ -22,8 +19,7 @@ - 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: @@ -33,11 +29,9 @@ - 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) + - name: Replace device configurations of listed LAG interfaces with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_lag_interfaces: *id001 @@ -49,7 +43,6 @@ - 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_bond.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 0e7c1787..5e9dc752 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_lag_interfaces round trip integration tests on connection={{ - ansible_connection }} + msg: START vyos_lag_interfaces round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_bond.yaml @@ -51,9 +50,7 @@ - name: Assert that changes were applied assert: - that: - "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Revert back to base config using facts round trip register: revert @@ -63,8 +60,6 @@ - name: Assert that config was reverted assert: - that: - "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ - \ == 0 }}" + that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" always: - include_tasks: _remove_bond.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/redirection/cli/shortname.yaml index 876563c9..40c5fe2b 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/redirection/cli/shortname.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/redirection/cli/shortname.yaml @@ -26,25 +26,19 @@ - name: Assert that before dicts were correctly generated assert: - that: - "{{ merged['before'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + 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 }}" + - "{{ 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 }}" + - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.lag_interfaces: *id001 @@ -56,7 +50,6 @@ - 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_bond.yaml |