summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjctanner <tanner.jc@gmail.com>2018-05-25 08:50:45 -0400
committerJohn R Barker <john@johnrbarker.com>2018-05-25 13:50:45 +0100
commit1d5fe326e8860605e064993cd04533eb178756f9 (patch)
treecede365266aa55ad37965e632e4f7a62bab7b885
parent362e622a4b33602d8c70d05f7c76b9ae03de536c (diff)
downloadansible-1d5fe326e8860605e064993cd04533eb178756f9.tar.gz
Add a cloud provider and a set of smoketests for the NIOS modules (#40573)
* Add a cloud provider and a set of smoketests for the NIOS modules
-rw-r--r--test/integration/targets/nios_dns_view/aliases4
-rw-r--r--test/integration/targets/nios_dns_view/tasks/cli.yaml0
-rw-r--r--test/integration/targets/nios_dns_view/tasks/main.yaml2
-rw-r--r--test/integration/targets/nios_dns_view/tasks/main.yml1
-rw-r--r--test/integration/targets/nios_dns_view/tasks/niapi.yaml0
-rw-r--r--test/integration/targets/nios_dns_view/tasks/nios_dns_view_idempotence.yml58
-rw-r--r--test/integration/targets/nios_host_record/aliases4
-rw-r--r--test/integration/targets/nios_host_record/tasks/cli.yaml22
-rw-r--r--test/integration/targets/nios_host_record/tasks/main.yaml2
-rw-r--r--test/integration/targets/nios_host_record/tasks/main.yml1
-rw-r--r--test/integration/targets/nios_host_record/tasks/niapi.yaml0
-rw-r--r--test/integration/targets/nios_host_record/tasks/nios_host_record_idempotence.yml85
-rw-r--r--test/integration/targets/nios_host_record/tests/configure_ipv4_host_record.yaml0
-rw-r--r--test/integration/targets/nios_network/aliases4
-rw-r--r--test/integration/targets/nios_network/tasks/cli.yaml0
-rw-r--r--test/integration/targets/nios_network/tasks/main.yaml2
-rw-r--r--test/integration/targets/nios_network/tasks/main.yml1
-rw-r--r--test/integration/targets/nios_network/tasks/niapi.yaml0
-rw-r--r--test/integration/targets/nios_network/tasks/nios_network_idempotence.yml80
-rw-r--r--test/integration/targets/nios_network_view/aliases4
-rw-r--r--test/integration/targets/nios_network_view/tasks/cli.yaml0
-rw-r--r--test/integration/targets/nios_network_view/tasks/main.yaml2
-rw-r--r--test/integration/targets/nios_network_view/tasks/main.yml1
-rw-r--r--test/integration/targets/nios_network_view/tasks/niapi.yaml0
-rw-r--r--test/integration/targets/nios_network_view/tasks/nios_network_view_idempotence.yml58
-rw-r--r--test/integration/targets/nios_zone/aliases4
-rw-r--r--test/integration/targets/nios_zone/tasks/cli.yaml0
-rw-r--r--test/integration/targets/nios_zone/tasks/main.yaml2
-rw-r--r--test/integration/targets/nios_zone/tasks/main.yml1
-rw-r--r--test/integration/targets/nios_zone/tasks/niapi.yaml0
-rw-r--r--test/integration/targets/nios_zone/tasks/nios_zone_idempotence.yml68
-rw-r--r--test/integration/targets/prepare_nios_tests/tasks/main.yml7
-rw-r--r--test/runner/lib/cloud/nios.py185
-rw-r--r--test/runner/requirements/integration.cloud.nios.txt1
34 files changed, 562 insertions, 37 deletions
diff --git a/test/integration/targets/nios_dns_view/aliases b/test/integration/targets/nios_dns_view/aliases
index 89aea537d1..a52e8b266f 100644
--- a/test/integration/targets/nios_dns_view/aliases
+++ b/test/integration/targets/nios_dns_view/aliases
@@ -1 +1,3 @@
-unsupported \ No newline at end of file
+posix/ci/cloud/group4/nios
+cloud/nios
+destructive
diff --git a/test/integration/targets/nios_dns_view/tasks/cli.yaml b/test/integration/targets/nios_dns_view/tasks/cli.yaml
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/integration/targets/nios_dns_view/tasks/cli.yaml
+++ /dev/null
diff --git a/test/integration/targets/nios_dns_view/tasks/main.yaml b/test/integration/targets/nios_dns_view/tasks/main.yaml
deleted file mode 100644
index d4898c29bc..0000000000
--- a/test/integration/targets/nios_dns_view/tasks/main.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-- { include: cli.yaml, tags: ['cli'] } \ No newline at end of file
diff --git a/test/integration/targets/nios_dns_view/tasks/main.yml b/test/integration/targets/nios_dns_view/tasks/main.yml
new file mode 100644
index 0000000000..1eb9c07ab2
--- /dev/null
+++ b/test/integration/targets/nios_dns_view/tasks/main.yml
@@ -0,0 +1 @@
+- include: nios_dns_view_idempotence.yml
diff --git a/test/integration/targets/nios_dns_view/tasks/niapi.yaml b/test/integration/targets/nios_dns_view/tasks/niapi.yaml
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/integration/targets/nios_dns_view/tasks/niapi.yaml
+++ /dev/null
diff --git a/test/integration/targets/nios_dns_view/tasks/nios_dns_view_idempotence.yml b/test/integration/targets/nios_dns_view/tasks/nios_dns_view_idempotence.yml
new file mode 100644
index 0000000000..b9dc9fec4a
--- /dev/null
+++ b/test/integration/targets/nios_dns_view/tasks/nios_dns_view_idempotence.yml
@@ -0,0 +1,58 @@
+- name: delete dns view instance
+ nios_dns_view:
+ name: ansible-dns
+ state: absent
+ provider: "{{ nios_provider }}"
+
+- name: configure a new dns view instance
+ nios_dns_view:
+ name: ansible-dns
+ state: present
+ provider: "{{ nios_provider }}"
+ register: nios_dns_create1
+
+- name: configure a new dns view instance
+ nios_dns_view:
+ name: ansible-dns
+ state: present
+ provider: "{{ nios_provider }}"
+ register: nios_dns_create2
+
+- name: update the comment for dns view
+ nios_dns_view:
+ name: ansible-dns
+ comment: this is an example comment
+ state: present
+ provider: "{{ nios_provider }}"
+ register: nios_dns_update1
+
+- name: update the comment for dns view
+ nios_dns_view:
+ name: ansible-dns
+ comment: this is an example comment
+ state: present
+ provider: "{{ nios_provider }}"
+ register: nios_dns_update2
+
+- name: delete dns view instance
+ nios_dns_view:
+ name: ansible-dns
+ state: absent
+ provider: "{{ nios_provider }}"
+ register: nios_dns_delete1
+
+- name: delete dns view instance
+ nios_dns_view:
+ name: ansible-dns
+ state: absent
+ provider: "{{ nios_provider }}"
+ register: nios_dns_delete2
+
+- assert:
+ that:
+ - "nios_dns_create1.changed"
+ - "not nios_dns_create2.changed"
+ - "nios_dns_update1.changed"
+ - "not nios_dns_update2.changed"
+ - "nios_dns_delete1.changed"
+ - "not nios_dns_delete2.changed"
diff --git a/test/integration/targets/nios_host_record/aliases b/test/integration/targets/nios_host_record/aliases
index 89aea537d1..a52e8b266f 100644
--- a/test/integration/targets/nios_host_record/aliases
+++ b/test/integration/targets/nios_host_record/aliases
@@ -1 +1,3 @@
-unsupported \ No newline at end of file
+posix/ci/cloud/group4/nios
+cloud/nios
+destructive
diff --git a/test/integration/targets/nios_host_record/tasks/cli.yaml b/test/integration/targets/nios_host_record/tasks/cli.yaml
deleted file mode 100644
index 1930ea2d91..0000000000
--- a/test/integration/targets/nios_host_record/tasks/cli.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
----
-- name: collect all cli test cases
- find:
- paths: "{{ role_path }}/tests/cli"
- patterns: "{{ testcase }}.yaml"
- register: test_cases
- delegate_to: localhost
-
-- name: set test_items
- set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
-
-- name: run test cases (connection=network_cli)
- include: "{{ test_case_to_run }} "
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
-
-- name: run test case (connection=local)
- include: "{{ test_case_to_run }} ansible_connection=local"
- with_first_found: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
diff --git a/test/integration/targets/nios_host_record/tasks/main.yaml b/test/integration/targets/nios_host_record/tasks/main.yaml
deleted file mode 100644
index d4898c29bc..0000000000
--- a/test/integration/targets/nios_host_record/tasks/main.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-- { include: cli.yaml, tags: ['cli'] } \ No newline at end of file
diff --git a/test/integration/targets/nios_host_record/tasks/main.yml b/test/integration/targets/nios_host_record/tasks/main.yml
new file mode 100644
index 0000000000..2f1dcc55e5
--- /dev/null
+++ b/test/integration/targets/nios_host_record/tasks/main.yml
@@ -0,0 +1 @@
+- include: nios_host_record_idempotence.yml
diff --git a/test/integration/targets/nios_host_record/tasks/niapi.yaml b/test/integration/targets/nios_host_record/tasks/niapi.yaml
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/integration/targets/nios_host_record/tasks/niapi.yaml
+++ /dev/null
diff --git a/test/integration/targets/nios_host_record/tasks/nios_host_record_idempotence.yml b/test/integration/targets/nios_host_record/tasks/nios_host_record_idempotence.yml
new file mode 100644
index 0000000000..3542b34c04
--- /dev/null
+++ b/test/integration/targets/nios_host_record/tasks/nios_host_record_idempotence.yml
@@ -0,0 +1,85 @@
+- name: cleanup the parent object
+ nios_zone:
+ name: ansible.com
+ state: absent
+ provider: "{{ nios_provider }}"
+
+- name: create the parent object
+ nios_zone:
+ name: ansible.com
+ state: present
+ provider: "{{ nios_provider }}"
+
+- name: cleanup ipv4 host record
+ nios_host_record:
+ name: host.ansible.com
+ ipv4:
+ - address: 192.168.10.1
+ state: absent
+ provider: "{{ nios_provider }}"
+
+- name: create an ipv4 host record
+ nios_host_record:
+ name: host.ansible.com
+ ipv4:
+ - address: 192.168.10.1
+ state: present
+ provider: "{{ nios_provider }}"
+ register: ipv4_create1
+
+- name: recreate an ipv4 host record
+ nios_host_record:
+ name: host.ansible.com
+ ipv4:
+ - address: 192.168.10.1
+ state: present
+ provider: "{{ nios_provider }}"
+ register: ipv4_create2
+
+- assert:
+ that:
+ - "ipv4_create1.changed"
+ - "not ipv4_create2.changed"
+
+- name: add a comment to an existing host record
+ nios_host_record:
+ name: host.ansible.com
+ ipv4:
+ - address: 192.168.10.1
+ comment: this is a test comment
+ state: present
+ provider: "{{ nios_provider }}"
+ register: ipv4_update1
+
+- name: add a comment to an existing host record
+ nios_host_record:
+ name: host.ansible.com
+ ipv4:
+ - address: 192.168.10.1
+ comment: this is a test comment
+ state: present
+ provider: "{{ nios_provider }}"
+ register: ipv4_update2
+
+- name: remove a host record from the system
+ nios_host_record:
+ name: host.ansible.com
+ state: absent
+ provider: "{{ nios_provider }}"
+ register: ipv4_delete1
+
+- name: remove a host record from the system
+ nios_host_record:
+ name: host.ansible.com
+ state: absent
+ provider: "{{ nios_provider }}"
+ register: ipv4_delete2
+
+- assert:
+ that:
+ - "ipv4_create1.changed"
+ - "not ipv4_create2.changed"
+ - "ipv4_update1.changed"
+ - "not ipv4_update2.changed"
+ - "ipv4_delete1.changed"
+ - "not ipv4_delete2.changed"
diff --git a/test/integration/targets/nios_host_record/tests/configure_ipv4_host_record.yaml b/test/integration/targets/nios_host_record/tests/configure_ipv4_host_record.yaml
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/integration/targets/nios_host_record/tests/configure_ipv4_host_record.yaml
+++ /dev/null
diff --git a/test/integration/targets/nios_network/aliases b/test/integration/targets/nios_network/aliases
index 89aea537d1..a52e8b266f 100644
--- a/test/integration/targets/nios_network/aliases
+++ b/test/integration/targets/nios_network/aliases
@@ -1 +1,3 @@
-unsupported \ No newline at end of file
+posix/ci/cloud/group4/nios
+cloud/nios
+destructive
diff --git a/test/integration/targets/nios_network/tasks/cli.yaml b/test/integration/targets/nios_network/tasks/cli.yaml
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/integration/targets/nios_network/tasks/cli.yaml
+++ /dev/null
diff --git a/test/integration/targets/nios_network/tasks/main.yaml b/test/integration/targets/nios_network/tasks/main.yaml
deleted file mode 100644
index d4898c29bc..0000000000
--- a/test/integration/targets/nios_network/tasks/main.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-- { include: cli.yaml, tags: ['cli'] } \ No newline at end of file
diff --git a/test/integration/targets/nios_network/tasks/main.yml b/test/integration/targets/nios_network/tasks/main.yml
new file mode 100644
index 0000000000..c147af8f41
--- /dev/null
+++ b/test/integration/targets/nios_network/tasks/main.yml
@@ -0,0 +1 @@
+- include: nios_network_idempotence.yml
diff --git a/test/integration/targets/nios_network/tasks/niapi.yaml b/test/integration/targets/nios_network/tasks/niapi.yaml
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/integration/targets/nios_network/tasks/niapi.yaml
+++ /dev/null
diff --git a/test/integration/targets/nios_network/tasks/nios_network_idempotence.yml b/test/integration/targets/nios_network/tasks/nios_network_idempotence.yml
new file mode 100644
index 0000000000..3b5dbc4b5a
--- /dev/null
+++ b/test/integration/targets/nios_network/tasks/nios_network_idempotence.yml
@@ -0,0 +1,80 @@
+- name: cleanup a network ipv4
+ nios_network:
+ network: 192.168.10.0/24
+ comment: this is a test comment
+ state: absent
+ provider: "{{ nios_provider }}"
+
+- name: configure a network ipv4
+ nios_network:
+ network: 192.168.10.0/24
+ comment: this is a test comment
+ state: present
+ provider: "{{ nios_provider }}"
+ register: nios_ipv4_create1
+
+- name: configure a network ipv4
+ nios_network:
+ network: 192.168.10.0/24
+ comment: this is a test comment
+ state: present
+ provider: "{{ nios_provider }}"
+ register: nios_ipv4_create2
+
+#- assert:
+# that:
+# - "nios_ipv4_create1.changed"
+# - "not nios_ipv4_create2.changed"
+
+- name: set dhcp options for a network ipv4
+ nios_network:
+ network: 192.168.10.0/24
+ comment: this is a test comment
+ options:
+ - name: domain-name
+ value: ansible.com
+ state: present
+ provider: "{{ nios_provider }}"
+ register: nios_ipv4_update1
+
+- name: set dhcp options for a network ipv4
+ nios_network:
+ network: 192.168.10.0/24
+ comment: this is a test comment
+ options:
+ - name: domain-name
+ value: ansible.com
+ state: present
+ provider: "{{ nios_provider }}"
+ register: nios_ipv4_update2
+
+- name: remove a network ipv4
+ nios_network:
+ network: 192.168.10.0/24
+ state: absent
+ provider: "{{ nios_provider }}"
+ register: nios_ipv4_remove1
+
+- name: remove a network ipv4
+ nios_network:
+ network: 192.168.10.0/24
+ state: absent
+ provider: "{{ nios_provider }}"
+ register: nios_ipv4_remove2
+
+- name: configure a network ipv6
+ nios_network:
+ network: fe80::/64
+ comment: this is a test comment
+ state: present
+ provider: "{{ nios_provider }}"
+ register: nios_ipv6_create1
+
+- assert:
+ that:
+ - "nios_ipv4_create1.changed"
+ - "not nios_ipv4_create2.changed"
+ - "nios_ipv4_update1.changed"
+ - "not nios_ipv4_update2.changed"
+ - "nios_ipv4_remove1.changed"
+ - "not nios_ipv4_remove2.changed"
diff --git a/test/integration/targets/nios_network_view/aliases b/test/integration/targets/nios_network_view/aliases
index 89aea537d1..a52e8b266f 100644
--- a/test/integration/targets/nios_network_view/aliases
+++ b/test/integration/targets/nios_network_view/aliases
@@ -1 +1,3 @@
-unsupported \ No newline at end of file
+posix/ci/cloud/group4/nios
+cloud/nios
+destructive
diff --git a/test/integration/targets/nios_network_view/tasks/cli.yaml b/test/integration/targets/nios_network_view/tasks/cli.yaml
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/integration/targets/nios_network_view/tasks/cli.yaml
+++ /dev/null
diff --git a/test/integration/targets/nios_network_view/tasks/main.yaml b/test/integration/targets/nios_network_view/tasks/main.yaml
deleted file mode 100644
index d4898c29bc..0000000000
--- a/test/integration/targets/nios_network_view/tasks/main.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-- { include: cli.yaml, tags: ['cli'] } \ No newline at end of file
diff --git a/test/integration/targets/nios_network_view/tasks/main.yml b/test/integration/targets/nios_network_view/tasks/main.yml
new file mode 100644
index 0000000000..97e87148b5
--- /dev/null
+++ b/test/integration/targets/nios_network_view/tasks/main.yml
@@ -0,0 +1 @@
+- include: nios_network_view_idempotence.yml
diff --git a/test/integration/targets/nios_network_view/tasks/niapi.yaml b/test/integration/targets/nios_network_view/tasks/niapi.yaml
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/integration/targets/nios_network_view/tasks/niapi.yaml
+++ /dev/null
diff --git a/test/integration/targets/nios_network_view/tasks/nios_network_view_idempotence.yml b/test/integration/targets/nios_network_view/tasks/nios_network_view_idempotence.yml
new file mode 100644
index 0000000000..ad13e3a33d
--- /dev/null
+++ b/test/integration/targets/nios_network_view/tasks/nios_network_view_idempotence.yml
@@ -0,0 +1,58 @@
+- name: cleanup a new network view
+ nios_network_view:
+ name: ansible
+ state: absent
+ provider: "{{ nios_provider }}"
+
+- name: configure a new network view
+ nios_network_view:
+ name: ansible
+ state: present
+ provider: "{{ nios_provider }}"
+ register: nios_network_view_create1
+
+- name: configure a new network view
+ nios_network_view:
+ name: ansible
+ state: present
+ provider: "{{ nios_provider }}"
+ register: nios_network_view_create2
+
+- name: update the comment for network view
+ nios_network_view:
+ name: ansible
+ comment: this is an example comment
+ state: present
+ provider: "{{ nios_provider }}"
+ register: nios_network_view_update1
+
+- name: update the comment for network view
+ nios_network_view:
+ name: ansible
+ comment: this is an example comment
+ state: present
+ provider: "{{ nios_provider }}"
+ register: nios_network_view_update2
+
+- name: remove the network view
+ nios_network_view:
+ name: ansible
+ state: absent
+ provider: "{{ nios_provider }}"
+ register: nios_network_view_delete1
+
+- name: remove the network view
+ nios_network_view:
+ name: ansible
+ state: absent
+ provider: "{{ nios_provider }}"
+ register: nios_network_view_delete2
+
+- assert:
+ that:
+ - "nios_network_view_create1.changed"
+ - "not nios_network_view_create2.changed"
+ - "nios_network_view_update1.changed"
+ - "not nios_network_view_update2.changed"
+ - "nios_network_view_delete1.changed"
+ - "not nios_network_view_delete2.changed"
diff --git a/test/integration/targets/nios_zone/aliases b/test/integration/targets/nios_zone/aliases
index 89aea537d1..a52e8b266f 100644
--- a/test/integration/targets/nios_zone/aliases
+++ b/test/integration/targets/nios_zone/aliases
@@ -1 +1,3 @@
-unsupported \ No newline at end of file
+posix/ci/cloud/group4/nios
+cloud/nios
+destructive
diff --git a/test/integration/targets/nios_zone/tasks/cli.yaml b/test/integration/targets/nios_zone/tasks/cli.yaml
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/integration/targets/nios_zone/tasks/cli.yaml
+++ /dev/null
diff --git a/test/integration/targets/nios_zone/tasks/main.yaml b/test/integration/targets/nios_zone/tasks/main.yaml
deleted file mode 100644
index d4898c29bc..0000000000
--- a/test/integration/targets/nios_zone/tasks/main.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-- { include: cli.yaml, tags: ['cli'] } \ No newline at end of file
diff --git a/test/integration/targets/nios_zone/tasks/main.yml b/test/integration/targets/nios_zone/tasks/main.yml
new file mode 100644
index 0000000000..f066edcdbc
--- /dev/null
+++ b/test/integration/targets/nios_zone/tasks/main.yml
@@ -0,0 +1 @@
+- include: nios_zone_idempotence.yml
diff --git a/test/integration/targets/nios_zone/tasks/niapi.yaml b/test/integration/targets/nios_zone/tasks/niapi.yaml
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/integration/targets/nios_zone/tasks/niapi.yaml
+++ /dev/null
diff --git a/test/integration/targets/nios_zone/tasks/nios_zone_idempotence.yml b/test/integration/targets/nios_zone/tasks/nios_zone_idempotence.yml
new file mode 100644
index 0000000000..03d40aaf28
--- /dev/null
+++ b/test/integration/targets/nios_zone/tasks/nios_zone_idempotence.yml
@@ -0,0 +1,68 @@
+- name: cleanup dns view instance
+ nios_dns_view:
+ name: ansible-dns
+ state: absent
+ provider: "{{ nios_provider }}"
+
+- name: cleanup test zone
+ nios_zone:
+ name: ansible-dns
+ state: absent
+ provider: "{{ nios_provider }}"
+
+- name: configure a zone on the system
+ nios_zone:
+ name: ansible-dns
+ state: present
+ provider: "{{ nios_provider }}"
+ register: zone_create1
+
+- name: configure a zone on the system
+ nios_zone:
+ name: ansible-dns
+ state: present
+ provider: "{{ nios_provider }}"
+ register: zone_create2
+
+- name: update the comment and ext attributes for an existing zone
+ nios_zone:
+ name: ansible-dns
+ comment: this is an example comment
+ extattrs:
+ Site: west-dc
+ state: present
+ provider: "{{ nios_provider }}"
+ register: zone_update1
+
+- name: update the comment and ext attributes for an existing zone
+ nios_zone:
+ name: ansible-dns
+ comment: this is an example comment
+ extattrs:
+ Site: west-dc
+ state: present
+ provider: "{{ nios_provider }}"
+ register: zone_update2
+
+- name: remove the dns zone
+ nios_zone:
+ name: ansible-dns
+ state: absent
+ provider: "{{ nios_provider }}"
+ register: zone_delete1
+
+- name: remove the dns zone
+ nios_zone:
+ name: ansible-dns
+ state: absent
+ provider: "{{ nios_provider }}"
+ register: zone_delete2
+
+- assert:
+ that:
+ - "zone_create1.changed"
+ - "not zone_create2.changed"
+ - "zone_update1.changed"
+ - "not zone_update2.changed"
+ - "zone_delete1.changed"
+ - "not zone_delete2.changed"
diff --git a/test/integration/targets/prepare_nios_tests/tasks/main.yml b/test/integration/targets/prepare_nios_tests/tasks/main.yml
new file mode 100644
index 0000000000..ef713635f6
--- /dev/null
+++ b/test/integration/targets/prepare_nios_tests/tasks/main.yml
@@ -0,0 +1,7 @@
+- name: create the provider credentials from the cloud script
+ set_fact:
+ nios_provider:
+ host: "{{ lookup('env', 'NIOS_HOST') }}"
+ username: admin
+ password: infoblox
+- debug: var=nios_provider
diff --git a/test/runner/lib/cloud/nios.py b/test/runner/lib/cloud/nios.py
new file mode 100644
index 0000000000..07e767c8b9
--- /dev/null
+++ b/test/runner/lib/cloud/nios.py
@@ -0,0 +1,185 @@
+"""NIOS plugin for integration tests."""
+
+from __future__ import absolute_import, print_function
+
+import os
+
+from . import (
+ CloudProvider,
+ CloudEnvironment,
+)
+
+from ..util import (
+ find_executable,
+ display,
+)
+
+from ..docker_util import (
+ docker_run,
+ docker_rm,
+ docker_inspect,
+ docker_pull,
+ get_docker_container_id,
+)
+
+
+class NiosProvider(CloudProvider):
+ """Nios plugin.
+
+ Sets up NIOS mock server for tests.
+ """
+
+ DOCKER_SIMULATOR_NAME = 'nios-simulator'
+
+ DOCKER_IMAGE = 'quay.io/ansible/nios-test-container:1.0.0'
+ """Default image to run the nios simulator.
+
+ The simulator must be pinned to a specific version
+ to guarantee CI passes with the version used.
+
+ It's source source itself resides at:
+ https://github.com/ansible/nios-test-container
+ """
+
+ def __init__(self, args):
+ """Set up container references for provider.
+
+ :type args: TestConfig
+ """
+ super(NiosProvider, self).__init__(args)
+
+ self.__container_from_env = os.getenv('ANSIBLE_NIOSSIM_CONTAINER')
+ """Overrides target container, might be used for development.
+
+ Use ANSIBLE_NIOSSIM_CONTAINER=whatever_you_want if you want
+ to use other image. Omit/empty otherwise.
+ """
+
+ self.image = self.__container_from_env or self.DOCKER_IMAGE
+ self.container_name = ''
+
+ def filter(self, targets, exclude):
+ """Filter out the tests with the necessary config and res unavailable.
+
+ :type targets: tuple[TestTarget]
+ :type exclude: list[str]
+ """
+ docker_cmd = 'docker'
+ docker = find_executable(docker_cmd, required=False)
+
+ if docker:
+ return
+
+ skip = 'cloud/%s/' % self.platform
+ skipped = [target.name for target in targets if skip in target.aliases]
+
+ if skipped:
+ exclude.append(skip)
+ display.warning(
+ 'Excluding tests marked "%s" '
+ 'which require the "%s" command: %s'
+ % (skip.rstrip('/'), docker_cmd, ', '.join(skipped))
+ )
+
+ def setup(self):
+ """Setup cloud resource before delegation and reg cleanup callback."""
+ super(NiosProvider, self).setup()
+
+ if self._use_static_config():
+ self._setup_static()
+ else:
+ self._setup_dynamic()
+
+ def get_docker_run_options(self):
+ """Get additional options needed when delegating tests to a container.
+
+ :rtype: list[str]
+ """
+ return ['--link', self.DOCKER_SIMULATOR_NAME] if self.managed else []
+
+ def cleanup(self):
+ """Clean up the resource and temporary configs files after tests."""
+ if self.container_name:
+ docker_rm(self.args, self.container_name)
+
+ super(NiosProvider, self).cleanup()
+
+ def _setup_dynamic(self):
+ """Spawn a NIOS simulator within docker container."""
+ nios_port = 443
+ container_id = get_docker_container_id()
+
+ if container_id:
+ display.info(
+ 'Running in docker container: %s' % container_id,
+ verbosity=1,
+ )
+
+ self.container_name = self.DOCKER_SIMULATOR_NAME
+
+ results = docker_inspect(self.args, self.container_name)
+
+ if results and not results[0].get('State', {}).get('Running'):
+ docker_rm(self.args, self.container_name)
+ results = []
+
+ display.info(
+ '%s NIOS simulator docker container.'
+ % ('Using the existing' if results else 'Starting a new'),
+ verbosity=1,
+ )
+
+ if not results:
+ if self.args.docker or container_id:
+ publish_ports = []
+ else:
+ # publish the simulator ports when not running inside docker
+ publish_ports = [
+ '-p', ':'.join((str(nios_port), ) * 2),
+ ]
+
+ if not self.__container_from_env:
+ docker_pull(self.args, self.image)
+
+ docker_run(
+ self.args,
+ self.image,
+ ['-d', '--name', self.container_name] + publish_ports,
+ )
+
+ if self.args.docker:
+ nios_host = self.DOCKER_SIMULATOR_NAME
+ elif container_id:
+ nios_host = self._get_simulator_address()
+ display.info(
+ 'Found NIOS simulator container address: %s'
+ % nios_host, verbosity=1
+ )
+ else:
+ nios_host = 'localhost'
+
+ self._set_cloud_config('NIOS_HOST', nios_host)
+
+ def _get_simulator_address(self):
+ results = docker_inspect(self.args, self.container_name)
+ ip_address = results[0]['NetworkSettings']['IPAddress']
+ return ip_address
+
+ def _setup_static(self):
+ raise NotImplementedError
+
+
+class NiosEnvironment(CloudEnvironment):
+ """NIOS environment plugin.
+
+ Updates integration test environment after delegation.
+ """
+
+ def configure_environment(self, env, cmd):
+ """
+ :type env: dict[str, str]
+ :type cmd: list[str]
+ """
+
+ # Send the container IP down to the integration test(s)
+ env['NIOS_HOST'] = self._get_cloud_config('NIOS_HOST')
diff --git a/test/runner/requirements/integration.cloud.nios.txt b/test/runner/requirements/integration.cloud.nios.txt
new file mode 100644
index 0000000000..be61145433
--- /dev/null
+++ b/test/runner/requirements/integration.cloud.nios.txt
@@ -0,0 +1 @@
+infoblox-client