summaryrefslogtreecommitdiff
path: root/test/integration/targets
diff options
context:
space:
mode:
authorTrishna Guha <trishnaguha17@gmail.com>2018-01-15 13:16:41 +0530
committerGitHub <noreply@github.com>2018-01-15 13:16:41 +0530
commit48ecbb8fb90080b4d1056bbb1dc2bfaddcf2c847 (patch)
treef6e24adffeebea432747295f3cf779da256a8b41 /test/integration/targets
parentc04cd8642d0589c3ffc0395a24bd2843a066b196 (diff)
downloadansible-48ecbb8fb90080b4d1056bbb1dc2bfaddcf2c847.tar.gz
fix connection gets overridden by network_cli for transport nxapi,eapi net_* modules (#34778)
* fix connection gets overridden by network_cli for transport nxapi,eapi net_* modules Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Define functions in individual action plugins to avoid code duplication Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Add net_* eos tests for eapi Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * update plugin code
Diffstat (limited to 'test/integration/targets')
-rw-r--r--test/integration/targets/eos_banner/tests/eapi/net_banner.yaml36
-rw-r--r--test/integration/targets/eos_interface/tests/eapi/net_interface.yaml53
-rw-r--r--test/integration/targets/eos_l3_interface/tests/eapi/net_l3_interface.yaml42
-rw-r--r--test/integration/targets/eos_logging/tests/eapi/net_logging.yaml39
-rw-r--r--test/integration/targets/eos_system/tests/eapi/net_system.yaml37
-rw-r--r--test/integration/targets/nxos_logging/tests/common/basic.yaml6
-rw-r--r--test/integration/targets/nxos_logging/tests/common/net_logging.yaml7
-rw-r--r--test/integration/targets/nxos_system/tests/nxapi/net_system.yaml38
-rw-r--r--test/integration/targets/nxos_user/tests/common/basic.yaml6
-rw-r--r--test/integration/targets/nxos_user/tests/common/net_user.yaml12
10 files changed, 269 insertions, 7 deletions
diff --git a/test/integration/targets/eos_banner/tests/eapi/net_banner.yaml b/test/integration/targets/eos_banner/tests/eapi/net_banner.yaml
new file mode 100644
index 0000000000..23681d76af
--- /dev/null
+++ b/test/integration/targets/eos_banner/tests/eapi/net_banner.yaml
@@ -0,0 +1,36 @@
+---
+- debug: msg="START eos eapi/net_banner.yaml on connection={{ ansible_connection }}"
+
+# Add minimal testcase to check args are passed correctly to
+# implementation module and module run is successful.
+
+- name: Remove previous motd banner (setup)
+ eos_config:
+ lines: no banner motd
+ authorize: yes
+ provider: "{{ eapi }}"
+
+- name: create motd
+ net_banner:
+ banner: motd
+ text: this is my motd banner configure by net_banner
+ state: present
+ authorize: yes
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - "result.changed == true"
+ - "result.commands.0.cmd == 'banner motd'"
+ - "result.commands.0.input == 'this is my motd banner configure by net_banner'"
+ # Ensure sessions contains epoc. Will fail after 18th May 2033
+ - "'ansible_1' in result.session_name"
+
+- name: Remove previous motd banner (teardown)
+ eos_config:
+ lines: no banner motd
+ authorize: yes
+ provider: "{{ eapi }}"
+
+- debug: msg="END eos eapi/net_banner.yaml on connection={{ ansible_connection }}"
diff --git a/test/integration/targets/eos_interface/tests/eapi/net_interface.yaml b/test/integration/targets/eos_interface/tests/eapi/net_interface.yaml
new file mode 100644
index 0000000000..02a9f6663b
--- /dev/null
+++ b/test/integration/targets/eos_interface/tests/eapi/net_interface.yaml
@@ -0,0 +1,53 @@
+---
+- debug: msg="START eos eapi/net_interface.yaml on connection={{ ansible_connection }}"
+
+# Add minimal testcase to check args are passed correctly to
+# implementation module and module run is successful.
+
+- name: Set test interface
+ set_fact:
+ test_interface_1: ethernet1
+
+- name: Configure interface (setup)
+ net_interface:
+ name: "{{ test_interface_1 }}"
+ description: test-interface-1
+ mtu: 1800
+ state: present
+ authorize: yes
+ provider: "{{ eapi }}"
+ register: result
+
+- name: Configure interface description using platform agnostic module
+ net_interface:
+ name: "{{ test_interface_1 }}"
+ description: test-interface-initial
+ state: present
+ authorize: yes
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == true'
+ - '"interface {{ test_interface_1 }}" in result.commands'
+ - '"description test-interface-initial" in result.commands'
+
+- name: Confgure interface parameters
+ net_interface:
+ name: "{{ test_interface_1 }}"
+ description: test-interface
+ mtu: 2000
+ state: present
+ authorize: yes
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == true'
+ - '"interface {{ test_interface_1 }}" in result.commands'
+ - '"description test-interface" in result.commands'
+ - '"mtu 2000" in result.commands'
+
+- debug: msg="END eos eapi/net_interface.yaml on connection={{ ansible_connection }}"
diff --git a/test/integration/targets/eos_l3_interface/tests/eapi/net_l3_interface.yaml b/test/integration/targets/eos_l3_interface/tests/eapi/net_l3_interface.yaml
new file mode 100644
index 0000000000..8ab448918a
--- /dev/null
+++ b/test/integration/targets/eos_l3_interface/tests/eapi/net_l3_interface.yaml
@@ -0,0 +1,42 @@
+---
+- debug: msg="START eos eapi/net_l3_interface.yaml on connection={{ ansible_connection }}"
+
+# Add minimal testcase to check args are passed correctly to
+# implementation module and module run is successful.
+
+- name: Set test interface
+ set_fact:
+ test_interface_1: ethernet1
+
+- name: Delete interface ipv4 and ipv6 address(setup)
+ net_l3_interface:
+ name: "{{ test_interface_1 }}"
+ state: absent
+ authorize: yes
+ provider: "{{ eapi }}"
+ register: result
+
+- name: Configure interface ipv4 address using platform agnostic module
+ net_l3_interface:
+ name: "{{ test_interface_1 }}"
+ ipv4: 192.108.0.1/24
+ state: present
+ authorize: yes
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == true'
+ - '"interface {{ test_interface_1 }}" in result.commands'
+ - '"ip address 192.108.0.1/24" in result.commands'
+
+- name: Delete interface ipv4 and ipv6 address(teardown)
+ net_l3_interface:
+ name: "{{ test_interface_1 }}"
+ state: absent
+ authorize: yes
+ provider: "{{ eapi }}"
+ register: result
+
+- debug: msg="END eos eapi/net_l3_interface.yaml on connection={{ ansible_connection }}"
diff --git a/test/integration/targets/eos_logging/tests/eapi/net_logging.yaml b/test/integration/targets/eos_logging/tests/eapi/net_logging.yaml
new file mode 100644
index 0000000000..f60d30b04b
--- /dev/null
+++ b/test/integration/targets/eos_logging/tests/eapi/net_logging.yaml
@@ -0,0 +1,39 @@
+---
+- debug: msg="START eos eapi/net_logging.yaml on connection={{ ansible_connection }}"
+
+# Add minimal testcase to check args are passed correctly to
+# implementation module and module run is successful.
+
+- name: Delete/disable host logging- setup
+ net_logging:
+ dest: host
+ name: 172.16.0.1
+ state: absent
+ authorize: yes
+ provider: "{{ eapi }}"
+ register: result
+
+- name: Set up host logging using platform agnostic module
+ net_logging:
+ dest: host
+ name: 172.16.0.1
+ state: present
+ authorize: yes
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == true'
+ - '"logging host 172.16.0.1" in result.commands'
+
+- name: Delete/disable host logging- teardown
+ net_logging:
+ dest: host
+ name: 172.16.0.1
+ state: absent
+ authorize: yes
+ provider: "{{ eapi }}"
+ register: result
+
+- debug: msg="END eos eapi/net_logging.yaml on connection={{ ansible_connection }}"
diff --git a/test/integration/targets/eos_system/tests/eapi/net_system.yaml b/test/integration/targets/eos_system/tests/eapi/net_system.yaml
new file mode 100644
index 0000000000..b094339b53
--- /dev/null
+++ b/test/integration/targets/eos_system/tests/eapi/net_system.yaml
@@ -0,0 +1,37 @@
+---
+- debug: msg="START eos eapi/net_system.yaml on connection={{ ansible_connection }}"
+
+# Add minimal testcase to check args are passed correctly to
+# implementation module and module run is successful.
+
+- name: setup
+ eos_config:
+ lines:
+ - no ip domain-list ansible.com
+ - no ip domain-list redhat.com
+ match: none
+ provider: "{{ eapi }}"
+
+- name: configure domain_list using platform agnostic module
+ net_system:
+ domain_list:
+ - ansible.com
+ - redhat.com
+ provider: "{{ eapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - "'ip domain-list ansible.com' in result.commands"
+ - "'ip domain-list redhat.com' in result.commands"
+
+- name: teardown
+ eos_config:
+ lines:
+ - no ip domain-list ansible.com
+ - no ip domain-list redhat.com
+ match: none
+ provider: "{{ eapi }}"
+
+- debug: msg="END eos eapi/net_system.yaml on connection={{ ansible_connection }}"
diff --git a/test/integration/targets/nxos_logging/tests/common/basic.yaml b/test/integration/targets/nxos_logging/tests/common/basic.yaml
index 3556f7251f..5e4d99eb52 100644
--- a/test/integration/targets/nxos_logging/tests/common/basic.yaml
+++ b/test/integration/targets/nxos_logging/tests/common/basic.yaml
@@ -1,4 +1,8 @@
---
+- debug: msg="START connection={{ ansible_connection }} nxos_logging basic test"
+- debug: msg="Using provider={{ connection.transport }}"
+ when: ansible_connection == "local"
+
- name: Set up console logging
nxos_logging:
dest: console
@@ -88,3 +92,5 @@
- 'result.changed == true'
- '"no logging logfile" in result.commands'
- '"no logging level daemon" in result.commands'
+
+- debug: msg="END connection={{ ansible_connection }} nxos_logging basic test"
diff --git a/test/integration/targets/nxos_logging/tests/common/net_logging.yaml b/test/integration/targets/nxos_logging/tests/common/net_logging.yaml
index 5d78f1a8a5..f2ec87d70a 100644
--- a/test/integration/targets/nxos_logging/tests/common/net_logging.yaml
+++ b/test/integration/targets/nxos_logging/tests/common/net_logging.yaml
@@ -1,5 +1,7 @@
---
-- debug: msg="START nxos common/net_logging.yaml on connection={{ ansible_connection }}"
+- debug: msg="START connection={{ ansible_connection }} nxos common/net_logging.yaml"
+- debug: msg="Using provider={{ connection.transport }}"
+ when: ansible_connection == "local"
# Add minimal testcase to check args are passed correctly to
# implementation module and module run is successful.
@@ -33,4 +35,5 @@
provider: "{{ connection }}"
register: result
-- debug: msg="END nxos common/net_logging.yaml on connection={{ ansible_connection }}"
+
+- debug: msg="END connection={{ ansible_connection }} nxos common/net_logging.yaml"
diff --git a/test/integration/targets/nxos_system/tests/nxapi/net_system.yaml b/test/integration/targets/nxos_system/tests/nxapi/net_system.yaml
new file mode 100644
index 0000000000..8193f809b8
--- /dev/null
+++ b/test/integration/targets/nxos_system/tests/nxapi/net_system.yaml
@@ -0,0 +1,38 @@
+---
+- debug: msg="START nxos nxapi/net_system.yaml on connection={{ ansible_connection }}"
+- debug: msg="Using provider={{ connection.transport }}"
+
+# Add minimal testcase to check args are passed correctly to
+# implementation module and module run is successful.
+
+- name: setup
+ nxos_config:
+ lines:
+ - no ip domain-list ansible.com
+ - no ip domain-list redhat.com
+ match: none
+ provider: "{{ nxapi }}"
+
+- name: configure domain_list using platform agnostic module
+ net_system:
+ domain_search:
+ - ansible.com
+ - redhat.com
+ provider: "{{ nxapi }}"
+ register: result
+
+- assert:
+ that:
+ - result.changed == true
+ - "'ip domain-list ansible.com' in result.commands"
+ - "'ip domain-list redhat.com' in result.commands"
+
+- name: setup
+ nxos_config:
+ lines:
+ - no ip domain-list ansible.com
+ - no ip domain-list redhat.com
+ match: none
+ provider: "{{ nxapi }}"
+
+- debug: msg="END nxos nxapi/net_system.yaml on connection={{ ansible_connection }}"
diff --git a/test/integration/targets/nxos_user/tests/common/basic.yaml b/test/integration/targets/nxos_user/tests/common/basic.yaml
index 8767788956..5901786317 100644
--- a/test/integration/targets/nxos_user/tests/common/basic.yaml
+++ b/test/integration/targets/nxos_user/tests/common/basic.yaml
@@ -1,4 +1,8 @@
---
+- debug: msg="START connection={{ ansible_connection }} nxos_user basic test"
+- debug: msg="Using provider={{ connection.transport }}"
+ when: ansible_connection == "local"
+
- name: Remove old entries of user
nxos_user:
aggregate:
@@ -51,3 +55,5 @@
that:
- 'result.changed == true'
- '"no username" in result.commands[0]'
+
+- debug: msg="END connection={{ ansible_connection }} nxos_user basic test"
diff --git a/test/integration/targets/nxos_user/tests/common/net_user.yaml b/test/integration/targets/nxos_user/tests/common/net_user.yaml
index f46005dbdf..1952d35e14 100644
--- a/test/integration/targets/nxos_user/tests/common/net_user.yaml
+++ b/test/integration/targets/nxos_user/tests/common/net_user.yaml
@@ -1,12 +1,14 @@
---
-- debug: msg="START nxos common/net_user.yaml on connection={{ ansible_connection }}"
+- debug: msg="START connection={{ ansible_connection }} nxos common/net_user.yaml"
+- debug: msg="Using provider={{ connection.transport }}"
+ when: ansible_connection == "local"
# Add minimal testcase to check args are passed correctly to
# implementation module and module run is successful.
-- name: Remove old entries of user - setup
+- name: "Remove old entries of user - setup"
net_user:
- - name: ansibletest1
+ name: ansibletest1
state: absent
provider: "{{ connection }}"
@@ -27,8 +29,8 @@
- name: teardown
net_user:
- - name: ansibletest1
+ name: ansibletest1
state: absent
provider: "{{ connection }}"
-- debug: msg="END nxos common/net_user.yaml on connection={{ ansible_connection }}"
+- debug: msg="END connection={{ ansible_connection }} nxos common/net_user.yaml"