summaryrefslogtreecommitdiffstats
path: root/ansible_collections/junipernetworks/junos/tests/integration
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/junipernetworks/junos/tests/integration')
-rw-r--r--ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tests/netconf/network_facts.yaml124
-rw-r--r--ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/rtt.yml12
-rw-r--r--ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/aliases0
-rw-r--r--ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/defaults/main.yaml2
-rw-r--r--ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/meta/main.yml3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tasks/main.yaml3
-rw-r--r--ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tasks/netconf.yaml21
-rw-r--r--ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tests/netconf/basic.yaml407
-rw-r--r--ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/_reset_config.yaml6
-rw-r--r--ansible_collections/junipernetworks/junos/tests/integration/targets/prepare_junos_tests/tasks/main.yml20
-rw-r--r--ansible_collections/junipernetworks/junos/tests/integration/targets/prepare_junos_tests/tasks/prepare.yml18
11 files changed, 151 insertions, 465 deletions
diff --git a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tests/netconf/network_facts.yaml b/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tests/netconf/network_facts.yaml
new file mode 100644
index 000000000..f0d08f310
--- /dev/null
+++ b/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tests/netconf/network_facts.yaml
@@ -0,0 +1,124 @@
+---
+- ansible.builtin.debug:
+ msg="START cli_config/cli_basic.yaml on connection={{ ansible_connection
+ }}"
+
+- name: Reset acls
+ junipernetworks.junos.junos_acls:
+ state: deleted
+
+- name: Reset vlans
+ junipernetworks.junos.junos_vlans:
+ state: deleted
+
+- name: Reset lldp_global
+ junipernetworks.junos.junos_lldp_global:
+ state: deleted
+
+- name: Reset lldp_interfaces
+ junipernetworks.junos.junos_lldp_interfaces:
+ state: deleted
+
+- name: Reset logging_global
+ junipernetworks.junos.junos_logging_global:
+ state: deleted
+
+- name: Reset ntp_global
+ junipernetworks.junos.junos_ntp_global:
+ state: deleted
+
+- name: Reset ospf_interfaces
+ junipernetworks.junos.junos_ospf_interfaces:
+ state: deleted
+
+- name: Reset ospfv2
+ junipernetworks.junos.junos_ospfv2:
+ state: deleted
+
+- name: Reset ospfv3
+ junipernetworks.junos.junos_ospfv3:
+ state: deleted
+
+- name: Reset prefix_lists
+ junipernetworks.junos.junos_prefix_lists:
+ state: deleted
+
+- name: Reset routing_instances
+ junipernetworks.junos.junos_routing_instances:
+ state: deleted
+
+- name: Reset routing_options
+ junipernetworks.junos.junos_routing_options:
+ state: deleted
+
+- name: Reset security_policies
+ junipernetworks.junos.junos_security_policies:
+ state: deleted
+
+- name: Reset security_policies_global
+ junipernetworks.junos.junos_security_policies_global:
+ state: deleted
+
+- name: Reset security_zones
+ junipernetworks.junos.junos_security_zones:
+ state: deleted
+
+- name: Reset snmp_server
+ junipernetworks.junos.junos_snmp_server:
+ state: deleted
+
+- name: Reset static_routes
+ junipernetworks.junos.junos_static_routes:
+ state: deleted
+
+- name: Gather junipernetworks junos facts
+ junipernetworks.junos.junos_facts:
+ gather_subset: config
+ gather_network_resources:
+ - acls
+ - lldp_global
+ - lldp_interfaces
+ - logging_global
+ - ntp_global
+ - ospf_interfaces
+ - ospfv2
+ - ospfv3
+ - prefix_lists
+ - routing_instances
+ - routing_options
+ - security_policies
+ - security_policies_global
+ - security_zones
+ - snmp_server
+ - static_routes
+ - vlans
+ register: gather_resources
+
+- name: Display Facts
+ ansible.builtin.debug:
+ msg: "{{ gather_resources }}"
+
+- name: Assert that empty facts was generated
+ ansible.builtin.assert:
+ that:
+ - " gather_resources['ansible_facts']['ansible_network_resources']['acls'] == []"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['lldp_global'] == {}"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['lldp_interfaces'] == []"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['logging_global'] == {}"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['ntp_global'] == {}"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['ospf_interfaces'] == []"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['ospfv2'] == []"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['ospfv3'] == []"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['prefix_lists'] == []"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['routing_instances'] == []"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['routing_options'] == []"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['security_policies'] == {}"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['security_policies_global'] == {}"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['security_zones'] == {}"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['snmp_server'] == {}"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['static_routes'] == []"
+ - " gather_resources['ansible_facts']['ansible_network_resources']['vlans'] == []"
+
+- ansible.builtin.debug:
+ msg="END cli_config/cli_basic.yaml on connection={{ ansible_connection
+ }}"
diff --git a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/rtt.yml b/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/rtt.yml
index 634727a67..f934983c9 100644
--- a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/rtt.yml
+++ b/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/rtt.yml
@@ -16,7 +16,6 @@
trunk:
allowed_vlans:
- vlan100
- native_vlan: "200"
state: merged
- name: Gather interfaces facts
@@ -30,17 +29,12 @@
register: result
junipernetworks.junos.junos_l2_interfaces:
config:
- - name: ge-0/0/1
+ - name: ge-0/0/2
trunk:
allowed_vlans:
- vlan100
- - vlan300
- native_vlan: "400"
-
- - name: ge-0/0/2
- access:
- vlan: vlan200
- state: replaced
+ native_vlan: "200"
+ state: overridden
- name: Assert that changes were applied
ansible.builtin.assert:
diff --git a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/aliases b/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/aliases
deleted file mode 100644
index e69de29bb..000000000
--- a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/aliases
+++ /dev/null
diff --git a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/defaults/main.yaml b/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/defaults/main.yaml
deleted file mode 100644
index 5f709c5aa..000000000
--- a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/defaults/main.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-testcase: "*"
diff --git a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/meta/main.yml b/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/meta/main.yml
deleted file mode 100644
index d80f5fbf3..000000000
--- a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/meta/main.yml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
- - prepare_junos_tests
diff --git a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tasks/main.yaml b/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tasks/main.yaml
deleted file mode 100644
index eace31d3f..000000000
--- a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tasks/main.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-- name: Invoke netconf
- ansible.builtin.include_tasks: netconf.yaml
diff --git a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tasks/netconf.yaml b/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tasks/netconf.yaml
deleted file mode 100644
index 6071adcfe..000000000
--- a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tasks/netconf.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
----
-- name: Collect all netconf test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/netconf"
- patterns: "{{ testcase }}.yaml"
- register: test_cases
- connection: local
-
-- name: Set test_items
- ansible.builtin.set_fact:
- test_items: "{{ test_cases.files | map(attribute='path') | list }}"
-
-- name: Run test case (connection=ansible.netcommon.netconf)
- ansible.builtin.include_tasks: "{{ test_case_to_run }}"
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
- vars:
- ansible_connection: ansible.netcommon.netconf
- tags:
- - netconf
diff --git a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tests/netconf/basic.yaml b/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tests/netconf/basic.yaml
deleted file mode 100644
index 030ce9e69..000000000
--- a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tests/netconf/basic.yaml
+++ /dev/null
@@ -1,407 +0,0 @@
----
-- ansible.builtin.debug:
- msg="START junos_logging netconf/basic.yaml on connection={{ ansible_connection
- }}"
-
-- name: setup - remove file logging
- junipernetworks.junos.junos_logging:
- dest: file
- name: test
- facility: pfe
- level: error
- state: absent
-
-- name: Create file logging
- register: result
- junipernetworks.junos.junos_logging:
- dest: file
- name: test_file
- facility: pfe
- level: error
- state: present
-
-- name: Get running configuration
- register: config
- junipernetworks.junos.junos_rpc:
- rpc: get-configuration
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - "'<name>test_file</name>' in config.xml"
- - "'<name>pfe</name>' in config.xml"
- - "'<error/>' in config.xml"
-
-- name: Create file logging (idempotent)
- register: result
- junipernetworks.junos.junos_logging:
- dest: file
- name: test_file
- facility: pfe
- level: error
- state: present
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Deactivate logging configuration
- register: result
- junipernetworks.junos.junos_logging:
- dest: file
- name: test_file
- facility: pfe
- level: error
- state: present
- active: false
-
-- name: Get running configuration
- register: config
- junipernetworks.junos.junos_rpc:
- rpc: get-configuration
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '''<file inactive="inactive">'' in config.xml'
- - '''<contents inactive="inactive">'' in config.xml'
-
-- name: Activate logging configuration
- register: result
- junipernetworks.junos.junos_logging:
- dest: file
- name: test_file
- facility: pfe
- level: error
- state: present
- active: true
-
-- name: Get running configuration
- register: config
- junipernetworks.junos.junos_rpc:
- rpc: get-configuration
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - "'<name>test_file</name>' in config.xml"
- - "'<name>pfe</name>' in config.xml"
- - "'<error/>' in config.xml"
-
-- name: Delete logging configuration
- register: result
- junipernetworks.junos.junos_logging:
- dest: file
- name: test_file
- facility: pfe
- level: error
- state: absent
-
-- name: Get running configuration
- register: config
- junipernetworks.junos.junos_rpc:
- rpc: get-configuration
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - "'<name>test_file</name>' not in config.xml"
-
-- name: Configure console logging
- register: result
- junipernetworks.junos.junos_logging:
- dest: console
- facility: kernel
- level: emergency
- state: present
- active: true
-
-- name: Get running configuration
- register: config
- junipernetworks.junos.junos_rpc:
- rpc: get-configuration
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - "'<console>' in config.xml"
- - "'<name>kernel</name>' in config.xml"
- - "'<emergency/>' in config.xml"
-
-- name: Configure console logging (idempotent)
- register: result
- junipernetworks.junos.junos_logging:
- dest: console
- facility: kernel
- level: emergency
- state: present
- active: true
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Disable console logging
- register: result
- junipernetworks.junos.junos_logging:
- dest: console
- facility: kernel
- level: emergency
- state: present
- active: false
-
-- name: Get running configuration
- register: config
- junipernetworks.junos.junos_rpc:
- rpc: get-configuration
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '''<console inactive="inactive">'' in config.xml'
-
-- name: Delete console logging
- register: result
- junipernetworks.junos.junos_logging:
- dest: console
- facility: kernel
- level: emergency
- state: absent
-
-- name: Get running configuration
- register: config
- junipernetworks.junos.junos_rpc:
- rpc: get-configuration
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - "'<console>' not in config.xml"
-
-- name: Configure logging parameters
- register: result
- junipernetworks.junos.junos_logging:
- size: 65536
- files: 40
- rotate_frequency: 20
- state: present
-
-- name: Get running configuration
- register: config
- junipernetworks.junos.junos_rpc:
- rpc: get-configuration
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - "'<size>64k</size>' in config.xml"
- - "'<files>40</files>' in config.xml"
- - "'<log-rotate-frequency>20</log-rotate-frequency>' in config.xml"
-
-- name: Configure logging parameters (idempotent)
- register: result
- junipernetworks.junos.junos_logging:
- size: 65536
- files: 40
- rotate_frequency: 20
- state: present
- active: true
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- name: Disable logging parameters
- register: result
- junipernetworks.junos.junos_logging:
- size: 65536
- files: 40
- rotate_frequency: 20
- state: present
- active: false
-
-- name: Get running configuration
- register: config
- junipernetworks.junos.junos_rpc:
- rpc: get-configuration
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - '''<size inactive="inactive">64k</size>'' in config.xml'
- - '''<files inactive="inactive">40</files>'' in config.xml'
- - "'<log-rotate-frequency inactive=\"inactive\">20</log-rotate-frequency>'\
- \ in config.xml"
-
-- name: Activate logging parameters
- register: result
- junipernetworks.junos.junos_logging:
- size: 65536
- files: 40
- rotate_frequency: 20
- state: present
- active: true
-
-- name: Get running configuration
- register: config
- junipernetworks.junos.junos_rpc:
- rpc: get-configuration
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - "'<size>64k</size>' in config.xml"
- - "'<files>40</files>' in config.xml"
- - "'<log-rotate-frequency>20</log-rotate-frequency>' in config.xml"
-
-- name: Delete logging parameters
- register: result
- junipernetworks.junos.junos_logging:
- size: 65536
- files: 40
- rotate_frequency: 20
- state: absent
-
-- name: Get running configuration
- register: config
- junipernetworks.junos.junos_rpc:
- rpc: get-configuration
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - "'<size>64k</size>' not in config.xml"
- - "'<files>40</files>' not in config.xml"
- - "'<log-rotate-frequency>20</log-rotate-frequency>' not in config.xml"
-
-- name: Seup file logging using aggregate
- register: result
- junipernetworks.junos.junos_logging:
- aggregate:
- - dest: file
- name: test-1
- facility: pfe
- level: critical
- state: absent
-
- - dest: file
- name: test-2
- facility: kernel
- level: emergency
- state: absent
-
-- name: Configure file logging using aggregate
- register: result
- junipernetworks.junos.junos_logging:
- aggregate:
- - dest: file
- name: test-1
- facility: pfe
- level: critical
- active: true
-
- - dest: file
- name: test-2
- facility: kernel
- level: emergency
- active: true
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - result.diff.prepared is search("\+ *file test-1")
- - result.diff.prepared is search("\+ *pfe critical")
- - result.diff.prepared is search("\+ *file test-2")
- - result.diff.prepared is search("\+ *kernel emergency")
-
-- name: Deactivate file logging configuration using aggregate
- register: result
- junipernetworks.junos.junos_logging:
- aggregate:
- - dest: file
- name: test-1
- facility: pfe
- level: critical
-
- - dest: file
- name: test-2
- facility: kernel
- level: emergency
- active: false
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - result.diff.prepared is search("! *inactive[:] file test-1")
- - result.diff.prepared is search("! *inactive[:] pfe")
- - result.diff.prepared is search("! *inactive[:] file test-2")
- - result.diff.prepared is search("! *inactive[:] kernel")
-
-- name: activate file logging configuration using aggregate
- register: result
- junipernetworks.junos.junos_logging:
- aggregate:
- - dest: file
- name: test-1
- facility: pfe
- level: critical
-
- - dest: file
- name: test-2
- facility: kernel
- level: emergency
- active: true
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - result.diff.prepared is search("! *active[:] file test-1")
- - result.diff.prepared is search("! *active[:] pfe")
- - result.diff.prepared is search("! *active[:] file test-2")
- - result.diff.prepared is search("! *active[:] kernel")
-
-- name: Delete file logging using aggregate
- register: result
- junipernetworks.junos.junos_logging:
- aggregate:
- - dest: file
- name: test-1
- facility: pfe
- level: critical
-
- - dest: file
- name: test-2
- facility: kernel
- level: emergency
- state: absent
-
-- ansible.builtin.assert:
- that:
- - result.changed == true
- - result.diff.prepared is search("\- *file test-1")
- - result.diff.prepared is search("\- *pfe critical")
- - result.diff.prepared is search("\- *file test-2")
- - result.diff.prepared is search("\- *kernel emergency")
-
-- name: Delete file logging using aggregate (idempotent)
- register: result
- junipernetworks.junos.junos_logging:
- aggregate:
- - dest: file
- name: test-1
- facility: pfe
- level: critical
-
- - dest: file
- name: test-2
- facility: kernel
- level: emergency
- state: absent
-
-- ansible.builtin.assert:
- that:
- - result.changed == false
-
-- ansible.builtin.debug:
- msg="END junos_logging netconf/basic.yaml on connection={{ ansible_connection
- }}"
diff --git a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/_reset_config.yaml b/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/_reset_config.yaml
index 8ed9385eb..070a57754 100644
--- a/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/_reset_config.yaml
+++ b/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/_reset_config.yaml
@@ -1,11 +1,11 @@
---
- ansible.builtin.debug:
- msg: "START junos_ospfv3 reset config on connection={{ ansible_connection }}"
+ msg: "START reset ospf and routing-options config on connection={{ ansible_connection }}"
-- name: Reset configuration for ospf3 and routing-options
+- name: Reset configuration for ospf and routing-options
junipernetworks.junos.junos_config:
lines:
- delete protocols ospf
- delete routing-options
- ansible.builtin.debug:
- msg: "END junos_ospfv3 reset config on connection={{ ansible_connection }}"
+ msg: "END ospf and routing-options reset config on connection={{ ansible_connection }}"
diff --git a/ansible_collections/junipernetworks/junos/tests/integration/targets/prepare_junos_tests/tasks/main.yml b/ansible_collections/junipernetworks/junos/tests/integration/targets/prepare_junos_tests/tasks/main.yml
index 179fb0d95..68bf6e300 100644
--- a/ansible_collections/junipernetworks/junos/tests/integration/targets/prepare_junos_tests/tasks/main.yml
+++ b/ansible_collections/junipernetworks/junos/tests/integration/targets/prepare_junos_tests/tasks/main.yml
@@ -1,18 +1,4 @@
---
-- name: Debug task
- ansible.builtin.debug:
- msg: "START prepare_junos_tests/main.yaml"
-
-- name: Ensure netconf is enabled
- connection: ansible.netcommon.network_cli
- tags: netconf
- junipernetworks.junos.junos_netconf:
- state: present
-
-- name: Wait for netconf server to come up
- delegate_to: localhost
- tags: netconf
- ansible.builtin.wait_for:
- host: "{{ hostvars[item].ansible_host }}"
- port: 830
- with_inventory_hostnames: junos
+- name: Run the prepare steps if requested
+ ansible.builtin.include_tasks: prepare.yml
+ when: prepare_junos_tests_task | default(True) | bool
diff --git a/ansible_collections/junipernetworks/junos/tests/integration/targets/prepare_junos_tests/tasks/prepare.yml b/ansible_collections/junipernetworks/junos/tests/integration/targets/prepare_junos_tests/tasks/prepare.yml
new file mode 100644
index 000000000..179fb0d95
--- /dev/null
+++ b/ansible_collections/junipernetworks/junos/tests/integration/targets/prepare_junos_tests/tasks/prepare.yml
@@ -0,0 +1,18 @@
+---
+- name: Debug task
+ ansible.builtin.debug:
+ msg: "START prepare_junos_tests/main.yaml"
+
+- name: Ensure netconf is enabled
+ connection: ansible.netcommon.network_cli
+ tags: netconf
+ junipernetworks.junos.junos_netconf:
+ state: present
+
+- name: Wait for netconf server to come up
+ delegate_to: localhost
+ tags: netconf
+ ansible.builtin.wait_for:
+ host: "{{ hostvars[item].ansible_host }}"
+ port: 830
+ with_inventory_hostnames: junos