summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/nxos_feature
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/nxos_feature')
-rw-r--r--test/integration/targets/nxos_feature/meta/main.yml2
-rw-r--r--test/integration/targets/nxos_feature/tasks/cli.yaml15
-rw-r--r--test/integration/targets/nxos_feature/tasks/main.yaml3
-rw-r--r--test/integration/targets/nxos_feature/tasks/nxapi.yaml28
-rw-r--r--test/integration/targets/nxos_feature/tests/cli/configure.yaml60
-rw-r--r--test/integration/targets/nxos_feature/tests/cli/invalid.yaml15
-rw-r--r--test/integration/targets/nxos_feature/tests/nxapi/configure.yaml60
-rw-r--r--test/integration/targets/nxos_feature/tests/nxapi/invalid.yaml15
8 files changed, 198 insertions, 0 deletions
diff --git a/test/integration/targets/nxos_feature/meta/main.yml b/test/integration/targets/nxos_feature/meta/main.yml
new file mode 100644
index 0000000000..ae741cbdc7
--- /dev/null
+++ b/test/integration/targets/nxos_feature/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - prepare_nxos_tests
diff --git a/test/integration/targets/nxos_feature/tasks/cli.yaml b/test/integration/targets/nxos_feature/tasks/cli.yaml
new file mode 100644
index 0000000000..d675462dd0
--- /dev/null
+++ b/test/integration/targets/nxos_feature/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_feature/tasks/main.yaml b/test/integration/targets/nxos_feature/tasks/main.yaml
new file mode 100644
index 0000000000..4b0f8c64d9
--- /dev/null
+++ b/test/integration/targets/nxos_feature/tasks/main.yaml
@@ -0,0 +1,3 @@
+---
+- { include: cli.yaml, tags: ['cli'] }
+- { include: nxapi.yaml, tags: ['nxapi'] }
diff --git a/test/integration/targets/nxos_feature/tasks/nxapi.yaml b/test/integration/targets/nxos_feature/tasks/nxapi.yaml
new file mode 100644
index 0000000000..ea525379f7
--- /dev/null
+++ b/test/integration/targets/nxos_feature/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_feature/tests/cli/configure.yaml b/test/integration/targets/nxos_feature/tests/cli/configure.yaml
new file mode 100644
index 0000000000..0eab6de003
--- /dev/null
+++ b/test/integration/targets/nxos_feature/tests/cli/configure.yaml
@@ -0,0 +1,60 @@
+---
+- debug: msg="START cli/configure.yaml"
+
+- name: setup
+ nxos_config:
+ lines: no feature vn-segment-vlan-based
+ match: none
+ provider: "{{ cli }}"
+
+- name: enable vn-segment-vlan-based
+ nxos_feature:
+ feature: vn-segment-vlan-based
+ state: enabled
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+
+- name: verify vn-segment-vlan-based
+ nxos_feature:
+ feature: vn-segment-vlan-based
+ state: enabled
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
+
+- name: disable vn-segment-vlan-based
+ nxos_feature:
+ feature: vn-segment-vlan-based
+ state: disabled
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+
+- name: verify vn-segment-vlan-based
+ nxos_feature:
+ feature: vn-segment-vlan-based
+ state: disabled
+ provider: "{{ cli }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
+
+- name: teardown
+ nxos_config:
+ lines: no feature vn-segment-vlan-based
+ match: none
+ provider: "{{ cli }}"
+
+- debug: msg="END cli/configure.yaml"
diff --git a/test/integration/targets/nxos_feature/tests/cli/invalid.yaml b/test/integration/targets/nxos_feature/tests/cli/invalid.yaml
new file mode 100644
index 0000000000..7e198b61b2
--- /dev/null
+++ b/test/integration/targets/nxos_feature/tests/cli/invalid.yaml
@@ -0,0 +1,15 @@
+---
+- debug: msg="START cli/invalid.yaml"
+
+- name: configure invalid feature name
+ nxos_feature:
+ feature: invalid
+ provider: "{{ cli }}"
+ register: result
+ ignore_errors: yes
+
+- assert:
+ that:
+ - result.failed == true
+
+- debug: msg="END cli/invalid.yaml"
diff --git a/test/integration/targets/nxos_feature/tests/nxapi/configure.yaml b/test/integration/targets/nxos_feature/tests/nxapi/configure.yaml
new file mode 100644
index 0000000000..074b6c2813
--- /dev/null
+++ b/test/integration/targets/nxos_feature/tests/nxapi/configure.yaml
@@ -0,0 +1,60 @@
+---
+- debug: msg="START nxapi/configure.yaml"
+
+- name: setup
+ nxos_config:
+ lines: no feature vn-segment-vlan-based
+ match: none
+ provider: "{{ nxapi }}"
+
+- name: enable vn-segment-vlan-based
+ nxos_feature:
+ feature: vn-segment-vlan-based
+ state: enabled
+ provider: "{{ nxapi }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+
+- name: verify vn-segment-vlan-based
+ nxos_feature:
+ feature: vn-segment-vlan-based
+ state: enabled
+ provider: "{{ nxapi }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
+
+- name: disable vn-segment-vlan-based
+ nxos_feature:
+ feature: vn-segment-vlan-based
+ state: disabled
+ provider: "{{ nxapi }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+
+- name: verify vn-segment-vlan-based
+ nxos_feature:
+ feature: vn-segment-vlan-based
+ state: disabled
+ provider: "{{ nxapi }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == false"
+
+- name: teardown
+ nxos_config:
+ lines: no feature vn-segment-vlan-based
+ match: none
+ provider: "{{ nxapi }}"
+
+- debug: msg="END nxapi/configure.yaml"
diff --git a/test/integration/targets/nxos_feature/tests/nxapi/invalid.yaml b/test/integration/targets/nxos_feature/tests/nxapi/invalid.yaml
new file mode 100644
index 0000000000..19223a20c3
--- /dev/null
+++ b/test/integration/targets/nxos_feature/tests/nxapi/invalid.yaml
@@ -0,0 +1,15 @@
+---
+- debug: msg="START nxapi/invalid.yaml"
+
+- name: configure invalid feature name
+ nxos_feature:
+ feature: invalid
+ provider: "{{ nxapi }}"
+ register: result
+ ignore_errors: yes
+
+- assert:
+ that:
+ - result.failed == true
+
+- debug: msg="END nxapi/invalid.yaml"