summaryrefslogtreecommitdiff
path: root/tests/integration/targets
diff options
context:
space:
mode:
authorGomathiselviS <gomathiselvi@gmail.com>2021-03-26 20:48:39 -0400
committerGitHub <noreply@github.com>2021-03-27 00:48:39 +0000
commit4f83f5cf80ca92bf91792a0cd4621744b4f1c37e (patch)
tree7e37f5cab203d5ab92022ffcadc8cc24c2eef6cb /tests/integration/targets
parentc936f0c6d7138e23f4d8c14c4bb1c5727ab303fc (diff)
downloadvyos-ansible-old-4f83f5cf80ca92bf91792a0cd4621744b4f1c37e.tar.gz
vyos-ansible-old-4f83f5cf80ca92bf91792a0cd4621744b4f1c37e.zip
Add vyos_bgp_address_family resource module. (#132)
Add vyos_bgp_address_family resource module. Reviewed-by: https://github.com/apps/ansible-zuul
Diffstat (limited to 'tests/integration/targets')
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/defaults/main.yaml3
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/meta/main.yaml3
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/tasks/cli.yaml19
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/tasks/main.yaml4
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/tests/cli/_parsed_config.cfg9
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/tests/cli/_populate.yaml17
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/tests/cli/_preconfig.yaml11
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/tests/cli/_remove_config.yaml12
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/tests/cli/deleted.yaml49
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/tests/cli/empty_config.yaml60
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/tests/cli/gathered.yaml24
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/tests/cli/merged.yaml70
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/tests/cli/overridden.yaml58
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/tests/cli/parsed.yaml16
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/tests/cli/rendered.yaml44
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/tests/cli/replaced.yaml58
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/tests/cli/rtt.yaml90
-rw-r--r--tests/integration/targets/vyos_bgp_address_family/vars/main.yaml99
18 files changed, 646 insertions, 0 deletions
diff --git a/tests/integration/targets/vyos_bgp_address_family/defaults/main.yaml b/tests/integration/targets/vyos_bgp_address_family/defaults/main.yaml
new file mode 100644
index 0000000..852a6be
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/defaults/main.yaml
@@ -0,0 +1,3 @@
+---
+testcase: '[^_].*'
+test_items: []
diff --git a/tests/integration/targets/vyos_bgp_address_family/meta/main.yaml b/tests/integration/targets/vyos_bgp_address_family/meta/main.yaml
new file mode 100644
index 0000000..7413320
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/meta/main.yaml
@@ -0,0 +1,3 @@
+---
+dependencies:
+ - prepare_vyos_tests
diff --git a/tests/integration/targets/vyos_bgp_address_family/tasks/cli.yaml b/tests/integration/targets/vyos_bgp_address_family/tasks/cli.yaml
new file mode 100644
index 0000000..93eb2fe
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/tasks/cli.yaml
@@ -0,0 +1,19 @@
+---
+- name: Collect all cli test cases
+ find:
+ paths: '{{ role_path }}/tests/cli'
+ patterns: '{{ testcase }}.yaml'
+ use_regex: true
+ register: test_cases
+ delegate_to: localhost
+
+- name: Set test_items
+ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
+
+- name: Run test case (connection=ansible.netcommon.network_cli)
+ include: '{{ test_case_to_run }}'
+ vars:
+ ansible_connection: ansible.netcommon.network_cli
+ with_items: '{{ test_items }}'
+ loop_control:
+ loop_var: test_case_to_run
diff --git a/tests/integration/targets/vyos_bgp_address_family/tasks/main.yaml b/tests/integration/targets/vyos_bgp_address_family/tasks/main.yaml
new file mode 100644
index 0000000..b957d2f
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/tasks/main.yaml
@@ -0,0 +1,4 @@
+---
+- include: cli.yaml
+ tags:
+ - network_cli
diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_bgp_address_family/tests/cli/_parsed_config.cfg
new file mode 100644
index 0000000..2aecc80
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/_parsed_config.cfg
@@ -0,0 +1,9 @@
+set policy access-list 20 description 'acl20'
+set policy access-list 40 description 'acl40'
+set policy route-map map01 description 'map01'
+set protocols bgp 65536 address-family ipv6-unicast aggregate-address 5000:1:1::/64 summary-only
+set protocols bgp 65536 address-family ipv6-unicast network 21e0:1:1::/64 route-map 'map01'
+set protocols bgp 65536 address-family ipv6-unicast redistribute ripng metric '20'
+set protocols bgp 65536 neighbor 192.0.2.25 address-family ipv6-unicast route-map export 'map01'
+set protocols bgp 65536 neighbor 192.0.2.25 address-family ipv6-unicast soft-reconfiguration inbound
+set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast attribute-unchanged next-hop
diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/_populate.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/_populate.yaml
new file mode 100644
index 0000000..3aca916
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/_populate.yaml
@@ -0,0 +1,17 @@
+---
+- name: setup
+ vyos.vyos.vyos_config:
+ lines:
+ - set policy access-list 20 description 'acl20'
+ - set policy access-list 40 description 'acl40'
+ - set policy access-list6 10 description 'acl10'
+ - set policy route-map map01 description 'map01'
+ - set protocols bgp 65536 address-family ipv6-unicast aggregate-address 5000:1:1::/64 summary-only
+ - set protocols bgp 65536 address-family ipv6-unicast network 21e0:1:1::/64 route-map 'map01'
+ - set protocols bgp 65536 address-family ipv6-unicast redistribute ripng metric '20'
+ - set protocols bgp 65536 neighbor 192.0.2.25 address-family ipv6-unicast route-map export 'map01'
+ - set protocols bgp 65536 neighbor 192.0.2.25 address-family ipv6-unicast soft-reconfiguration inbound
+ - set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast attribute-unchanged next-hop
+ ignore_errors: true
+ vars:
+ ansible_connection: ansible.netcommon.network_cli
diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/_preconfig.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/_preconfig.yaml
new file mode 100644
index 0000000..5024a70
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/_preconfig.yaml
@@ -0,0 +1,11 @@
+---
+- name: setup
+ vyos.vyos.vyos_config:
+ lines:
+ - set policy access-list 20 description 'acl20'
+ - set policy access-list 40 description 'acl40'
+ - set policy access-list6 10 description 'acl10'
+ - set policy route-map map01 description 'map01'
+ ignore_errors: true
+ vars:
+ ansible_connection: ansible.netcommon.network_cli
diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/_remove_config.yaml
new file mode 100644
index 0000000..39d8bd0
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/_remove_config.yaml
@@ -0,0 +1,12 @@
+---
+- name: Remove pre-existing bgp processes
+ vyos.vyos.vyos_config:
+ lines:
+ - delete protocols bgp 65536
+ - delete policy access-list 20
+ - delete policy access-list 40
+ - delete policy access-list6 10
+ - delete policy route-map map01
+ ignore_errors: true
+ vars:
+ ansible_connection: ansible.netcommon.network_cli
diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/deleted.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/deleted.yaml
new file mode 100644
index 0000000..7fb8e10
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/deleted.yaml
@@ -0,0 +1,49 @@
+---
+- debug:
+ msg: START vyos_bgp_address_family deleted integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Delete the provided configuration
+ register: result
+ vyos.vyos.vyos_bgp_address_family: &id001
+ config:
+ as_number: "65536"
+ address_family:
+ - afi: "ipv6"
+ neighbors:
+ - neighbor_address: "203.0.113.5"
+ - neighbor_address: "192.0.2.25"
+ address_family:
+ - afi: "ipv6"
+ state: deleted
+
+ - become: true
+ vyos.vyos.vyos_facts:
+ gather_network_resources: bgp_address_family
+
+ - assert:
+ that:
+ - result.commands|length == 3
+ - result.changed == true
+ - result.commands|symmetric_difference(deleted.commands) == []
+ - result.after == ansible_facts['network_resources']['bgp_address_family']
+
+ - name: Delete the existing configuration with the provided running configuration
+ (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_bgp_address_family: *id001
+
+ - name: Assert that the previous task was idempotent
+ assert:
+ that:
+ - result['changed'] == false
+
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/empty_config.yaml
new file mode 100644
index 0000000..3a12be9
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/empty_config.yaml
@@ -0,0 +1,60 @@
+---
+- debug:
+ msg: START vyos_bgp_address_family empty_config integration tests on connection={{
+ ansible_connection }}
+
+- name: Merged with empty config should give appropriate error message
+ register: result
+ ignore_errors: true
+ vyos.vyos.vyos_bgp_address_family:
+ config:
+ state: merged
+
+- assert:
+ that:
+ - result.msg == 'value of config parameter must not be empty for state merged'
+
+- name: Replaced with empty config should give appropriate error message
+ register: result
+ ignore_errors: true
+ vyos.vyos.vyos_bgp_address_family:
+ config:
+ state: replaced
+
+- assert:
+ that:
+ - result.msg == 'value of config parameter must not be empty for state replaced'
+
+- name: OVerridden with empty config should give appropriate error message
+ register: result
+ ignore_errors: true
+ vyos.vyos.vyos_bgp_address_family:
+ config:
+ state: overridden
+
+- assert:
+ that:
+ - result.msg == 'value of config parameter must not be empty for state overridden'
+
+- name: Parsed with empty running_config should give appropriate error message
+ register: result
+ ignore_errors: true
+ vyos.vyos.vyos_bgp_address_family:
+ running_config:
+ state: parsed
+
+- assert:
+ that:
+ - result.msg == 'value of running_config parameter must not be empty for state
+ parsed'
+
+- name: Rendered with empty config should give appropriate error message
+ register: result
+ ignore_errors: true
+ vyos.vyos.vyos_bgp_address_family:
+ config:
+ state: rendered
+
+- assert:
+ that:
+ - result.msg == 'value of config parameter must not be empty for state rendered'
diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/gathered.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/gathered.yaml
new file mode 100644
index 0000000..7176a48
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/gathered.yaml
@@ -0,0 +1,24 @@
+---
+- debug:
+ msg: START vyos_bgp_address_family gathered integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Gather config from the device in structured format.
+ register: result
+ vyos.vyos.vyos_bgp_address_family:
+ state: gathered
+
+ - become: true
+ vyos.vyos.vyos_facts:
+ gather_network_resources: bgp_address_family
+
+ - assert:
+ that:
+ - result.changed == false
+ - result.gathered == ansible_facts['network_resources']['bgp_address_family']
diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/merged.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/merged.yaml
new file mode 100644
index 0000000..45870c6
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/merged.yaml
@@ -0,0 +1,70 @@
+---
+- debug:
+ msg: START vyos_bgp_address_family merged integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _preconfig.yaml
+
+- block:
+
+ - name: Merge the provided configuration with the exisiting running configuration
+ register: result
+ vyos.vyos.vyos_bgp_address_family: &id001
+ config:
+ as_number: "65536"
+ address_family:
+ - afi: "ipv6"
+ redistribute:
+ - protocol: "static"
+ metric: 50
+ neighbors:
+ - neighbor_address: "203.0.113.5"
+ address_family:
+ - afi: "ipv6"
+ allowas_in: 4
+ attribute_unchanged:
+ med: true
+ default_originate: "map01"
+ distribute_list:
+ - action: "export"
+ acl: 10
+ - neighbor_address: "192.0.2.25"
+ address_family:
+ - afi: "ipv6"
+ maximum_prefix: 45
+ nexthop_self: true
+ route_map:
+ - action: "export"
+ route_map: "map01"
+ - action: "import"
+ route_map: "map01"
+ state: merged
+
+ - become: true
+ vyos.vyos.vyos_facts:
+ gather_network_resources: bgp_address_family
+
+ - assert:
+ that:
+ - result.commands|length == 9
+ - result.changed == true
+ - result.commands|symmetric_difference(merged.commands) == []
+ - result.after == ansible_facts['network_resources']['bgp_address_family']
+ - result.before == {}
+ - result.after == merged.after
+
+ - name: Merge the provided configuration with the existing running configuration
+ (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_bgp_address_family: *id001
+
+ - name: Assert that the previous task was idempotent
+ assert:
+ that:
+ - result['changed'] == false
+
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/overridden.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/overridden.yaml
new file mode 100644
index 0000000..77ba5b4
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/overridden.yaml
@@ -0,0 +1,58 @@
+---
+- debug:
+ msg: START vyos_bgp_address_family overridden integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Replace the existing configuration with the provided running configuration
+ register: result
+ vyos.vyos.vyos_bgp_address_family: &id001
+ config:
+ as_number: "65536"
+ address_family:
+ - afi: "ipv6"
+ redistribute:
+ - protocol: "static"
+ metric: 50
+ neighbors:
+ - neighbor_address: "203.0.113.5"
+ address_family:
+ - afi: "ipv6"
+ allowas_in: 4
+ attribute_unchanged:
+ med: true
+ default_originate: "map01"
+ distribute_list:
+ - action: "export"
+ acl: 10
+ state: overridden
+
+ - become: true
+ vyos.vyos.vyos_facts:
+ gather_network_resources: bgp_address_family
+
+ - assert:
+ that:
+ - result.commands|length == 10
+ - result.changed == true
+ - result.commands|symmetric_difference(overridden.commands) == []
+ - result.after == ansible_facts['network_resources']['bgp_address_family']
+
+ - name: Replace the existing configuration with the provided running configuration
+ (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_bgp_address_family: *id001
+
+ - name: Assert that the previous task was idempotent
+ assert:
+ that:
+ - result['changed'] == false
+
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/parsed.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/parsed.yaml
new file mode 100644
index 0000000..d20684f
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/parsed.yaml
@@ -0,0 +1,16 @@
+---
+- debug:
+ msg: START vyos_bgp_address_family parsed integration tests on connection={{ ansible_connection
+ }}
+
+- name: Provide the running configuration for parsing (config to be parsed)
+ become: true
+ register: result
+ vyos.vyos.vyos_bgp_address_family:
+ running_config: "{{ lookup('file', '_parsed_config.cfg') }}"
+ state: parsed
+
+- assert:
+ that:
+ - result.changed == false
+ - result.parsed == populate.config
diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/rendered.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/rendered.yaml
new file mode 100644
index 0000000..1071657
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/rendered.yaml
@@ -0,0 +1,44 @@
+---
+- debug:
+ msg: START vyos_bgp_address_family rendered integration tests on connection={{
+ ansible_connection }}
+
+- block:
+
+ - name: Render the given config in the form of native config.
+ register: result
+ vyos.vyos.vyos_bgp_address_family: &id001
+ config:
+ as_number: "65536"
+ address_family:
+ - afi: "ipv6"
+ redistribute:
+ - protocol: "static"
+ metric: 50
+ neighbors:
+ - neighbor_address: "203.0.113.5"
+ address_family:
+ - afi: "ipv6"
+ allowas_in: 4
+ attribute_unchanged:
+ med: true
+ default_originate: "map01"
+ distribute_list:
+ - action: "export"
+ acl: 10
+ - neighbor_address: "192.0.2.25"
+ address_family:
+ - afi: "ipv6"
+ maximum_prefix: 45
+ nexthop_self: true
+ route_map:
+ - action: "export"
+ route_map: "map01"
+ - action: "import"
+ route_map: "map01"
+ state: rendered
+
+ - assert:
+ that:
+ - result.changed == false
+ - result.rendered|symmetric_difference(merged.commands) == []
diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/replaced.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/replaced.yaml
new file mode 100644
index 0000000..001c997
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/replaced.yaml
@@ -0,0 +1,58 @@
+---
+- debug:
+ msg: START vyos_bgp_address_family replaced integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Replace the existing configuration with the provided running configuration
+ register: result
+ vyos.vyos.vyos_bgp_address_family: &id001
+ config:
+ as_number: "65536"
+ address_family:
+ - afi: "ipv6"
+ redistribute:
+ - protocol: "static"
+ metric: 50
+ neighbors:
+ - neighbor_address: "203.0.113.5"
+ address_family:
+ - afi: "ipv6"
+ allowas_in: 4
+ attribute_unchanged:
+ med: true
+ default_originate: "map01"
+ distribute_list:
+ - action: "export"
+ acl: 10
+ state: replaced
+
+ - become: true
+ vyos.vyos.vyos_facts:
+ gather_network_resources: bgp_address_family
+
+ - assert:
+ that:
+ - result.commands|length == 9
+ - result.changed == true
+ - result.commands|symmetric_difference(replaced.commands) == []
+ - result.after == ansible_facts['network_resources']['bgp_address_family']
+
+ - name: Replace the existing configuration with the provided running configuration
+ (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_bgp_address_family: *id001
+
+ - name: Assert that the previous task was idempotent
+ assert:
+ that:
+ - result['changed'] == false
+
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/rtt.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/rtt.yaml
new file mode 100644
index 0000000..3ef93c4
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/rtt.yaml
@@ -0,0 +1,90 @@
+---
+- debug:
+ msg: START vyos_bgp_address_family rtt integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _preconfig.yaml
+
+- block:
+
+ - name: Merge the provided configuration with the exisiting running configuration
+ register: baseconfig
+ vyos.vyos.vyos_bgp_address_family:
+ config:
+ as_number: "65536"
+ address_family:
+ - afi: "ipv6"
+ redistribute:
+ - protocol: "static"
+ metric: 50
+ neighbors:
+ - neighbor_address: "203.0.113.5"
+ address_family:
+ - afi: "ipv6"
+ allowas_in: 4
+ attribute_unchanged:
+ med: true
+ default_originate: "map01"
+ distribute_list:
+ - action: "export"
+ acl: 10
+ - neighbor_address: "192.0.2.25"
+ address_family:
+ - afi: "ipv6"
+ maximum_prefix: 45
+ nexthop_self: true
+ route_map:
+ - action: "export"
+ route_map: "map01"
+ - action: "import"
+ route_map: "map01"
+ state: merged
+
+ - become: true
+ vyos.vyos.vyos_facts:
+ gather_network_resources: bgp_address_family
+
+ - assert:
+ that:
+ - baseconfig.commands|length == 9
+ - baseconfig.changed == true
+ - baseconfig.commands|symmetric_difference(merged.commands) == []
+ - baseconfig.after == ansible_facts['network_resources']['bgp_address_family']
+
+ - name: Apply the provided configuration (config to be reverted)
+ become: true
+ register: result
+ vyos.vyos.vyos_bgp_address_family:
+ config:
+ as_number: "65536"
+ address_family:
+ - afi: "ipv6"
+ aggregate_address:
+ - summary_only: true
+ prefix: "21e0:1:1::/64"
+ networks:
+ - prefix: "21e0:1:1::/64"
+ route_map: "map01"
+ neighbors:
+ - address_family:
+ - afi: "ipv6"
+ remove_private_as: true
+ neighbor_address: "203.0.113.5"
+
+ - name: Revert back to base config using facts round trip
+ become: true
+ register: revert
+ vyos.vyos.vyos_bgp_address_family:
+ config: "{{ ansible_facts['network_resources']['bgp_address_family'] }}"
+ state: overridden
+
+ - name: Assert that config was reverted
+ assert:
+ that: baseconfig.after == revert.after
+
+
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_bgp_address_family/vars/main.yaml b/tests/integration/targets/vyos_bgp_address_family/vars/main.yaml
new file mode 100644
index 0000000..aed6de6
--- /dev/null
+++ b/tests/integration/targets/vyos_bgp_address_family/vars/main.yaml
@@ -0,0 +1,99 @@
+---
+merged:
+ commands:
+ - set protocols bgp 65536 address-family ipv6-unicast redistribute static metric 50
+ - set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast allowas-in number 4
+ - set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast attribute-unchanged med
+ - set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast default-originate route-map map01
+ - set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast distribute-list export 10
+ - set protocols bgp 65536 neighbor 192.0.2.25 address-family ipv6-unicast maximum-prefix 45
+ - set protocols bgp 65536 neighbor 192.0.2.25 address-family ipv6-unicast nexthop-self
+ - set protocols bgp 65536 neighbor 192.0.2.25 address-family ipv6-unicast route-map export map01
+ - set protocols bgp 65536 neighbor 192.0.2.25 address-family ipv6-unicast route-map import map01
+ after:
+ address_family:
+ - afi: "ipv6"
+ redistribute:
+ - metric: 50
+ protocol: "static"
+ as_number: 65536
+ neighbors:
+ - address_family:
+ - afi: "ipv6"
+ maximum_prefix: 45
+ nexthop_self: true
+ route_map:
+ - action: "export"
+ route_map: "map01"
+ - action: "import"
+ route_map: "map01"
+ neighbor_address: "192.0.2.25"
+ - address_family:
+ - afi: "ipv6"
+ allowas_in: 4
+ attribute_unchanged:
+ med: true
+ default_originate: "map01"
+ distribute_list:
+ - acl: 10
+ action: "export"
+ neighbor_address: "203.0.113.5"
+
+replaced:
+ commands:
+ - delete protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast attribute-unchanged
+ - delete protocols bgp 65536 address-family ipv6 aggregate-address
+ - delete protocols bgp 65536 address-family ipv6 network
+ - delete protocols bgp 65536 address-family ipv6-unicast redistribute ripng
+ - set protocols bgp 65536 address-family ipv6-unicast redistribute static metric 50
+ - set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast allowas-in number 4
+ - set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast attribute-unchanged med
+ - set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast default-originate route-map map01
+ - set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast distribute-list export 10
+
+overridden:
+ commands:
+ - delete protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast attribute-unchanged
+ - delete protocols bgp 65536 neighbor 192.0.2.25 address-family
+ - delete protocols bgp 65536 address-family ipv6-unicast redistribute ripng
+ - delete protocols bgp 65536 address-family ipv6 aggregate-address
+ - delete protocols bgp 65536 address-family ipv6 network
+ - set protocols bgp 65536 address-family ipv6-unicast redistribute static metric 50
+ - set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast allowas-in number 4
+ - set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast attribute-unchanged med
+ - set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast default-originate route-map map01
+ - set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast distribute-list export 10
+
+deleted:
+ commands:
+ - delete protocols bgp 65536 address-family ipv6-unicast
+ - delete protocols bgp 65536 neighbor 203.0.113.5 address-family
+ - delete protocols bgp 65536 neighbor 192.0.2.25 address-family ipv6-unicast
+
+populate:
+ config:
+ address_family:
+ - afi: "ipv6"
+ aggregate_address:
+ - summary_only: true
+ prefix: "5000:1:1::/64"
+ networks:
+ - prefix: "21e0:1:1::/64"
+ route_map: "map01"
+ redistribute:
+ - metric: 20
+ protocol: "ripng"
+ as_number: 65536
+ neighbors:
+ - address_family:
+ - afi: "ipv6"
+ route_map:
+ - action: "export"
+ route_map: "map01"
+ soft_reconfiguration: true
+ neighbor_address: "192.0.2.25"
+ - address_family:
+ - afi: "ipv6"
+ attribute_unchanged:
+ next_hop: true
+ neighbor_address: "203.0.113.5"