summaryrefslogtreecommitdiff
path: root/test/integration/targets/nxos_banner
diff options
context:
space:
mode:
authorTrishna Guha <trishnaguha17@gmail.com>2018-01-18 11:50:15 +0530
committerGitHub <noreply@github.com>2018-01-18 11:50:15 +0530
commit8a6d69919863c2b1583da03e91e1c2108cde892c (patch)
treef4f0e2a57f77808c01c14fd8e2c9b2b5bd44a7d9 /test/integration/targets/nxos_banner
parentf806a58a5e3d8089ba2bb68cd45edfa0233cc975 (diff)
downloadansible-8a6d69919863c2b1583da03e91e1c2108cde892c.tar.gz
Enable nxapi nxos_banner test (#35033)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
Diffstat (limited to 'test/integration/targets/nxos_banner')
-rw-r--r--test/integration/targets/nxos_banner/tasks/main.yaml2
-rw-r--r--test/integration/targets/nxos_banner/tests/cli/basic-exec.yaml (renamed from test/integration/targets/nxos_banner/tests/common/basic-exec.yaml)17
-rw-r--r--test/integration/targets/nxos_banner/tests/cli/basic-motd.yaml (renamed from test/integration/targets/nxos_banner/tests/common/basic-motd.yaml)16
-rw-r--r--test/integration/targets/nxos_banner/tests/cli/basic-no-motd.yaml (renamed from test/integration/targets/nxos_banner/tests/common/basic-no-motd.yaml)10
-rw-r--r--test/integration/targets/nxos_banner/tests/nxapi/basic-exec.yaml32
-rw-r--r--test/integration/targets/nxos_banner/tests/nxapi/basic-motd.yaml29
-rw-r--r--test/integration/targets/nxos_banner/tests/nxapi/basic-no-motd.yaml25
7 files changed, 109 insertions, 22 deletions
diff --git a/test/integration/targets/nxos_banner/tasks/main.yaml b/test/integration/targets/nxos_banner/tasks/main.yaml
index f9482f77cf..4b0f8c64d9 100644
--- a/test/integration/targets/nxos_banner/tasks/main.yaml
+++ b/test/integration/targets/nxos_banner/tasks/main.yaml
@@ -1,3 +1,3 @@
---
- { include: cli.yaml, tags: ['cli'] }
-#- { include: nxapi.yaml, tags: ['nxapi'] }
+- { include: nxapi.yaml, tags: ['nxapi'] }
diff --git a/test/integration/targets/nxos_banner/tests/common/basic-exec.yaml b/test/integration/targets/nxos_banner/tests/cli/basic-exec.yaml
index 978f3892a9..f795df3f58 100644
--- a/test/integration/targets/nxos_banner/tests/common/basic-exec.yaml
+++ b/test/integration/targets/nxos_banner/tests/cli/basic-exec.yaml
@@ -1,12 +1,12 @@
---
-- debug: msg="START nxos_banner exec test"
+- debug: msg="START cli/nxos_banner exec test"
- block:
- name: setup - remove exec
- nxos_banner:
+ nxos_banner: &remove
banner: exec
state: absent
- provider: "{{ connection }}"
+ provider: "{{ cli }}"
- name: Set exec
nxos_banner: &exec
@@ -16,7 +16,7 @@
that has a multiline
string
state: present
- provider: "{{ connection }}"
+ provider: "{{ cli }}"
register: result
- assert:
@@ -33,10 +33,9 @@
- "result.changed == false"
- "result.commands | length == 0"
- when: platform is match("N7K")
+ - name: teardown - remove exec
+ nxos_banner: *remove
-- debug: msg="END nxos_banner exec test"
+ when: platform is match("N7K")
-# FIXME add in tests for everything defined in docs
-# FIXME Test state:absent + test:
-# FIXME Without powers ensure "privileged mode required"
+- debug: msg="END cli/nxos_banner exec test"
diff --git a/test/integration/targets/nxos_banner/tests/common/basic-motd.yaml b/test/integration/targets/nxos_banner/tests/cli/basic-motd.yaml
index 9a207f8b4b..18121ba3a6 100644
--- a/test/integration/targets/nxos_banner/tests/common/basic-motd.yaml
+++ b/test/integration/targets/nxos_banner/tests/cli/basic-motd.yaml
@@ -1,9 +1,11 @@
---
+- debug: msg="START cli/nxos_banner motd test"
+
- name: setup - remove motd
- nxos_banner:
+ nxos_banner: &remove
banner: motd
state: absent
- provider: "{{ connection }}"
+ provider: "{{ cli }}"
- name: Set motd
nxos_banner: &motd
@@ -13,7 +15,7 @@
that has a multiline
string
state: present
- provider: "{{ connection }}"
+ provider: "{{ cli }}"
register: result
- assert:
@@ -28,8 +30,8 @@
- assert:
that:
- "result.changed == false"
- - "result.commands | length == 0"
-# FIXME add in tests for everything defined in docs
-# FIXME Test state:absent + test:
-# FIXME Without powers ensure "privileged mode required"
+- name: teardown - remove motd
+ nxos_banner: *remove
+
+- debug: msg="END cli/nxos_banner motd test"
diff --git a/test/integration/targets/nxos_banner/tests/common/basic-no-motd.yaml b/test/integration/targets/nxos_banner/tests/cli/basic-no-motd.yaml
index b7c9fbfc99..8f4368c229 100644
--- a/test/integration/targets/nxos_banner/tests/common/basic-no-motd.yaml
+++ b/test/integration/targets/nxos_banner/tests/cli/basic-no-motd.yaml
@@ -1,4 +1,6 @@
---
+- debug: msg="START cli/nxos_banner no-motd test"
+
- name: Setup
nxos_banner:
banner: motd
@@ -6,13 +8,13 @@
Junk motd banner
over multiple lines
state: present
- provider: "{{ connection }}"
+ provider: "{{ cli }}"
- name: remove motd
nxos_banner: &rm-motd
banner: motd
state: absent
- provider: "{{ connection }}"
+ provider: "{{ cli }}"
register: result
- assert:
@@ -29,6 +31,4 @@
- "result.changed == false"
- "result.commands | length == 0"
-# FIXME add in tests for everything defined in docs
-# FIXME Test state:absent + test:
-# FIXME Without powers ensure "privileged mode required"
+- debug: msg="END cli/nxos_banner no-motd test"
diff --git a/test/integration/targets/nxos_banner/tests/nxapi/basic-exec.yaml b/test/integration/targets/nxos_banner/tests/nxapi/basic-exec.yaml
new file mode 100644
index 0000000000..8ecc7f06a9
--- /dev/null
+++ b/test/integration/targets/nxos_banner/tests/nxapi/basic-exec.yaml
@@ -0,0 +1,32 @@
+---
+- debug: msg="START nxapi/nxos_banner exec test"
+
+- block:
+ - name: setup - remove exec
+ nxos_banner: &remove
+ banner: exec
+ state: absent
+ provider: "{{ nxapi }}"
+
+ - name: Set exec
+ nxos_banner: &exec
+ banner: exec
+ text: |
+ this is my exec banner
+ that has a multiline
+ string
+ state: present
+ provider: "{{ nxapi }}"
+ register: result
+
+ - assert:
+ that:
+ - "result.changed == true"
+ - "'banner exec @\nthis is my exec banner\nthat has a multiline\nstring\n@' in result.commands"
+
+ - name: teardown - remove exec
+ nxos_banner: *remove
+
+ when: platform is match("N7K")
+
+- debug: msg="END nxapi/nxos_banner exec test"
diff --git a/test/integration/targets/nxos_banner/tests/nxapi/basic-motd.yaml b/test/integration/targets/nxos_banner/tests/nxapi/basic-motd.yaml
new file mode 100644
index 0000000000..ac94103f24
--- /dev/null
+++ b/test/integration/targets/nxos_banner/tests/nxapi/basic-motd.yaml
@@ -0,0 +1,29 @@
+---
+- debug: msg="START nxapi/nxos_banner motd test"
+
+- name: setup - remove motd
+ nxos_banner: &remove
+ banner: motd
+ state: absent
+ provider: "{{ nxapi }}"
+
+- name: Set motd
+ nxos_banner: &motd
+ banner: motd
+ text: |
+ this is my motd banner
+ that has a multiline
+ string
+ state: present
+ provider: "{{ nxapi }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+ - "'banner motd @\nthis is my motd banner\nthat has a multiline\nstring\n@' in result.commands"
+
+- name: teardown - remove motd
+ nxos_banner: *remove
+
+- debug: msg="END nxapi/nxos_banner motd test"
diff --git a/test/integration/targets/nxos_banner/tests/nxapi/basic-no-motd.yaml b/test/integration/targets/nxos_banner/tests/nxapi/basic-no-motd.yaml
new file mode 100644
index 0000000000..69072f24cc
--- /dev/null
+++ b/test/integration/targets/nxos_banner/tests/nxapi/basic-no-motd.yaml
@@ -0,0 +1,25 @@
+---
+- debug: msg="START nxapi/nxos_banner no-motd test"
+
+- name: Setup
+ nxos_banner:
+ banner: motd
+ text: |
+ Junk motd banner
+ over multiple lines
+ state: present
+ provider: "{{ nxapi }}"
+
+- name: remove motd
+ nxos_banner: &rm-motd
+ banner: motd
+ state: absent
+ provider: "{{ nxapi }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+ - "'no banner motd' in result.commands"
+
+- debug: msg="END nxapi/nxos_banner no-motd test"