From 41f5648c4462feaf06120af99c90a44dffffa7ba Mon Sep 17 00:00:00 2001
From: John R Barker <john@johnrbarker.com>
Date: Wed, 8 Mar 2017 19:21:45 +0000
Subject: [PATCH] Test system (#22420)

* ios_system

* tests for ios_system

* tests for *_system

* working ios_system on cli

* Typo

* Loopback10 (single word, upeprcase)

* Revert docs changes

* Working iosxr_system tests

* eos, not nxos

* nxos_system
---
 test/integration/ios.yaml                     |   2 +
 test/integration/iosxr.yaml                   |   1 +
 test/integration/nxos.yaml                    |   3 +-
 .../targets/eos_system/tasks/cli.yaml         |   2 +-
 .../targets/eos_system/tasks/eapi.yaml        |  19 +--
 .../targets/ios_system/meta/main.yml          |   2 +
 .../targets/ios_system/tasks/cli.yaml         |  16 +++
 .../targets/ios_system/tasks/main.yaml        |   2 +
 .../ios_system/tests/cli/set_domain_list.yaml | 132 ++++++++++++++++++
 .../ios_system/tests/cli/set_domain_name.yaml |  40 ++++++
 .../ios_system/tests/cli/set_hostname.yaml    |  40 ++++++
 .../tests/cli/set_lookup_source.yaml          |  76 ++++++++++
 .../tests/cli/set_name_servers.yaml           |  96 +++++++++++++
 .../targets/iosxr_system/meta/main.yml        |   2 +
 .../targets/iosxr_system/tasks/cli.yaml       |  16 +++
 .../targets/iosxr_system/tasks/main.yaml      |   2 +
 .../tests/cli/set_domain_list.yaml            | 122 ++++++++++++++++
 .../tests/cli/set_domain_name.yaml            |  36 +++++
 .../iosxr_system/tests/cli/set_hostname.yaml  |  36 +++++
 .../tests/cli/set_lookup_source.yaml          |  68 +++++++++
 .../tests/cli/set_name_servers.yaml           |  88 ++++++++++++
 .../nxos_mtu/tests/cli/set_sysmtu.yaml        |   1 +
 .../targets/nxos_system/meta/main.yml         |   2 +
 .../targets/nxos_system/tasks/cli.yaml        |  16 +++
 .../targets/nxos_system/tasks/main.yaml       |   3 +
 .../targets/nxos_system/tasks/nxapi.yaml      |  29 ++++
 .../tests/cli/set_domain_list.yaml            | 122 ++++++++++++++++
 .../tests/cli/set_domain_name.yaml            |  36 +++++
 .../nxos_system/tests/cli/set_hostname.yaml   |  36 +++++
 .../cli/set_lookup_source.yaml-not-on-nxos    |  68 +++++++++
 .../tests/cli/set_name_servers.yaml           |  95 +++++++++++++
 .../tests/nxapi/set_domain_list.yaml          | 131 +++++++++++++++++
 .../tests/nxapi/set_domain_name.yaml          |  38 +++++
 .../nxos_system/tests/nxapi/set_hostname.yaml |  36 +++++
 .../nxapi/set_lookup_source.yaml-not-on-nxos  |  68 +++++++++
 .../tests/nxapi/set_name_servers.yaml         | 101 ++++++++++++++
 36 files changed, 1573 insertions(+), 10 deletions(-)
 create mode 100644 test/integration/targets/ios_system/meta/main.yml
 create mode 100644 test/integration/targets/ios_system/tasks/cli.yaml
 create mode 100644 test/integration/targets/ios_system/tasks/main.yaml
 create mode 100644 test/integration/targets/ios_system/tests/cli/set_domain_list.yaml
 create mode 100644 test/integration/targets/ios_system/tests/cli/set_domain_name.yaml
 create mode 100644 test/integration/targets/ios_system/tests/cli/set_hostname.yaml
 create mode 100644 test/integration/targets/ios_system/tests/cli/set_lookup_source.yaml
 create mode 100644 test/integration/targets/ios_system/tests/cli/set_name_servers.yaml
 create mode 100644 test/integration/targets/iosxr_system/meta/main.yml
 create mode 100644 test/integration/targets/iosxr_system/tasks/cli.yaml
 create mode 100644 test/integration/targets/iosxr_system/tasks/main.yaml
 create mode 100644 test/integration/targets/iosxr_system/tests/cli/set_domain_list.yaml
 create mode 100644 test/integration/targets/iosxr_system/tests/cli/set_domain_name.yaml
 create mode 100644 test/integration/targets/iosxr_system/tests/cli/set_hostname.yaml
 create mode 100644 test/integration/targets/iosxr_system/tests/cli/set_lookup_source.yaml
 create mode 100644 test/integration/targets/iosxr_system/tests/cli/set_name_servers.yaml
 create mode 100644 test/integration/targets/nxos_system/meta/main.yml
 create mode 100644 test/integration/targets/nxos_system/tasks/cli.yaml
 create mode 100644 test/integration/targets/nxos_system/tasks/main.yaml
 create mode 100644 test/integration/targets/nxos_system/tasks/nxapi.yaml
 create mode 100644 test/integration/targets/nxos_system/tests/cli/set_domain_list.yaml
 create mode 100644 test/integration/targets/nxos_system/tests/cli/set_domain_name.yaml
 create mode 100644 test/integration/targets/nxos_system/tests/cli/set_hostname.yaml
 create mode 100644 test/integration/targets/nxos_system/tests/cli/set_lookup_source.yaml-not-on-nxos
 create mode 100644 test/integration/targets/nxos_system/tests/cli/set_name_servers.yaml
 create mode 100644 test/integration/targets/nxos_system/tests/nxapi/set_domain_list.yaml
 create mode 100644 test/integration/targets/nxos_system/tests/nxapi/set_domain_name.yaml
 create mode 100644 test/integration/targets/nxos_system/tests/nxapi/set_hostname.yaml
 create mode 100644 test/integration/targets/nxos_system/tests/nxapi/set_lookup_source.yaml-not-on-nxos
 create mode 100644 test/integration/targets/nxos_system/tests/nxapi/set_name_servers.yaml

diff --git a/test/integration/ios.yaml b/test/integration/ios.yaml
index 09ff697138b..7e0bc264bd3 100644
--- a/test/integration/ios.yaml
+++ b/test/integration/ios.yaml
@@ -1,6 +1,7 @@
 ---
 - hosts: ios
   gather_facts: no
+  connection: local
 
   vars:
     limit_to: "*"
@@ -11,3 +12,4 @@
     - { role: ios_config, when: "limit_to in ['*', 'ios_config']" }
     - { role: ios_facts, when: "limit_to in ['*', 'ios_facts']" }
     - { role: ios_template, when: "limit_to in ['*', 'ios_template']" }
+    - { role: ios_system, when: "limit_to in ['*', 'ios_system']" }
diff --git a/test/integration/iosxr.yaml b/test/integration/iosxr.yaml
index 117d3aec30e..e2d0960a2eb 100644
--- a/test/integration/iosxr.yaml
+++ b/test/integration/iosxr.yaml
@@ -12,3 +12,4 @@
     - { role: iosxr_config, when: "limit_to in ['*', 'iosxr_config']" }
     - { role: iosxr_facts, when: "limit_to in ['*', 'iosxr_facts']" }
     - { role: iosxr_template, when: "limit_to in ['*', 'iosxr_template']" }
+    - { role: iosxr_system, when: "limit_to in ['*', 'iosxr_system']" }
diff --git a/test/integration/nxos.yaml b/test/integration/nxos.yaml
index d5fca2b70fd..a221e4e9a81 100644
--- a/test/integration/nxos.yaml
+++ b/test/integration/nxos.yaml
@@ -15,4 +15,5 @@
     - { role: nxos_nxapi, when: "limit_to in ['*', 'nxos_nxapi']" }
     - { role: nxos_evpn_global, when: "limit_to in ['*', 'nxos_evpn_global']" }
     - { role: nxos_feature, when: "limit_to in ['*', 'nxos_feature']" }
-    - { role: nxos_feature, when: "limit_to in ['*', 'nxos_mtu']" }
+    - { role: nxos_mtu, when: "limit_to in ['*', 'nxos_mtu']" }
+    - { role: nxos_system, when: "limit_to in ['*', 'nxos_system']" }
\ No newline at end of file
diff --git a/test/integration/targets/eos_system/tasks/cli.yaml b/test/integration/targets/eos_system/tasks/cli.yaml
index d675462dd02..ec835e9eb6d 100644
--- a/test/integration/targets/eos_system/tasks/cli.yaml
+++ b/test/integration/targets/eos_system/tasks/cli.yaml
@@ -6,7 +6,7 @@
   register: test_cases
 
 - name: set test_items
-  set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
+  set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" #"
 
 - name: run test case
   include: "{{ test_case_to_run }}"
diff --git a/test/integration/targets/eos_system/tasks/eapi.yaml b/test/integration/targets/eos_system/tasks/eapi.yaml
index 26c247320b2..f39b09baefd 100644
--- a/test/integration/targets/eos_system/tasks/eapi.yaml
+++ b/test/integration/targets/eos_system/tasks/eapi.yaml
@@ -6,13 +6,14 @@
   register: test_cases
 
 - name: set test_items
-  set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
+  set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" #"
 
 - name: enable eapi
-  nxos_config:
-    lines:
-      - feature eapi
-      - eapi http port 80
+  eos_eapi:
+    enable_http: yes
+    enable_https: yes
+    enable_local_http: yes
+    enable_socket: yes
     provider: "{{ cli }}"
 
 - name: run test case
@@ -22,7 +23,9 @@
     loop_var: test_case_to_run
 
 - name: disable eapi
-  nxos_config:
-    lines:
-      - no feature eapi
+  eos_eapi:
+    enable_http: no
+    enable_https: no
+    enable_local_http: no
+    enable_socket: no
     provider: "{{ cli }}"
diff --git a/test/integration/targets/ios_system/meta/main.yml b/test/integration/targets/ios_system/meta/main.yml
new file mode 100644
index 00000000000..159cea8d383
--- /dev/null
+++ b/test/integration/targets/ios_system/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+  - prepare_ios_tests
diff --git a/test/integration/targets/ios_system/tasks/cli.yaml b/test/integration/targets/ios_system/tasks/cli.yaml
new file mode 100644
index 00000000000..46d86dd6988
--- /dev/null
+++ b/test/integration/targets/ios_system/tasks/cli.yaml
@@ -0,0 +1,16 @@
+---
+- 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 case
+  include: "{{ test_case_to_run }}"
+  with_items: "{{ test_items }}"
+  loop_control:
+    loop_var: test_case_to_run
diff --git a/test/integration/targets/ios_system/tasks/main.yaml b/test/integration/targets/ios_system/tasks/main.yaml
new file mode 100644
index 00000000000..415c99d8b12
--- /dev/null
+++ b/test/integration/targets/ios_system/tasks/main.yaml
@@ -0,0 +1,2 @@
+---
+- { include: cli.yaml, tags: ['cli'] }
diff --git a/test/integration/targets/ios_system/tests/cli/set_domain_list.yaml b/test/integration/targets/ios_system/tests/cli/set_domain_list.yaml
new file mode 100644
index 00000000000..bd62a399282
--- /dev/null
+++ b/test/integration/targets/ios_system/tests/cli/set_domain_list.yaml
@@ -0,0 +1,132 @@
+---
+- debug: msg="START cli/set_domain_search.yaml"
+
+- name: setup
+  ios_config:
+    lines:
+      - no ip domain-list ansible.com
+      - no ip domain-list redhat.com
+    match: none
+    authorize: yes
+    provider: "{{ cli }}"
+
+- name: configure domain_search
+  ios_system:
+    domain_search:
+      - ansible.com
+      - redhat.com
+    provider: "{{ cli }}"
+    authorize: yes
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'ip domain list ansible.com' in result.commands"
+      - "'ip domain list redhat.com' in result.commands"
+
+- name: verify domain_search
+  ios_system:
+    domain_search:
+      - ansible.com
+      - redhat.com
+    provider: "{{ cli }}"
+    authorize: yes
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: remove one entry
+  ios_system:
+    domain_search:
+      - ansible.com
+    provider: "{{ cli }}"
+    authorize: yes
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'no ip domain list redhat.com' in result.commands"
+
+- name: verify remove one entry
+  ios_system:
+    domain_search:
+      - ansible.com
+    provider: "{{ cli }}"
+    authorize: yes
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: add one entry
+  ios_system:
+    domain_search:
+      - ansible.com
+      - redhat.com
+    provider: "{{ cli }}"
+    authorize: yes
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'ip domain list redhat.com' in result.commands"
+
+- name: verify add one entry
+  ios_system:
+    domain_search:
+      - ansible.com
+      - redhat.com
+    provider: "{{ cli }}"
+    authorize: yes
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: add and remove one entry
+  ios_system:
+    domain_search:
+      - ansible.com
+      - eng.ansible.com
+    provider: "{{ cli }}"
+    authorize: yes
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'no ip domain list redhat.com' in result.commands"
+      - "'ip domain list eng.ansible.com' in result.commands"
+      - result.commands|length == 2
+
+- name: verify add and remove one entry
+  ios_system:
+    domain_search:
+      - ansible.com
+      - eng.ansible.com
+    provider: "{{ cli }}"
+    authorize: yes
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: teardown
+  ios_config:
+    lines:
+      - no ip domain-list ansible.com
+      - no ip domain-list redhat.com
+      - no ip domain-list eng.ansible.com
+    match: none
+    authorize: yes
+    provider: "{{ cli }}"
+
+- debug: msg="END cli/set_domain_search.yaml"
diff --git a/test/integration/targets/ios_system/tests/cli/set_domain_name.yaml b/test/integration/targets/ios_system/tests/cli/set_domain_name.yaml
new file mode 100644
index 00000000000..eab5af85955
--- /dev/null
+++ b/test/integration/targets/ios_system/tests/cli/set_domain_name.yaml
@@ -0,0 +1,40 @@
+---
+- debug: msg="START cli/set_domain_name.yaml"
+
+- name: setup
+  ios_config:
+    lines: no ip domain-name
+    match: none
+    authorize: yes
+    provider: "{{ cli }}"
+
+- name: configure domain_name
+  ios_system:
+    domain_name: eng.ansible.com
+    authorize: yes
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == true"
+
+- name: verify domain_name
+  ios_system:
+    domain_name: eng.ansible.com
+    authorize: yes
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == false"
+
+- name: teardown
+  ios_config:
+    lines: no ip domain-name
+    match: none
+    authorize: yes
+    provider: "{{ cli }}"
+
+- debug: msg="END cli/set_domain_name.yaml"
diff --git a/test/integration/targets/ios_system/tests/cli/set_hostname.yaml b/test/integration/targets/ios_system/tests/cli/set_hostname.yaml
new file mode 100644
index 00000000000..d2e6dcc097f
--- /dev/null
+++ b/test/integration/targets/ios_system/tests/cli/set_hostname.yaml
@@ -0,0 +1,40 @@
+---
+- debug: msg="START cli/set_hostname.yaml"
+
+- name: setup
+  ios_config:
+    lines: hostname switch
+    match: none
+    authorize: yes
+    provider: "{{ cli }}"
+
+- name: configure hostname
+  ios_system:
+    hostname: foo
+    authorize: yes
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == true"
+
+- name: verify hostname
+  ios_system:
+    hostname: foo
+    authorize: yes
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == false"
+
+- name: teardown
+  ios_config:
+    lines: "hostname {{ inventory_hostname }}"
+    match: none
+    authorize: yes
+    provider: "{{ cli }}"
+
+- debug: msg="END cli/set_hostname.yaml"
diff --git a/test/integration/targets/ios_system/tests/cli/set_lookup_source.yaml b/test/integration/targets/ios_system/tests/cli/set_lookup_source.yaml
new file mode 100644
index 00000000000..beed27a2e95
--- /dev/null
+++ b/test/integration/targets/ios_system/tests/cli/set_lookup_source.yaml
@@ -0,0 +1,76 @@
+---
+- debug: msg="START cli/set_lookup_source.yaml"
+
+- name: setup
+  ios_config:
+    lines:
+      - no ip domain lookup source-interface
+      - vrf definition ansible
+    match: none
+    authorize: yes
+    provider: "{{ cli }}"
+
+- name: configure lookup_source
+  ios_system:
+    lookup_source: Loopback10
+    provider: "{{ cli }}"
+    authorize: yes
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'ip domain lookup source-interface Loopback10' in result.commands"
+
+- name: verify lookup_source
+  ios_system:
+    lookup_source: Loopback10
+    provider: "{{ cli }}"
+    authorize: yes
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+#- name: change to vrf
+#  ios_system:
+#    lookup_source:
+#      - interface: Loopback10
+#        vrf: ansible
+#    authorize: yes
+#    provider: "{{ cli }}"
+#  register: result
+#
+#- assert:
+#    that:
+#      - result.changed == true
+#      - "'no ip domain lookup source-interface Management1' in result.commands"
+#      - "'ip domain lookup vrf ansible source-interface Management1' in result.commands"
+#      - result.commands|length == 2
+#
+#- name: verify change to vrf
+#  ios_system:
+#    lookup_source:
+#      - interface: Management1
+#        vrf: ansible
+#    authorize: yes
+#    provider: "{{ cli }}"
+#  register: result
+#
+#- assert:
+#    that:
+#      - result.changed == false
+
+- name: teardown
+  ios_config:
+    lines:
+      - no ip domain lookup source-interface
+      - no vrf definition ansible
+    match: none
+    authorize: yes
+    provider: "{{ cli }}"
+  ignore_errors: yes
+# FIXME: Not sure why this is failing with msg": "no vrf definition ansible\r\n% IPv4 and IPv6 addresses from all interfaces in VRF ansible have been removed\r\nfoo(config)#", rc:1
+
+- debug: msg="END cli/set_lookup_source.yaml"
diff --git a/test/integration/targets/ios_system/tests/cli/set_name_servers.yaml b/test/integration/targets/ios_system/tests/cli/set_name_servers.yaml
new file mode 100644
index 00000000000..1d515840e7c
--- /dev/null
+++ b/test/integration/targets/ios_system/tests/cli/set_name_servers.yaml
@@ -0,0 +1,96 @@
+---
+- debug: msg="START cli/set_name_servers.yaml"
+
+- name: setup
+  ios_config:
+    lines:
+      - no ip name-server
+    match: none
+    authorize: yes
+    provider: "{{ cli }}"
+
+- name: configure name_servers
+  ios_system:
+    name_servers:
+      - 1.1.1.1
+      - 2.2.2.2
+      - 3.3.3.3
+    authorize: yes
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - result.commands|length == 3
+      - "'ip name-server 1.1.1.1' in result.commands"
+      - "'ip name-server 2.2.2.2' in result.commands"
+      - "'ip name-server 3.3.3.3' in result.commands"
+
+- name: verify name_servers
+  ios_system:
+    name_servers:
+      - 1.1.1.1
+      - 2.2.2.2
+      - 3.3.3.3
+    authorize: yes
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+#- name: change to vrf
+#  ios_system:
+#    name_servers:
+#      - 1.1.1.1
+#      - { server: 2.2.2.2, vrf: ansible }
+#      - 3.3.3.3
+#    provider: "{{ cli }}"
+#  register: result
+
+#- assert:
+#    that:
+#      - result.changed == true
+#      - result.commands|length == 2
+#      - "'no ip name-server 2.2.2.2' in result.commands"
+#      - "'ip name-server 2.2.2.2 vrf ansible' in result.commands"
+
+#- name: verify change to vrf
+#  ios_system:
+#    name_servers:
+#      - 1.1.1.1
+#      - { server: 2.2.2.2, vrf: ansible }
+#      - 3.3.3.3
+#    provider: "{{ cli }}"
+#  register: result
+#
+#- assert:
+#    that:
+#      - result.changed == false
+
+- name: remove one
+  ios_system:
+    name_servers:
+      - 1.1.1.1
+      - 2.2.2.2
+    authorize: yes
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - result.commands|length == 1
+      - "'no ip name-server 3.3.3.3' in result.commands"
+
+- name: teardown
+  ios_config:
+    lines:
+      - no ip domain lookup source-interface
+    match: none
+    authorize: yes
+    provider: "{{ cli }}"
+
+- debug: msg="END cli/set_name_servers.yaml"
diff --git a/test/integration/targets/iosxr_system/meta/main.yml b/test/integration/targets/iosxr_system/meta/main.yml
new file mode 100644
index 00000000000..d4da833dd50
--- /dev/null
+++ b/test/integration/targets/iosxr_system/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+  - prepare_iosxr_tests
diff --git a/test/integration/targets/iosxr_system/tasks/cli.yaml b/test/integration/targets/iosxr_system/tasks/cli.yaml
new file mode 100644
index 00000000000..46d86dd6988
--- /dev/null
+++ b/test/integration/targets/iosxr_system/tasks/cli.yaml
@@ -0,0 +1,16 @@
+---
+- 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 case
+  include: "{{ test_case_to_run }}"
+  with_items: "{{ test_items }}"
+  loop_control:
+    loop_var: test_case_to_run
diff --git a/test/integration/targets/iosxr_system/tasks/main.yaml b/test/integration/targets/iosxr_system/tasks/main.yaml
new file mode 100644
index 00000000000..415c99d8b12
--- /dev/null
+++ b/test/integration/targets/iosxr_system/tasks/main.yaml
@@ -0,0 +1,2 @@
+---
+- { include: cli.yaml, tags: ['cli'] }
diff --git a/test/integration/targets/iosxr_system/tests/cli/set_domain_list.yaml b/test/integration/targets/iosxr_system/tests/cli/set_domain_list.yaml
new file mode 100644
index 00000000000..6b3db147c5a
--- /dev/null
+++ b/test/integration/targets/iosxr_system/tests/cli/set_domain_list.yaml
@@ -0,0 +1,122 @@
+---
+- debug: msg="START cli/set_domain_search.yaml"
+
+- name: setup
+  iosxr_config:
+    lines:
+      - no ip domain-list ansible.com
+      - no ip domain-list redhat.com
+    match: none
+    provider: "{{ cli }}"
+
+- name: configure domain_search
+  iosxr_system:
+    domain_search:
+      - ansible.com
+      - redhat.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'domain list ansible.com' in result.commands"
+      - "'domain list redhat.com' in result.commands"
+
+- name: verify domain_search
+  iosxr_system:
+    domain_search:
+      - ansible.com
+      - redhat.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: remove one entry
+  iosxr_system:
+    domain_search:
+      - ansible.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'no domain list redhat.com' in result.commands"
+
+- name: verify remove one entry
+  iosxr_system:
+    domain_search:
+      - ansible.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: add one entry
+  iosxr_system:
+    domain_search:
+      - ansible.com
+      - redhat.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'domain list redhat.com' in result.commands"
+
+- name: verify add one entry
+  iosxr_system:
+    domain_search:
+      - ansible.com
+      - redhat.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: add and remove one entry
+  iosxr_system:
+    domain_search:
+      - ansible.com
+      - eng.ansible.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'no domain list redhat.com' in result.commands"
+      - "'domain list eng.ansible.com' in result.commands"
+      - result.commands|length == 2
+
+- name: verify add and remove one entry
+  iosxr_system:
+    domain_search:
+      - ansible.com
+      - eng.ansible.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: teardown
+  iosxr_config:
+    lines:
+      - no domain list ansible.com
+      - no domain list redhat.com
+      - no domain list eng.ansible.com
+    match: none
+    provider: "{{ cli }}"
+
+- debug: msg="END cli/set_domain_search.yaml"
diff --git a/test/integration/targets/iosxr_system/tests/cli/set_domain_name.yaml b/test/integration/targets/iosxr_system/tests/cli/set_domain_name.yaml
new file mode 100644
index 00000000000..fc14aaaa006
--- /dev/null
+++ b/test/integration/targets/iosxr_system/tests/cli/set_domain_name.yaml
@@ -0,0 +1,36 @@
+---
+- debug: msg="START cli/set_domain_name.yaml"
+
+- name: setup
+  iosxr_config:
+    lines: no domain name
+    match: none
+    provider: "{{ cli }}"
+
+- name: configure domain_name
+  iosxr_system:
+    domain_name: eng.ansible.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == true"
+
+- name: verify domain_name
+  iosxr_system:
+    domain_name: eng.ansible.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == false"
+
+- name: teardown
+  iosxr_config:
+    lines: no domain name
+    match: none
+    provider: "{{ cli }}"
+
+- debug: msg="END cli/set_domain_name.yaml"
diff --git a/test/integration/targets/iosxr_system/tests/cli/set_hostname.yaml b/test/integration/targets/iosxr_system/tests/cli/set_hostname.yaml
new file mode 100644
index 00000000000..d9fd02212b6
--- /dev/null
+++ b/test/integration/targets/iosxr_system/tests/cli/set_hostname.yaml
@@ -0,0 +1,36 @@
+---
+- debug: msg="START cli/set_hostname.yaml"
+
+- name: setup
+  iosxr_config:
+    lines: hostname switch
+    match: none
+    provider: "{{ cli }}"
+
+- name: configure hostname
+  iosxr_system:
+    hostname: foo
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == true"
+
+- name: verify hostname
+  iosxr_system:
+    hostname: foo
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == false"
+
+- name: teardown
+  iosxr_config:
+    lines: "hostname {{ inventory_hostname }}"
+    match: none
+    provider: "{{ cli }}"
+
+- debug: msg="END cli/set_hostname.yaml"
diff --git a/test/integration/targets/iosxr_system/tests/cli/set_lookup_source.yaml b/test/integration/targets/iosxr_system/tests/cli/set_lookup_source.yaml
new file mode 100644
index 00000000000..683145e2b3a
--- /dev/null
+++ b/test/integration/targets/iosxr_system/tests/cli/set_lookup_source.yaml
@@ -0,0 +1,68 @@
+---
+- debug: msg="START cli/set_lookup_source.yaml"
+
+- name: setup
+  iosxr_config:
+    lines:
+      - no domain lookup source-interface Loopback10
+#      - vrf ansible
+    match: none
+    provider: "{{ cli }}"
+
+- name: configure lookup_source
+  iosxr_system:
+    lookup_source: Loopback10
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'domain lookup source-interface Loopback10' in result.commands"
+
+- name: verify lookup_source
+  iosxr_system:
+    lookup_source: Loopback10
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+#- name: change to vrf
+#  iosxr_system:
+#    lookup_source:
+#      - interface: Loopback10
+#        vrf: ansible
+#    provider: "{{ cli }}"
+#  register: result
+#
+#- assert:
+#    that:
+#      - result.changed == true
+#      - "'no ip domain lookup source-interface Management1' in result.commands"
+#      - "'ip domain lookup vrf ansible source-interface Management1' in result.commands"
+#      - result.commands|length == 2
+#
+#- name: verify change to vrf
+#  iosxr_system:
+#    lookup_source:
+#      - interface: Management1
+#        vrf: ansible
+#    provider: "{{ cli }}"
+#  register: result
+#
+#- assert:
+#    that:
+#      - result.changed == false
+
+- name: teardown
+  iosxr_config:
+    lines:
+      - no domain lookup source-interface Loopback10
+      - no vrf ansible
+    match: none
+    provider: "{{ cli }}"
+
+- debug: msg="END cli/set_lookup_source.yaml"
diff --git a/test/integration/targets/iosxr_system/tests/cli/set_name_servers.yaml b/test/integration/targets/iosxr_system/tests/cli/set_name_servers.yaml
new file mode 100644
index 00000000000..58ad277f869
--- /dev/null
+++ b/test/integration/targets/iosxr_system/tests/cli/set_name_servers.yaml
@@ -0,0 +1,88 @@
+---
+- debug: msg="START cli/set_name_servers.yaml"
+
+- name: setup
+  iosxr_config:
+    lines:
+      - no ip name-server 1.1.1.1
+      - no ip name-server 2.2.2.2
+      - no ip name-server 3.3.3.3
+    match: none
+    provider: "{{ cli }}"
+
+- name: configure name_servers
+  iosxr_system:
+    name_servers:
+      - 1.1.1.1
+      - 2.2.2.2
+      - 3.3.3.3
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - result.commands|length == 3
+      - "'domain name-server 1.1.1.1' in result.commands"
+      - "'domain name-server 2.2.2.2' in result.commands"
+      - "'domain name-server 3.3.3.3' in result.commands"
+
+- name: verify name_servers
+  iosxr_system:
+    name_servers:
+      - 1.1.1.1
+      - 2.2.2.2
+      - 3.3.3.3
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+#- name: change to vrf
+#  iosxr_system:
+#    name_servers:
+#      - 1.1.1.1
+#      - { server: 2.2.2.2, vrf: ansible }
+#      - 3.3.3.3
+#    provider: "{{ cli }}"
+#  register: result
+
+#- assert:
+#    that:
+#      - result.changed == true
+#      - result.commands|length == 2
+#      - "'no ip name-server 2.2.2.2' in result.commands"
+#      - "'ip name-server 2.2.2.2 vrf ansible' in result.commands"
+
+#- name: verify change to vrf
+#  iosxr_system:
+#    name_servers:
+#      - 1.1.1.1
+#      - { server: 2.2.2.2, vrf: ansible }
+#      - 3.3.3.3
+#    provider: "{{ cli }}"
+#  register: result
+#
+#- assert:
+#    that:
+#      - result.changed == false
+
+- name: remove one
+  iosxr_system:
+    name_servers:
+      - 1.1.1.1
+      - 2.2.2.2
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - result.commands|length == 1
+      - "'no domain name-server 3.3.3.3' in result.commands"
+
+# FIXME: No teardown
+#
+- debug: msg="END cli/set_name_servers.yaml"
diff --git a/test/integration/targets/nxos_mtu/tests/cli/set_sysmtu.yaml b/test/integration/targets/nxos_mtu/tests/cli/set_sysmtu.yaml
index 17b6802fbb8..aa14aa62ea4 100644
--- a/test/integration/targets/nxos_mtu/tests/cli/set_sysmtu.yaml
+++ b/test/integration/targets/nxos_mtu/tests/cli/set_sysmtu.yaml
@@ -11,6 +11,7 @@
   nxos_mtu:
     sysmtu: 2000
     provider: "{{ cli }}"
+    transport: nxapi
   register: result
 
 - assert:
diff --git a/test/integration/targets/nxos_system/meta/main.yml b/test/integration/targets/nxos_system/meta/main.yml
new file mode 100644
index 00000000000..ae741cbdc71
--- /dev/null
+++ b/test/integration/targets/nxos_system/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+  - prepare_nxos_tests
diff --git a/test/integration/targets/nxos_system/tasks/cli.yaml b/test/integration/targets/nxos_system/tasks/cli.yaml
new file mode 100644
index 00000000000..46d86dd6988
--- /dev/null
+++ b/test/integration/targets/nxos_system/tasks/cli.yaml
@@ -0,0 +1,16 @@
+---
+- 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 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_system/tasks/main.yaml b/test/integration/targets/nxos_system/tasks/main.yaml
new file mode 100644
index 00000000000..4b0f8c64d90
--- /dev/null
+++ b/test/integration/targets/nxos_system/tasks/main.yaml
@@ -0,0 +1,3 @@
+---
+- { include: cli.yaml, tags: ['cli'] }
+- { include: nxapi.yaml, tags: ['nxapi'] }
diff --git a/test/integration/targets/nxos_system/tasks/nxapi.yaml b/test/integration/targets/nxos_system/tasks/nxapi.yaml
new file mode 100644
index 00000000000..fc67dff2301
--- /dev/null
+++ b/test/integration/targets/nxos_system/tasks/nxapi.yaml
@@ -0,0 +1,29 @@
+---
+- name: collect all nxapi test cases
+  find:
+    paths: "{{ role_path }}/tests/nxapi"
+    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: 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_system/tests/cli/set_domain_list.yaml b/test/integration/targets/nxos_system/tests/cli/set_domain_list.yaml
new file mode 100644
index 00000000000..244d674681c
--- /dev/null
+++ b/test/integration/targets/nxos_system/tests/cli/set_domain_list.yaml
@@ -0,0 +1,122 @@
+---
+- debug: msg="START cli/set_domain_list.yaml"
+
+- name: setup
+  nxos_config:
+    lines:
+      - no ip domain-list ansible.com
+      - no ip domain-list redhat.com
+    match: none
+    provider: "{{ cli }}"
+
+- name: configure domain_list
+  nxos_system:
+    domain_search:
+      - ansible.com
+      - redhat.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'ip domain-list ansible.com' in result.commands"
+      - "'ip domain-list redhat.com' in result.commands"
+
+- name: verify domain_list
+  nxos_system:
+    domain_search:
+      - ansible.com
+      - redhat.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: remove one entry
+  nxos_system:
+    domain_search:
+      - ansible.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'no ip domain-list redhat.com' in result.commands"
+
+- name: verify remove one entry
+  nxos_system:
+    domain_search:
+      - ansible.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: add one entry
+  nxos_system:
+    domain_search:
+      - ansible.com
+      - redhat.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'ip domain-list redhat.com' in result.commands"
+
+- name: verify add one entry
+  nxos_system:
+    domain_search:
+      - ansible.com
+      - redhat.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: add and remove one entry
+  nxos_system:
+    domain_search:
+      - ansible.com
+      - eng.ansible.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'no ip domain-list redhat.com' in result.commands"
+      - "'ip domain-list eng.ansible.com' in result.commands"
+      - result.commands|length == 2
+
+- name: verify add and remove one entry
+  nxos_system:
+    domain_search:
+      - ansible.com
+      - eng.ansible.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: teardown
+  nxos_config:
+    lines:
+      - no ip domain-list ansible.com
+      - no ip domain-list redhat.com
+      - no ip domain-list eng.ansible.com
+    match: none
+    provider: "{{ cli }}"
+
+- debug: msg="END cli/set_domain_search.yaml"
diff --git a/test/integration/targets/nxos_system/tests/cli/set_domain_name.yaml b/test/integration/targets/nxos_system/tests/cli/set_domain_name.yaml
new file mode 100644
index 00000000000..9e0e08d9a3c
--- /dev/null
+++ b/test/integration/targets/nxos_system/tests/cli/set_domain_name.yaml
@@ -0,0 +1,36 @@
+---
+- debug: msg="START cli/set_domain_name.yaml"
+
+- name: setup
+  nxos_config:
+    lines: no ip domain-name eng.ansible.com
+    match: none
+    provider: "{{ cli }}"
+
+- name: configure domain_name
+  nxos_system:
+    domain_name: eng.ansible.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == true"
+
+- name: verify domain_name
+  nxos_system:
+    domain_name: eng.ansible.com
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == false"
+
+- name: teardown
+  nxos_config:
+    lines: no ip domain-name eng.ansible.com
+    match: none
+    provider: "{{ cli }}"
+
+- debug: msg="END cli/set_domain_name.yaml"
diff --git a/test/integration/targets/nxos_system/tests/cli/set_hostname.yaml b/test/integration/targets/nxos_system/tests/cli/set_hostname.yaml
new file mode 100644
index 00000000000..8d82137d7c0
--- /dev/null
+++ b/test/integration/targets/nxos_system/tests/cli/set_hostname.yaml
@@ -0,0 +1,36 @@
+---
+- debug: msg="START cli/set_hostname.yaml"
+
+- name: setup
+  nxos_config:
+    lines: hostname switch
+    match: none
+    provider: "{{ cli }}"
+
+- name: configure hostname
+  nxos_system:
+    hostname: foo
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == true"
+
+- name: verify hostname
+  nxos_system:
+    hostname: foo
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == false"
+
+- name: teardown
+  nxos_config:
+    lines: "hostname {{ inventory_hostname }}"
+    match: none
+    provider: "{{ cli }}"
+
+- debug: msg="END cli/set_hostname.yaml"
diff --git a/test/integration/targets/nxos_system/tests/cli/set_lookup_source.yaml-not-on-nxos b/test/integration/targets/nxos_system/tests/cli/set_lookup_source.yaml-not-on-nxos
new file mode 100644
index 00000000000..4a39a498827
--- /dev/null
+++ b/test/integration/targets/nxos_system/tests/cli/set_lookup_source.yaml-not-on-nxos
@@ -0,0 +1,68 @@
+---
+- debug: msg="START cli/set_lookup_source.yaml"
+
+- name: setup
+  nxos_config:
+    lines:
+      - no ip domain lookup source-interface
+      - vrf definition ansible
+    match: none
+    provider: "{{ cli }}"
+
+- name: configure lookup_source
+  nxos_system:
+    lookup_source: Management1
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'ip domain lookup source-interface Management1' in result.commands"
+
+- name: verify lookup_source
+  nxos_system:
+    lookup_source: Management1
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: change to vrf
+  nxos_system:
+    lookup_source:
+      - interface: Management1
+        vrf: ansible
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'no ip domain lookup source-interface Management1' in result.commands"
+      - "'ip domain lookup vrf ansible source-interface Management1' in result.commands"
+      - result.commands|length == 2
+
+- name: verify change to vrf
+  nxos_system:
+    lookup_source:
+      - interface: Management1
+        vrf: ansible
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: teardown
+  nxos_config:
+    lines:
+      - no ip domain lookup source-interface
+      - no vrf definition ansible
+    match: none
+    provider: "{{ cli }}"
+
+- debug: msg="END cli/set_lookup_source.yaml"
diff --git a/test/integration/targets/nxos_system/tests/cli/set_name_servers.yaml b/test/integration/targets/nxos_system/tests/cli/set_name_servers.yaml
new file mode 100644
index 00000000000..735bbd26f3a
--- /dev/null
+++ b/test/integration/targets/nxos_system/tests/cli/set_name_servers.yaml
@@ -0,0 +1,95 @@
+---
+- debug: msg="START cli/set_name_servers.yaml"
+
+- name: setup
+  nxos_config:
+    lines:
+      - no ip name-server 1.1.1.1
+      - no ip name-server 2.2.2.2
+      - no ip name-server 3.3.3.3
+    match: none
+    provider: "{{ cli }}"
+
+- name: configure name_servers
+  nxos_system:
+    name_servers:
+      - 1.1.1.1
+      - 2.2.2.2
+      - 3.3.3.3
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - result.commands|length == 3
+      - "'ip name-server 1.1.1.1' in result.commands"
+      - "'ip name-server 2.2.2.2' in result.commands"
+      - "'ip name-server 3.3.3.3' in result.commands"
+
+- name: verify name_servers
+  nxos_system:
+    name_servers:
+      - 1.1.1.1
+      - 2.2.2.2
+      - 3.3.3.3
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+#- name: change to vrf
+#  nxos_system:
+#    name_servers:
+#      - 1.1.1.1
+#      - { server: 2.2.2.2, vrf: ansible }
+#      - 3.3.3.3
+#    provider: "{{ cli }}"
+#  register: result
+
+#- assert:
+#    that:
+#      - result.changed == true
+#      - result.commands|length == 2
+#      - "'no ip name-server 2.2.2.2' in result.commands"
+#      - "'ip name-server 2.2.2.2 vrf ansible' in result.commands"
+
+#- name: verify change to vrf
+#  nxos_system:
+#    name_servers:
+#      - 1.1.1.1
+#      - { server: 2.2.2.2, vrf: ansible }
+#      - 3.3.3.3
+#    provider: "{{ cli }}"
+#  register: result
+#
+#- assert:
+#    that:
+#      - result.changed == false
+
+- name: remove one
+  nxos_system:
+    name_servers:
+      - 1.1.1.1
+      - 2.2.2.2
+    provider: "{{ cli }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - result.commands|length == 1
+      - "'no ip name-server 3.3.3.3' in result.commands"
+
+- name: teardown
+  nxos_config:
+    lines:
+      - no ip lookup source-interface
+    match: none
+    provider: "{{ cli }}"
+  ignore_errors: yes
+  # FIXME Copied from iosxr, not sure what we need here
+
+- debug: msg="END cli/set_name_servers.yaml"
diff --git a/test/integration/targets/nxos_system/tests/nxapi/set_domain_list.yaml b/test/integration/targets/nxos_system/tests/nxapi/set_domain_list.yaml
new file mode 100644
index 00000000000..f19622f8a45
--- /dev/null
+++ b/test/integration/targets/nxos_system/tests/nxapi/set_domain_list.yaml
@@ -0,0 +1,131 @@
+---
+- debug: msg="START nxapi/set_domain_list.yaml"
+
+
+# nxapi will error if you try and remove a non-existent entry,
+# Therefore we do this as a with_items loop with ignore_errors
+- name: setup
+  nxos_config:
+    lines:
+      - no ip domain-list {{ item }}
+    match: none
+    provider: "{{ nxapi }}"
+  ignore_errors: yes
+  with_items:
+      - ansible.com
+      - redhat.com
+
+- name: configure domain_list
+  nxos_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: verify domain_list
+  nxos_system:
+    domain_search:
+      - ansible.com
+      - redhat.com
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: remove one entry
+  nxos_system:
+    domain_search:
+      - ansible.com
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'no ip domain-list redhat.com' in result.commands"
+
+- name: verify remove one entry
+  nxos_system:
+    domain_search:
+      - ansible.com
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: add one entry
+  nxos_system:
+    domain_search:
+      - ansible.com
+      - redhat.com
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'ip domain-list redhat.com' in result.commands"
+
+- name: verify add one entry
+  nxos_system:
+    domain_search:
+      - ansible.com
+      - redhat.com
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: add and remove one entry
+  nxos_system:
+    domain_search:
+      - ansible.com
+      - eng.ansible.com
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'no ip domain-list redhat.com' in result.commands"
+      - "'ip domain-list eng.ansible.com' in result.commands"
+      - result.commands|length == 2
+
+- name: verify add and remove one entry
+  nxos_system:
+    domain_search:
+      - ansible.com
+      - eng.ansible.com
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: teardown
+  nxos_config:
+    lines:
+      - no ip domain-list {{ item }}
+    match: none
+    provider: "{{ nxapi }}"
+  ignore_errors: yes
+  with_items:
+      - ansible.com
+      - redhat.com
+      - eng.ansible.com
+
+- debug: msg="END nxapi/set_domain_search.yaml"
diff --git a/test/integration/targets/nxos_system/tests/nxapi/set_domain_name.yaml b/test/integration/targets/nxos_system/tests/nxapi/set_domain_name.yaml
new file mode 100644
index 00000000000..a0585b1e314
--- /dev/null
+++ b/test/integration/targets/nxos_system/tests/nxapi/set_domain_name.yaml
@@ -0,0 +1,38 @@
+---
+- debug: msg="START nxapi/set_domain_name.yaml"
+
+- name: setup
+  nxos_config:
+    lines: no ip domain-name eng.ansible.com
+    match: none
+    provider: "{{ nxapi }}"
+# NXAPI errors if you try to remove something that doesn't exist
+  ignore_errors: yes
+
+- name: configure domain_name
+  nxos_system:
+    domain_name: eng.ansible.com
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == true"
+
+- name: verify domain_name
+  nxos_system:
+    domain_name: eng.ansible.com
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == false"
+
+- name: teardown
+  nxos_config:
+    lines: no ip domain-name eng.ansible.com
+    match: none
+    provider: "{{ nxapi }}"
+
+- debug: msg="END nxapi/set_domain_name.yaml"
diff --git a/test/integration/targets/nxos_system/tests/nxapi/set_hostname.yaml b/test/integration/targets/nxos_system/tests/nxapi/set_hostname.yaml
new file mode 100644
index 00000000000..74398c800aa
--- /dev/null
+++ b/test/integration/targets/nxos_system/tests/nxapi/set_hostname.yaml
@@ -0,0 +1,36 @@
+---
+- debug: msg="START nxapi/set_hostname.yaml"
+
+- name: setup
+  nxos_config:
+    lines: hostname switch
+    match: none
+    provider: "{{ nxapi }}"
+
+- name: configure hostname
+  nxos_system:
+    hostname: foo
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == true"
+
+- name: verify hostname
+  nxos_system:
+    hostname: foo
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - "result.changed == false"
+
+- name: teardown
+  nxos_config:
+    lines: "hostname {{ inventory_hostname }}"
+    match: none
+    provider: "{{ nxapi }}"
+
+- debug: msg="END nxapi/set_hostname.yaml"
diff --git a/test/integration/targets/nxos_system/tests/nxapi/set_lookup_source.yaml-not-on-nxos b/test/integration/targets/nxos_system/tests/nxapi/set_lookup_source.yaml-not-on-nxos
new file mode 100644
index 00000000000..7a39bb24923
--- /dev/null
+++ b/test/integration/targets/nxos_system/tests/nxapi/set_lookup_source.yaml-not-on-nxos
@@ -0,0 +1,68 @@
+---
+- debug: msg="START nxapi/set_lookup_source.yaml"
+
+- name: setup
+  nxos_config:
+    lines:
+      - no ip domain lookup source-interface
+      - vrf definition ansible
+    match: none
+    provider: "{{ nxapi }}"
+
+- name: configure lookup_source
+  nxos_system:
+    lookup_source: Management1
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'ip domain lookup source-interface Management1' in result.commands"
+
+- name: verify lookup_source
+  nxos_system:
+    lookup_source: Management1
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: change to vrf
+  nxos_system:
+    lookup_source:
+      - interface: Management1
+        vrf: ansible
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - "'no ip domain lookup source-interface Management1' in result.commands"
+      - "'ip domain lookup vrf ansible source-interface Management1' in result.commands"
+      - result.commands|length == 2
+
+- name: verify change to vrf
+  nxos_system:
+    lookup_source:
+      - interface: Management1
+        vrf: ansible
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+- name: teardown
+  nxos_config:
+    lines:
+      - no ip domain lookup source-interface
+      - no vrf definition ansible
+    match: none
+    provider: "{{ nxapi }}"
+
+- debug: msg="END nxapi/set_lookup_source.yaml"
diff --git a/test/integration/targets/nxos_system/tests/nxapi/set_name_servers.yaml b/test/integration/targets/nxos_system/tests/nxapi/set_name_servers.yaml
new file mode 100644
index 00000000000..39620572d20
--- /dev/null
+++ b/test/integration/targets/nxos_system/tests/nxapi/set_name_servers.yaml
@@ -0,0 +1,101 @@
+---
+- debug: msg="START nxapi/set_name_servers.yaml"
+
+
+# nxapi will error if you try and remove a non-existent entry,
+# Therefore we do this as a with_items loop with ignore_errors
+- name: setup
+  nxos_config:
+    lines:
+      - no ip name-server {{ item }}
+    match: none
+    provider: "{{ nxapi }}"
+  ignore_errors: yes
+  with_items:
+      - 1.1.1.1
+      - 2.2.2.2
+      - 3.3.3.3
+
+- name: configure name_servers
+  nxos_system:
+    name_servers:
+      - 1.1.1.1
+      - 2.2.2.2
+      - 3.3.3.3
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - result.commands|length == 3
+      - "'ip name-server 1.1.1.1' in result.commands"
+      - "'ip name-server 2.2.2.2' in result.commands"
+      - "'ip name-server 3.3.3.3' in result.commands"
+
+- name: verify name_servers
+  nxos_system:
+    name_servers:
+      - 1.1.1.1
+      - 2.2.2.2
+      - 3.3.3.3
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == false
+
+#- name: change to vrf
+#  nxos_system:
+#    name_servers:
+#      - 1.1.1.1
+#      - { server: 2.2.2.2, vrf: ansible }
+#      - 3.3.3.3
+#    provider: "{{ nxapi }}"
+#  register: result
+
+#- assert:
+#    that:
+#      - result.changed == true
+#      - result.commands|length == 2
+#      - "'no ip name-server 2.2.2.2' in result.commands"
+#      - "'ip name-server 2.2.2.2 vrf ansible' in result.commands"
+
+#- name: verify change to vrf
+#  nxos_system:
+#    name_servers:
+#      - 1.1.1.1
+#      - { server: 2.2.2.2, vrf: ansible }
+#      - 3.3.3.3
+#    provider: "{{ nxapi }}"
+#  register: result
+#
+#- assert:
+#    that:
+#      - result.changed == false
+
+- name: remove one
+  nxos_system:
+    name_servers:
+      - 1.1.1.1
+      - 2.2.2.2
+    provider: "{{ nxapi }}"
+  register: result
+
+- assert:
+    that:
+      - result.changed == true
+      - result.commands|length == 1
+      - "'no ip name-server 3.3.3.3' in result.commands"
+
+- name: teardown
+  nxos_config:
+    lines:
+      - no ip lookup source-interface
+    match: none
+    provider: "{{ nxapi }}"
+  ignore_errors: yes
+  # FIXME Copied from iosxr, not sure what we need here
+
+- debug: msg="END nxapi/set_name_servers.yaml"