mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Add active param to junos declarative modules (#26222)
* active/deactivate configuration capability * integration test refactor
This commit is contained in:
@@ -15,10 +15,16 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<message>this is my login banner</message>' in result.rpc"
|
||||
- "'<message>this is my login banner</message>' in config.xml"
|
||||
|
||||
- name: Create login banner (idempotent)
|
||||
junos_banner:
|
||||
@@ -36,27 +42,41 @@
|
||||
junos_banner:
|
||||
banner: login
|
||||
text: this is my login banner
|
||||
state: suspend
|
||||
state: present
|
||||
active: False
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<message inactive=\"inactive\" />' in result.rpc"
|
||||
- "'<message inactive=\"inactive\">this is my login banner</message>' in config.xml"
|
||||
|
||||
- name: Activate login banner
|
||||
junos_banner:
|
||||
banner: login
|
||||
text: this is my login banner
|
||||
state: active
|
||||
state: present
|
||||
active: True
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<message active=\"active\" />' in result.rpc"
|
||||
- "'<message>this is my login banner</message>' in config.xml"
|
||||
|
||||
- name: delete login banner
|
||||
junos_banner:
|
||||
@@ -65,10 +85,16 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<message delete=\"delete\" />' in result.rpc"
|
||||
- "'<message>this is my login banner</message>' not in config.xml"
|
||||
|
||||
- name: setup - remove motd banner
|
||||
junos_banner:
|
||||
@@ -84,13 +110,16 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
msg: "{{ result }}"
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<announcement>this is my motd banner</announcement>' in result.rpc"
|
||||
- "'<announcement>this is my motd banner</announcement>' in config.xml"
|
||||
|
||||
- name: Create motd banner (idempotent)
|
||||
junos_banner:
|
||||
@@ -107,26 +136,42 @@
|
||||
- name: Deactivate motd banner
|
||||
junos_banner:
|
||||
banner: motd
|
||||
state: suspend
|
||||
text: this is my motd banner
|
||||
state: present
|
||||
active: False
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<announcement inactive=\"inactive\" />' in result.rpc"
|
||||
- "'<announcement inactive=\"inactive\">this is my motd banner</announcement>' in config.xml"
|
||||
|
||||
- name: Activate motd banner
|
||||
junos_banner:
|
||||
banner: motd
|
||||
state: active
|
||||
text: this is my motd banner
|
||||
state: present
|
||||
active: True
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<announcement active=\"active\" />' in result.rpc"
|
||||
- "'<announcement>this is my motd banner</announcement>' in config.xml"
|
||||
|
||||
- name: delete motd banner
|
||||
junos_banner:
|
||||
@@ -135,7 +180,13 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<announcement delete=\"delete\" />' in result.rpc"
|
||||
- "'<announcement>this is my motd banner</announcement>' not in config.xml"
|
||||
|
||||
@@ -16,14 +16,17 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
msg: "{{ result }}"
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<name>ge-0/0/1</name>' in result.rpc"
|
||||
- "'<description>test-interface</description>' in result.rpc"
|
||||
- "'<name>ge-0/0/1</name>' in config.xml"
|
||||
- "'<description>test-interface</description>' in config.xml"
|
||||
|
||||
- name: Create interface (idempotent)
|
||||
junos_interface:
|
||||
@@ -41,29 +44,43 @@
|
||||
junos_interface:
|
||||
name: ge-0/0/1
|
||||
description: test-interface
|
||||
state: suspend
|
||||
state: present
|
||||
active: False
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<interface inactive=\"inactive\">' in result.rpc"
|
||||
- "'<name>ge-0/0/1</name>' in result.rpc"
|
||||
- "'<interface inactive=\"inactive\">' in config.xml"
|
||||
- "'<name>ge-0/0/1</name>' in config.xml"
|
||||
|
||||
- name: Activate interface configuration
|
||||
junos_interface:
|
||||
name: ge-0/0/1
|
||||
description: test-interface
|
||||
state: active
|
||||
state: present
|
||||
active: True
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<interface active=\"active\">' in result.rpc"
|
||||
- "'<name>ge-0/0/1</name>' in result.rpc"
|
||||
- "'<interface>' in config.xml"
|
||||
- "'<name>ge-0/0/1</name>' in config.xml"
|
||||
|
||||
- name: Configure interface attributes
|
||||
junos_interface:
|
||||
@@ -76,44 +93,60 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<name>ge-0/0/1</name>' in result.rpc"
|
||||
- "'<link-mode>full-duplex</link-mode>' in result.rpc"
|
||||
- "'<mtu>256</mtu>' in result.rpc"
|
||||
- "'<speed>1g</speed>' in result.rpc"
|
||||
- "'<description>test-interface</description>' in result.rpc"
|
||||
- "'<name>ge-0/0/1</name>' in config.xml"
|
||||
- "'<link-mode>full-duplex</link-mode>' in config.xml"
|
||||
- "'<mtu>256</mtu>' in config.xml"
|
||||
- "'<speed>1g</speed>' in config.xml"
|
||||
- "'<description>test-interface</description>' in config.xml"
|
||||
|
||||
- name: Disable interface
|
||||
junos_interface:
|
||||
name: ge-0/0/1
|
||||
description: test-interface
|
||||
state: present
|
||||
enabled: False
|
||||
state: down
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<disable />' in result.rpc"
|
||||
- "'<name>ge-0/0/1</name>' in result.rpc"
|
||||
- "'<disable/>' in config.xml"
|
||||
- "'<name>ge-0/0/1</name>' in config.xml"
|
||||
|
||||
- name: Enable interface
|
||||
junos_interface:
|
||||
name: ge-0/0/1
|
||||
description: test-interface
|
||||
state: present
|
||||
enabled: True
|
||||
state: up
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<disable delete=\"delete\" />' in result.rpc"
|
||||
- "'<name>ge-0/0/1</name>' in result.rpc"
|
||||
- "'<disable/>' not in config.xml"
|
||||
- "'<name>ge-0/0/1</name>' in config.xml"
|
||||
|
||||
- name: Delete interface
|
||||
junos_interface:
|
||||
@@ -123,8 +156,19 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<interface delete=\"delete\">' in result.rpc"
|
||||
- "'<name>ge-0/0/1</name>' in result.rpc"
|
||||
- "'<name>ge-0/0/1</name>' not in config.xml"
|
||||
|
||||
@@ -14,10 +14,16 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<host-name>vsrx01</host-name>' in result.rpc"
|
||||
- "'<host-name>vsrx01</host-name>' in config.xml"
|
||||
|
||||
- name: Set hostname (idempotent)
|
||||
junos_system:
|
||||
@@ -33,26 +39,40 @@
|
||||
- name: Deactivate hostname configuration
|
||||
junos_system:
|
||||
hostname: vsrx01
|
||||
state: suspend
|
||||
state: present
|
||||
active: False
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<host-name inactive=\"inactive\" />' in result.rpc"
|
||||
- "'<host-name inactive=\"inactive\">' in config.xml"
|
||||
|
||||
- name: Activate hostname configuration
|
||||
junos_system:
|
||||
hostname: vsrx01
|
||||
state: active
|
||||
state: present
|
||||
active: True
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<host-name active=\"active\" />' in result.rpc"
|
||||
- "'<host-name>vsrx01</host-name>' in config.xml"
|
||||
|
||||
- name: Delete hostname configuration
|
||||
junos_system:
|
||||
@@ -64,7 +84,7 @@
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<host-name delete=\"delete\" />' in result.rpc"
|
||||
- "'<host-name>vsrx01</host-name>' in config.xml"
|
||||
|
||||
- name: Teardown - set hostname
|
||||
junos_system:
|
||||
@@ -85,10 +105,16 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<domain-name>ansible.com</domain-name>' in result.rpc"
|
||||
- "'<domain-name>ansible.com</domain-name>' in config.xml"
|
||||
|
||||
- name: Set domain name (idempotent)
|
||||
junos_system:
|
||||
@@ -104,26 +130,40 @@
|
||||
- name: Deactivate domain name
|
||||
junos_system:
|
||||
domain_name: ansible.com
|
||||
state: suspend
|
||||
state: present
|
||||
active: False
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<domain-name inactive=\"inactive\" />' in result.rpc"
|
||||
- "'<domain-name inactive=\"inactive\">' in config.xml"
|
||||
|
||||
- name: Activate domain name
|
||||
junos_system:
|
||||
domain_name: ansible.com
|
||||
state: active
|
||||
state: present
|
||||
active: True
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<domain-name active=\"active\" />' in result.rpc"
|
||||
- "'<domain-name>ansible.com</domain-name>' in config.xml"
|
||||
|
||||
- name: Delete domain name
|
||||
junos_system:
|
||||
@@ -132,10 +172,16 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<domain-name delete=\"delete\" />' in result.rpc"
|
||||
- "'<domain-name>ansible.com</domain-name>' not in config.xml"
|
||||
|
||||
- name: Teardown - set domain name
|
||||
junos_system:
|
||||
@@ -161,13 +207,19 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<domain-search>test.com</domain-search>' in result.rpc"
|
||||
- "'<domain-search>sample.com</domain-search>' in result.rpc"
|
||||
- "'<domain-search>test.com</domain-search>' in config.xml"
|
||||
- "'<domain-search>sample.com</domain-search>' in config.xml"
|
||||
|
||||
- name: Set domain search
|
||||
- name: Set domain search (idempotency)
|
||||
junos_system:
|
||||
domain_search:
|
||||
- test.com
|
||||
@@ -185,30 +237,44 @@
|
||||
domain_search:
|
||||
- test.com
|
||||
- sample.com
|
||||
state: suspend
|
||||
state: present
|
||||
active: False
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- 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"
|
||||
- "'<domain-search inactive=\"inactive\">test.com</domain-search>' in config.xml"
|
||||
- "'<domain-search inactive=\"inactive\">sample.com</domain-search>' in config.xml"
|
||||
|
||||
- name: Activate domain search
|
||||
junos_system:
|
||||
domain_search:
|
||||
- test.com
|
||||
- sample.com
|
||||
state: active
|
||||
state: present
|
||||
active: True
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- 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"
|
||||
- "'<domain-search>test.com</domain-search>' in config.xml"
|
||||
- "'<domain-search>sample.com</domain-search>' in config.xml"
|
||||
|
||||
- name: Delete domain search
|
||||
junos_system:
|
||||
@@ -219,11 +285,17 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- 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"
|
||||
- "'<domain-search>test.com</domain-search>' not in config.xml"
|
||||
- "'<domain-search>sample.com</domain-search>' not in config.xml"
|
||||
|
||||
- name: Setup - delete name servers
|
||||
junos_system:
|
||||
@@ -243,11 +315,17 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- 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>8.8.8.8</name>' in config.xml"
|
||||
- "'<name>8.8.4.4</name>' in config.xml"
|
||||
|
||||
- name: Set name servers (idempotent)
|
||||
junos_system:
|
||||
@@ -267,30 +345,43 @@
|
||||
name_servers:
|
||||
- 8.8.8.8
|
||||
- 8.8.4.4
|
||||
state: suspend
|
||||
state: present
|
||||
active: False
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- 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-server inactive=\"inactive\">' in config.xml"
|
||||
|
||||
- name: Activate name servers
|
||||
junos_system:
|
||||
name_servers:
|
||||
- 8.8.8.8
|
||||
- 8.8.4.4
|
||||
state: active
|
||||
state: present
|
||||
active: True
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- 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>8.8.8.8</name>' in config.xml"
|
||||
- "'<name>8.8.4.4</name>' in config.xml"
|
||||
|
||||
- name: Delete name servers
|
||||
junos_system:
|
||||
@@ -301,8 +392,14 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- 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"
|
||||
- "'<name>8.8.8.8</name>' not in config.xml"
|
||||
- "'<name>8.8.4.4</name>' not in config.xml"
|
||||
|
||||
@@ -18,14 +18,17 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
msg: "{{ result }}"
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<name>test-vlan</name>' in result.rpc"
|
||||
- "'<vlan-id>100</vlan-id>' in result.rpc"
|
||||
- "'<name>test-vlan</name>' in config.xml"
|
||||
- "'<vlan-id>100</vlan-id>' in config.xml"
|
||||
|
||||
- name: Create vlan again (idempotent)
|
||||
junos_vlan:
|
||||
@@ -44,29 +47,42 @@
|
||||
junos_vlan:
|
||||
vlan_id: 100
|
||||
name: test-vlan
|
||||
state: suspend
|
||||
state: present
|
||||
active: False
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<vlan inactive=\"inactive\">' in result.rpc"
|
||||
- "'<name>test-vlan</name>' in result.rpc"
|
||||
- "'<vlan inactive=\"inactive\">' in config.xml"
|
||||
- "'<name>test-vlan</name>' in config.xml"
|
||||
|
||||
- name: Activate vlan
|
||||
junos_vlan:
|
||||
vlan_id: 100
|
||||
name: test-vlan
|
||||
state: active
|
||||
state: present
|
||||
active: True
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<vlan active=\"active\">' in result.rpc"
|
||||
- "'<name>test-vlan</name>' in result.rpc"
|
||||
- "'<name>test-vlan</name>' in config.xml"
|
||||
|
||||
- name: Delete vlan
|
||||
junos_vlan:
|
||||
@@ -76,8 +92,13 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<vlan delete=\"delete\">' in result.rpc"
|
||||
- "'<name>test-vlan</name>' in result.rpc"
|
||||
- "'<name>test-vlan</name>' not in config.xml"
|
||||
|
||||
@@ -15,10 +15,16 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<message>this is my login banner</message>' in result.rpc"
|
||||
- "'<message>this is my login banner</message>' in config.xml"
|
||||
|
||||
- name: Create login banner (idempotent)
|
||||
net_banner:
|
||||
@@ -39,10 +45,16 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<message delete=\"delete\" />' in result.rpc"
|
||||
- "'<message>this is my login banner</message>' not in config.xml"
|
||||
|
||||
- name: setup - remove motd banner
|
||||
net_banner:
|
||||
@@ -58,13 +70,16 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
msg: "{{ result }}"
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<announcement>this is my motd banner</announcement>' in result.rpc"
|
||||
- "'<announcement>this is my motd banner</announcement>' in config.xml"
|
||||
|
||||
- name: Create motd banner (idempotent)
|
||||
net_banner:
|
||||
@@ -85,7 +100,13 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<announcement delete=\"delete\" />' in result.rpc"
|
||||
- "'<announcement>this is my motd banner</announcement>' not in config.xml"
|
||||
|
||||
@@ -16,14 +16,17 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
msg: "{{ result }}"
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<name>ge-0/0/1</name>' in result.rpc"
|
||||
- "'<description>test-interface</description>' in result.rpc"
|
||||
- "'<name>ge-0/0/1</name>' in config.xml"
|
||||
- "'<description>test-interface</description>' in config.xml"
|
||||
|
||||
- name: Create interface (idempotent)
|
||||
net_interface:
|
||||
@@ -48,44 +51,60 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<name>ge-0/0/1</name>' in result.rpc"
|
||||
- "'<link-mode>full-duplex</link-mode>' in result.rpc"
|
||||
- "'<mtu>256</mtu>' in result.rpc"
|
||||
- "'<speed>1g</speed>' in result.rpc"
|
||||
- "'<description>test-interface</description>' in result.rpc"
|
||||
- "'<name>ge-0/0/1</name>' in config.xml"
|
||||
- "'<link-mode>full-duplex</link-mode>' in config.xml"
|
||||
- "'<mtu>256</mtu>' in config.xml"
|
||||
- "'<speed>1g</speed>' in config.xml"
|
||||
- "'<description>test-interface</description>' in config.xml"
|
||||
|
||||
- name: Disable interface
|
||||
net_interface:
|
||||
name: ge-0/0/1
|
||||
description: test-interface
|
||||
state: present
|
||||
enabled: False
|
||||
state: down
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<disable />' in result.rpc"
|
||||
- "'<name>ge-0/0/1</name>' in result.rpc"
|
||||
- "'<disable/>' in config.xml"
|
||||
- "'<name>ge-0/0/1</name>' in config.xml"
|
||||
|
||||
- name: Enable interface
|
||||
net_interface:
|
||||
name: ge-0/0/1
|
||||
description: test-interface
|
||||
state: present
|
||||
enabled: True
|
||||
state: up
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<disable delete=\"delete\" />' in result.rpc"
|
||||
- "'<name>ge-0/0/1</name>' in result.rpc"
|
||||
- "'<disable/>' not in config.xml"
|
||||
- "'<name>ge-0/0/1</name>' in config.xml"
|
||||
|
||||
- name: Delete interface
|
||||
net_interface:
|
||||
@@ -95,8 +114,13 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<interface delete=\"delete\">' in result.rpc"
|
||||
- "'<name>ge-0/0/1</name>' in result.rpc"
|
||||
- "'<name>ge-0/0/1</name>' not in config.xml"
|
||||
|
||||
@@ -14,10 +14,16 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<host-name>vsrx01</host-name>' in result.rpc"
|
||||
- "'<host-name>vsrx01</host-name>' in config.xml"
|
||||
|
||||
- name: Set hostname (idempotent)
|
||||
net_system:
|
||||
@@ -30,30 +36,6 @@
|
||||
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
|
||||
@@ -61,10 +43,16 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<host-name delete=\"delete\" />' in result.rpc"
|
||||
- "'<host-name>vsrx01</host-name>' not in config.xml"
|
||||
|
||||
- name: Teardown - set hostname
|
||||
net_system:
|
||||
@@ -85,10 +73,16 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<domain-name>ansible.com</domain-name>' in result.rpc"
|
||||
- "'<domain-name>ansible.com</domain-name>' in config.xml"
|
||||
|
||||
- name: Set domain name (idempotent)
|
||||
net_system:
|
||||
@@ -101,30 +95,6 @@
|
||||
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
|
||||
@@ -132,10 +102,16 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<domain-name delete=\"delete\" />' in result.rpc"
|
||||
- "'<domain-name>ansible.com</domain-name>' not in config.xml"
|
||||
|
||||
- name: Teardown - set domain name
|
||||
net_system:
|
||||
@@ -161,11 +137,17 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<domain-search>test.com</domain-search>' in result.rpc"
|
||||
- "'<domain-search>sample.com</domain-search>' in result.rpc"
|
||||
- "'<domain-search>test.com</domain-search>' in config.xml"
|
||||
- "'<domain-search>sample.com</domain-search>' in config.xml"
|
||||
|
||||
- name: Set domain search
|
||||
net_system:
|
||||
@@ -180,36 +162,6 @@
|
||||
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:
|
||||
@@ -219,11 +171,17 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- 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"
|
||||
- "'<domain-search>test.com</domain-search>' not in config.xml"
|
||||
- "'<domain-search>sample.com</domain-search>' not in config.xml"
|
||||
|
||||
- name: Setup - delete name servers
|
||||
net_system:
|
||||
@@ -243,11 +201,17 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- 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>8.8.8.8</name>' in config.xml"
|
||||
- "'<name>8.8.4.4</name>' in config.xml"
|
||||
|
||||
- name: Set name servers (idempotent)
|
||||
net_system:
|
||||
@@ -262,36 +226,6 @@
|
||||
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:
|
||||
@@ -301,8 +235,14 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- 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"
|
||||
- "'<name>8.8.8.8</name>' not in config.xml"
|
||||
- "'<name>8.8.4.4</name>' not in config.xml"
|
||||
|
||||
@@ -16,14 +16,17 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- debug:
|
||||
msg: "{{ result }}"
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<name>test-vlan</name>' in result.rpc"
|
||||
- "'<vlan-id>100</vlan-id>' in result.rpc"
|
||||
- "'<name>test-vlan</name>' in config.xml"
|
||||
- "'<vlan-id>100</vlan-id>' in config.xml"
|
||||
|
||||
- name: Create vlan again (idempotent)
|
||||
net_vlan:
|
||||
@@ -37,34 +40,6 @@
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: Deactivate vlan
|
||||
net_vlan:
|
||||
vlan_id: 100
|
||||
name: test-vlan
|
||||
state: suspend
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<vlan inactive=\"inactive\">' in result.rpc"
|
||||
- "'<name>test-vlan</name>' in result.rpc"
|
||||
|
||||
- name: Activate vlan
|
||||
net_vlan:
|
||||
vlan_id: 100
|
||||
name: test-vlan
|
||||
state: active
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<vlan active=\"active\">' in result.rpc"
|
||||
- "'<name>test-vlan</name>' in result.rpc"
|
||||
|
||||
- name: Delete vlan
|
||||
net_vlan:
|
||||
vlan_id: 100
|
||||
@@ -73,8 +48,13 @@
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Get running configuration
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
provider: "{{ netconf }}"
|
||||
register: config
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<vlan delete=\"delete\">' in result.rpc"
|
||||
- "'<name>test-vlan</name>' in result.rpc"
|
||||
- "'<name>test-vlan</name>' not in config.xml"
|
||||
|
||||
Reference in New Issue
Block a user