diff options
Diffstat (limited to 'tests/integration/targets/vyos_linkagg')
5 files changed, 68 insertions, 51 deletions
diff --git a/tests/integration/targets/vyos_linkagg/defaults/main.yaml b/tests/integration/targets/vyos_linkagg/defaults/main.yaml index 9ef5ba5..a845c24 100644 --- a/tests/integration/targets/vyos_linkagg/defaults/main.yaml +++ b/tests/integration/targets/vyos_linkagg/defaults/main.yaml @@ -1,3 +1,3 @@ --- -testcase: "*" +testcase: '*' test_items: [] diff --git a/tests/integration/targets/vyos_linkagg/tasks/cli.yaml b/tests/integration/targets/vyos_linkagg/tasks/cli.yaml index 890d3ac..90f265f 100644 --- a/tests/integration/targets/vyos_linkagg/tasks/cli.yaml +++ b/tests/integration/targets/vyos_linkagg/tasks/cli.yaml @@ -1,22 +1,22 @@ --- - name: collect all cli test cases find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' register: test_cases delegate_to: localhost - name: set test_items set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" -- name: run test case (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" +- 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 - name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" - with_first_found: "{{ test_items }}" + include: '{{ test_case_to_run }} ansible_connection=local' + with_first_found: '{{ test_items }}' loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/vyos_linkagg/tasks/main.yaml b/tests/integration/targets/vyos_linkagg/tasks/main.yaml index d4cf26f..a3db933 100644 --- a/tests/integration/targets/vyos_linkagg/tasks/main.yaml +++ b/tests/integration/targets/vyos_linkagg/tasks/main.yaml @@ -1,2 +1,4 @@ --- -- {include: cli.yaml, tags: ['cli']} +- include: cli.yaml + tags: + - cli diff --git a/tests/integration/targets/vyos_linkagg/tests/cli/basic.yaml b/tests/integration/targets/vyos_linkagg/tests/cli/basic.yaml index fadbbd7..ffe0c42 100644 --- a/tests/integration/targets/vyos_linkagg/tests/cli/basic.yaml +++ b/tests/integration/targets/vyos_linkagg/tests/cli/basic.yaml @@ -12,173 +12,189 @@ state: absent - name: Create linkagg + register: result vyos.vyos.vyos_linkagg: name: bond0 members: - eth1 state: present - register: result - assert: that: - - 'result.changed == true' + - result.changed == true - '"set interfaces bonding bond0 mode 802.3ad" in result.commands' - '"set interfaces ethernet eth1 bond-group bond0" in result.commands' - name: Create linkagg again (idempotent) + register: result vyos.vyos.vyos_linkagg: name: bond0 members: - eth1 state: present - register: result - assert: that: - - 'result.changed == false' + - result.changed == false - name: Add linkagg member + register: result vyos.vyos.vyos_linkagg: name: bond0 members: - eth2 state: present - register: result - assert: that: - - 'result.changed == true' + - result.changed == true - '"set interfaces ethernet eth2 bond-group bond0" in result.commands' - name: Add linkagg member again (idempotent) + register: result vyos.vyos.vyos_linkagg: name: bond0 members: - eth2 state: present - register: result - assert: that: - - 'result.changed == false' + - result.changed == false - name: Disable linkagg + register: result vyos.vyos.vyos_linkagg: name: bond0 state: down - register: result - assert: that: - - 'result.changed == true' + - result.changed == true - '"set interfaces bonding bond0 disable" in result.commands' - name: Disable linkagg again (idempotent) + register: result vyos.vyos.vyos_linkagg: name: bond0 state: down - register: result - assert: that: - - 'result.changed == false' + - result.changed == false - name: Enable linkagg + register: result vyos.vyos.vyos_linkagg: name: bond0 state: up - register: result - assert: that: - - 'result.changed == true' + - result.changed == true - '"delete interfaces bonding bond0 disable" in result.commands[0]' - name: Enable linkagg again (idempotent) + register: result vyos.vyos.vyos_linkagg: name: bond0 state: up - register: result - assert: that: - - 'result.changed == false' + - result.changed == false - name: Remove linkagg + register: result vyos.vyos.vyos_linkagg: name: bond0 state: absent - register: result - assert: that: - - 'result.changed == true' + - result.changed == true - '"delete interfaces ethernet eth1 bond-group" in result.commands' - '"delete interfaces ethernet eth2 bond-group" in result.commands' - '"delete interfaces bonding bond0" in result.commands' - name: Remove linkagg again (idempotent) + register: result vyos.vyos.vyos_linkagg: name: bond0 state: absent - register: result - assert: that: - - 'result.changed == false' + - result.changed == false - name: Create collection of linkagg definitions + register: result vyos.vyos.vyos_linkagg: aggregate: - - {name: bond0, members: [eth1]} - - {name: bond1, members: [eth2]} + + - name: bond0 + members: + - eth1 + + - name: bond1 + members: + - eth2 state: present - register: result - assert: that: - - 'result.changed == true' + - result.changed == true - '"set interfaces bonding bond0 mode 802.3ad" in result.commands' - '"set interfaces ethernet eth1 bond-group bond0" in result.commands' - '"set interfaces bonding bond1 mode 802.3ad" in result.commands' - '"set interfaces ethernet eth2 bond-group bond1" in result.commands' - name: Create collection of linkagg definitions again (idempotent) + register: result vyos.vyos.vyos_linkagg: aggregate: - - {name: bond0, members: [eth1]} - - {name: bond1, members: [eth2]} + + - name: bond0 + members: + - eth1 + + - name: bond1 + members: + - eth2 state: present - register: result - assert: that: - - 'result.changed == false' + - result.changed == false - name: Remove collection of linkagg definitions + register: result vyos.vyos.vyos_linkagg: aggregate: + - name: bond0 + - name: bond1 state: absent - register: result - assert: that: - - 'result.changed == true' + - result.changed == true - '"delete interfaces ethernet eth1 bond-group" in result.commands' - '"delete interfaces bonding bond0" in result.commands' - '"delete interfaces ethernet eth2 bond-group" in result.commands' - '"delete interfaces bonding bond1" in result.commands' - name: Remove collection of linkagg definitions again (idempotent) + register: result vyos.vyos.vyos_linkagg: aggregate: + - name: bond0 + - name: bond1 state: absent - register: result - assert: that: - - 'result.changed == false' + - result.changed == false diff --git a/tests/integration/targets/vyos_linkagg/tests/cli/net_linkagg.yaml b/tests/integration/targets/vyos_linkagg/tests/cli/net_linkagg.yaml index 93f98e7..8178f92 100644 --- a/tests/integration/targets/vyos_linkagg/tests/cli/net_linkagg.yaml +++ b/tests/integration/targets/vyos_linkagg/tests/cli/net_linkagg.yaml @@ -1,31 +1,30 @@ --- -- debug: msg="START vyos cli/net_linkagg.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. +- debug: msg="START vyos cli/net_linkagg.yaml on connection={{ ansible_connection + }}" - name: Remove linkagg - set - net_linkagg: + ansible.netcommon.net_linkagg: name: bond0 state: absent - name: Create linkagg using platform agnostic module - net_linkagg: + register: result + ansible.netcommon.net_linkagg: name: bond0 members: - eth1 state: present - register: result - assert: that: - - 'result.changed == true' + - result.changed == true - '"set interfaces bonding bond0 mode 802.3ad" in result.commands' - '"set interfaces ethernet eth1 bond-group bond0" in result.commands' - name: Remove linkagg - teardown - net_linkagg: + ansible.netcommon.net_linkagg: name: bond0 state: absent -- debug: msg="END vyos cli/net_linkagg.yaml on connection={{ ansible_connection }}" +- debug: msg="END vyos cli/net_linkagg.yaml on connection={{ ansible_connection + }}" |