summaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
authorMike Wiebe <mwiebe@cisco.com>2017-11-13 03:03:06 -0500
committerTrishna Guha <trishnaguha17@gmail.com>2017-11-13 08:03:06 +0000
commitde8d00b401d0073dfa60be2a71b9972ebc5c1554 (patch)
tree8829e3493a9ef69004fee7c76dcf7f7697736949 /test/integration
parentd97080174e9bbebd27a967368934ef91d1f28f64 (diff)
downloadansible-de8d00b401d0073dfa60be2a71b9972ebc5c1554.tar.gz
Fix snmp bugs on Nexus 3500 platform (#32773)
* Add n35 platform support * Fix regex bug and add snmp_location it tests * Enable nxos_snmp_location tests
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/nxos.yaml10
-rw-r--r--test/integration/targets/nxos_snmp_location/defaults/main.yaml2
-rw-r--r--test/integration/targets/nxos_snmp_location/meta/main.yml2
-rw-r--r--test/integration/targets/nxos_snmp_location/tasks/cli.yaml15
-rw-r--r--test/integration/targets/nxos_snmp_location/tasks/main.yaml7
-rw-r--r--test/integration/targets/nxos_snmp_location/tasks/nxapi.yaml28
-rw-r--r--test/integration/targets/nxos_snmp_location/tests/cli/sanity.yaml4
-rw-r--r--test/integration/targets/nxos_snmp_location/tests/common/sanity.yaml47
-rw-r--r--test/integration/targets/nxos_snmp_location/tests/nxapi/sanity.yaml4
9 files changed, 119 insertions, 0 deletions
diff --git a/test/integration/nxos.yaml b/test/integration/nxos.yaml
index d77e50059e..d69ef3dfb6 100644
--- a/test/integration/nxos.yaml
+++ b/test/integration/nxos.yaml
@@ -472,6 +472,16 @@
- set_fact:
failed_modules: "{{ failed_modules }} + [ 'nxos_snmp_community' ]"
test_failed: true
+
+ - block:
+ - include_role:
+ name: nxos_snmp_location
+ when: "limit_to in ['*', 'nxos_snmp_location']"
+ rescue:
+ - set_fact:
+ failed_modules: "{{ failed_modules }} + [ 'nxos_snmp_location' ]"
+ test_failed: true
+
###########
- debug: var=failed_modules
when: test_failed
diff --git a/test/integration/targets/nxos_snmp_location/defaults/main.yaml b/test/integration/targets/nxos_snmp_location/defaults/main.yaml
new file mode 100644
index 0000000000..5f709c5aac
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_location/defaults/main.yaml
@@ -0,0 +1,2 @@
+---
+testcase: "*"
diff --git a/test/integration/targets/nxos_snmp_location/meta/main.yml b/test/integration/targets/nxos_snmp_location/meta/main.yml
new file mode 100644
index 0000000000..ae741cbdc7
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_location/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - prepare_nxos_tests
diff --git a/test/integration/targets/nxos_snmp_location/tasks/cli.yaml b/test/integration/targets/nxos_snmp_location/tasks/cli.yaml
new file mode 100644
index 0000000000..d675462dd0
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_location/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_snmp_location/tasks/main.yaml b/test/integration/targets/nxos_snmp_location/tasks/main.yaml
new file mode 100644
index 0000000000..fea9337c14
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_location/tasks/main.yaml
@@ -0,0 +1,7 @@
+---
+# Use block to ensure that both cli and nxapi tests
+# will run even if there are failures or errors.
+- block:
+ - { include: cli.yaml, tags: ['cli'] }
+ always:
+ - { include: nxapi.yaml, tags: ['nxapi'] }
diff --git a/test/integration/targets/nxos_snmp_location/tasks/nxapi.yaml b/test/integration/targets/nxos_snmp_location/tasks/nxapi.yaml
new file mode 100644
index 0000000000..ea525379f7
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_location/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_snmp_location/tests/cli/sanity.yaml b/test/integration/targets/nxos_snmp_location/tests/cli/sanity.yaml
new file mode 100644
index 0000000000..420af7420e
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_location/tests/cli/sanity.yaml
@@ -0,0 +1,4 @@
+---
+- set_fact: connection="{{ cli }}"
+
+- import_tasks: "{{ role_path }}/tests/common/sanity.yaml"
diff --git a/test/integration/targets/nxos_snmp_location/tests/common/sanity.yaml b/test/integration/targets/nxos_snmp_location/tests/common/sanity.yaml
new file mode 100644
index 0000000000..7c6e4405a7
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_location/tests/common/sanity.yaml
@@ -0,0 +1,47 @@
+---
+- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_snmp_location sanity test"
+
+- name: Setup - Remove snmp_location if configured
+ nxos_snmp_location: &remove
+ location: Test
+ state: absent
+ timeout: 60
+ provider: "{{ connection }}"
+ ignore_errors: yes
+
+- block:
+
+ - name: Configure snmp host
+ nxos_snmp_location: &config
+ location: Test
+ state: present
+ timeout: 60
+ provider: "{{ connection }}"
+ register: result
+
+ - assert: &true
+ that:
+ - "result.changed == true"
+
+ - name: Idempotence Check
+ nxos_snmp_location: *config
+ register: result
+
+ - assert: &false
+ that:
+ - "result.changed == false"
+
+ always:
+ - name: Cleanup
+ nxos_snmp_location: *remove
+ register: result
+
+ - assert: *true
+
+ - name: Cleanup Idempotence
+ nxos_snmp_location: *remove
+ register: result
+
+ - assert: *false
+
+ - debug: msg="END TRANSPORT:{{ connection.transport }} nxos_snmp_location sanity test"
diff --git a/test/integration/targets/nxos_snmp_location/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_snmp_location/tests/nxapi/sanity.yaml
new file mode 100644
index 0000000000..e30ea6eaf7
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_location/tests/nxapi/sanity.yaml
@@ -0,0 +1,4 @@
+---
+- set_fact: connection="{{ nxapi }}"
+
+- import_tasks: "{{ role_path }}/tests/common/sanity.yaml"