summaryrefslogtreecommitdiff
path: root/test/integration/targets/eos_acls/tests
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/eos_acls/tests')
-rw-r--r--test/integration/targets/eos_acls/tests/common/_parsed.cfg4
-rw-r--r--test/integration/targets/eos_acls/tests/common/_parsed_cfg.yaml11
-rw-r--r--test/integration/targets/eos_acls/tests/common/_populate.yaml49
-rw-r--r--test/integration/targets/eos_acls/tests/common/_remove_config.yaml8
-rw-r--r--test/integration/targets/eos_acls/tests/common/deleted.yaml168
-rw-r--r--test/integration/targets/eos_acls/tests/common/gathered.yaml37
-rw-r--r--test/integration/targets/eos_acls/tests/common/merged.yaml152
-rw-r--r--test/integration/targets/eos_acls/tests/common/overridden.yaml71
-rw-r--r--test/integration/targets/eos_acls/tests/common/parsed.yaml29
-rw-r--r--test/integration/targets/eos_acls/tests/common/rendered.yaml80
-rw-r--r--test/integration/targets/eos_acls/tests/common/replaced.yaml94
-rw-r--r--test/integration/targets/eos_acls/tests/common/rtt.yaml101
12 files changed, 0 insertions, 804 deletions
diff --git a/test/integration/targets/eos_acls/tests/common/_parsed.cfg b/test/integration/targets/eos_acls/tests/common/_parsed.cfg
deleted file mode 100644
index 11758ce538..0000000000
--- a/test/integration/targets/eos_acls/tests/common/_parsed.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-ip access-list test1
-35 deny tcp 20.0.0.0/8 any log
-45 remark Run by ansible
-55 permit tcp any any
diff --git a/test/integration/targets/eos_acls/tests/common/_parsed_cfg.yaml b/test/integration/targets/eos_acls/tests/common/_parsed_cfg.yaml
deleted file mode 100644
index 5a655ce534..0000000000
--- a/test/integration/targets/eos_acls/tests/common/_parsed_cfg.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
----
-- name: Setup
- cli_config:
- config: "{{ lines }}"
- become: yes
- vars:
- lines: |
- ip access-list test1
- 35 deny tcp 20.0.0.0/8 any log
- 45 remark Run by ansible
- 55 permit tcp any any
diff --git a/test/integration/targets/eos_acls/tests/common/_populate.yaml b/test/integration/targets/eos_acls/tests/common/_populate.yaml
deleted file mode 100644
index 07ed5b9673..0000000000
--- a/test/integration/targets/eos_acls/tests/common/_populate.yaml
+++ /dev/null
@@ -1,49 +0,0 @@
----
-- name: Setup
- eos_acls: &merged
- config:
- - afi: "ipv4"
- acls:
- - name: test1
- aces:
- - sequence: 35
- grant: "deny"
- protocol: "tcp"
- source:
- subnet_address: 20.0.0.0/8
- destination:
- any: true
- log: true
- - remark: "Run by ansible"
- - grant: "permit"
- protocol: "6"
- source:
- any: true
- destination:
- any: true
- - name: test4
- aces:
- - grant: "permit"
- source:
- any: true
- port_protocol:
- eq: "25"
- destination:
- any: true
- port_protocol:
- eq: "www"
- protocol: "tcp"
- ttl:
- eq: "55"
- - afi: "ipv6"
- acls:
- - name: test2
- standard: true
- aces:
- - grant: "permit"
- log: "true"
- source:
- any: true
- state: merged
- become: yes
- register: result
diff --git a/test/integration/targets/eos_acls/tests/common/_remove_config.yaml b/test/integration/targets/eos_acls/tests/common/_remove_config.yaml
deleted file mode 100644
index a8a351d80b..0000000000
--- a/test/integration/targets/eos_acls/tests/common/_remove_config.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-- name: Setup
- eos_acls:
- config:
- - afi: "ipv4"
- - afi: "ipv6"
- state: deleted
- become: yes
diff --git a/test/integration/targets/eos_acls/tests/common/deleted.yaml b/test/integration/targets/eos_acls/tests/common/deleted.yaml
deleted file mode 100644
index 750e214d49..0000000000
--- a/test/integration/targets/eos_acls/tests/common/deleted.yaml
+++ /dev/null
@@ -1,168 +0,0 @@
----
-- debug:
- msg: "Start eos_acls deleted integration tests ansible_connection={{ ansible_connection }}"
-
-- include_tasks: _populate.yaml
-
-- set_fact:
- config1:
- - afi: "ipv4"
- acls:
- - name: test1
- aces:
- - sequence: 55
- grant: "permit"
- protocol: "tcp"
- source:
- any: true
- destination:
- any: true
- - remark: "Run by ansible"
- sequence: 45
- - name: test4
- aces:
- - grant: "permit"
- sequence: 10
- source:
- any: true
- port_protocol:
- eq: "smtp"
- destination:
- any: true
- port_protocol:
- eq: "www"
- protocol: "tcp"
- ttl:
- eq: "55"
- - afi: "ipv6"
- acls:
- - name: test2
- standard: true
- aces:
- - grant: "permit"
- sequence: 10
- log: "true"
- source:
- any: true
-
-- set_fact:
- config2:
- - afi: "ipv4"
- acls:
- - name: test1
- aces:
- - sequence: 35
- grant: "deny"
- protocol: "tcp"
- source:
- subnet_address: 20.0.0.0/8
- destination:
- any: true
- log: true
- - remark: "Run by ansible"
- sequence: 45
- - name: test4
- aces:
- - grant: "permit"
- sequence: 10
- source:
- any: true
- port_protocol:
- eq: "smtp"
- destination:
- any: true
- port_protocol:
- eq: "www"
- protocol: "tcp"
- ttl:
- eq: "55"
-- set_fact:
- config3:
- - afi: "ipv4"
- acls:
- - name: test1
- aces:
- - sequence: 35
- grant: "deny"
- protocol: "tcp"
- source:
- subnet_address: 20.0.0.0/8
- destination:
- any: true
- log: true
- - remark: "Run by ansible"
- sequence: 45
-
-- block:
- - name: Delete attributes of given acls.
- eos_acls:
- config:
- - afi: "ipv4"
- acls:
- - name: test1
- aces:
- - sequence: 35
- grant: "deny"
- protocol: "tcp"
- source:
- subnet_address: 20.0.0.0/8
- destination:
- any: true
- log: true
- state: deleted
- become: yes
- register: result
-
- - eos_facts:
- gather_network_resources: acls
- become: yes
-
- - assert:
- that:
- - "result.commands|length == 2"
- - "result.changed == true"
- - "ansible_facts.network_resources.acls|symmetric_difference(result.after) == [] "
- become: yes
-
- - name: Delete afi of given acls.
- eos_acls:
- config:
- - afi: "ipv6"
- state: deleted
- become: yes
- register: result
-
- - eos_facts:
- gather_network_resources: acls
- become: yes
-
- - assert:
- that:
- - "result.commands|length == 1"
- - "result.changed == true"
- - "ansible_facts.network_resources.acls|symmetric_difference(result.after) == [] "
- become: yes
-
- - name: Delete attributes of given named acl.
- eos_acls:
- config:
- - afi: "ipv4"
- acls:
- - name: test4
- state: deleted
- become: yes
- register: result
-
- - eos_facts:
- gather_network_resources: acls
- become: yes
-
- - assert:
- that:
- - "result.commands|length == 1"
- - "result.changed == true"
- - "ansible_facts.network_resources.acls|symmetric_difference(result.after) == [] "
- become: yes
-
- always:
- - include_tasks: _remove_config.yaml
diff --git a/test/integration/targets/eos_acls/tests/common/gathered.yaml b/test/integration/targets/eos_acls/tests/common/gathered.yaml
deleted file mode 100644
index 0baedb13af..0000000000
--- a/test/integration/targets/eos_acls/tests/common/gathered.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
----
-- debug:
- msg: "START eos_acls gathered integration tests on connection={{ ansible_connection }}"
-
-
-- include_tasks: _populate.yaml
-
-- block:
- - name: Gathered the provided configuration with the exisiting running configuration
- eos_acls: &gathered
- config:
- state: gathered
- become: yes
- register: result
-
- - eos_facts:
- gather_network_resources: acls
- become: yes
-
- - name: Assert
- assert:
- that:
- - "ansible_facts.network_resources.acls | symmetric_difference(result.gathered) == []"
-
-
- - name: Gather the existing running configuration (IDEMPOTENT)
- eos_acls: *gathered
- become: yes
- register: result
-
- - name: Assert that the previous task was idempotent
- assert:
- that:
- - "result['changed'] == false"
-
- always:
- - include_tasks: _remove_config.yaml
diff --git a/test/integration/targets/eos_acls/tests/common/merged.yaml b/test/integration/targets/eos_acls/tests/common/merged.yaml
deleted file mode 100644
index 9bfd233805..0000000000
--- a/test/integration/targets/eos_acls/tests/common/merged.yaml
+++ /dev/null
@@ -1,152 +0,0 @@
----
-- debug:
- msg: "Start eos_acls merged integration tests ansible_connection={{ ansible_connection }}"
-
-
-- set_fact:
- config:
- - afi: "ipv4"
- acls:
- - name: test1
- aces:
- - sequence: 35
- grant: "deny"
- protocol: "tcp"
- source:
- subnet_address: 20.0.0.0/8
- destination:
- any: true
- log: true
- - remark: "Run by ansible"
- sequence: 45
- - grant: "permit"
- sequence: 55
- protocol: "tcp"
- source:
- any: true
- destination:
- any: true
- - name: test4
- aces:
- - grant: "permit"
- sequence: 10
- source:
- any: true
- port_protocol:
- eq: "smtp"
- destination:
- any: true
- port_protocol:
- eq: "www"
- protocol: "tcp"
- ttl:
- eq: "55"
- - afi: "ipv6"
- acls:
- - name: test2
- standard: true
- aces:
- - grant: "permit"
- sequence: 10
- log: "true"
- source:
- any: true
-
-- block:
- - name: merge attributes of given acls.
- eos_acls: &merged
- config:
- - afi: "ipv4"
- acls:
- - name: test1
- aces:
- - sequence: 35
- grant: "deny"
- protocol: "tcp"
- source:
- subnet_address: 20.0.0.0/8
- destination:
- any: true
- log: true
- - remark: "Run by ansible"
- - grant: "permit"
- protocol: "6"
- source:
- any: true
- destination:
- any: true
- - name: test4
- aces:
- - grant: "permit"
- source:
- any: true
- port_protocol:
- eq: "25"
- destination:
- any: true
- port_protocol:
- eq: "www"
- protocol: "tcp"
- ttl:
- eq: "55"
- - afi: "ipv6"
- acls:
- - name: test2
- standard: true
- aces:
- - grant: "permit"
- log: "true"
- source:
- any: true
- state: merged
- become: yes
- register: result
-
- - eos_facts:
- gather_network_resources: acls
- become: yes
-
- - assert:
- that:
- - "result.commands|length == 8"
- - "result.changed == true"
- become: yes
-
- - name: Idempotency check
- eos_acls: *merged
- become: yes
- register: result
-
- - assert:
- that:
- - "result.changed == false"
- - "result.commands|length == 0"
- - "ansible_facts.network_resources.acls|symmetric_difference(result.before) == []"
-
- - name: merge attributes with an existing ace
- eos_acls:
- config:
- - afi: "ipv4"
- acls:
- - name: test1
- aces:
- - sequence: 35
- log: true
- ttl:
- eq: 33
- source:
- any: true
- state: merged
- become: yes
- register: result
-
- - assert:
- that:
- - "result.changed == true"
- - "result.commands|length == 3"
- - "'no 35' in result.commands"
- - "'35 deny tcp any any ttl eq 33 log' in result.commands"
-
-
- always:
- - include_tasks: _remove_config.yaml
diff --git a/test/integration/targets/eos_acls/tests/common/overridden.yaml b/test/integration/targets/eos_acls/tests/common/overridden.yaml
deleted file mode 100644
index 4c8e51998e..0000000000
--- a/test/integration/targets/eos_acls/tests/common/overridden.yaml
+++ /dev/null
@@ -1,71 +0,0 @@
----
-- debug:
- msg: "Start eos_acls merged integration tests ansible_connection={{ ansible_connection }}"
-
-- include_tasks: _populate.yaml
-
-- set_fact:
- config:
- - afi: "ipv4"
- acls:
- - name: test1
- aces:
- - sequence: 10
- grant: "permit"
- protocol: "ospf"
- source:
- any: true
- destination:
- any: true
- log: true
-
-- block:
- - name: overriden attributes with given acls.
- eos_acls: &overridden
- config:
- - afi: "ipv4"
- acls:
- - name: test1
- aces:
- - grant: "permit"
- sequence: 10
- protocol: "ospf"
- source:
- any: true
- destination:
- any: true
- log: true
- state: overridden
- become: yes
- register: result
-
- - eos_facts:
- gather_network_resources: acls
- become: yes
-
- - assert:
- that:
- - "result.commands|length == 8"
- - "result.changed == true"
- - "'ip access-list test1' in result.commands"
- - "'10 permit ospf any any log' in result.commands"
- - "ansible_facts.network_resources.acls|symmetric_difference(result.after) == []"
- become: yes
-
- - name: Idempotency check
- eos_acls: *overridden
- become: yes
- register: result
-
- - eos_facts:
- gather_network_resources: acls
- become: yes
-
- - assert:
- that:
- - "result.changed == false"
- - "result.commands|length == 0"
- - "ansible_facts.network_resources.acls|symmetric_difference(result.before) == []"
-
- always:
- - include_tasks: _remove_config.yaml
diff --git a/test/integration/targets/eos_acls/tests/common/parsed.yaml b/test/integration/targets/eos_acls/tests/common/parsed.yaml
deleted file mode 100644
index ffadce84ed..0000000000
--- a/test/integration/targets/eos_acls/tests/common/parsed.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
----
-- debug:
- msg: "START eos_acls parsed integration tests on connection={{ ansible_connection }}"
-
-- include_tasks: _parsed_cfg.yaml
-
-- name: Gather acls facts
- eos_facts:
- gather_subset:
- - default
- gather_network_resources:
- - acls
- become: yes
- register: acls_facts
-
-- name: Provide the running configuration for parsing (config to be parsed)
- eos_acls: &parsed
- running_config:
- "{{ lookup('file', '_parsed.cfg') }}"
- state: parsed
- become: yes
- register: result
-
-- assert:
- that:
- - "result.changed == false"
- - "ansible_facts.network_resources.acls|symmetric_difference(result.parsed) == []"
-
-- include_tasks: _remove_config.yaml
diff --git a/test/integration/targets/eos_acls/tests/common/rendered.yaml b/test/integration/targets/eos_acls/tests/common/rendered.yaml
deleted file mode 100644
index f447c52ac0..0000000000
--- a/test/integration/targets/eos_acls/tests/common/rendered.yaml
+++ /dev/null
@@ -1,80 +0,0 @@
----
-- debug:
- msg: "START eos_acls rendered integration tests on connection={{ ansible_connection }}"
-
-
-- block:
- - name: Structure provided configuration into device specific commands
- eos_acls: &rendered
- config:
- - afi: "ipv4"
- acls:
- - name: test1
- aces:
- - sequence: 35
- grant: "deny"
- protocol: "tcp"
- source:
- subnet_address: 20.0.0.0/8
- destination:
- any: true
- log: true
- - remark: "Run by ansible"
- - grant: "permit"
- protocol: "6"
- source:
- any: true
- destination:
- any: true
- - name: test4
- aces:
- - grant: "permit"
- source:
- any: true
- port_protocol:
- eq: "25"
- destination:
- any: true
- port_protocol:
- eq: "www"
- protocol: "tcp"
- ttl:
- eq: "55"
- - afi: "ipv6"
- acls:
- - name: test2
- standard: true
- aces:
- - grant: "permit"
- log: "true"
- source:
- any: true
- state: rendered
- become: yes
- register: result
-
-
- - name: Assert that correct set of commands were generated
- vars:
- lines:
- - ip access-list test1
- - 35 deny tcp 20.0.0.0/8 any log
- - remark Run by ansible
- - permit tcp any any
- - ip access-list test4
- - permit tcp any eq smtp any eq www ttl eq 55
- - ipv6 access-list standard test2
- - permit any log
-
- assert:
- that:
- - "{{ lines | symmetric_difference(result['rendered']) |length == 0 }}"
-
- - name: Structure provided configuration into device specific commands (IDEMPOTENT)
- eos_acls: *rendered
- register: result
-
- - name: Assert that the previous task was idempotent
- assert:
- that:
- - "result['changed'] == false"
diff --git a/test/integration/targets/eos_acls/tests/common/replaced.yaml b/test/integration/targets/eos_acls/tests/common/replaced.yaml
deleted file mode 100644
index 068e177ef5..0000000000
--- a/test/integration/targets/eos_acls/tests/common/replaced.yaml
+++ /dev/null
@@ -1,94 +0,0 @@
----
-- debug:
- msg: "Start eos_acls replaced integration tests ansible_connection={{ ansible_connection }}"
-
-- include_tasks: _populate.yaml
-
-- set_fact:
- config:
- - afi: "ipv4"
- acls:
- - name: test1
- aces:
- - sequence: 10
- grant: "permit"
- protocol: "ospf"
- source:
- any: true
- destination:
- any: true
- log: true
- - name: test4
- aces:
- - grant: "permit"
- sequence: 10
- source:
- any: true
- port_protocol:
- eq: "smtp"
- destination:
- any: true
- port_protocol:
- eq: "www"
- protocol: "tcp"
- ttl:
- eq: "55"
- - afi: "ipv6"
- acls:
- - name: test2
- standard: true
- aces:
- - grant: "permit"
- sequence: 10
- log: "true"
- source:
- any: true
-
-- block:
- - name: replace attributes with given acls.
- eos_acls: &replaced
- config:
- - afi: "ipv4"
- acls:
- - name: test1
- aces:
- - grant: "permit"
- sequence: 10
- protocol: "ospf"
- source:
- any: true
- destination:
- any: true
- log: true
- state: replaced
- become: yes
- register: result
-
- - eos_facts:
- gather_network_resources: acls
- become: yes
-
- - assert:
- that:
- - "result.commands|length == 5"
- - "result.changed == true"
- - "ansible_facts.network_resources.acls|symmetric_difference(result.after) == []"
- become: yes
-
- - name: Idempotency check
- eos_acls: *replaced
- become: yes
- register: result
-
- - eos_facts:
- gather_network_resources: acls
- become: yes
-
- - assert:
- that:
- - "result.changed == false"
- - "result.commands|length == 0"
- - "ansible_facts.network_resources.acls|symmetric_difference(result.before) == []"
-
- always:
- - include_tasks: _remove_config.yaml
diff --git a/test/integration/targets/eos_acls/tests/common/rtt.yaml b/test/integration/targets/eos_acls/tests/common/rtt.yaml
deleted file mode 100644
index 4b78a8e782..0000000000
--- a/test/integration/targets/eos_acls/tests/common/rtt.yaml
+++ /dev/null
@@ -1,101 +0,0 @@
----
-- debug:
- msg: "Start eos_acls round trip integration tests ansible_connection={{ ansible_connection }}"
-
-
-- block:
- - name: merge attributes of given acls(apply base config).
- eos_acls: &merged
- config:
- - afi: "ipv4"
- acls:
- - name: test1
- aces:
- - sequence: 35
- grant: "deny"
- protocol: "tcp"
- source:
- subnet_address: 20.0.0.0/8
- destination:
- any: true
- log: true
- - remark: "Run by ansible"
- - grant: "permit"
- protocol: "6"
- source:
- any: true
- destination:
- any: true
- - name: test4
- aces:
- - grant: "permit"
- source:
- any: true
- port_protocol:
- eq: "25"
- destination:
- any: true
- port_protocol:
- eq: "www"
- protocol: "tcp"
- ttl:
- eq: "55"
- - afi: "ipv6"
- acls:
- - name: test2
- standard: true
- aces:
- - grant: "permit"
- log: "true"
- source:
- any: true
- state: merged
- become: yes
- register: base_config
-
- - eos_facts:
- gather_network_resources: acls
- become: yes
-
- - assert:
- that:
- - "base_config.commands|length == 8"
- - "base_config.changed == true"
- - "ansible_facts.network_resources.acls|symmetric_difference(base_config.after) == []"
-
- - name: Apply the provided configuration (config to be reverted)
- eos_acls:
- config:
- - afi: "ipv4"
- acls:
- - name: test3
- aces:
- - sequence: 100
- grant: "permit"
- protocol: "icmp"
- source:
- any: true
- destination:
- any: true
- log: true
- become: yes
- register: result
-
- - name: Assert that changes were applied
- assert:
- that:
- - "{{ round_trip['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
-
- - name: Revert back to base config using facts round trip
- eos_acls:
- config: "{{ ansible_facts['network_resources']['acls'] }}"
- state: overridden
- become: yes
- register: revert
-
- - name: Assert that config was reverted
- assert:
- that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}"
-
- always:
- - include_tasks: _remove_config.yaml