summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsaichint <saichint@cisco.com>2017-10-26 08:27:55 -0700
committerToshio Kuratomi <a.badger@gmail.com>2017-11-01 08:53:11 -0700
commit7967b759805bd3d10dfc65d49af24346d4d99762 (patch)
tree3b0199221d6199a92acc478835f386a1c0f84691
parent6721c5392516487bfd4d54e7ad11f128bbfde294 (diff)
downloadansible-7967b759805bd3d10dfc65d49af24346d4d99762.tar.gz
Integration Tests only: add static route, snmp_user, snapshot and hsrp it cases (#28933)
* add static route and hsrp it cases * add snmp_user and snapshot it * password strength correction * fix typo * add compare snapshot as it is fixed in the code now * skip snapshot tests for titanium * titanium and nxapi conditions added (cherry picked from commit c8222923477d339c5f9ac3b66d986717e41dd4dc)
-rw-r--r--test/integration/nxos.yaml36
-rw-r--r--test/integration/targets/nxos_bgp/tests/common/sanity.yaml4
-rw-r--r--test/integration/targets/nxos_bgp_neighbor/tests/common/sanity.yaml4
-rw-r--r--test/integration/targets/nxos_hsrp/defaults/main.yaml2
-rw-r--r--test/integration/targets/nxos_hsrp/meta/main.yml2
-rw-r--r--test/integration/targets/nxos_hsrp/tasks/cli.yaml15
-rw-r--r--test/integration/targets/nxos_hsrp/tasks/main.yaml7
-rw-r--r--test/integration/targets/nxos_hsrp/tasks/nxapi.yaml28
-rw-r--r--test/integration/targets/nxos_hsrp/tests/cli/sanity.yaml4
-rw-r--r--test/integration/targets/nxos_hsrp/tests/common/sanity.yaml92
-rw-r--r--test/integration/targets/nxos_hsrp/tests/nxapi/sanity.yaml4
-rw-r--r--test/integration/targets/nxos_snapshot/defaults/main.yaml2
-rw-r--r--test/integration/targets/nxos_snapshot/meta/main.yml2
-rw-r--r--test/integration/targets/nxos_snapshot/tasks/cli.yaml15
-rw-r--r--test/integration/targets/nxos_snapshot/tasks/main.yaml3
-rw-r--r--test/integration/targets/nxos_snapshot/tasks/nxapi.yaml28
-rw-r--r--test/integration/targets/nxos_snapshot/tests/cli/sanity.yaml4
-rw-r--r--test/integration/targets/nxos_snapshot/tests/common/sanity.yaml46
-rw-r--r--test/integration/targets/nxos_snapshot/tests/nxapi/sanity.yaml4
-rw-r--r--test/integration/targets/nxos_snmp_user/defaults/main.yaml2
-rw-r--r--test/integration/targets/nxos_snmp_user/meta/main.yml2
-rw-r--r--test/integration/targets/nxos_snmp_user/tasks/cli.yaml15
-rw-r--r--test/integration/targets/nxos_snmp_user/tasks/main.yaml7
-rw-r--r--test/integration/targets/nxos_snmp_user/tasks/nxapi.yaml28
-rw-r--r--test/integration/targets/nxos_snmp_user/tests/cli/sanity.yaml4
-rw-r--r--test/integration/targets/nxos_snmp_user/tests/common/sanity.yaml41
-rw-r--r--test/integration/targets/nxos_snmp_user/tests/nxapi/sanity.yaml4
-rw-r--r--test/integration/targets/nxos_static_route/defaults/main.yaml2
-rw-r--r--test/integration/targets/nxos_static_route/meta/main.yml2
-rw-r--r--test/integration/targets/nxos_static_route/tasks/cli.yaml15
-rw-r--r--test/integration/targets/nxos_static_route/tasks/main.yaml7
-rw-r--r--test/integration/targets/nxos_static_route/tasks/nxapi.yaml28
-rw-r--r--test/integration/targets/nxos_static_route/tests/cli/sanity.yaml4
-rw-r--r--test/integration/targets/nxos_static_route/tests/common/sanity.yaml61
-rw-r--r--test/integration/targets/nxos_static_route/tests/nxapi/sanity.yaml4
-rw-r--r--test/integration/targets/prepare_nxos_tests/tasks/main.yml1
36 files changed, 525 insertions, 4 deletions
diff --git a/test/integration/nxos.yaml b/test/integration/nxos.yaml
index eea6960bb4..f4a5d62f12 100644
--- a/test/integration/nxos.yaml
+++ b/test/integration/nxos.yaml
@@ -224,6 +224,42 @@
- block:
- include_role:
+ name: nxos_snmp_user
+ when: "limit_to in ['*', 'nxos_snmp_user']"
+ rescue:
+ - set_fact:
+ failed_modules: "{{ failed_modules }} + [ 'nxos_snmp_user' ]"
+ test_failed: true
+
+ - block:
+ - include_role:
+ name: nxos_snapshot
+ when: "limit_to in ['*', 'nxos_snapshot']"
+ rescue:
+ - set_fact:
+ failed_modules: "{{ failed_modules }} + [ 'nxos_snapshot' ]"
+ test_failed: true
+
+ - block:
+ - include_role:
+ name: nxos_hsrp
+ when: "limit_to in ['*', 'nxos_hsrp']"
+ rescue:
+ - set_fact:
+ failed_modules: "{{ failed_modules }} + [ 'nxos_hsrp' ]"
+ test_failed: true
+
+ - block:
+ - include_role:
+ name: nxos_static_route
+ when: "limit_to in ['*', 'nxos_static_route']"
+ rescue:
+ - set_fact:
+ failed_modules: "{{ failed_modules }} + [ 'nxos_static_route' ]"
+ test_failed: true
+
+ - block:
+ - include_role:
name: nxos_rollback
when: "limit_to in ['*', 'nxos_rollback']"
rescue:
diff --git a/test/integration/targets/nxos_bgp/tests/common/sanity.yaml b/test/integration/targets/nxos_bgp/tests/common/sanity.yaml
index ac6a17cf06..0b7d0ab53b 100644
--- a/test/integration/targets/nxos_bgp/tests/common/sanity.yaml
+++ b/test/integration/targets/nxos_bgp/tests/common/sanity.yaml
@@ -2,10 +2,10 @@
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_bgp sanity test"
- set_fact: neighbor_down_fib_accelerate="true"
- when: (titanium is defined) and not ((titanium | search('true')))
+ when: not titanium
- set_fact: reconnect_interval="55"
- when: (titanium is defined) and not ((titanium | search('true')))
+ when: not titanium
- name: "Enable feature BGP"
nxos_feature:
diff --git a/test/integration/targets/nxos_bgp_neighbor/tests/common/sanity.yaml b/test/integration/targets/nxos_bgp_neighbor/tests/common/sanity.yaml
index f61147f86d..72b199c11a 100644
--- a/test/integration/targets/nxos_bgp_neighbor/tests/common/sanity.yaml
+++ b/test/integration/targets/nxos_bgp_neighbor/tests/common/sanity.yaml
@@ -4,10 +4,10 @@
- set_fact: intname="{{ nxos_int1 }}"
- set_fact: log_neighbor_changes="enable"
- when: (titanium is defined) and not ((titanium | search('true')))
+ when: not titanium
- set_fact: remove_private_as="all"
- when: (titanium is defined) and not ((titanium | search('true')))
+ when: not titanium
- name: "Enable feature BGP"
nxos_feature:
diff --git a/test/integration/targets/nxos_hsrp/defaults/main.yaml b/test/integration/targets/nxos_hsrp/defaults/main.yaml
new file mode 100644
index 0000000000..5f709c5aac
--- /dev/null
+++ b/test/integration/targets/nxos_hsrp/defaults/main.yaml
@@ -0,0 +1,2 @@
+---
+testcase: "*"
diff --git a/test/integration/targets/nxos_hsrp/meta/main.yml b/test/integration/targets/nxos_hsrp/meta/main.yml
new file mode 100644
index 0000000000..ae741cbdc7
--- /dev/null
+++ b/test/integration/targets/nxos_hsrp/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - prepare_nxos_tests
diff --git a/test/integration/targets/nxos_hsrp/tasks/cli.yaml b/test/integration/targets/nxos_hsrp/tasks/cli.yaml
new file mode 100644
index 0000000000..d675462dd0
--- /dev/null
+++ b/test/integration/targets/nxos_hsrp/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_hsrp/tasks/main.yaml b/test/integration/targets/nxos_hsrp/tasks/main.yaml
new file mode 100644
index 0000000000..fea9337c14
--- /dev/null
+++ b/test/integration/targets/nxos_hsrp/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_hsrp/tasks/nxapi.yaml b/test/integration/targets/nxos_hsrp/tasks/nxapi.yaml
new file mode 100644
index 0000000000..ea525379f7
--- /dev/null
+++ b/test/integration/targets/nxos_hsrp/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_hsrp/tests/cli/sanity.yaml b/test/integration/targets/nxos_hsrp/tests/cli/sanity.yaml
new file mode 100644
index 0000000000..413b3df3ac
--- /dev/null
+++ b/test/integration/targets/nxos_hsrp/tests/cli/sanity.yaml
@@ -0,0 +1,4 @@
+---
+- set_fact: connection="{{ cli }}"
+
+- import_tasks: targets/nxos_hsrp/tests/common/sanity.yaml
diff --git a/test/integration/targets/nxos_hsrp/tests/common/sanity.yaml b/test/integration/targets/nxos_hsrp/tests/common/sanity.yaml
new file mode 100644
index 0000000000..8fdf1deb6d
--- /dev/null
+++ b/test/integration/targets/nxos_hsrp/tests/common/sanity.yaml
@@ -0,0 +1,92 @@
+---
+- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_hsrp sanity test"
+
+# Select interface for test
+- set_fact: intname="{{ nxos_int1 }}"
+
+- block:
+ - name: "Enable feature hsrp"
+ nxos_feature:
+ feature: hsrp
+ state: enabled
+ provider: "{{ connection }}"
+
+ - name: "change interface mode"
+ nxos_config:
+ commands:
+ - no switchport
+ parents:
+ - "interface {{ intname }}"
+ match: none
+ provider: "{{ connection }}"
+
+ - name: "configure nxos_hsrp"
+ nxos_hsrp: &configure
+ group: 10
+ version: 2
+ vip: 10.1.1.1
+ priority: 150
+ interface: "{{ intname }}"
+ preempt: enabled
+ auth_type: text
+ auth_string: CISCO
+ provider: "{{ connection }}"
+ register: result
+
+ - assert: &true
+ that:
+ - "result.changed == true"
+
+ - name: "Conf Idempotence"
+ nxos_hsrp: *configure
+ register: result
+
+ - assert: &false
+ that:
+ - "result.changed == false"
+
+ - name: "remove nxos_hsrp"
+ nxos_hsrp: &remove
+ group: 10
+ version: 2
+ vip: 10.1.1.1
+ priority: 150
+ interface: "{{ intname }}"
+ preempt: enabled
+ auth_type: text
+ auth_string: CISCO
+ provider: "{{ connection }}"
+ state: absent
+ register: result
+
+ - assert: *true
+
+ - name: "Remove Idempotence"
+ nxos_hsrp: *remove
+ register: result
+
+ - assert: *false
+
+ always:
+ - name: "remove nxos_hsrp"
+ nxos_hsrp:
+ group: 10
+ version: 2
+ vip: 10.1.1.1
+ priority: 150
+ interface: "{{ intname }}"
+ preempt: enabled
+ auth_type: text
+ auth_string: CISCO
+ provider: "{{ connection }}"
+ state: absent
+ ignore_errors: yes
+
+ - name: "Disable feature hsrp"
+ nxos_feature:
+ feature: hsrp
+ state: disabled
+ provider: "{{ connection }}"
+ ignore_errors: yes
+
+- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_hsrp sanity test"
diff --git a/test/integration/targets/nxos_hsrp/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_hsrp/tests/nxapi/sanity.yaml
new file mode 100644
index 0000000000..7718b7c858
--- /dev/null
+++ b/test/integration/targets/nxos_hsrp/tests/nxapi/sanity.yaml
@@ -0,0 +1,4 @@
+---
+- set_fact: connection="{{ nxapi }}"
+
+- import_tasks: targets/nxos_hsrp/tests/common/sanity.yaml
diff --git a/test/integration/targets/nxos_snapshot/defaults/main.yaml b/test/integration/targets/nxos_snapshot/defaults/main.yaml
new file mode 100644
index 0000000000..5f709c5aac
--- /dev/null
+++ b/test/integration/targets/nxos_snapshot/defaults/main.yaml
@@ -0,0 +1,2 @@
+---
+testcase: "*"
diff --git a/test/integration/targets/nxos_snapshot/meta/main.yml b/test/integration/targets/nxos_snapshot/meta/main.yml
new file mode 100644
index 0000000000..ae741cbdc7
--- /dev/null
+++ b/test/integration/targets/nxos_snapshot/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - prepare_nxos_tests
diff --git a/test/integration/targets/nxos_snapshot/tasks/cli.yaml b/test/integration/targets/nxos_snapshot/tasks/cli.yaml
new file mode 100644
index 0000000000..d675462dd0
--- /dev/null
+++ b/test/integration/targets/nxos_snapshot/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_snapshot/tasks/main.yaml b/test/integration/targets/nxos_snapshot/tasks/main.yaml
new file mode 100644
index 0000000000..4b0f8c64d9
--- /dev/null
+++ b/test/integration/targets/nxos_snapshot/tasks/main.yaml
@@ -0,0 +1,3 @@
+---
+- { include: cli.yaml, tags: ['cli'] }
+- { include: nxapi.yaml, tags: ['nxapi'] }
diff --git a/test/integration/targets/nxos_snapshot/tasks/nxapi.yaml b/test/integration/targets/nxos_snapshot/tasks/nxapi.yaml
new file mode 100644
index 0000000000..ea525379f7
--- /dev/null
+++ b/test/integration/targets/nxos_snapshot/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_snapshot/tests/cli/sanity.yaml b/test/integration/targets/nxos_snapshot/tests/cli/sanity.yaml
new file mode 100644
index 0000000000..b73edf246d
--- /dev/null
+++ b/test/integration/targets/nxos_snapshot/tests/cli/sanity.yaml
@@ -0,0 +1,4 @@
+---
+- set_fact: connection="{{ cli }}"
+
+- import_tasks: targets/nxos_snapshot/tests/common/sanity.yaml
diff --git a/test/integration/targets/nxos_snapshot/tests/common/sanity.yaml b/test/integration/targets/nxos_snapshot/tests/common/sanity.yaml
new file mode 100644
index 0000000000..040e77fc26
--- /dev/null
+++ b/test/integration/targets/nxos_snapshot/tests/common/sanity.yaml
@@ -0,0 +1,46 @@
+---
+- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_snapshot sanity test"
+
+- set_fact: snapshot_run="true"
+- set_fact: snapshot_run="false"
+ when: titanium and (connection.transport | match('nxapi'))
+
+- block:
+ - name: create snapshot
+ nxos_snapshot:
+ action: create
+ snapshot_name: test_snapshot1
+ description: Ansible
+ provider: "{{ connection }}"
+
+ - name: create another snapshot
+ nxos_snapshot:
+ action: create
+ snapshot_name: test_snapshot2
+ description: row
+ section: myshow
+ show_command: show ip interface brief
+ row_id: ROW_intf
+ element_key1: intf-name
+ provider: "{{ connection }}"
+
+ - name: compare snapshots
+ nxos_snapshot:
+ action: compare
+ snapshot1: test_snapshot1
+ snapshot2: test_snapshot2
+ comparison_results_file: compare_snapshots.txt
+ compare_option: summary
+ path: '.'
+ provider: "{{ connection }}"
+
+ when: snapshot_run
+
+ always:
+ - name: delete snapshot
+ nxos_snapshot:
+ action: delete_all
+ provider: "{{ connection }}"
+ ignore_errors: yes
+
+- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_snapshot sanity test"
diff --git a/test/integration/targets/nxos_snapshot/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_snapshot/tests/nxapi/sanity.yaml
new file mode 100644
index 0000000000..a13de83ac7
--- /dev/null
+++ b/test/integration/targets/nxos_snapshot/tests/nxapi/sanity.yaml
@@ -0,0 +1,4 @@
+---
+- set_fact: connection="{{ nxapi }}"
+
+- import_tasks: targets/nxos_snapshot/tests/common/sanity.yaml
diff --git a/test/integration/targets/nxos_snmp_user/defaults/main.yaml b/test/integration/targets/nxos_snmp_user/defaults/main.yaml
new file mode 100644
index 0000000000..5f709c5aac
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_user/defaults/main.yaml
@@ -0,0 +1,2 @@
+---
+testcase: "*"
diff --git a/test/integration/targets/nxos_snmp_user/meta/main.yml b/test/integration/targets/nxos_snmp_user/meta/main.yml
new file mode 100644
index 0000000000..ae741cbdc7
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_user/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - prepare_nxos_tests
diff --git a/test/integration/targets/nxos_snmp_user/tasks/cli.yaml b/test/integration/targets/nxos_snmp_user/tasks/cli.yaml
new file mode 100644
index 0000000000..d675462dd0
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_user/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_user/tasks/main.yaml b/test/integration/targets/nxos_snmp_user/tasks/main.yaml
new file mode 100644
index 0000000000..fea9337c14
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_user/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_user/tasks/nxapi.yaml b/test/integration/targets/nxos_snmp_user/tasks/nxapi.yaml
new file mode 100644
index 0000000000..ea525379f7
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_user/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_user/tests/cli/sanity.yaml b/test/integration/targets/nxos_snmp_user/tests/cli/sanity.yaml
new file mode 100644
index 0000000000..ddc152e309
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_user/tests/cli/sanity.yaml
@@ -0,0 +1,4 @@
+---
+- set_fact: connection="{{ cli }}"
+
+- import_tasks: targets/nxos_snmp_user/tests/common/sanity.yaml
diff --git a/test/integration/targets/nxos_snmp_user/tests/common/sanity.yaml b/test/integration/targets/nxos_snmp_user/tests/common/sanity.yaml
new file mode 100644
index 0000000000..dbc7252e21
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_user/tests/common/sanity.yaml
@@ -0,0 +1,41 @@
+---
+- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_snmp_user sanity test"
+
+- name: Create snmp user
+ nxos_snmp_user: &create
+ user: ntc
+ group: network-operator
+ authentication: md5
+ pwd: N$tOpe%1
+ privacy: HelloU$er1
+ encrypt: true
+ provider: "{{ connection }}"
+ register: result
+
+- assert: &true
+ that:
+ - "result.changed == true"
+
+- name: delete snmp user
+ nxos_snmp_user: &remove
+ user: ntc
+ group: network-operator
+ authentication: md5
+ pwd: Testing1%
+ privacy: HelloU$er1
+ encrypt: true
+ state: absent
+ provider: "{{ connection }}"
+ register: result
+
+- assert: *true
+
+- name: "Remove Idempotence"
+ nxos_snmp_user: *remove
+ register: result
+
+- assert: &false
+ that:
+ - "result.changed == false"
+
+- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_snmp_user sanity test"
diff --git a/test/integration/targets/nxos_snmp_user/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_snmp_user/tests/nxapi/sanity.yaml
new file mode 100644
index 0000000000..1ae7b202c4
--- /dev/null
+++ b/test/integration/targets/nxos_snmp_user/tests/nxapi/sanity.yaml
@@ -0,0 +1,4 @@
+---
+- set_fact: connection="{{ nxapi }}"
+
+- import_tasks: targets/nxos_snmp_user/tests/common/sanity.yaml
diff --git a/test/integration/targets/nxos_static_route/defaults/main.yaml b/test/integration/targets/nxos_static_route/defaults/main.yaml
new file mode 100644
index 0000000000..5f709c5aac
--- /dev/null
+++ b/test/integration/targets/nxos_static_route/defaults/main.yaml
@@ -0,0 +1,2 @@
+---
+testcase: "*"
diff --git a/test/integration/targets/nxos_static_route/meta/main.yml b/test/integration/targets/nxos_static_route/meta/main.yml
new file mode 100644
index 0000000000..ae741cbdc7
--- /dev/null
+++ b/test/integration/targets/nxos_static_route/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - prepare_nxos_tests
diff --git a/test/integration/targets/nxos_static_route/tasks/cli.yaml b/test/integration/targets/nxos_static_route/tasks/cli.yaml
new file mode 100644
index 0000000000..d675462dd0
--- /dev/null
+++ b/test/integration/targets/nxos_static_route/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_static_route/tasks/main.yaml b/test/integration/targets/nxos_static_route/tasks/main.yaml
new file mode 100644
index 0000000000..fea9337c14
--- /dev/null
+++ b/test/integration/targets/nxos_static_route/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_static_route/tasks/nxapi.yaml b/test/integration/targets/nxos_static_route/tasks/nxapi.yaml
new file mode 100644
index 0000000000..ea525379f7
--- /dev/null
+++ b/test/integration/targets/nxos_static_route/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_static_route/tests/cli/sanity.yaml b/test/integration/targets/nxos_static_route/tests/cli/sanity.yaml
new file mode 100644
index 0000000000..ad856f1460
--- /dev/null
+++ b/test/integration/targets/nxos_static_route/tests/cli/sanity.yaml
@@ -0,0 +1,4 @@
+---
+- set_fact: connection="{{ cli }}"
+
+- import_tasks: targets/nxos_static_route/tests/common/sanity.yaml
diff --git a/test/integration/targets/nxos_static_route/tests/common/sanity.yaml b/test/integration/targets/nxos_static_route/tests/common/sanity.yaml
new file mode 100644
index 0000000000..25a48f3f87
--- /dev/null
+++ b/test/integration/targets/nxos_static_route/tests/common/sanity.yaml
@@ -0,0 +1,61 @@
+---
+- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_static_route sanity test"
+
+- block:
+ - name: create static route
+ nxos_static_route: &configure
+ prefix: "192.168.20.64/24"
+ next_hop: "3.3.3.3"
+ route_name: testing
+ pref: 100
+ tag: 5500
+ vrf: testing
+ provider: "{{ connection }}"
+ register: result
+
+ - assert: &true
+ that:
+ - "result.changed == true"
+
+ - name: "Conf Idempotence"
+ nxos_static_route: *configure
+ register: result
+
+ - assert: &false
+ that:
+ - "result.changed == false"
+
+ - name: remove static route
+ nxos_static_route: &remove
+ prefix: "192.168.20.64/24"
+ next_hop: "3.3.3.3"
+ route_name: testing
+ pref: 100
+ tag: 5500
+ vrf: testing
+ state: absent
+ provider: "{{ connection }}"
+ register: result
+
+ - assert: *true
+
+ - name: "Remove Idempotence"
+ nxos_static_route: *remove
+ register: result
+
+ - assert: *false
+
+ always:
+ - name: remove static route
+ nxos_static_route:
+ prefix: "192.168.20.64/24"
+ next_hop: "3.3.3.3"
+ route_name: testing
+ pref: 100
+ tag: 5500
+ vrf: testing
+ state: absent
+ provider: "{{ connection }}"
+ ignore_errors: yes
+
+- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_static_route sanity test"
diff --git a/test/integration/targets/nxos_static_route/tests/nxapi/sanity.yaml b/test/integration/targets/nxos_static_route/tests/nxapi/sanity.yaml
new file mode 100644
index 0000000000..5b4e0f8732
--- /dev/null
+++ b/test/integration/targets/nxos_static_route/tests/nxapi/sanity.yaml
@@ -0,0 +1,4 @@
+---
+- set_fact: connection="{{ nxapi }}"
+
+- import_tasks: targets/nxos_static_route/tests/common/sanity.yaml
diff --git a/test/integration/targets/prepare_nxos_tests/tasks/main.yml b/test/integration/targets/prepare_nxos_tests/tasks/main.yml
index 78e65cb55d..ff1c125d4b 100644
--- a/test/integration/targets/prepare_nxos_tests/tasks/main.yml
+++ b/test/integration/targets/prepare_nxos_tests/tasks/main.yml
@@ -82,6 +82,7 @@
when: (platform | match("N9K")) and (fretta | search("true"))
# Check if platform is titanium
+- set_fact: titanium="false"
- set_fact: titanium={% for row in nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'] if 'NX-OSv' in row['desc']%}"true"{% endfor %}
when: platform | match("N7K")