diff --git a/test/integration/nxos.yaml b/test/integration/nxos.yaml index cc67ec35793..d5fca2b70fd 100644 --- a/test/integration/nxos.yaml +++ b/test/integration/nxos.yaml @@ -15,3 +15,4 @@ - { role: nxos_nxapi, when: "limit_to in ['*', 'nxos_nxapi']" } - { role: nxos_evpn_global, when: "limit_to in ['*', 'nxos_evpn_global']" } - { role: nxos_feature, when: "limit_to in ['*', 'nxos_feature']" } + - { role: nxos_feature, when: "limit_to in ['*', 'nxos_mtu']" } diff --git a/test/integration/targets/nxos_mtu/meta/main.yml b/test/integration/targets/nxos_mtu/meta/main.yml new file mode 100644 index 00000000000..ae741cbdc71 --- /dev/null +++ b/test/integration/targets/nxos_mtu/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_nxos_tests diff --git a/test/integration/targets/nxos_mtu/tasks/cli.yaml b/test/integration/targets/nxos_mtu/tasks/cli.yaml new file mode 100644 index 00000000000..d675462dd02 --- /dev/null +++ b/test/integration/targets/nxos_mtu/tasks/cli.yaml @@ -0,0 +1,15 @@ +--- +- name: collect all cli test cases + find: + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case + include: "{{ test_case_to_run }}" + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run diff --git a/test/integration/targets/nxos_mtu/tasks/main.yaml b/test/integration/targets/nxos_mtu/tasks/main.yaml new file mode 100644 index 00000000000..4b0f8c64d90 --- /dev/null +++ b/test/integration/targets/nxos_mtu/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- { include: cli.yaml, tags: ['cli'] } +- { include: nxapi.yaml, tags: ['nxapi'] } diff --git a/test/integration/targets/nxos_mtu/tasks/nxapi.yaml b/test/integration/targets/nxos_mtu/tasks/nxapi.yaml new file mode 100644 index 00000000000..ea525379f7f --- /dev/null +++ b/test/integration/targets/nxos_mtu/tasks/nxapi.yaml @@ -0,0 +1,28 @@ +--- +- name: collect all nxapi test cases + find: + paths: "{{ role_path }}/tests/nxapi" + patterns: "{{ testcase }}.yaml" + register: test_cases + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: enable nxapi + nxos_config: + lines: + - feature nxapi + - nxapi http port 80 + provider: "{{ cli }}" + +- name: run test case + include: "{{ test_case_to_run }}" + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run + +- name: disable nxapi + nxos_config: + lines: + - no feature nxapi + provider: "{{ cli }}" diff --git a/test/integration/targets/nxos_mtu/tests/cli/set_mtu.yaml b/test/integration/targets/nxos_mtu/tests/cli/set_mtu.yaml new file mode 100644 index 00000000000..37f266a927a --- /dev/null +++ b/test/integration/targets/nxos_mtu/tests/cli/set_mtu.yaml @@ -0,0 +1,76 @@ +--- +- debug: msg="START cli/set_mtu.yaml" + +- name: setup + nxos_config: + lines: + - no switchport + - no mtu + parents: interface Ethernet3/1 + match: none + provider: "{{ cli }}" + +- name: configure interface mtu + nxos_mtu: + interface: Ethernet3/1 + mtu: 2000 + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == true" + +- name: verify interface mtu + nxos_mtu: + interface: Ethernet3/1 + mtu: 2000 + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + +- name: configure interface mtu + nxos_mtu: + interface: Ethernet3/1 + mtu: 2001 + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == true" + +- name: verify interface mtu + nxos_mtu: + interface: Ethernet3/1 + mtu: 2001 + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + +- name: invalid mtu setting + nxos_mtu: + interface: Ethernet3/1 + mtu: 100000 + provider: "{{ cli }}" + register: result + ignore_errors: yes + +- assert: + that: + - "result.failed == true" + +- name: teardown + nxos_config: + lines: no mtu + parents: interface Ethernet3/1 + match: none + provider: "{{ cli }}" + +- debug: msg="END cli/set_mtu.yaml" diff --git a/test/integration/targets/nxos_mtu/tests/cli/set_sysmtu.yaml b/test/integration/targets/nxos_mtu/tests/cli/set_sysmtu.yaml new file mode 100644 index 00000000000..17b6802fbb8 --- /dev/null +++ b/test/integration/targets/nxos_mtu/tests/cli/set_sysmtu.yaml @@ -0,0 +1,67 @@ +--- +- debug: msg="START cli/sysmtu.yaml" + +- name: setup + nxos_config: + lines: no system jumbomtu + match: none + provider: "{{ cli }}" + +- name: configure system mtu + nxos_mtu: + sysmtu: 2000 + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == true" + +- name: verify system mtu + nxos_mtu: + sysmtu: 2000 + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + +- name: update system mtu + nxos_mtu: + sysmtu: 2001 + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == true" + +- name: verify system mtu + nxos_mtu: + sysmtu: 2001 + provider: "{{ cli }}" + register: result + +- assert: + that: + - "result.changed == false" + +- name: invalid setting + nxos_mtu: + sysmtu: 3000 + provider: "{{ cli }}" + register: result + ignore_errors: yes + +- assert: + that: + - "result.failed == true" + +- name: teardown + nxos_config: + lines: no system jumbomtu + match: none + provider: "{{ cli }}" + +- debug: msg="END cli/sysmtu.yaml" diff --git a/test/integration/targets/nxos_mtu/tests/nxapi/set_mtu.yaml b/test/integration/targets/nxos_mtu/tests/nxapi/set_mtu.yaml new file mode 100644 index 00000000000..802b95961df --- /dev/null +++ b/test/integration/targets/nxos_mtu/tests/nxapi/set_mtu.yaml @@ -0,0 +1,76 @@ +--- +- debug: msg="START nxapi/set_mtu.yaml" + +- name: setup + nxos_config: + lines: + - no switchport + - no mtu + parents: interface Ethernet3/1 + match: none + provider: "{{ nxapi }}" + +- name: configure interface mtu + nxos_mtu: + interface: Ethernet3/1 + mtu: 2000 + provider: "{{ nxapi }}" + register: result + +- assert: + that: + - "result.changed == true" + +- name: verify interface mtu + nxos_mtu: + interface: Ethernet3/1 + mtu: 2000 + provider: "{{ nxapi }}" + register: result + +- assert: + that: + - "result.changed == false" + +- name: configure interface mtu + nxos_mtu: + interface: Ethernet3/1 + mtu: 2001 + provider: "{{ nxapi }}" + register: result + +- assert: + that: + - "result.changed == true" + +- name: verify interface mtu + nxos_mtu: + interface: Ethernet3/1 + mtu: 2001 + provider: "{{ nxapi }}" + register: result + +- assert: + that: + - "result.changed == false" + +- name: invalid mtu setting + nxos_mtu: + interface: Ethernet3/1 + mtu: 100000 + provider: "{{ nxapi }}" + register: result + ignore_errors: yes + +- assert: + that: + - "result.failed == true" + +- name: teardown + nxos_config: + lines: no mtu + parents: interface Ethernet3/1 + match: none + provider: "{{ nxapi }}" + +- debug: msg="END nxapi/set_mtu.yaml" diff --git a/test/integration/targets/nxos_mtu/tests/nxapi/set_sysmtu.yaml b/test/integration/targets/nxos_mtu/tests/nxapi/set_sysmtu.yaml new file mode 100644 index 00000000000..4b733aa99d3 --- /dev/null +++ b/test/integration/targets/nxos_mtu/tests/nxapi/set_sysmtu.yaml @@ -0,0 +1,67 @@ +--- +- debug: msg="START nxapi/sysmtu.yaml" + +- name: setup + nxos_config: + lines: no system jumbomtu + match: none + provider: "{{ nxapi }}" + +- name: configure system mtu + nxos_mtu: + sysmtu: 2000 + provider: "{{ nxapi }}" + register: result + +- assert: + that: + - "result.changed == true" + +- name: verify system mtu + nxos_mtu: + sysmtu: 2000 + provider: "{{ nxapi }}" + register: result + +- assert: + that: + - "result.changed == false" + +- name: update system mtu + nxos_mtu: + sysmtu: 2001 + provider: "{{ nxapi }}" + register: result + +- assert: + that: + - "result.changed == true" + +- name: verify system mtu + nxos_mtu: + sysmtu: 2001 + provider: "{{ nxapi }}" + register: result + +- assert: + that: + - "result.changed == false" + +- name: invalid setting + nxos_mtu: + sysmtu: 3000 + provider: "{{ nxapi }}" + register: result + ignore_errors: yes + +- assert: + that: + - "result.failed == true" + +- name: teardown + nxos_config: + lines: no system jumbomtu + match: none + provider: "{{ nxapi }}" + +- debug: msg="END nxapi/sysmtu.yaml"