ansible/test/integration/targets/net_system/tests/junos/basic.yaml
Ganesh Nalawade b2f46753ec Add junos_system declartive module and other related change (#25859)
* Add junos_system declartive module and other related change

*  junos_system declartive module
*  integration test for junos_system
*  integration test for net_system (junos platform)
*  pep8 fixes for junos modules
*  move to lxml from elementree for xml parsing as it support
   complete set of xpath api's
*  other minor changes

* Fix CI and doc changes

* Fix unit test failures

* Fix typo in import

* Fix import issue for py2.6

* Add missed Element in import
2017-06-22 09:34:50 +05:30

308 lines
6.7 KiB
YAML

---
- debug: msg="START net_system junos/basic.yaml"
- name: setup - remove hostname
net_system:
hostname: vsrx01
state: absent
provider: "{{ netconf }}"
- name: Set hostname
net_system:
hostname: vsrx01
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<host-name>vsrx01</host-name>' in result.rpc"
- name: Set hostname (idempotent)
net_system:
hostname: vsrx01
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- name: Deactivate hostname configuration
net_system:
hostname: vsrx01
state: suspend
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<host-name inactive=\"inactive\" />' in result.rpc"
- name: Activate hostname configuration
net_system:
hostname: vsrx01
state: active
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<host-name active=\"active\" />' in result.rpc"
- name: Delete hostname configuration
net_system:
hostname: vsrx01
state: absent
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<host-name delete=\"delete\" />' in result.rpc"
- name: Teardown - set hostname
net_system:
hostname: vsrx01
state: present
provider: "{{ netconf }}"
- name: setup - remove domain name
net_system:
domain_name: ansible.com
state: absent
provider: "{{ netconf }}"
- name: Set domain name
net_system:
domain_name: ansible.com
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<domain-name>ansible.com</domain-name>' in result.rpc"
- name: Set domain name (idempotent)
net_system:
domain_name: ansible.com
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- name: Deactivate domain name
net_system:
domain_name: ansible.com
state: suspend
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<domain-name inactive=\"inactive\" />' in result.rpc"
- name: Activate domain name
net_system:
domain_name: ansible.com
state: active
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<domain-name active=\"active\" />' in result.rpc"
- name: Delete domain name
net_system:
domain_name: ansible.com
state: absent
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<domain-name delete=\"delete\" />' in result.rpc"
- name: Teardown - set domain name
net_system:
domain_name: ansible.com
state: present
provider: "{{ netconf }}"
- name: Setup - delete domain search
net_system:
domain_search:
- test.com
- sample.com
state: absent
provider: "{{ netconf }}"
register: result
- name: Set domain search
net_system:
domain_search:
- test.com
- sample.com
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<domain-search>test.com</domain-search>' in result.rpc"
- "'<domain-search>sample.com</domain-search>' in result.rpc"
- name: Set domain search
net_system:
domain_search:
- test.com
- sample.com
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- name: Deactivate domain search
net_system:
domain_search:
- test.com
- sample.com
state: suspend
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<domain-search inactive=\"inactive\">test.com</domain-search>' in result.rpc"
- "'<domain-search inactive=\"inactive\">sample.com</domain-search>' in result.rpc"
- name: Activate domain search
net_system:
domain_search:
- test.com
- sample.com
state: active
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<domain-search active=\"active\">test.com</domain-search>' in result.rpc"
- "'<domain-search active=\"active\">sample.com</domain-search>' in result.rpc"
- name: Delete domain search
net_system:
domain_search:
- test.com
- sample.com
state: absent
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<domain-search delete=\"delete\">test.com</domain-search>' in result.rpc"
- "'<domain-search delete=\"delete\">sample.com</domain-search>' in result.rpc"
- name: Setup - delete name servers
net_system:
name_servers:
- 8.8.8.8
- 8.8.4.4
state: absent
provider: "{{ netconf }}"
register: result
- name: Set name servers
net_system:
name_servers:
- 8.8.8.8
- 8.8.4.4
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<name-server><name>8.8.8.8</name></name-server>' in result.rpc"
- "'<name-server><name>8.8.4.4</name></name-server>' in result.rpc"
- name: Set name servers (idempotent)
net_system:
name_servers:
- 8.8.8.8
- 8.8.4.4
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- name: Deactivate name servers
net_system:
name_servers:
- 8.8.8.8
- 8.8.4.4
state: suspend
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<name-server inactive=\"inactive\"><name>8.8.8.8</name></name-server>' in result.rpc"
- "'<name-server inactive=\"inactive\"><name>8.8.4.4</name></name-server>' in result.rpc"
- name: Activate name servers
net_system:
name_servers:
- 8.8.8.8
- 8.8.4.4
state: active
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<name-server active=\"active\"><name>8.8.8.8</name></name-server>' in result.rpc"
- "'<name-server active=\"active\"><name>8.8.4.4</name></name-server>' in result.rpc"
- name: Delete name servers
net_system:
name_servers:
- 8.8.8.8
- 8.8.4.4
state: absent
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'<name-server delete=\"delete\"><name>8.8.8.8</name></name-server>' in result.rpc"
- "'<name-server delete=\"delete\"><name>8.8.4.4</name></name-server>' in result.rpc"