summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/ios/tests/integration
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/cisco/ios/tests/integration')
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_acls/tests/cli/_populate_config.yaml15
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_acls/tests/cli/remarks_states.yaml134
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_acls/tests/cli/replaced.yaml35
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_acls/vars/main.yaml291
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/defaults/main.yaml2
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/meta/main.yaml3
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/tasks/cli.yaml17
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/tasks/main.yaml5
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/tests/cli/basic.yaml490
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_bgp_global/tests/cli/deleted.yaml1
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_bgp_global/tests/cli/merged.yaml24
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_bgp_global/vars/main.yaml50
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_facts/tests/cli/all_facts.yaml7
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml2
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_interfaces/vars/main.yaml4
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_l3_interfaces/tests/cli/merged.yaml15
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_l3_interfaces/vars/main.yaml21
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/defaults/main.yaml2
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/meta/main.yml3
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/tasks/cli.yaml18
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/tasks/main.yaml3
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/tests/cli/ntp_configuration.yaml87
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_user/tests/cli/basic.yaml73
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/_populate_config_vlan_config.yaml1
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/_remove_config_vlan_config.yaml1
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/deleted_vlan_config.yaml1
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/gathered_vlan_config.yaml1
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/merged_vlan_config.yaml1
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/overridden_vlan_config.yaml1
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/parsed_vlan_config.yaml1
-rw-r--r--ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/rendered_vlan_config.yaml1
31 files changed, 601 insertions, 709 deletions
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/tests/cli/_populate_config.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/tests/cli/_populate_config.yaml
index 7fd5aa1e3..16053c325 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/tests/cli/_populate_config.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/tests/cli/_populate_config.yaml
@@ -1,10 +1,15 @@
---
- name: Populate configuration
vars:
- lines:
- "ip access-list extended test_acl\ndeny tcp 192.0.2.0 0.0.0.255 192.0.3.0 0.0.0.255 eq www fin option traceroute ttl eq 10\nip access-list extended 110\n\
- deny icmp 192.0.2.0 0.0.0.255 192.0.3.0 0.0.0.255 echo dscp ef ttl eq 10\nip access-list extended 123\ndeny tcp 198.51.100.0 0.0.0.255 198.51.101.0 0.0.0.255\
- \ eq telnet ack tos 12\ndeny tcp 192.0.3.0 0.0.0.255 192.0.4.0 0.0.0.255 eq www ack dscp ef ttl lt 20\nipv6 access-list R1_TRAFFIC\ndeny tcp any eq www any\
- \ eq telnet ack dscp af11\n"
+ lines: |
+ ip access-list extended test_acl
+ deny tcp 192.0.2.0 0.0.0.255 192.0.3.0 0.0.0.255 eq www fin option traceroute ttl eq 10
+ ip access-list extended 110
+ deny icmp 192.0.2.0 0.0.0.255 192.0.3.0 0.0.0.255 echo dscp ef ttl eq 10
+ ip access-list extended 123
+ deny tcp 198.51.100.0 0.0.0.255 198.51.101.0 0.0.0.255 eq telnet ack tos 12
+ deny tcp 192.0.3.0 0.0.0.255 192.0.4.0 0.0.0.255 eq www ack dscp ef ttl lt 20
+ ipv6 access-list R1_TRAFFIC
+ deny tcp any eq www any eq telnet ack dscp af11
ansible.netcommon.cli_config:
config: "{{ lines }}"
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/tests/cli/remarks_states.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/tests/cli/remarks_states.yaml
new file mode 100644
index 000000000..856b5e6ad
--- /dev/null
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/tests/cli/remarks_states.yaml
@@ -0,0 +1,134 @@
+---
+- ansible.builtin.debug:
+ msg: START ios_acls round trip integration tests on connection={{ ansible_connection }}
+
+- ansible.builtin.include_tasks: _remove_config.yaml
+
+- ansible.builtin.include_tasks: _populate_config.yaml
+
+- block:
+ - name: Apply the configuration with remarks
+ register: base_config
+ cisco.ios.ios_acls:
+ config:
+ - afi: ipv4
+ acls:
+ - name: TEST
+ acl_type: extended
+ aces:
+ - sequence: 10
+ remarks:
+ - "FIRST REMARK BEFORE SEQUENCE 10"
+ - "============"
+ - "REMARKS FOR SEQUENCE 10 NO FOLLOWING ACE"
+ - sequence: 20
+ remarks:
+ - "FIRST REMARK BEFORE SEQUENCE 20"
+ - "============"
+ - "ALLOW HOST FROM SEQUENCE 20"
+ grant: permit
+ protocol: ip
+ source:
+ host: 1.1.1.1
+ destination:
+ any: true
+ - sequence: 30
+ remarks:
+ - "FIRST REMARK BEFORE SEQUENCE 30"
+ - "============"
+ - "ALLOW HOST FROM SEQUENCE 30"
+ grant: permit
+ protocol: ip
+ source:
+ host: 2.2.2.2
+ destination:
+ any: true
+ - sequence: 40
+ remarks:
+ - "FIRST REMARK BEFORE SEQUENCE 40"
+ - "============"
+ - "ALLOW NEW HOST FROM SEQUENCE 40"
+ grant: permit
+ protocol: ip
+ source:
+ host: 3.3.3.3
+ destination:
+ any: true
+ - remarks:
+ - "Remark not specific to sequence"
+ - "============"
+ - "End Remarks"
+ state: merged
+
+ - ansible.builtin.assert:
+ that:
+ - base_config.changed == true
+ - base_config.commands|symmetric_difference(remarks_check.commands) == []
+ - base_config.before|symmetric_difference(remarks_check.before) == []
+ - base_config.after|symmetric_difference(remarks_check.after) == []
+
+ - name: Apply enhanced configuration
+ register: base_config_overridden
+ cisco.ios.ios_acls:
+ config:
+ - afi: ipv4
+ acls:
+ - name: TEST
+ acl_type: extended
+ aces:
+ - sequence: 10
+ remarks:
+ - "FIRST REMARK BEFORE SEQUENCE 10"
+ - "============"
+ - "REMARKS FOR SEQUENCE 10 NO FOLLOWING ACE"
+ grant: permit
+ protocol: ip
+ source:
+ host: 1.1.1.1
+ destination:
+ any: true
+ - sequence: 20
+ remarks:
+ - "FIRST REMARK BEFORE SEQUENCE 20"
+ - "============"
+ - "ALLOW HOST FROM SEQUENCE 20"
+ grant: permit
+ protocol: ip
+ source:
+ host: 192.168.0.1
+ destination:
+ any: true
+ - sequence: 30
+ remarks:
+ - "FIRST REMARK BEFORE SEQUENCE 30"
+ - "============"
+ - "ALLOW HOST FROM SEQUENCE 30 updated"
+ grant: permit
+ protocol: ip
+ source:
+ host: 2.2.2.2
+ destination:
+ any: true
+ - sequence: 40
+ remarks:
+ - "FIRST REMARK BEFORE SEQUENCE 40"
+ - "============"
+ - "ALLOW NEW HOST FROM SEQUENCE 40"
+ grant: permit
+ protocol: ip
+ source:
+ host: 3.3.3.3
+ destination:
+ any: true
+ - remarks:
+ - "Remark not specific to sequence"
+ - "============"
+ - "End Remarks updated"
+ - "04j"
+ state: overridden
+
+ - ansible.builtin.assert:
+ that:
+ - base_config_overridden.commands|symmetric_difference(remarks_check_override.commands) == []
+ always:
+ - ansible.builtin.include_tasks: _remove_config.yaml
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/tests/cli/replaced.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/tests/cli/replaced.yaml
index f4faca3ba..aae010b64 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/tests/cli/replaced.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/tests/cli/replaced.yaml
@@ -87,5 +87,40 @@
that:
- result.commands|length == 0
- result['changed'] == false
+
+ - ansible.builtin.include_tasks: _remove_config.yaml
+
+ - ansible.builtin.include_tasks: _populate_config.yaml
+
+ - name: Replaces device configuration of ACL with provided configuration
+ register: result
+ cisco.ios.ios_acls: &id002
+ config:
+ - afi: ipv4
+ acls:
+ - name: test_acl
+ acl_type: standard
+ aces:
+ - grant: deny
+ sequence: 10
+ source:
+ address: 198.51.100.0
+ wildcard_bits: 0.0.0.255
+ state: replaced
+
+ - ansible.builtin.assert:
+ that:
+ - result.commands|length == 3
+ - result.changed == true
+ - result.commands|symmetric_difference(replaced_changetype.commands) == []
+
+ - name: Replaces device configuration of ACL with provided configuration (idempotent)
+ register: result
+ cisco.ios.ios_acls: *id002
+ - name: Assert that task was idempotent
+ ansible.builtin.assert:
+ that:
+ - result.commands|length == 0
+ - result['changed'] == false
always:
- ansible.builtin.include_tasks: _remove_config.yaml
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/vars/main.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/vars/main.yaml
index 2d324ebe1..8460ae2f5 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/vars/main.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_acls/vars/main.yaml
@@ -36,6 +36,11 @@ replaced:
- ip access-list extended 150
- 20 deny tcp 198.51.100.0 0.0.0.255 eq telnet 198.51.110.0 0.0.0.255 eq telnet
syn dscp ef ttl eq 10
+replaced_changetype:
+ commands:
+ - no ip access-list extended test_acl
+ - ip access-list standard test_acl
+ - 10 deny 198.51.100.0 0.0.0.255
overridden:
commands:
- no ipv6 access-list R1_TRAFFIC
@@ -391,3 +396,289 @@ rtt:
- no ip access-list extended 150
- ipv6 access-list R1_TRAFFIC
- deny tcp any eq www any eq telnet ack dscp af11 sequence 10
+remarks_check:
+ commands:
+ - ip access-list extended TEST
+ - 10 remark FIRST REMARK BEFORE SEQUENCE 10
+ - 10 remark ============
+ - 10 remark REMARKS FOR SEQUENCE 10 NO FOLLOWING ACE
+ - 20 remark FIRST REMARK BEFORE SEQUENCE 20
+ - 20 remark ============
+ - 20 remark ALLOW HOST FROM SEQUENCE 20
+ - 20 permit ip host 1.1.1.1 any
+ - 30 remark FIRST REMARK BEFORE SEQUENCE 30
+ - 30 remark ============
+ - 30 remark ALLOW HOST FROM SEQUENCE 30
+ - 30 permit ip host 2.2.2.2 any
+ - 40 remark FIRST REMARK BEFORE SEQUENCE 40
+ - 40 remark ============
+ - 40 remark ALLOW NEW HOST FROM SEQUENCE 40
+ - 40 permit ip host 3.3.3.3 any
+ - remark Remark not specific to sequence
+ - remark ============
+ - remark End Remarks
+ before:
+ - acls:
+ - aces:
+ - destination:
+ address: 192.0.3.0
+ wildcard_bits: 0.0.0.255
+ dscp: ef
+ grant: deny
+ protocol: icmp
+ protocol_options:
+ icmp:
+ echo: true
+ sequence: 10
+ source:
+ address: 192.0.2.0
+ wildcard_bits: 0.0.0.255
+ ttl:
+ eq: 10
+ acl_type: extended
+ name: "110"
+ - aces:
+ - destination:
+ address: 198.51.101.0
+ port_protocol:
+ eq: telnet
+ wildcard_bits: 0.0.0.255
+ grant: deny
+ protocol: tcp
+ protocol_options:
+ tcp:
+ ack: true
+ sequence: 10
+ source:
+ address: 198.51.100.0
+ wildcard_bits: 0.0.0.255
+ tos:
+ service_value: 12
+ - destination:
+ address: 192.0.4.0
+ port_protocol:
+ eq: www
+ wildcard_bits: 0.0.0.255
+ dscp: ef
+ grant: deny
+ protocol: tcp
+ protocol_options:
+ tcp:
+ ack: true
+ sequence: 20
+ source:
+ address: 192.0.3.0
+ wildcard_bits: 0.0.0.255
+ ttl:
+ lt: 20
+ acl_type: extended
+ name: "123"
+ - aces:
+ - destination:
+ address: 192.0.3.0
+ port_protocol:
+ eq: www
+ wildcard_bits: 0.0.0.255
+ grant: deny
+ option:
+ traceroute: true
+ protocol: tcp
+ protocol_options:
+ tcp:
+ fin: true
+ sequence: 10
+ source:
+ address: 192.0.2.0
+ wildcard_bits: 0.0.0.255
+ ttl:
+ eq: 10
+ acl_type: extended
+ name: test_acl
+ afi: ipv4
+ - acls:
+ - aces:
+ - destination:
+ any: true
+ port_protocol:
+ eq: telnet
+ dscp: af11
+ grant: deny
+ protocol: tcp
+ protocol_options:
+ tcp:
+ ack: true
+ sequence: 10
+ source:
+ any: true
+ port_protocol:
+ eq: www
+ name: R1_TRAFFIC
+ afi: ipv6
+ after:
+ - acls:
+ - aces:
+ - destination:
+ address: 192.0.3.0
+ wildcard_bits: 0.0.0.255
+ dscp: ef
+ grant: deny
+ protocol: icmp
+ protocol_options:
+ icmp:
+ echo: true
+ sequence: 10
+ source:
+ address: 192.0.2.0
+ wildcard_bits: 0.0.0.255
+ ttl:
+ eq: 10
+ acl_type: extended
+ name: "110"
+ - aces:
+ - destination:
+ address: 198.51.101.0
+ port_protocol:
+ eq: telnet
+ wildcard_bits: 0.0.0.255
+ grant: deny
+ protocol: tcp
+ protocol_options:
+ tcp:
+ ack: true
+ sequence: 10
+ source:
+ address: 198.51.100.0
+ wildcard_bits: 0.0.0.255
+ tos:
+ service_value: 12
+ - destination:
+ address: 192.0.4.0
+ port_protocol:
+ eq: www
+ wildcard_bits: 0.0.0.255
+ dscp: ef
+ grant: deny
+ protocol: tcp
+ protocol_options:
+ tcp:
+ ack: true
+ sequence: 20
+ source:
+ address: 192.0.3.0
+ wildcard_bits: 0.0.0.255
+ ttl:
+ lt: 20
+ acl_type: extended
+ name: "123"
+ - aces:
+ - destination:
+ any: true
+ grant: permit
+ protocol: ip
+ remarks:
+ - FIRST REMARK BEFORE SEQUENCE 20
+ - ============
+ - ALLOW HOST FROM SEQUENCE 20
+ sequence: 20
+ source:
+ host: 1.1.1.1
+ - destination:
+ any: true
+ grant: permit
+ protocol: ip
+ remarks:
+ - FIRST REMARK BEFORE SEQUENCE 30
+ - ============
+ - ALLOW HOST FROM SEQUENCE 30
+ sequence: 30
+ source:
+ host: 2.2.2.2
+ - destination:
+ any: true
+ grant: permit
+ protocol: ip
+ remarks:
+ - FIRST REMARK BEFORE SEQUENCE 40
+ - ============
+ - ALLOW NEW HOST FROM SEQUENCE 40
+ sequence: 40
+ source:
+ host: 3.3.3.3
+ - remarks:
+ - FIRST REMARK BEFORE SEQUENCE 10
+ - ============
+ - REMARKS FOR SEQUENCE 10 NO FOLLOWING ACE
+ sequence: 10
+ - remarks:
+ - Remark not specific to sequence
+ - ============
+ - End Remarks
+ acl_type: extended
+ name: TEST
+ - aces:
+ - destination:
+ address: 192.0.3.0
+ port_protocol:
+ eq: www
+ wildcard_bits: 0.0.0.255
+ grant: deny
+ option:
+ traceroute: true
+ protocol: tcp
+ protocol_options:
+ tcp:
+ fin: true
+ sequence: 10
+ source:
+ address: 192.0.2.0
+ wildcard_bits: 0.0.0.255
+ ttl:
+ eq: 10
+ acl_type: extended
+ name: test_acl
+ afi: ipv4
+ - acls:
+ - aces:
+ - destination:
+ any: true
+ port_protocol:
+ eq: telnet
+ dscp: af11
+ grant: deny
+ protocol: tcp
+ protocol_options:
+ tcp:
+ ack: true
+ sequence: 10
+ source:
+ any: true
+ port_protocol:
+ eq: www
+ name: R1_TRAFFIC
+ afi: ipv6
+remarks_check_override:
+ commands:
+ - no ipv6 access-list R1_TRAFFIC
+ - ip access-list extended TEST
+ - no 10
+ - no 20 permit ip host 1.1.1.1 any
+ - no 30 remark
+ - no remark
+ - 10 remark FIRST REMARK BEFORE SEQUENCE 10
+ - 10 remark ============
+ - 10 remark REMARKS FOR SEQUENCE 10 NO FOLLOWING ACE
+ - 10 permit ip host 1.1.1.1 any
+ - 20 remark FIRST REMARK BEFORE SEQUENCE 20
+ - 20 remark ============
+ - 20 remark ALLOW HOST FROM SEQUENCE 20
+ - 20 permit ip host 192.168.0.1 any
+ - 30 remark FIRST REMARK BEFORE SEQUENCE 30
+ - 30 remark ============
+ - 30 remark ALLOW HOST FROM SEQUENCE 30 updated
+ - remark Remark not specific to sequence
+ - remark ============
+ - remark End Remarks updated
+ - remark 04j
+ - no ip access-list extended 110
+ - no ip access-list extended 123
+ - no ip access-list extended test_acl
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/defaults/main.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/defaults/main.yaml
deleted file mode 100644
index 5f709c5aa..000000000
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/defaults/main.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-testcase: "*"
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/meta/main.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/meta/main.yaml
deleted file mode 100644
index ab3ad91bc..000000000
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/meta/main.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
- - prepare_ios_tests
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/tasks/cli.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/tasks/cli.yaml
deleted file mode 100644
index 2b6056023..000000000
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/tasks/cli.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
----
-- name: Collect all CLI test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/cli"
- patterns: "{{ testcase }}.yaml"
- register: test_cases
- delegate_to: localhost
-
-- name: Set test_items
- ansible.builtin.set_fact:
- test_items: "{{ test_cases.files | map(attribute='path') | list }}"
-
-- name: Run test cases (connection=ansible.netcommon.network_cli)
- ansible.builtin.include_tasks: "{{ test_case_to_run }}"
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/tasks/main.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/tasks/main.yaml
deleted file mode 100644
index 2269ecb54..000000000
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/tasks/main.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
----
-- name: Main task for bgp module
- ansible.builtin.include_tasks: cli.yaml
- tags:
- - network_cli
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/tests/cli/basic.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/tests/cli/basic.yaml
deleted file mode 100644
index 752f9ff4f..000000000
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp/tests/cli/basic.yaml
+++ /dev/null
@@ -1,490 +0,0 @@
----
-- ansible.builtin.debug: msg="START ios cli/ios_bgp.yaml on connection={{ ansible_connection }}"
-
-- name: Clear existing BGP configuration
- ignore_errors: true
- cisco.ios.ios_bgp:
- operation: delete
-
-- block:
- - name: Add fake configuration with 'bgp' string
- cisco.ios.ios_config:
- match: none
- replace: block
- lines:
- - no ip access-list extended BGP_ACL
- - ip access-list extended BGP_ACL
- - permit tcp any any eq bgp
-
- - name: Try delete fake BGP configuration
- register: result
- cisco.ios.ios_bgp:
- operation: delete
-
- - ansible.builtin.assert:
- that:
- - result.changed == false
-
- - name: Clean fake configuration with 'bgp' string
- cisco.ios.ios_config:
- match: none
- replace: block
- lines:
- - no ip access-list extended BGP_ACL
-
- - name: Add fake bgp-like configuration
- cisco.ios.ios_config:
- match: none
- replace: block
- lines:
- - no ip access-list extended BGP_ACL_2
- - ip access-list extended BGP_ACL_2
- - remark router bgp 64496
- - remark neighbor 192.0.2.10 remote-as 64496
- - remark neighbor 192.0.2.10 shutdown
- - remark address-family ipv4
- - remark neighbor 192.0.2.10 activate
- - remark exit-address-family
- - permit tcp any any eq bgp
-
- - name: Try delete fake bgp-like configuration
- register: result
- cisco.ios.ios_bgp:
- operation: delete
-
- - ansible.builtin.assert:
- that:
- - result.changed == false
-
- - name: Clean fake bgp-like configuration
- cisco.ios.ios_config:
- match: none
- replace: block
- lines:
- - no ip access-list extended BGP_ACL_2
-
- - name: Configure BGP with as 64496 and a router-id
- register: result
- cisco.ios.ios_bgp: &id001
- operation: merge
- config:
- bgp_as: 64496
- router_id: 192.0.2.2
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - "'router bgp 64496' in result.commands"
- - "'bgp router-id 192.0.2.2' in result.commands"
-
- - name: Configure BGP with as 64496 and a router-id (idempotent)
- register: result
- cisco.ios.ios_bgp: *id001
- - ansible.builtin.assert:
- that:
- - result.changed == false
-
- - name: Configure BGP neighbors
- register: result
- cisco.ios.ios_bgp: &id002
- operation: merge
- config:
- bgp_as: 64496
- neighbors:
- - neighbor: 192.0.2.10
- remote_as: 64496
- password: ansible
- description: IBGP_NBR_1
- ebgp_multihop: 100
- timers:
- keepalive: 300
- holdtime: 360
- min_neighbor_holdtime: 360
-
- - neighbor: 192.0.2.15
- remote_as: 64496
- description: IBGP_NBR_2
- ebgp_multihop: 150
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - "'router bgp 64496' in result.commands"
- - "'neighbor 192.0.2.10 remote-as 64496' in result.commands"
- - "'neighbor 192.0.2.10 description IBGP_NBR_1' in result.commands"
- - "'neighbor 192.0.2.10 ebgp-multihop 100' in result.commands"
- - "'neighbor 192.0.2.10 timers 300 360 360' in result.commands"
- - "'neighbor 192.0.2.15 remote-as 64496' in result.commands"
- - "'neighbor 192.0.2.15 description IBGP_NBR_2' in result.commands"
- - "'neighbor 192.0.2.15 ebgp-multihop 150' in result.commands"
-
- - name: Configure BGP neighbors (idempotent)
- register: result
- cisco.ios.ios_bgp: *id002
- - ansible.builtin.assert:
- that:
- - result.changed == false
-
- - name: Configure BGP neighbors with operation replace
- register: result
- cisco.ios.ios_bgp: &id003
- operation: replace
- config:
- bgp_as: 64496
- neighbors:
- - neighbor: 192.0.2.15
- remote_as: 64496
- description: IBGP_NBR_2
- ebgp_multihop: 150
-
- - neighbor: 203.0.113.10
- remote_as: 64511
- description: EBGP_NBR_1
- local_as: 64497
-
- - neighbor: 10.10.20.20
- remote_as: 65012
- description: BGP_NBR_2
- ebgp_multihop: 100
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - "'neighbor 203.0.113.10 remote-as 64511' in result.commands"
- - "'neighbor 203.0.113.10 description EBGP_NBR_1' in result.commands"
- - "'neighbor 203.0.113.10 local-as 64497' in result.commands"
- - "'neighbor 10.10.20.20 remote-as 65012' in result.commands"
- - "'neighbor 10.10.20.20 description BGP_NBR_2' in result.commands"
- - "'no neighbor 192.0.2.10' in result.commands"
-
- - name: Configure BGP neighbors with operation replace (idempotent)
- register: result
- cisco.ios.ios_bgp: *id003
- - ansible.builtin.assert:
- that:
- - result.changed == false
-
- - name: Configure root-level networks for BGP
- register: result
- cisco.ios.ios_bgp: &id004
- operation: merge
- config:
- bgp_as: 64496
- networks:
- - prefix: 203.0.113.0
- masklen: 27
- route_map: RMAP_1
-
- - prefix: 203.0.113.32
- masklen: 27
- route_map: RMAP_2
-
- - ansible.builtin.assert:
- that:
- - result.changed == True
- - "'router bgp 64496' in result.commands"
- - "'network 203.0.113.0 mask 255.255.255.224 route-map RMAP_1' in result.commands"
- - "'network 203.0.113.32 mask 255.255.255.224 route-map RMAP_2' in result.commands"
-
- - name: Configure root-level networks for BGP (idempotent)
- register: result
- cisco.ios.ios_bgp: *id004
- - ansible.builtin.assert:
- that:
- - result.changed == false
-
- - name: Configure root-level networks for BGP with operation replace
- register: result
- cisco.ios.ios_bgp: &id005
- operation: replace
- config:
- bgp_as: 64496
- networks:
- - prefix: 203.0.113.0
- masklen: 27
- route_map: RMAP_1
-
- - prefix: 198.51.100.16
- masklen: 28
-
- - ansible.builtin.assert:
- that:
- - result.changed == True
- - "'router bgp 64496' in result.commands"
- - "'network 198.51.100.16 mask 255.255.255.240' in result.commands"
- - "'no network 203.0.113.32 mask 255.255.255.224 route-map RMAP_2' in result.commands"
-
- - name: Configure root-level networks for BGP with operation replace (idempotent)
- register: result
- cisco.ios.ios_bgp: *id005
- - ansible.builtin.assert:
- that:
- - result.changed == false
-
- - name: Configure BGP neighbors under address family mode
- register: result
- cisco.ios.ios_bgp: &id006
- operation: merge
- config:
- bgp_as: 64496
- address_family:
- - afi: ipv4
- safi: unicast
- neighbors:
- - neighbor: 203.0.113.10
- activate: true
- maximum_prefix: 250
- advertisement_interval: 120
-
- - neighbor: 192.0.2.15
- activate: true
- route_reflector_client: true
-
- - neighbor: 10.10.20.20
- activate: true
- prefix_list_in: incoming-prefixes
- prefix_list_out: outgoing-prefixes
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - "'router bgp 64496' in result.commands"
- - "'address-family ipv4' in result.commands"
- - "'neighbor 203.0.113.10 activate' in result.commands"
- - "'neighbor 203.0.113.10 maximum-prefix 250' in result.commands"
- - "'neighbor 203.0.113.10 advertisement-interval 120' in result.commands"
- - "'neighbor 192.0.2.15 activate' in result.commands"
- - "'neighbor 192.0.2.15 route-reflector-client' in result.commands"
- - "'neighbor 10.10.20.20 activate' in result.commands"
- - "'neighbor 10.10.20.20 prefix-list incoming-prefixes in' in result.commands"
- - "'neighbor 10.10.20.20 prefix-list outgoing-prefixes out' in result.commands"
-
- - name: Configure BGP neighbors under address family mode (idempotent)
- register: result
- cisco.ios.ios_bgp: *id006
- - ansible.builtin.assert:
- that:
- - result.changed == false
-
- - name: Configure networks under address family
- register: result
- cisco.ios.ios_bgp: &id007
- operation: merge
- config:
- bgp_as: 64496
- address_family:
- - afi: ipv4
- safi: multicast
- networks:
- - prefix: 198.51.100.48
- masklen: 28
- route_map: RMAP_1
-
- - prefix: 192.0.2.64
- masklen: 27
-
- - prefix: 203.0.113.160
- masklen: 27
- route_map: RMAP_2
-
- - afi: ipv4
- safi: unicast
- networks:
- - prefix: 198.51.100.64
- masklen: 28
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - "'router bgp 64496' in result.commands"
- - "'address-family ipv4 multicast' in result.commands"
- - "'network 198.51.100.48 mask 255.255.255.240 route-map RMAP_1' in result.commands"
- - "'network 192.0.2.64 mask 255.255.255.224' in result.commands"
- - "'network 203.0.113.160 mask 255.255.255.224 route-map RMAP_2' in result.commands"
- - "'exit-address-family' in result.commands"
- - "'address-family ipv4' in result.commands"
- - "'network 198.51.100.64 mask 255.255.255.240' in result.commands"
- - "'exit-address-family' in result.commands"
-
- - name: Configure networks under address family (idempotent)
- register: result
- cisco.ios.ios_bgp: *id007
- - ansible.builtin.assert:
- that:
- - result.changed == false
-
- - name: Configure networks under address family with operation replace
- register: result
- cisco.ios.ios_bgp: &id008
- operation: replace
- config:
- bgp_as: 64496
- address_family:
- - afi: ipv4
- safi: multicast
- networks:
- - prefix: 198.51.100.80
- masklen: 28
-
- - prefix: 192.0.2.64
- masklen: 27
-
- - prefix: 203.0.113.192
- masklen: 27
-
- - afi: ipv4
- safi: unicast
- networks:
- - prefix: 198.51.100.64
- masklen: 28
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - '"router bgp 64496" in result.commands'
- - '"address-family ipv4 multicast" in result.commands'
- - '"network 198.51.100.80 mask 255.255.255.240" in result.commands'
- - '"network 203.0.113.192 mask 255.255.255.224" in result.commands'
- - '"no network 198.51.100.48 mask 255.255.255.240 route-map RMAP_1" in result.commands'
- - '"no network 203.0.113.160 mask 255.255.255.224 route-map RMAP_2" in result.commands'
- - '"exit-address-family" in result.commands'
-
- - name: Configure networks under address family with operation replace (idempotent)
- register: result
- cisco.ios.ios_bgp: *id008
- - ansible.builtin.assert:
- that:
- - result.changed == false
-
- - name: Configure redistribute information under address family mode
- register: result
- cisco.ios.ios_bgp: &id009
- operation: merge
- config:
- bgp_as: 64496
- address_family:
- - afi: ipv4
- safi: multicast
- redistribute:
- - protocol: ospf
- id: 112
- metric: 64
-
- - protocol: eigrp
- id: 233
- metric: 256
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - "'router bgp 64496' in result.commands"
- - "'address-family ipv4 multicast' in result.commands"
- - "'redistribute ospf 112 metric 64' in result.commands"
- - "'redistribute eigrp 233 metric 256' in result.commands"
- - "'exit-address-family' in result.commands"
-
- - name: Configure redistribute information under address family mode (idempotent)
- register: result
- cisco.ios.ios_bgp: *id009
- - ansible.builtin.assert:
- that:
- - result.changed == false
-
- - name: Get the IOS version
- cisco.ios.ios_facts:
- gather_subset: all
-
- - name: Configure redistribute information under address family mode with operation replace
- register: result
- cisco.ios.ios_bgp: &id010
- operation: replace
- config:
- bgp_as: 64496
- address_family:
- - afi: ipv4
- safi: multicast
- redistribute:
- - protocol: ospf
- id: 112
- metric: 64
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - "'router bgp 64496' in result.commands"
- - "'address-family ipv4 multicast' in result.commands"
- - "'no redistribute eigrp 233' in result.commands"
- - "'exit-address-family' in result.commands"
-
- - name: Configure redistribute information under address family mode with operation replace (idempotent)
- register: result
- when: ansible_net_version != "15.6(2)T"
- cisco.ios.ios_bgp: *id010
- - ansible.builtin.assert:
- that:
- - result.changed == false
- when: ansible_net_version != "15.6(2)T"
-
- - name: Override all the existing BGP configuration
- register: result
- cisco.ios.ios_bgp:
- operation: override
- config:
- bgp_as: 64497
- router_id: 192.0.2.10
- log_neighbor_changes: true
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - "'no router bgp 64496' in result.commands"
- - "'router bgp 64497' in result.commands"
- - "'bgp router-id 192.0.2.10' in result.commands"
- - "'bgp log-neighbor-changes' in result.commands"
-
- - name: Configure BGP neighbors with classful boundary
- register: result
- cisco.ios.ios_bgp: &id011
- config:
- bgp_as: 64497
- log_neighbor_changes: true
- networks:
- - prefix: 198.51.100.0
- masklen: 23
-
- - prefix: 201.0.113.32
- masklen: 24
- operation: merge
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - "'router bgp 64497' in result.commands"
- - "'network 198.51.100.0 mask 255.255.254.0' in result.commands"
- - "'network 201.0.113.32' in result.commands"
-
- - name: Configure BGP neighbors with classful boundary (idempotent)
- register: result
- cisco.ios.ios_bgp: *id011
- - ansible.builtin.assert:
- that:
- - result.changed == false
- always:
- - name: Teardown
- register: result
- cisco.ios.ios_bgp: &id012
- operation: delete
-
- - ansible.builtin.assert:
- that:
- - result.changed == true
- - "'no router bgp 64497' in result.commands"
-
- - name: Teardown again (idempotent)
- register: result
- cisco.ios.ios_bgp: *id012
- - ansible.builtin.assert:
- that:
- - result.changed == false
-
-- ansible.builtin.debug: msg="END ios cli/ios_bgp.yaml on connection={{ ansible_connection }}"
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp_global/tests/cli/deleted.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp_global/tests/cli/deleted.yaml
index bd992e88a..c7647d008 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp_global/tests/cli/deleted.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp_global/tests/cli/deleted.yaml
@@ -26,6 +26,7 @@
- name: Delete provided BGP global (idempotent)
register: result
cisco.ios.ios_bgp_global: *id001
+
- name: Assert that the previous task was idempotent
ansible.builtin.assert:
that:
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp_global/tests/cli/merged.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp_global/tests/cli/merged.yaml
index 1404b4e91..6c126ccfd 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp_global/tests/cli/merged.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp_global/tests/cli/merged.yaml
@@ -11,14 +11,12 @@
config:
as_number: 65000
bgp:
- advertise_best_external: true
bestpath:
- compare_routerid: true
- dampening:
- penalty_half_time: 1
- reuse_route_val: 1
- suppress_route_val: 1
- max_suppress: 1
+ default:
+ ipv4_unicast: false
+ route_target:
+ filter: false
graceful_shutdown:
neighbors:
time: 50
@@ -33,20 +31,6 @@
remote_as: 100
shutdown:
set: false
- aigp:
- send:
- cost_community:
- id: 100
- poi:
- igp_cost: true
- transitive: true
- route_map:
- name: test-route
- out: true
- redistribute:
- - connected:
- metric: 10
- set: true
timers:
keepalive: 100
holdtime: 200
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp_global/vars/main.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp_global/vars/main.yaml
index 07638f98e..93fadcf29 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp_global/vars/main.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_bgp_global/vars/main.yaml
@@ -5,29 +5,24 @@ merged:
commands:
- router bgp 65000
- timers bgp 100 200 150
- - bgp advertise-best-external
- bgp bestpath compare-routerid
- - bgp dampening 1 1 1 1
+ - no bgp default ipv4-unicast
+ - no bgp default route-target filter
- bgp graceful-shutdown all neighbors 50 local-preference 100 community 100
- bgp log-neighbor-changes
- bgp nopeerup-delay post-boot 10
- neighbor 198.0.2.1 remote-as 100
- neighbor 198.0.2.1 description merge neighbor
- - neighbor 198.0.2.1 aigp send cost-community 100 poi igp-cost transitive
- - neighbor 198.0.2.1 route-map test-route out
- - redistribute connected metric 10
after:
as_number: "65000"
bgp:
- advertise_best_external: true
bestpath_options:
compare_routerid: true
- dampening:
- max_suppress: 1
- penalty_half_time: 1
- reuse_route_val: 1
- suppress_route_val: 1
+ default:
+ ipv4_unicast: false
+ route_target:
+ filter: false
graceful_shutdown:
community: "100"
local_preference: 100
@@ -37,23 +32,9 @@ merged:
nopeerup_delay_options:
post_boot: 10
neighbors:
- - aigp:
- send:
- cost_community:
- id: 100
- poi:
- igp_cost: true
- transitive: true
- description: merge neighbor
+ - description: merge neighbor
neighbor_address: 198.0.2.1
remote_as: "100"
- route_maps:
- - name: test-route
- out: true
- redistribute:
- - connected:
- metric: 10
- set: true
timers:
holdtime: 200
keepalive: 100
@@ -63,6 +44,10 @@ gathered:
after:
as_number: "65000"
bgp:
+ default:
+ ipv4_unicast: true
+ route_target:
+ filter: true
advertise_best_external: true
bestpath_options:
compare_routerid: true
@@ -119,6 +104,10 @@ replaced:
after:
as_number: "65000"
bgp:
+ default:
+ ipv4_unicast: true
+ route_target:
+ filter: true
advertise_best_external: true
bestpath_options:
med:
@@ -143,6 +132,10 @@ parsed:
after:
as_number: "65000"
bgp:
+ default:
+ ipv4_unicast: true
+ route_target:
+ filter: true
advertise_best_external: true
bestpath_options:
compare_routerid: true
@@ -213,6 +206,11 @@ deleted:
after:
as_number: "65000"
+ bgp:
+ default:
+ ipv4_unicast: true
+ route_target:
+ filter: true
rtt:
commands:
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_facts/tests/cli/all_facts.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_facts/tests/cli/all_facts.yaml
index ba8a1fd23..44d57ed9b 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_facts/tests/cli/all_facts.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_facts/tests/cli/all_facts.yaml
@@ -20,8 +20,10 @@
- result.ansible_facts.ansible_net_memtotal_mb > 1
- ansible.builtin.assert:
- that: "{{ item.value.spacetotal_kb }} > {{ item.value.spacefree_kb }}"
+ that: "{{ my_var.value.spacetotal_kb }} > {{ my_var.value.spacefree_kb }}"
loop: "{{ lookup('dict', result.ansible_facts.ansible_net_filesystems_info, wantlist=True) }}"
+ loop_control:
+ loop_var: my_var
- ansible.builtin.set_fact:
supported_network_resources:
@@ -34,6 +36,9 @@
- lldp_global
- lldp_interfaces
- l3_interfaces
+ - evpn_global
+ - evpn_evi
+ - vxlan_vtep
- logging_global
- acl_interfaces
- static_routes
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml
index c73dd0b11..3db4a1fb6 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml
@@ -14,7 +14,7 @@
enabled: true
- name: GigabitEthernet3
- description: Configured and Merged by Ansible-Network
+ description: 04j
enabled: false
state: merged
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_interfaces/vars/main.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_interfaces/vars/main.yaml
index 84b8afb22..bf89b4b37 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_interfaces/vars/main.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_interfaces/vars/main.yaml
@@ -20,7 +20,7 @@ merged:
- interface GigabitEthernet2
- description Configured and Merged by Ansible-Network
- interface GigabitEthernet3
- - description Configured and Merged by Ansible-Network
+ - description 04j
- shutdown
after:
- enabled: true
@@ -30,7 +30,7 @@ merged:
enabled: true
name: GigabitEthernet2
speed: "1000"
- - description: Configured and Merged by Ansible-Network
+ - description: 04j
enabled: false
name: GigabitEthernet3
speed: "1000"
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_l3_interfaces/tests/cli/merged.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_l3_interfaces/tests/cli/merged.yaml
index 06228ea7f..75217f5e5 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_l3_interfaces/tests/cli/merged.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_l3_interfaces/tests/cli/merged.yaml
@@ -23,6 +23,21 @@
- address: 198.51.100.2/24
ipv6:
- address: 2001:db8:0:3::/64
+ - name: Vlan101
+ ipv4:
+ - address: 198.51.100.2/24
+ mac_address: dead:beef:abcd
+ - name: Vlan901
+ autostate: false
+ ipv4:
+ - source_interface:
+ name: Loopback1
+ ipv6:
+ - enable: true
+ - name: Vlan902
+ autostate: true
+ ipv6:
+ - enable: true
state: merged
- name: L3_interface merged - assert that correct set of commands were generated
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_l3_interfaces/vars/main.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_l3_interfaces/vars/main.yaml
index 44ca9b85e..73996896e 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_l3_interfaces/vars/main.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_l3_interfaces/vars/main.yaml
@@ -19,6 +19,12 @@ merged:
- ip address 198.51.100.1 255.255.255.0 secondary
- ip address 198.51.100.2 255.255.255.0
- ipv6 address 2001:db8:0:3::/64
+ - interface Vlan901
+ - no autostate
+ - ip unnumbered Loopback1
+ - ipv6 enable
+ - interface Vlan902
+ - ipv6 enable
after:
- name: Loopback888
- ipv4:
@@ -40,6 +46,21 @@ merged:
- address: 2001:DB8:0:3::/64
name: GigabitEthernet3
- name: GigabitEthernet4
+ - name: Vlan101
+ ipv4:
+ - address: 198.51.100.2/24
+ mac_address: dead:beef:abcd
+ - name: Vlan901
+ ipv4:
+ - source_interface:
+ name: Loopback1
+ ipv6:
+ - enable: true
+ autostate: false
+ - name: Vlan902
+ ipv6:
+ - enable: true
+ autostate: true
replaced:
before:
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/defaults/main.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/defaults/main.yaml
deleted file mode 100644
index 5f709c5aa..000000000
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/defaults/main.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-testcase: "*"
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/meta/main.yml b/ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/meta/main.yml
deleted file mode 100644
index ab3ad91bc..000000000
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/meta/main.yml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-dependencies:
- - prepare_ios_tests
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/tasks/cli.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/tasks/cli.yaml
deleted file mode 100644
index cd8c04990..000000000
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/tasks/cli.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
----
-- name: Collect all CLI test cases
- ansible.builtin.find:
- paths: "{{ role_path }}/tests/cli"
- patterns: "{{ testcase }}.yaml"
- register: test_cases
- delegate_to: localhost
-
-- name: Set test_items
- ansible.builtin.set_fact:
- test_items: "{{ test_cases.files | map(attribute='path') | list }}"
-
-- name: Run test cases (connection=ansible.netcommon.network_cli)
- ansible.builtin.include_tasks: "{{ test_case_to_run }}"
- with_items: "{{ test_items }}"
- loop_control:
- loop_var: test_case_to_run
- tags: network_cli
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/tasks/main.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/tasks/main.yaml
deleted file mode 100644
index 3d2666f3e..000000000
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/tasks/main.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-- name: Main task for ntp module
- ansible.builtin.include_tasks: cli.yaml
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/tests/cli/ntp_configuration.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/tests/cli/ntp_configuration.yaml
deleted file mode 100644
index 92063dfb5..000000000
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_ntp/tests/cli/ntp_configuration.yaml
+++ /dev/null
@@ -1,87 +0,0 @@
----
-- ansible.builtin.debug: msg="START connection={{ ansible_connection }} ios_ntp sanity test"
-
-- name: Remove ntp (if set)
- ignore_errors: true
- cisco.ios.ios_ntp: &id007
- server: 10.75.32.5
- source_int: "{{ test_interface }}"
- acl: NTP_ACL
- logging: true
- key_id: 10
- auth_key: 15435A030726242723273C21181319000A
- auth: true
- state: absent
-
-- block:
- - name: Configure ntp
- register: result
- cisco.ios.ios_ntp: &id001
- server: 10.75.32.5
- source_int: "{{ test_interface }}"
- state: present
-
- - ansible.builtin.assert: &id002
- that:
- - result.changed == true
-
- - name: Idempotent check
- register: result
- cisco.ios.ios_ntp: *id001
- - ansible.builtin.assert: &id004
- that:
- - result.changed == false
-
- - name: Load ACL ntp_acl into device
- register: result
- cisco.ios.ios_config:
- lines:
- - 10 permit ip host 192.0.2.1 any log
- parents: ip access-list extended NTP_ACL
-
- - ansible.builtin.assert: *id002
- - name: Configure ntp
- register: result
- cisco.ios.ios_ntp: &id003
- acl: NTP_ACL
- logging: true
- state: present
-
- - ansible.builtin.assert: *id002
- - name: Idempotent check
- register: result
- cisco.ios.ios_ntp: *id003
- - ansible.builtin.assert: *id004
- - name: Configure ntp with different values
- register: result
- cisco.ios.ios_ntp: &id005
- key_id: 10
- auth_key: 15435A030726242723273C21181319000A
- auth: true
- vrf: my_mgmt_vrf
- state: present
-
- - ansible.builtin.assert: *id002
- - name: Idempotent check
- register: result
- cisco.ios.ios_ntp: *id005
- - ansible.builtin.assert: *id004
- - name: Remove part of configuration
- register: result
- cisco.ios.ios_ntp: &id006
- acl: NTP_ACL
- logging: true
- state: absent
-
- - ansible.builtin.assert: *id002
- - name: Idempotent check
- register: result
- cisco.ios.ios_ntp: *id006
- - ansible.builtin.assert: *id004
- always:
- - name: Remove ntp configuration
- cisco.ios.ios_ntp: *id007
- - name: Remove ntp_acl from device
- cisco.ios.ios_config:
- lines:
- - no ip access-list extended NTP_ACL
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_user/tests/cli/basic.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_user/tests/cli/basic.yaml
index 7d5606c1e..6c795ee2d 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_user/tests/cli/basic.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_user/tests/cli/basic.yaml
@@ -4,15 +4,10 @@
cisco.ios.ios_user:
aggregate:
- name: ansibletest1
-
- name: ansibletest2
-
- name: ansibletest3
-
- name: ansibletest4
-
- name: ansibletest5
-
- name: ansibletest6
state: absent
@@ -36,7 +31,6 @@
cisco.ios.ios_user:
aggregate:
- name: ansibletest2
-
- name: ansibletest3
state: present
view: network-admin
@@ -66,7 +60,6 @@
cisco.ios.ios_user:
aggregate:
- name: ansibletest2
-
- name: ansibletest3
state: present
view: network-admin
@@ -111,7 +104,7 @@
name: ansibleuser6
hashed_password:
type: 5
- value: $3$8JcDilcYgFZi.yz4ApaqkHG2.8/
+ value: $1$SpMm$eALjeyED.WSZs0naLNv22/
state: present
- ansible.builtin.assert:
@@ -125,16 +118,13 @@
cisco.ios.ios_user:
aggregate:
- name: ansibletest1
-
- name: ansibletest2
-
- name: ansibletest3
-
- - name: ansibletest4
-
- - name: ansibletest5
-
- - name: ansibletest6
+ - name: ansibleuser4
+ - name: ansibleuser5
+ - name: ansibleuser6
+ - name: ansibleuser7
+ - name: ssh_user
state: absent
- ansible.builtin.assert:
@@ -143,3 +133,54 @@
- '"no username ansibletest1" in result.commands[0]["command"]'
- '"no username ansibletest2" in result.commands[1]["command"]'
- '"no username ansibletest3" in result.commands[2]["command"]'
+
+- name: Add user to check purge
+ become: true
+ register: result
+ cisco.ios.ios_user:
+ name: ansibletest1
+ privilege: 15
+ role: network-operator
+ state: present
+
+- name: Create user with hashed_password 9
+ become: true
+ register: result
+ cisco.ios.ios_user:
+ name: ansibleuser6
+ hashed_password:
+ type: 9
+ value: $9$B/6NVV7joWJ9w.$XueHQxIOZk0GhNC3lxUFioUeowJrtLmXxouXfTuoNpc
+ state: present
+
+- ansible.builtin.assert:
+ that:
+ - result.changed == true
+ - "'username ansibleuser6 secret' in result.commands[0]"
+
+- name: Ensure SSH key is not world readable
+ ansible.builtin.file:
+ path: "{{ role_path }}/files/test_rsa"
+ mode: 384
+
+- name: Create user with sshkey to check purge
+ cisco.ios.ios_user:
+ name: ssh_user
+ privilege: 15
+ state: present
+ sshkey: "{{ lookup('file', 'files/test_rsa.pub') }}"
+
+- name: Reset connection with {{ ansible_user }}
+ ansible.builtin.meta: reset_connection
+
+- name: check if purge removes ssh_user
+ become: true
+ register: result_purge
+ cisco.ios.ios_user:
+ aggregate:
+ - name: cisco
+ purge: true
+
+- ansible.builtin.assert:
+ that:
+ - result.changed == true
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/_populate_config_vlan_config.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/_populate_config_vlan_config.yaml
index d1c517a03..9f740fd90 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/_populate_config_vlan_config.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/_populate_config_vlan_config.yaml
@@ -13,5 +13,4 @@
- vlan_id: 901
member:
vni: 50901
- configuration: true
state: merged
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/_remove_config_vlan_config.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/_remove_config_vlan_config.yaml
index f78bb0c56..591d6c6e9 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/_remove_config_vlan_config.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/_remove_config_vlan_config.yaml
@@ -8,5 +8,4 @@
- vlan_id: 202
- vlan_id: 901
- vlan_id: 902
- configuration: true
state: deleted
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/deleted_vlan_config.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/deleted_vlan_config.yaml
index 21249d763..ae7215669 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/deleted_vlan_config.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/deleted_vlan_config.yaml
@@ -10,7 +10,6 @@
- name: Delete vlans attributes for all configured vlans
register: result
cisco.ios.ios_vlans: &id001
- configuration: true
state: deleted
- name: Assert that correct set of commands were generated
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/gathered_vlan_config.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/gathered_vlan_config.yaml
index 576adee2f..6e0fc136e 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/gathered_vlan_config.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/gathered_vlan_config.yaml
@@ -11,7 +11,6 @@
register: result
cisco.ios.ios_vlans:
config:
- configuration: true
state: gathered
- name: Assert
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/merged_vlan_config.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/merged_vlan_config.yaml
index 6efce0fc0..5af123bcd 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/merged_vlan_config.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/merged_vlan_config.yaml
@@ -17,7 +17,6 @@
- vlan_id: 902
member:
vni: 50902
- configuration: true
state: merged
- name: Assert that correct set of commands were generated
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/overridden_vlan_config.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/overridden_vlan_config.yaml
index 52944e5ce..a739c6117 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/overridden_vlan_config.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/overridden_vlan_config.yaml
@@ -19,7 +19,6 @@
member:
vni: 10101
evi: 101
- configuration: true
state: overridden
- name: Assert that correct set of commands were generated
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/parsed_vlan_config.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/parsed_vlan_config.yaml
index 7d8311711..3234569ce 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/parsed_vlan_config.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/parsed_vlan_config.yaml
@@ -8,7 +8,6 @@
register: result
cisco.ios.ios_vlans:
running_config: "{{ lookup('file', '_parsed_vlan_config.cfg') }}"
- configuration: true
state: parsed
- ansible.builtin.assert:
diff --git a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/rendered_vlan_config.yaml b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/rendered_vlan_config.yaml
index 63cc24a29..1b3a0f093 100644
--- a/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/rendered_vlan_config.yaml
+++ b/ansible_collections/cisco/ios/tests/integration/targets/ios_vlans/tests/cli/rendered_vlan_config.yaml
@@ -19,7 +19,6 @@
- vlan_id: 901
member:
vni: 50901
- configuration: true
state: rendered
- ansible.builtin.assert: