diff options
Diffstat (limited to 'tests/integration/targets/vyos_lag_interfaces')
3 files changed, 90 insertions, 0 deletions
diff --git a/tests/integration/targets/vyos_lag_interfaces/tasks/main.yaml b/tests/integration/targets/vyos_lag_interfaces/tasks/main.yaml index a3db933..fb74fa1 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tasks/main.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tasks/main.yaml @@ -2,3 +2,8 @@ - include: cli.yaml tags: - cli + +- include: redirection.yaml + when: ansible_version.full is version('2.10.0', '>=') + tags: + - redirection diff --git a/tests/integration/targets/vyos_lag_interfaces/tasks/redirection.yaml b/tests/integration/targets/vyos_lag_interfaces/tasks/redirection.yaml new file mode 100644 index 0000000..5564a3e --- /dev/null +++ b/tests/integration/targets/vyos_lag_interfaces/tasks/redirection.yaml @@ -0,0 +1,16 @@ +--- +- name: collect all redirection cli test cases + find: + paths: '{{ role_path }}/tests/redirection/cli' + patterns: '{{ testcase }}.yaml' + register: shortname_test_cases + delegate_to: localhost + +- name: set test_items for redirection + set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run 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 new file mode 100644 index 0000000..be1cdc4 --- /dev/null +++ b/tests/integration/targets/vyos_lag_interfaces/tests/redirection/cli/shortname.yaml @@ -0,0 +1,69 @@ +--- +- debug: + msg: START lag_interfaces merged on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _remove_bond.yaml + +- include_tasks: _add_bond.yaml + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + vyos.vyos.lag_interfaces: &id001 + 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 + state: merged + + - 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) + register: result + vyos.vyos.lag_interfaces: *id001 + + - 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 |