adds integration tests for nxos_mtu (#21969)

This commit is contained in:
Peter Sprygada 2017-02-26 09:42:41 -05:00 committed by GitHub
parent 4c354c9c70
commit 8dbb12a9c4
9 changed files with 335 additions and 0 deletions

View file

@ -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']" }

View file

@ -0,0 +1,2 @@
dependencies:
- prepare_nxos_tests

View file

@ -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

View file

@ -0,0 +1,3 @@
---
- { include: cli.yaml, tags: ['cli'] }
- { include: nxapi.yaml, tags: ['nxapi'] }

View file

@ -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 }}"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"