summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/targets/vyos_firewall_rules/tests/cli/deleted.yaml4
-rw-r--r--tests/integration/targets/vyos_firewall_rules/tests/cli/gathered.yaml12
-rw-r--r--tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml47
-rw-r--r--tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml17
-rw-r--r--tests/integration/targets/vyos_firewall_rules/vars/main.yaml74
-rw-r--r--tests/integration/targets/vyos_interfaces/tests/cli/_parsed_config.cfg12
-rw-r--r--tests/integration/targets/vyos_interfaces/tests/cli/empty_config.yaml27
-rw-r--r--tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml26
-rw-r--r--tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml16
-rw-r--r--tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml47
-rw-r--r--tests/integration/targets/vyos_interfaces/vars/main.yaml37
-rw-r--r--tests/integration/targets/vyos_l3_interfaces/tests/cli/_parsed_config.cfg9
-rw-r--r--tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml23
-rw-r--r--tests/integration/targets/vyos_l3_interfaces/tests/cli/gathered.yaml34
-rw-r--r--tests/integration/targets/vyos_l3_interfaces/tests/cli/parsed.yaml16
-rw-r--r--tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml44
-rw-r--r--tests/integration/targets/vyos_l3_interfaces/vars/main.yaml24
-rw-r--r--tests/integration/targets/vyos_lag_interfaces/tests/cli/_parsed_config.cfg8
-rw-r--r--tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml23
-rw-r--r--tests/integration/targets/vyos_lag_interfaces/tests/cli/gathered.yaml26
-rw-r--r--tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml33
-rw-r--r--tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml38
-rw-r--r--tests/integration/targets/vyos_lag_interfaces/vars/main.yaml10
-rw-r--r--tests/integration/targets/vyos_lldp_global/tests/cli/_parsed_config.cfg3
-rw-r--r--tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml23
-rw-r--r--tests/integration/targets/vyos_lldp_global/tests/cli/gathered.yaml25
-rw-r--r--tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml15
-rw-r--r--tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml28
-rw-r--r--tests/integration/targets/vyos_lldp_global/vars/main.yaml12
-rw-r--r--tests/integration/targets/vyos_lldp_interfaces/tests/cli/_parsed_config.cfg6
-rw-r--r--tests/integration/targets/vyos_lldp_interfaces/tests/cli/empty_config.yaml23
-rw-r--r--tests/integration/targets/vyos_lldp_interfaces/tests/cli/gathered.yaml25
-rw-r--r--tests/integration/targets/vyos_lldp_interfaces/tests/cli/parsed.yaml16
-rw-r--r--tests/integration/targets/vyos_lldp_interfaces/tests/cli/rendered.yaml37
-rw-r--r--tests/integration/targets/vyos_lldp_interfaces/vars/main.yaml30
-rw-r--r--tests/integration/targets/vyos_ospfv2/defaults/main.yaml3
-rw-r--r--tests/integration/targets/vyos_ospfv2/meta/main.yaml3
-rw-r--r--tests/integration/targets/vyos_ospfv2/tasks/cli.yaml19
-rw-r--r--tests/integration/targets/vyos_ospfv2/tasks/main.yaml4
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/_parsed_config.cfg29
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml35
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/_remove_config.yaml6
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/deleted.yaml (renamed from tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_rule.yaml)28
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/empty_config.yaml49
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/gathered.yaml24
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/merged.yaml101
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/merged_update.yaml70
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml15
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/rendered.yaml76
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/replaced.yaml100
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/rtt.yaml149
-rw-r--r--tests/integration/targets/vyos_ospfv2/vars/main.yaml485
-rw-r--r--tests/integration/targets/vyos_ospfv3/defaults/main.yaml3
-rw-r--r--tests/integration/targets/vyos_ospfv3/meta/main.yaml3
-rw-r--r--tests/integration/targets/vyos_ospfv3/tasks/cli.yaml19
-rw-r--r--tests/integration/targets/vyos_ospfv3/tasks/main.yaml4
-rw-r--r--tests/integration/targets/vyos_ospfv3/tests/cli/_parsed_config.cfg8
-rw-r--r--tests/integration/targets/vyos_ospfv3/tests/cli/_populate.yaml13
-rw-r--r--tests/integration/targets/vyos_ospfv3/tests/cli/_remove_config.yaml6
-rw-r--r--tests/integration/targets/vyos_ospfv3/tests/cli/deleted.yaml48
-rw-r--r--tests/integration/targets/vyos_ospfv3/tests/cli/empty_config.yaml49
-rw-r--r--tests/integration/targets/vyos_ospfv3/tests/cli/gathered.yaml25
-rw-r--r--tests/integration/targets/vyos_ospfv3/tests/cli/merged.yaml62
-rw-r--r--tests/integration/targets/vyos_ospfv3/tests/cli/merged_update.yaml61
-rw-r--r--tests/integration/targets/vyos_ospfv3/tests/cli/parsed.yaml15
-rw-r--r--tests/integration/targets/vyos_ospfv3/tests/cli/rendered.yaml38
-rw-r--r--tests/integration/targets/vyos_ospfv3/tests/cli/replaced.yaml66
-rw-r--r--tests/integration/targets/vyos_ospfv3/tests/cli/rtt.yaml75
-rw-r--r--tests/integration/targets/vyos_ospfv3/vars/main.yaml142
-rw-r--r--tests/integration/targets/vyos_static_routes/tests/cli/deleted.yaml62
-rw-r--r--tests/integration/targets/vyos_static_routes/tests/cli/deleted_nh.yaml68
-rw-r--r--tests/integration/targets/vyos_static_routes/vars/main.yaml26
72 files changed, 2559 insertions, 280 deletions
diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted.yaml
index 7acfe653..67bfd3c1 100644
--- a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted.yaml
+++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted.yaml
@@ -11,15 +11,11 @@
register: result
vyos.vyos.vyos_firewall_rules: &id001
config:
-
- afi: ipv6
rule_sets:
-
- name: UPLINK
-
- afi: ipv4
rule_sets:
-
- name: INBOUND
state: deleted
diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/gathered.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/gathered.yaml
index cdc8e51c..59c81aad 100644
--- a/tests/integration/targets/vyos_firewall_rules/tests/cli/gathered.yaml
+++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/gathered.yaml
@@ -9,9 +9,9 @@
- block:
- - name: Merge the provided configuration with the exisiting running configuration
+ - name: Gather the provided configuration with the exisiting running configuration
register: result
- vyos.vyos.vyos_firewall_rules: &id001
+ vyos.vyos.vyos_firewall_rules:
config:
state: gathered
@@ -21,14 +21,6 @@
- "{{ populate | symmetric_difference(result['gathered']) |length == 0\
\ }}"
- - name: Gather the existing running configuration (IDEMPOTENT)
- register: result
- vyos.vyos.vyos_firewall_rules: *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_firewall_rules/tests/cli/parsed.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml
index a793ac58..bc955249 100644
--- a/tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml
+++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml
@@ -3,39 +3,14 @@
msg: START vyos_firewall_rules parsed integration tests on connection={{ ansible_connection
}}
-- include_tasks: _remove_config.yaml
-
-- include_tasks: _populate.yaml
-
-- block:
-
- - name: Gather firewall_rules facts
- register: firewall_rules_facts
- vyos.vyos.vyos_facts:
- gather_subset:
- - default
- gather_network_resources:
- - firewall_rules
-
- - name: Provide the running configuration for parsing (config to be parsed)
- register: result
- vyos.vyos.vyos_firewall_rules: &id001
- running_config: "{{ lookup('file', '_parsed_config.cfg') }}"
- state: parsed
-
- - name: Assert that correct parsing done
- assert:
- that: "{{ ansible_facts['network_resources']['firewall_rules'] | symmetric_difference(result['parsed'])\
- \ |length == 0 }}"
-
- - name: Gather the existing running configuration (IDEMPOTENT)
- register: result
- vyos.vyos.vyos_firewall_rules: *id001
-
- - name: Assert that the previous task was idempotent
- assert:
- that:
- - result['changed'] == false
- always:
-
- - include_tasks: _remove_config.yaml
+- name: Parse externally provided Firewall rules config to agnostic model
+ register: result
+ vyos.vyos.vyos_firewall_rules:
+ running_config: "{{ lookup('file', '_parsed_config.cfg') }}"
+ state: parsed
+
+- name: Assert that config was correctly parsed
+ assert:
+ that:
+ - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length ==\
+ \ 0 }}"
diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml
index f000998e..6670fd7b 100644
--- a/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml
+++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml
@@ -5,13 +5,11 @@
- include_tasks: _remove_config.yaml
-- include_tasks: _populate.yaml
-
- block:
- name: Structure provided configuration into device specific commands
register: result
- vyos.vyos.vyos_firewall_rules: &id001
+ vyos.vyos.vyos_firewall_rules:
config:
- afi: ipv6
@@ -60,14 +58,5 @@
- "{{ rendered['commands'] | symmetric_difference(result['rendered'])\
\ |length == 0 }}"
- - name: Structure provided configuration into device specific commands (IDEMPOTENT)
- register: result
- vyos.vyos.vyos_firewall_rules: *id001
-
- - name: Assert that the previous task was idempotent
- assert:
- that:
- - result['changed'] == false
- always:
-
- - include_tasks: _remove_config.yaml
+- debug:
+ msg: END vyos_firewall_rules rendered integration tests on connection={{ ansible_connection }}
diff --git a/tests/integration/targets/vyos_firewall_rules/vars/main.yaml b/tests/integration/targets/vyos_firewall_rules/vars/main.yaml
index c15a101a..88323bae 100644
--- a/tests/integration/targets/vyos_firewall_rules/vars/main.yaml
+++ b/tests/integration/targets/vyos_firewall_rules/vars/main.yaml
@@ -196,42 +196,7 @@ overridden:
action: reject
description: Rule 502 is configured by Ansible
ipsec: match-ipsec
-rendered:
- commands:
- - set firewall ipv6-name UPLINK default-action 'accept'
- - set firewall ipv6-name UPLINK description 'This is ipv6 specific rule-set'
- - set firewall name INBOUND default-action 'accept'
- - set firewall name INBOUND description 'IPv4 INBOUND rule set'
- - set firewall name INBOUND rule 101 action 'accept'
- - set firewall name INBOUND rule 101
- - set firewall name INBOUND rule 101 description 'Rule 101 is configured by Ansible'
- - set firewall name INBOUND rule 101 ipsec 'match-ipsec'
- - set firewall name INBOUND rule 102 action 'reject'
- - set firewall name INBOUND rule 102
- - set firewall name INBOUND rule 102 description 'Rule 102 is configured by Ansible'
- - set firewall name INBOUND rule 102 ipsec 'match-ipsec'
- - set firewall name INBOUND rule 103 description 'Rule 103 is configured by Ansible'
- - set firewall name INBOUND rule 103 destination group address-group inbound
- - set firewall name INBOUND rule 103
- - set firewall name INBOUND rule 103 source address 192.0.2.0
- - set firewall name INBOUND rule 103 state established enable
- - set firewall name INBOUND rule 103 state related enable
- - set firewall name INBOUND rule 103 state invalid disable
- - set firewall name INBOUND rule 103 state new disable
- - set firewall name INBOUND rule 103 action 'accept'
-deleted_rs:
- commands:
- - delete firewall ipv6-name UPLINK
- - delete firewall name INBOUND
- after: []
-deleted_afi_all:
- commands:
- - delete firewall ipv6-name
- - delete firewall name
- after: []
-deleted_r:
- commands:
- - delete firewall ipv6-name UPLINK rule 1
+parsed:
after:
- afi: ipv6
rule_sets:
@@ -239,6 +204,10 @@ deleted_r:
description: This is ipv6 specific rule-set
default_action: accept
rules:
+ - number: 1
+ action: accept
+ description: Fwipv6-Rule 1 is configured by Ansible
+ ipsec: match-ipsec
- number: 2
action: accept
description: Fwipv6-Rule 2 is configured by Ansible
@@ -270,6 +239,39 @@ deleted_r:
new: false
invalid: false
related: true
+rendered:
+ commands:
+ - set firewall ipv6-name UPLINK default-action 'accept'
+ - set firewall ipv6-name UPLINK description 'This is ipv6 specific rule-set'
+ - set firewall name INBOUND default-action 'accept'
+ - set firewall name INBOUND description 'IPv4 INBOUND rule set'
+ - set firewall name INBOUND rule 101 action 'accept'
+ - set firewall name INBOUND rule 101
+ - set firewall name INBOUND rule 101 description 'Rule 101 is configured by Ansible'
+ - set firewall name INBOUND rule 101 ipsec 'match-ipsec'
+ - set firewall name INBOUND rule 102 action 'reject'
+ - set firewall name INBOUND rule 102
+ - set firewall name INBOUND rule 102 description 'Rule 102 is configured by Ansible'
+ - set firewall name INBOUND rule 102 ipsec 'match-ipsec'
+ - set firewall name INBOUND rule 103 description 'Rule 103 is configured by Ansible'
+ - set firewall name INBOUND rule 103 destination group address-group inbound
+ - set firewall name INBOUND rule 103
+ - set firewall name INBOUND rule 103 source address 192.0.2.0
+ - set firewall name INBOUND rule 103 state established enable
+ - set firewall name INBOUND rule 103 state related enable
+ - set firewall name INBOUND rule 103 state invalid disable
+ - set firewall name INBOUND rule 103 state new disable
+ - set firewall name INBOUND rule 103 action 'accept'
+deleted_rs:
+ commands:
+ - delete firewall ipv6-name UPLINK
+ - delete firewall name INBOUND
+ after: []
+deleted_afi_all:
+ commands:
+ - delete firewall ipv6-name
+ - delete firewall name
+ after: []
round_trip:
after:
- afi: ipv6
diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_interfaces/tests/cli/_parsed_config.cfg
new file mode 100644
index 00000000..e5c3fc78
--- /dev/null
+++ b/tests/integration/targets/vyos_interfaces/tests/cli/_parsed_config.cfg
@@ -0,0 +1,12 @@
+set interfaces ethernet eth1 description 'Configured by Ansible - Interface 1'
+set interfaces ethernet eth1 duplex 'auto'
+set interfaces ethernet eth1 hw-id '08:00:27:da:67:43'
+set interfaces ethernet eth1 mtu '1500'
+set interfaces ethernet eth1 speed 'auto'
+set interfaces ethernet eth1 vif 100 description 'Eth1 - VIF 100'
+set interfaces ethernet eth1 vif 100 mtu '400'
+set interfaces ethernet eth1 vif 101 description 'Eth1 - VIF 101'
+set interfaces ethernet eth2 description 'Configured by Ansible - Interface 2 (ADMIN DOWN)'
+set interfaces ethernet eth2 'disable'
+set interfaces ethernet eth2 hw-id '08:00:27:d8:70:b0'
+set interfaces ethernet eth2 mtu '600'
diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/empty_config.yaml
index e1e154dc..652f1589 100644
--- a/tests/integration/targets/vyos_interfaces/tests/cli/empty_config.yaml
+++ b/tests/integration/targets/vyos_interfaces/tests/cli/empty_config.yaml
@@ -1,7 +1,7 @@
---
- debug:
- msg: START vyos_interfaces empty_config integration tests on connection={{ ansible_connection
- }}
+ msg: START vyos_interfaces empty_config integration tests on connection={{
+ ansible_connection }}
- name: Merged with empty config should give appropriate error message
register: result
@@ -35,3 +35,26 @@
- 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_interfaces:
+ 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_interfaces:
+ 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_interfaces/tests/cli/gathered.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml
new file mode 100644
index 00000000..ac9892cb
--- /dev/null
+++ b/tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml
@@ -0,0 +1,26 @@
+---
+- debug:
+ msg: START vyos_interfaces gathered integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Gather the provided configuration with the exisiting running configuration
+ register: result
+ vyos.vyos.vyos_interfaces:
+ config:
+ state: gathered
+
+ - name: Assert that gathered dicts was correctly generated
+ assert:
+ that:
+ - "{{ populate | symmetric_difference(result['gathered']) |length == 0\
+ \ }}"
+
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml
new file mode 100644
index 00000000..a44fc2f3
--- /dev/null
+++ b/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml
@@ -0,0 +1,16 @@
+---
+- debug:
+ msg: START vyos_interfaces parsed integration tests on connection={{ ansible_connection
+ }}
+
+- name: Parse externally provided interfaces config to agnostic model
+ register: result
+ vyos.vyos.vyos_interfaces:
+ running_config: "{{ lookup('file', '_parsed_config.cfg') }}"
+ state: parsed
+
+- name: Assert that config was correctly parsed
+ assert:
+ that:
+ - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length ==\
+ \ 0 }}"
diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml
new file mode 100644
index 00000000..5030d718
--- /dev/null
+++ b/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml
@@ -0,0 +1,47 @@
+---
+- debug:
+ msg: START vyos_interfaces rendered integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Structure provided configuration into device specific commands
+ register: result
+ vyos.vyos.vyos_interfaces:
+ config:
+ - name: eth0
+ enabled: true
+ duplex: auto
+ speed: auto
+ - name: eth1
+ description: Configured by Ansible - Interface 1
+ mtu: 1500
+ speed: auto
+ duplex: auto
+ enabled: true
+ vifs:
+ - vlan_id: 100
+ description: Eth1 - VIF 100
+ mtu: 400
+ enabled: true
+ - vlan_id: 101
+ description: Eth1 - VIF 101
+ enabled: true
+ - name: eth2
+ description: Configured by Ansible - Interface 2 (ADMIN DOWN)
+ mtu: 600
+ enabled: false
+ state: rendered
+
+ - name: Assert that correct set of commands were generated
+ assert:
+ that:
+ - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\
+ \ |length == 0 }}"
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_interfaces/vars/main.yaml b/tests/integration/targets/vyos_interfaces/vars/main.yaml
index b7300800..84a8bf05 100644
--- a/tests/integration/targets/vyos_interfaces/vars/main.yaml
+++ b/tests/integration/targets/vyos_interfaces/vars/main.yaml
@@ -104,6 +104,26 @@ replaced:
enabled: true
duplex: auto
speed: auto
+parsed:
+ after:
+ - name: eth1
+ description: Configured by Ansible - Interface 1
+ mtu: 1500
+ speed: auto
+ duplex: auto
+ enabled: true
+ vifs:
+ - vlan_id: 100
+ description: Eth1 - VIF 100
+ mtu: 400
+ enabled: true
+ - vlan_id: 101
+ description: Eth1 - VIF 101
+ enabled: true
+ - name: eth2
+ description: Configured by Ansible - Interface 2 (ADMIN DOWN)
+ mtu: 600
+ enabled: false
overridden:
commands:
- delete interfaces ethernet eth1 description
@@ -133,6 +153,23 @@ overridden:
vifs:
- vlan_id: 200
enabled: true
+rendered:
+ commands:
+ - set interfaces ethernet eth0 duplex 'auto'
+ - set interfaces ethernet eth0 speed 'auto'
+ - delete interfaces ethernet eth0 disable
+ - set interfaces ethernet eth1 duplex 'auto'
+ - delete interfaces ethernet eth1 disable
+ - set interfaces ethernet eth1 speed 'auto'
+ - set interfaces ethernet eth1 description 'Configured by Ansible - Interface 1'
+ - set interfaces ethernet eth1 mtu '1500'
+ - set interfaces ethernet eth1 vif 100 description 'Eth1 - VIF 100'
+ - set interfaces ethernet eth1 vif 100 mtu '400'
+ - set interfaces ethernet eth1 vif 101 description 'Eth1 - VIF 101'
+ - set interfaces ethernet eth2 disable
+ - set interfaces ethernet eth2 description 'Configured by Ansible - Interface 2 (ADMIN DOWN)'
+ - set interfaces ethernet eth2 mtu '600'
+
deleted:
commands:
- delete interfaces ethernet eth1 description
diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_l3_interfaces/tests/cli/_parsed_config.cfg
new file mode 100644
index 00000000..ef070a72
--- /dev/null
+++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/_parsed_config.cfg
@@ -0,0 +1,9 @@
+set interfaces ethernet eth1 address '192.0.2.10/24'
+set interfaces ethernet eth1 address '2001:db8::10/32'
+set interfaces ethernet eth1 hw-id '08:00:27:da:67:43'
+set interfaces ethernet eth2 address '198.51.100.10/24'
+set interfaces ethernet eth2 hw-id '08:00:27:d8:70:b0'
+set interfaces ethernet eth2 vif 101 address '198.51.100.130/25'
+set interfaces ethernet eth2 vif 101 address '2001:db8::20/32'
+
+
diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml
index 96d4cda9..9929dd7f 100644
--- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml
+++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml
@@ -35,3 +35,26 @@
- 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_l3_interfaces:
+ 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_l3_interfaces:
+ 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_l3_interfaces/tests/cli/gathered.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/gathered.yaml
new file mode 100644
index 00000000..625047bb
--- /dev/null
+++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/gathered.yaml
@@ -0,0 +1,34 @@
+---
+- debug:
+ msg: START vyos_l3_interfaces gathered integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Merge the provided configuration with the exisiting running configuration
+ register: result
+ vyos.vyos.vyos_l3_interfaces: &id001
+ config:
+ state: gathered
+
+ - name: Assert that gathered dicts was correctly generated
+ assert:
+ that:
+ - "{{ populate | symmetric_difference(result['gathered']) |length == 0\
+ \ }}"
+
+ - name: Gather the existing running configuration (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_l3_interfaces: *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_l3_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/parsed.yaml
new file mode 100644
index 00000000..d5ff2056
--- /dev/null
+++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/parsed.yaml
@@ -0,0 +1,16 @@
+---
+- debug:
+ msg: START vyos_l3_nterfaces parsed integration tests on connection={{ ansible_connection
+ }}
+
+- name: Parse externally provided interfaces config to agnostic model
+ register: result
+ vyos.vyos.vyos_l3_interfaces:
+ running_config: "{{ lookup('file', '_parsed_config.cfg') }}"
+ state: parsed
+
+- name: Assert that config was correctly parsed
+ assert:
+ that:
+ - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length ==\
+ \ 0 }}"
diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml
new file mode 100644
index 00000000..02a28655
--- /dev/null
+++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml
@@ -0,0 +1,44 @@
+---
+- debug:
+ msg: START vyos_l3_interfaces rendered integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Structure provided configuration into device specific commands
+ register: result
+ vyos.vyos.vyos_l3_interfaces: &id001
+ config:
+ - name: eth1
+ ipv4:
+ - address: 192.0.2.14/24
+ - name: eth2
+ ipv4:
+ - address: 192.0.2.10/24
+ - address: 192.0.2.11/24
+ ipv6:
+ - address: 2001:db8::10/32
+ - address: 2001:db8::12/32
+ state: rendered
+
+ - name: Assert that correct set of commands were generated
+ assert:
+ that:
+ - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\
+ \ |length == 0 }}"
+
+ - name: Structure provided configuration into device specific commands (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_l3_interfaces: *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_l3_interfaces/vars/main.yaml b/tests/integration/targets/vyos_l3_interfaces/vars/main.yaml
index ee329d30..e9781e6a 100644
--- a/tests/integration/targets/vyos_l3_interfaces/vars/main.yaml
+++ b/tests/integration/targets/vyos_l3_interfaces/vars/main.yaml
@@ -79,6 +79,30 @@ overridden:
ipv4:
- address: 192.0.2.15/24
- name: eth2
+parsed:
+ after:
+ - name: eth1
+ ipv4:
+ - address: 192.0.2.10/24
+ ipv6:
+ - address: 2001:db8::10/32
+ - name: eth2
+ ipv4:
+ - address: 198.51.100.10/24
+ vifs:
+ - vlan_id: 101
+ ipv4:
+ - address: 198.51.100.130/25
+ ipv6:
+ - address: 2001:db8::20/32
+rendered:
+ commands:
+ - set interfaces ethernet eth1 address '192.0.2.14/24'
+ - set interfaces ethernet eth2 address '192.0.2.11/24'
+ - set interfaces ethernet eth2 address '192.0.2.10/24'
+ - set interfaces ethernet eth2 address '2001:db8::10/32'
+ - set interfaces ethernet eth2 address '2001:db8::12/32'
+
deleted:
commands:
- delete interfaces ethernet eth1 address '192.0.2.14/24'
diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_parsed_config.cfg
new file mode 100644
index 00000000..ea3bfce6
--- /dev/null
+++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_parsed_config.cfg
@@ -0,0 +1,8 @@
+set interfaces bonding bond0 hash-policy 'layer2'
+set interfaces bonding bond0 mode 'active-backup'
+set interfaces bonding bond0 primary 'eth1'
+set interfaces bonding bond1 hash-policy 'layer2+3'
+set interfaces bonding bond1 mode 'active-backup'
+set interfaces bonding bond1 primary 'eth2'
+set interfaces ethernet eth1 bond-group 'bond0'
+set interfaces ethernet eth2 bond-group 'bond1' \ No newline at end of file
diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml
index 3894fb59..6e89eaed 100644
--- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml
+++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml
@@ -35,3 +35,26 @@
- 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_lag_interfaces:
+ 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_lag_interfaces:
+ 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_lag_interfaces/tests/cli/gathered.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/gathered.yaml
new file mode 100644
index 00000000..aca168dd
--- /dev/null
+++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/gathered.yaml
@@ -0,0 +1,26 @@
+---
+- debug:
+ msg: START vyos_lag_interfaces gathered integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Gather the provided configuration with the exisiting running configuration
+ register: result
+ vyos.vyos.vyos_lag_interfaces: &id001
+ config:
+ state: gathered
+
+ - name: Assert that gathered dicts was correctly generated
+ assert:
+ that:
+ - "{{ populate | symmetric_difference(result['gathered']) |length == 0\
+ \ }}"
+
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml
new file mode 100644
index 00000000..ed7bc612
--- /dev/null
+++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml
@@ -0,0 +1,33 @@
+---
+- debug:
+ msg: START vyos_lag_interfaces parsed integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Gather lag_interfaces facts
+ register: lag_interfaces_facts
+ vyos.vyos.vyos_facts:
+ gather_subset:
+ - default
+ gather_network_resources:
+ - lag_interfaces
+
+ - name: Provide the running configuration for parsing (config to be parsed)
+ register: result
+ vyos.vyos.vyos_lag_interfaces:
+ running_config: "{{ lookup('file', '_parsed_config.cfg') }}"
+ state: parsed
+
+ - name: Assert that correct parsing done
+ assert:
+ that: "{{ ansible_facts['network_resources']['lag_interfaces'] | symmetric_difference(result['parsed'])\
+ \ |length == 0 }}"
+
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml
new file mode 100644
index 00000000..e6d7928c
--- /dev/null
+++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml
@@ -0,0 +1,38 @@
+---
+- debug:
+ msg: START vyos_lag_interfaces rendered integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Structure provided configuration into device specific commands
+ register: result
+ vyos.vyos.vyos_lag_interfaces:
+ config:
+ - name: bond0
+ hash_policy: layer2
+ members:
+ - member: eth1
+ mode: active-backup
+ primary: eth1
+ - name: bond1
+ hash_policy: layer2+3
+ members:
+ - member: eth2
+ mode: active-backup
+ primary: eth2
+ state: rendered
+
+ - name: Assert that correct set of commands were generated
+ assert:
+ that:
+ - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\
+ \ |length == 0 }}"
+
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_lag_interfaces/vars/main.yaml b/tests/integration/targets/vyos_lag_interfaces/vars/main.yaml
index 57836936..9784fb97 100644
--- a/tests/integration/targets/vyos_lag_interfaces/vars/main.yaml
+++ b/tests/integration/targets/vyos_lag_interfaces/vars/main.yaml
@@ -83,6 +83,16 @@ deleted:
after:
- name: bond0
- name: bond1
+rendered:
+ commands:
+ - set interfaces bonding bond0 hash-policy 'layer2'
+ - set interfaces ethernet eth1 bond-group 'bond0'
+ - set interfaces bonding bond0 mode 'active-backup'
+ - set interfaces bonding bond0 primary 'eth1'
+ - set interfaces bonding bond1 hash-policy 'layer2+3'
+ - set interfaces ethernet eth2 bond-group 'bond1'
+ - set interfaces bonding bond1 mode 'active-backup'
+ - set interfaces bonding bond1 primary 'eth2'
round_trip:
after:
- name: bond0
diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_lldp_global/tests/cli/_parsed_config.cfg
new file mode 100644
index 00000000..9c9f66c5
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp_global/tests/cli/_parsed_config.cfg
@@ -0,0 +1,3 @@
+set service lldp legacy-protocols 'fdp'
+set service lldp legacy-protocols 'cdp'
+set service lldp management-address '192.0.2.17'
diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml
index a197c454..0333fa41 100644
--- a/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml
+++ b/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml
@@ -24,3 +24,26 @@
- assert:
that:
- result.msg == 'value of config parameter must not be empty for state replaced'
+
+- name: Parsed with empty running_config should give appropriate error message
+ register: result
+ ignore_errors: true
+ vyos.vyos.vyos_lldp_global:
+ 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_lldp_global:
+ 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_lldp_global/tests/cli/gathered.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/gathered.yaml
new file mode 100644
index 00000000..95e01de6
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp_global/tests/cli/gathered.yaml
@@ -0,0 +1,25 @@
+---
+- debug:
+ msg: START vyos_lldp_global gathered integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Gather the provided configuration with the exisiting running configuration
+ register: result
+ vyos.vyos.vyos_lldp_global:
+ config:
+ state: gathered
+
+ - name: Assert that gathered dicts was correctly generated
+ assert:
+ that:
+ - "{{ populate == result['gathered'] }}"
+
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml
new file mode 100644
index 00000000..b9c3abf0
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml
@@ -0,0 +1,15 @@
+---
+- debug:
+ msg: START vyos_lldp_global parsed integration tests on connection={{ ansible_connection
+ }}
+
+- name: Parse externally provided LLDP global config to agnostic model
+ register: result
+ vyos.vyos.vyos_lldp_global:
+ running_config: "{{ lookup('file', '_parsed_config.cfg') }}"
+ state: parsed
+
+- name: Assert that config was correctly parsed
+ assert:
+ that:
+ - "{{ parsed['after'] == result['parsed'] }}"
diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml
new file mode 100644
index 00000000..5e9f4c5a
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml
@@ -0,0 +1,28 @@
+---
+- debug:
+ msg: START vyos_lldp_global rendered integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- block:
+
+ - name: Structure provided configuration into device specific commands
+ register: result
+ vyos.vyos.vyos_lldp_global:
+ config:
+ address: 192.0.2.17
+ enable: true
+ legacy_protocols:
+ - cdp
+ state: rendered
+
+ - name: Assert that correct set of commands were generated
+ assert:
+ that:
+ - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\
+ \ |length == 0 }}"
+
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_lldp_global/vars/main.yaml b/tests/integration/targets/vyos_lldp_global/vars/main.yaml
index 81e71bed..622b8e4d 100644
--- a/tests/integration/targets/vyos_lldp_global/vars/main.yaml
+++ b/tests/integration/targets/vyos_lldp_global/vars/main.yaml
@@ -31,6 +31,18 @@ replaced:
- cdp
- edp
- sonmp
+parsed:
+ after:
+ address: 192.0.2.17
+ enable: true
+ legacy_protocols:
+ - fdp
+ - cdp
+rendered:
+ commands:
+ - set service lldp legacy-protocols 'cdp'
+ - set service lldp
+ - set service lldp management-address '192.0.2.17'
deleted:
commands:
- delete service lldp management-address
diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_parsed_config.cfg
new file mode 100644
index 00000000..40c96c40
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_parsed_config.cfg
@@ -0,0 +1,6 @@
+set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'
+set service lldp interface eth1 location civic-based country-code 'US'
+set service lldp interface eth2 location coordinate-based altitude '2200'
+set service lldp interface eth2 location coordinate-based datum 'WGS84'
+set service lldp interface eth2 location coordinate-based latitude '33.524449N'
+set service lldp interface eth2 location coordinate-based longitude '222.267255W' \ No newline at end of file
diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/empty_config.yaml
index a5ff0a8e..4ef40c9e 100644
--- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/empty_config.yaml
+++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/empty_config.yaml
@@ -35,3 +35,26 @@
- 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_lldp_interfaces:
+ 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_lldp_interfaces:
+ 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_lldp_interfaces/tests/cli/gathered.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/gathered.yaml
new file mode 100644
index 00000000..180b62f8
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/gathered.yaml
@@ -0,0 +1,25 @@
+---
+- debug:
+ msg: START vyos_lldp_interfaces gathered integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Gather the provided configuration with the exisiting running configuration
+ register: result
+ vyos.vyos.vyos_lldp_interfaces:
+ config:
+ state: gathered
+
+ - name: Assert that gathered dicts was correctly generated
+ assert:
+ that:
+ - "{{ populate | symmetric_difference(result['gathered']) |length == 0\
+ \ }}"
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/parsed.yaml
new file mode 100644
index 00000000..0ca52bed
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/parsed.yaml
@@ -0,0 +1,16 @@
+---
+- debug:
+ msg: START vyos_lldp_nterfaces parsed integration tests on connection={{ ansible_connection
+ }}
+
+- name: Parse externally provided interfaces config to agnostic model
+ register: result
+ vyos.vyos.vyos_lldp_interfaces:
+ running_config: "{{ lookup('file', '_parsed_config.cfg') }}"
+ state: parsed
+
+- name: Assert that config was correctly parsed
+ assert:
+ that:
+ - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length ==\
+ \ 0 }}"
diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rendered.yaml
new file mode 100644
index 00000000..342e64b9
--- /dev/null
+++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rendered.yaml
@@ -0,0 +1,37 @@
+---
+- debug:
+ msg: START vyos_lldp_interfaces rendered integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_config.yaml
+
+- block:
+
+ - name: Structure provided configuration into device specific commands
+ register: result
+ vyos.vyos.vyos_lldp_interfaces:
+ config:
+ - name: eth1
+ location:
+ civic_based:
+ country_code: US
+ ca_info:
+ - ca_type: 0
+ ca_value: ENGLISH
+ - name: eth2
+ location:
+ coordinate_based:
+ altitude: 2200
+ datum: WGS84
+ longitude: 222.267255W
+ latitude: 33.524449N
+ state: rendered
+
+ - name: Assert that correct set of commands were generated
+ assert:
+ that:
+ - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\
+ \ |length == 0 }}"
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_lldp_interfaces/vars/main.yaml b/tests/integration/targets/vyos_lldp_interfaces/vars/main.yaml
index 3cb684ea..092f653c 100644
--- a/tests/integration/targets/vyos_lldp_interfaces/vars/main.yaml
+++ b/tests/integration/targets/vyos_lldp_interfaces/vars/main.yaml
@@ -9,10 +9,6 @@ merged:
- set service lldp interface eth2 location coordinate-based altitude '2200'
- set service lldp interface eth2 location coordinate-based datum 'WGS84'
- set service lldp interface eth2 location coordinate-based longitude '222.267255W'
- - set service lldp interface eth2 location coordinate-based latitude '33.524449N'
- - set service lldp interface eth2 location coordinate-based altitude '2200'
- - set service lldp interface eth2 location coordinate-based datum 'WGS84'
- - set service lldp interface eth2 location coordinate-based longitude '222.267255W'
- set service lldp interface eth2
after:
- name: eth1
@@ -44,6 +40,16 @@ populate:
datum: WGS84
longitude: 222.267255W
latitude: 33.524449N
+rendered:
+ commands:
+ - set service lldp interface eth1 location civic-based country-code 'US'
+ - set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH'
+ - set service lldp interface eth1
+ - set service lldp interface eth2 location coordinate-based latitude '33.524449N'
+ - set service lldp interface eth2 location coordinate-based altitude '2200'
+ - set service lldp interface eth2 location coordinate-based datum 'WGS84'
+ - set service lldp interface eth2 location coordinate-based longitude '222.267255W'
+ - set service lldp interface eth2
replaced:
commands:
- delete service lldp interface eth2 location
@@ -91,6 +97,22 @@ overridden:
- name: eth2
location:
elin: 0000000911
+parsed:
+ after:
+ - name: eth1
+ location:
+ civic_based:
+ country_code: US
+ ca_info:
+ - ca_type: 0
+ ca_value: ENGLISH
+ - name: eth2
+ location:
+ coordinate_based:
+ altitude: 2200
+ datum: WGS84
+ longitude: 222.267255W
+ latitude: 33.524449N
deleted:
commands:
- delete service lldp interface eth1
diff --git a/tests/integration/targets/vyos_ospfv2/defaults/main.yaml b/tests/integration/targets/vyos_ospfv2/defaults/main.yaml
new file mode 100644
index 00000000..852a6bee
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/defaults/main.yaml
@@ -0,0 +1,3 @@
+---
+testcase: '[^_].*'
+test_items: []
diff --git a/tests/integration/targets/vyos_ospfv2/meta/main.yaml b/tests/integration/targets/vyos_ospfv2/meta/main.yaml
new file mode 100644
index 00000000..7413320e
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/meta/main.yaml
@@ -0,0 +1,3 @@
+---
+dependencies:
+ - prepare_vyos_tests
diff --git a/tests/integration/targets/vyos_ospfv2/tasks/cli.yaml b/tests/integration/targets/vyos_ospfv2/tasks/cli.yaml
new file mode 100644
index 00000000..93eb2fe4
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/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_ospfv2/tasks/main.yaml b/tests/integration/targets/vyos_ospfv2/tasks/main.yaml
new file mode 100644
index 00000000..a3db933e
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tasks/main.yaml
@@ -0,0 +1,4 @@
+---
+- include: cli.yaml
+ tags:
+ - cli
diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_ospfv2/tests/cli/_parsed_config.cfg
new file mode 100644
index 00000000..9cc720b4
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/_parsed_config.cfg
@@ -0,0 +1,29 @@
+set protocols ospf area 2 area-type 'normal'
+set protocols ospf area 2 authentication 'plaintext-password'
+set protocols ospf area 2 shortcut 'enable'
+set protocols ospf area 3 area-type 'nssa'
+set protocols ospf area 4 area-type stub default-cost '20'
+set protocols ospf area 4 network '192.0.2.0/24'
+set protocols ospf area 4 range 192.0.3.0/24 cost '10'
+set protocols ospf area 4 range 192.0.4.0/24 cost '12'
+set protocols ospf auto-cost reference-bandwidth '2'
+set protocols ospf default-information originate 'always'
+set protocols ospf default-information originate metric '10'
+set protocols ospf default-information originate metric-type '2'
+set protocols ospf default-information originate route-map 'ingress'
+set protocols ospf log-adjacency-changes 'detail'
+set protocols ospf max-metric router-lsa 'administrative'
+set protocols ospf max-metric router-lsa on-shutdown '10'
+set protocols ospf max-metric router-lsa on-startup '10'
+set protocols ospf mpls-te 'enable'
+set protocols ospf mpls-te router-address '192.0.11.11'
+set protocols ospf neighbor 192.0.11.12 poll-interval '10'
+set protocols ospf neighbor 192.0.11.12 priority '2'
+set protocols ospf parameters abr-type 'cisco'
+set protocols ospf parameters 'opaque-lsa'
+set protocols ospf parameters 'rfc1583-compatibility'
+set protocols ospf parameters router-id '192.0.1.1'
+set protocols ospf passive-interface 'eth1'
+set protocols ospf passive-interface 'eth2'
+set protocols ospf redistribute bgp metric '10'
+set protocols ospf redistribute bgp metric-type '2'
diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml
new file mode 100644
index 00000000..9f358d5e
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml
@@ -0,0 +1,35 @@
+---
+- name: Setup
+ vars:
+ lines: "set protocols ospf mpls-te 'enable' \n
+ set protocols ospf mpls-te router-address '192.0.11.11' \n
+ set protocols ospf redistribute bgp metric-type '2' \n
+ set protocols ospf redistribute bgp metric '10'\n
+ set protocols ospf default-information originate metric-type '2' \n
+ set protocols ospf default-information originate 'always' \n
+ set protocols ospf default-information originate metric '10' \n
+ set protocols ospf default-information originate route-map 'ingress' \n
+ set protocols ospf auto-cost reference-bandwidth '2' \n
+ set protocols ospf parameters router-id '192.0.1.1' \n
+ set protocols ospf parameters 'opaque-lsa' \n
+ set protocols ospf parameters abr-type 'cisco' \n
+ set protocols ospf parameters 'rfc1583-compatibility' \n
+ set protocols ospf passive-interface 'eth1' \n
+ set protocols ospf passive-interface 'eth2' \n
+ set protocols ospf max-metric router-lsa on-shutdown '10' \n
+ set protocols ospf max-metric router-lsa 'administrative' \n
+ set protocols ospf max-metric router-lsa on-startup '10' \n
+ set protocols ospf log-adjacency-changes 'detail' \n
+ set protocols ospf neighbor 192.0.11.12 priority '2' \n
+ set protocols ospf neighbor 192.0.11.12 poll-interval '10' \n
+ set protocols ospf area 2 authentication 'plaintext-password' \n
+ set protocols ospf area 2 shortcut 'enable' \n
+ set protocols ospf area 2 area-type 'normal' \n
+ set protocols ospf area 3 area-type 'nssa' \n
+ set protocols ospf area 4 range 192.0.3.0/24 cost '10' \n
+ set protocols ospf area 4 range 192.0.4.0/24 cost '12' \n
+ set protocols ospf area 4 area-type stub default-cost '20' \n
+ set protocols ospf area 4 network '192.0.2.0/24'"
+
+ ansible.netcommon.cli_config:
+ config: '{{ lines }}'
diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/_remove_config.yaml
new file mode 100644
index 00000000..73608705
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/_remove_config.yaml
@@ -0,0 +1,6 @@
+---
+- name: Remove Config
+ vars:
+ lines: "delete protocols ospf\n"
+ ansible.netcommon.cli_config:
+ config: '{{ lines }}'
diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_rule.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/deleted.yaml
index d77e2a9c..a61f5a7c 100644
--- a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_rule.yaml
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/deleted.yaml
@@ -1,46 +1,37 @@
---
- debug:
- msg: Start vyos_firewall_rules deleted integration tests ansible_connection={{
+ msg: Start vyos_ospfv2 deleted integration tests ansible_connection={{
ansible_connection }}
- include_tasks: _populate.yaml
- block:
- - name: Delete firewall rule.
+ - name: Delete attributes of ospfv2.
register: result
- vyos.vyos.vyos_firewall_rules: &id001
+ vyos.vyos.vyos_ospfv2: &id001
config:
-
- - afi: ipv6
- rule_sets:
-
- - name: UPLINK
- rules:
-
- - number: 1
state: deleted
- name: Assert that the before dicts were correctly generated
assert:
that:
- - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
+ - "{{ populate == result['before'] }}"
- name: Assert that the correct set of commands were generated
assert:
that:
- - "{{ deleted_r['commands'] | symmetric_difference(result['commands'])\
- \ |length == 0 }}"
+ - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\
+ \ == 0 }}"
- name: Assert that the after dicts were correctly generated
assert:
that:
- - "{{ deleted_r['after'] | symmetric_difference(result['after']) |length\
- \ == 0 }}"
+ - "{{ deleted['after'] == result['after'] }}"
- name: Delete attributes of given interfaces (IDEMPOTENT)
register: result
- vyos.vyos.vyos_firewall_rules: *id001
+ vyos.vyos.vyos_ospfv2: *id001
- name: Assert that the previous task was idempotent
assert:
@@ -51,8 +42,7 @@
- name: Assert that the before dicts were correctly generated
assert:
that:
- - "{{ deleted_r['after'] | symmetric_difference(result['before']) |length\
- \ == 0 }}"
+ - "{{ deleted['after'] == result['before'] }}"
always:
- include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/empty_config.yaml
new file mode 100644
index 00000000..4566bf47
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/empty_config.yaml
@@ -0,0 +1,49 @@
+---
+- debug:
+ msg: START vyos_ospfv2 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_ospfv2:
+ 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_ospfv2:
+ config:
+ state: replaced
+
+- assert:
+ that:
+ - result.msg == 'value of config parameter must not be empty for state replaced'
+
+- name: Parsed with empty running_config should give appropriate error message
+ register: result
+ ignore_errors: true
+ vyos.vyos.vyos_ospfv2:
+ 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_ospfv2:
+ 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_ospfv2/tests/cli/gathered.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/gathered.yaml
new file mode 100644
index 00000000..bc5e1e27
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/gathered.yaml
@@ -0,0 +1,24 @@
+---
+- debug:
+ msg: START vyos_ospfv2 gathered integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Gather the provided configuration with the exisiting running configuration
+ register: result
+ vyos.vyos.vyos_ospfv2:
+ config:
+ state: gathered
+
+ - name: Assert that gathered dicts was correctly generated
+ assert:
+ that:
+ - "{{ populate == result['gathered'] }}"
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/merged.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/merged.yaml
new file mode 100644
index 00000000..6a58bb57
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/merged.yaml
@@ -0,0 +1,101 @@
+---
+- debug:
+ msg: START vyos_ospfv2 merged integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_config.yaml
+
+- block:
+
+ - name: Merge the provided configuration with the exisiting running configuration
+ register: result
+ vyos.vyos.vyos_ospfv2: &id001
+ config:
+ log_adjacency_changes: 'detail'
+ max_metric:
+ router_lsa:
+ administrative: true
+ on_shutdown: 10
+ on_startup: 10
+ default_information:
+ originate:
+ always: true
+ metric: 10
+ metric_type: 2
+ route_map: 'ingress'
+ mpls_te:
+ enabled: true
+ router_address: '192.0.11.11'
+ auto_cost:
+ reference_bandwidth: 2
+ neighbor:
+ - neighbor_id: '192.0.11.12'
+ poll_interval: 10
+ priority: 2
+ redistribute:
+ - route_type: 'bgp'
+ metric: 10
+ metric_type: 2
+ passive_interface:
+ - 'eth1'
+ - 'eth2'
+ parameters:
+ router_id: '192.0.1.1'
+ opaque_lsa: true
+ rfc1583_compatibility: true
+ abr_type: 'cisco'
+ areas:
+ - area_id: '2'
+ area_type:
+ normal: true
+ authentication: "plaintext-password"
+ shortcut: 'enable'
+ - area_id: '3'
+ area_type:
+ nssa:
+ set: true
+ - area_id: '4'
+ area_type:
+ stub:
+ default_cost: 20
+ network:
+ - address: '192.0.2.0/24'
+ range:
+ - address: '192.0.3.0/24'
+ cost: 10
+ - address: '192.0.4.0/24'
+ cost: 12
+ state: merged
+
+ - name: Assert that before dicts were correctly generated
+ assert:
+ that: "{{ merged['before'] == result['before'] }}"
+
+ - name: Assert that correct set of commands were generated
+ assert:
+ that:
+ - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\
+ \ == 0 }}"
+
+ - name: Assert that after dicts was correctly generated
+ assert:
+ that:
+ - "{{ merged['after'] == result['after'] }}"
+
+ - name: Merge the provided configuration with the existing running configuration
+ (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_ospfv2: *id001
+
+ - name: Assert that the previous task was idempotent
+ assert:
+ that:
+ - result['changed'] == false
+
+ - name: Assert that before dicts were correctly generated
+ assert:
+ that:
+ - "{{ merged['after'] == result['before'] }}"
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/merged_update.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/merged_update.yaml
new file mode 100644
index 00000000..9b6823c9
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/merged_update.yaml
@@ -0,0 +1,70 @@
+---
+- debug:
+ msg: START vyos_ospfv2 merged integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Merge the provided configuration with the exisiting running configuration
+ register: result
+ vyos.vyos.vyos_ospfv2: &id001
+ config:
+ log_adjacency_changes: 'detail'
+ max_metric:
+ router_lsa:
+ administrative: true
+ on_shutdown: 10
+ on_startup: 10
+ passive_interface:
+ - 'eth1'
+ areas:
+ - area_id: '3'
+ area_type:
+ nssa:
+ set: true
+ - area_id: '4'
+ area_type:
+ stub:
+ set: false
+ network:
+ - address: '192.0.2.0/24'
+ - address: '192.0.22.0/24'
+ - address: '192.0.32.0/24'
+ state: merged
+
+ - name: Assert that before dicts were correctly generated
+ assert:
+ that: "{{ merged_update['before'] == result['before'] }}"
+
+ - name: Assert that correct set of commands were generated
+ assert:
+ that:
+ - "{{ merged_update['commands'] | symmetric_difference(result['commands']) |length\
+ \ == 0 }}"
+
+ - name: Assert that after dicts was correctly generated
+ assert:
+ that:
+ - "{{ merged_update['after'] == result['after'] }}"
+
+ - name: Merge the provided configuration with the existing running configuration
+ (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_ospfv2: *id001
+
+ - name: Assert that the previous task was idempotent
+ assert:
+ that:
+ - result['changed'] == false
+
+ - name: Assert that before dicts were correctly generated
+ assert:
+ that:
+ - "{{ merged_update['after'] == result['before'] }}"
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml
new file mode 100644
index 00000000..cfa29f99
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml
@@ -0,0 +1,15 @@
+---
+- debug:
+ msg: START vyos_ospfv2 parsed integration tests on connection={{ ansible_connection
+ }}
+
+- name: Parse externally provided ospfv2 config to agnostic model
+ register: result
+ vyos.vyos.vyos_ospfv2:
+ running_config: "{{ lookup('file', '_parsed_config.cfg') }}"
+ state: parsed
+
+- name: Assert that config was correctly parsed
+ assert:
+ that:
+ - "{{ parsed['after'] == result['parsed'] }}"
diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/rendered.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/rendered.yaml
new file mode 100644
index 00000000..8a805a6a
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/rendered.yaml
@@ -0,0 +1,76 @@
+---
+- debug:
+ msg: START vyos_ospfv2 rendered integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- block:
+
+ - name: Structure provided configuration into device specific commands
+ register: result
+ vyos.vyos.vyos_ospfv2:
+ config:
+ log_adjacency_changes: 'detail'
+ max_metric:
+ router_lsa:
+ administrative: true
+ on_shutdown: 10
+ on_startup: 10
+ default_information:
+ originate:
+ always: true
+ metric: 10
+ metric_type: 2
+ route_map: 'ingress'
+ mpls_te:
+ enabled: true
+ router_address: '192.0.11.11'
+ auto_cost:
+ reference_bandwidth: 2
+ neighbor:
+ - neighbor_id: '192.0.11.12'
+ poll_interval: 10
+ priority: 2
+ redistribute:
+ - route_type: 'bgp'
+ metric: 10
+ metric_type: 2
+ passive_interface:
+ - 'eth1'
+ - 'eth2'
+ parameters:
+ router_id: '192.0.1.1'
+ opaque_lsa: true
+ rfc1583_compatibility: true
+ abr_type: 'cisco'
+ areas:
+ - area_id: '2'
+ area_type:
+ normal: true
+ authentication: "plaintext-password"
+ shortcut: 'enable'
+ - area_id: '3'
+ area_type:
+ nssa:
+ set: true
+ - area_id: '4'
+ area_type:
+ stub:
+ default_cost: 20
+ network:
+ - address: '192.0.2.0/24'
+ range:
+ - address: '192.0.3.0/24'
+ cost: 10
+ - address: '192.0.4.0/24'
+ cost: 12
+ state: rendered
+
+ - name: Assert that correct set of commands were generated
+ assert:
+ that:
+ - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\
+ \ |length == 0 }}"
+- debug:
+ msg: END vyos_ospfv2 rendered integration tests on connection={{ ansible_connection }}
diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/replaced.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/replaced.yaml
new file mode 100644
index 00000000..07606f94
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/replaced.yaml
@@ -0,0 +1,100 @@
+---
+- debug:
+ msg: START vyos_ospfv2 replaced integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Replace device configurations of listed ospfv2 routes with provided configurations
+ register: result
+ vyos.vyos.vyos_ospfv2: &id001
+ config:
+ log_adjacency_changes: 'detail'
+ max_metric:
+ router_lsa:
+ administrative: true
+ on_shutdown: 10
+ on_startup: 10
+ default_information:
+ originate:
+ always: true
+ metric: 10
+ metric_type: 2
+ route_map: 'ingress'
+ mpls_te:
+ enabled: true
+ router_address: '192.0.22.22'
+ auto_cost:
+ reference_bandwidth: 2
+ neighbor:
+ - neighbor_id: '192.0.11.12'
+ poll_interval: 10
+ priority: 2
+ redistribute:
+ - route_type: 'bgp'
+ metric: 10
+ metric_type: 2
+ passive_interface:
+ - 'eth1'
+ parameters:
+ router_id: '192.0.1.1'
+ opaque_lsa: true
+ rfc1583_compatibility: true
+ abr_type: 'cisco'
+ areas:
+ - area_id: '2'
+ area_type:
+ normal: true
+ authentication: "plaintext-password"
+ shortcut: 'enable'
+ - area_id: '4'
+ area_type:
+ stub:
+ default_cost: 20
+ network:
+ - address: '192.0.2.0/24'
+ - address: '192.0.12.0/24'
+ - address: '192.0.22.0/24'
+ - address: '192.0.32.0/24'
+ range:
+ - address: '1.1.2.0/24'
+ cost: 10
+ state: replaced
+
+ - name: Assert that correct set of commands were generated
+ assert:
+ that:
+ - "{{ replaced['commands'] | symmetric_difference(result['commands'])\
+ \ |length == 0 }}"
+
+ - name: Assert that before dicts are correctly generated
+ assert:
+ that:
+ - "{{ populate == result['before'] }}"
+
+ - name: Assert that after dict is correctly generated
+ assert:
+ that:
+ - "{{ replaced['after'] == result['after'] }}"
+
+ - name: Replace device configurations of listed ospfv2 routes with provided configurarions
+ (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_ospfv2: *id001
+
+ - name: Assert that task was idempotent
+ assert:
+ that:
+ - result['changed'] == false
+
+ - name: Assert that before dict is correctly generated
+ assert:
+ that:
+ - "{{ replaced['after'] == result['before'] }}"
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/rtt.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/rtt.yaml
new file mode 100644
index 00000000..7efc2a7b
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/rtt.yaml
@@ -0,0 +1,149 @@
+---
+- debug:
+ msg: START vyos_ospfv2 round trip integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- block:
+
+ - name: Apply the provided configuration (base config)
+ register: base_config
+ vyos.vyos.vyos_ospfv2:
+ config:
+ log_adjacency_changes: 'detail'
+ max_metric:
+ router_lsa:
+ administrative: true
+ on_shutdown: 10
+ on_startup: 10
+ default_information:
+ originate:
+ always: true
+ metric: 10
+ metric_type: 2
+ route_map: 'ingress'
+ mpls_te:
+ enabled: true
+ router_address: '192.0.11.11'
+ auto_cost:
+ reference_bandwidth: 2
+ neighbor:
+ - neighbor_id: '192.0.11.12'
+ poll_interval: 10
+ priority: 2
+ redistribute:
+ - route_type: 'bgp'
+ metric: 10
+ metric_type: 2
+ passive_interface:
+ - 'eth1'
+ - 'eth2'
+ parameters:
+ router_id: '192.0.1.1'
+ opaque_lsa: true
+ rfc1583_compatibility: true
+ abr_type: 'cisco'
+ areas:
+ - area_id: '2'
+ area_type:
+ normal: true
+ authentication: "plaintext-password"
+ shortcut: 'enable'
+ - area_id: '3'
+ area_type:
+ nssa:
+ set: true
+ - area_id: '4'
+ area_type:
+ stub:
+ default_cost: 20
+ network:
+ - address: '192.0.2.0/24'
+ range:
+ - address: '192.0.3.0/24'
+ cost: 10
+ - address: '192.0.4.0/24'
+ cost: 12
+ state: merged
+
+ - name: Gather ospfv2 facts
+ vyos.vyos.vyos_facts:
+ gather_subset:
+ - default
+ gather_network_resources:
+ - ospfv2
+
+ - name: Apply the provided configuration (config to be reverted)
+ register: result
+ vyos.vyos.vyos_ospfv2:
+ config:
+ areas:
+ - area_id: '2'
+ area_type:
+ normal: true
+ authentication: "plaintext-password"
+ shortcut: 'enable'
+ - area_id: '4'
+ area_type:
+ stub:
+ default_cost: 20
+ set: true
+ network:
+ - address: '192.0.12.0/24'
+ - address: '192.0.2.0/24'
+ - address: '192.0.22.0/24'
+ - address: '192.0.32.0/24'
+ range:
+ - address: '1.1.2.0/24'
+ cost: 10
+ auto_cost:
+ reference_bandwidth: 2
+ default_information:
+ originate:
+ always: true
+ metric: 10
+ metric_type: 2
+ route_map: 'ingress'
+ log_adjacency_changes: 'detail'
+ max_metric:
+ router_lsa:
+ administrative: true
+ on_shutdown: 10
+ on_startup: 10
+ mpls_te:
+ enabled: true
+ router_address: '192.0.22.22'
+ neighbor:
+ - neighbor_id: '192.0.11.12'
+ poll_interval: 10
+ priority: 2
+ parameters:
+ abr_type: 'cisco'
+ opaque_lsa: true
+ rfc1583_compatibility: true
+ router_id: '192.0.1.1'
+ passive_interface:
+ - 'eth1'
+ redistribute:
+ - metric: 10
+ metric_type: 2
+ route_type: 'bgp'
+ state: replaced
+
+ - name: Assert that changes were applied
+ assert:
+ that: "{{ round_trip['after'] == result['after'] }}"
+
+ - name: Revert back to base config using facts round trip
+ register: revert
+ vyos.vyos.vyos_ospfv2:
+ config: "{{ ansible_facts['network_resources']['ospfv2'] }}"
+ state: replaced
+
+ - name: Assert that config was reverted
+ assert:
+ that: "{{ base_config['after'] == revert['after']}}"
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_ospfv2/vars/main.yaml b/tests/integration/targets/vyos_ospfv2/vars/main.yaml
new file mode 100644
index 00000000..e55da20f
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/vars/main.yaml
@@ -0,0 +1,485 @@
+---
+merged:
+ before: {}
+ commands:
+ - set protocols ospf mpls-te enable
+ - set protocols ospf mpls-te router-address '192.0.11.11'
+ - set protocols ospf redistribute bgp
+ - set protocols ospf redistribute bgp metric-type 2
+ - set protocols ospf redistribute bgp metric 10
+ - set protocols ospf default-information originate metric-type 2
+ - set protocols ospf default-information originate always
+ - set protocols ospf default-information originate metric 10
+ - set protocols ospf default-information originate route-map ingress
+ - set protocols ospf auto-cost reference-bandwidth '2'
+ - set protocols ospf parameters router-id '192.0.1.1'
+ - set protocols ospf parameters opaque-lsa
+ - set protocols ospf parameters abr-type 'cisco'
+ - set protocols ospf parameters rfc1583-compatibility
+ - set protocols ospf passive-interface eth1
+ - set protocols ospf passive-interface eth2
+ - set protocols ospf max-metric router-lsa on-shutdown 10
+ - set protocols ospf max-metric router-lsa administrative
+ - set protocols ospf max-metric router-lsa on-startup 10
+ - set protocols ospf log-adjacency-changes 'detail'
+ - set protocols ospf neighbor 192.0.11.12 priority 2
+ - set protocols ospf neighbor 192.0.11.12 poll-interval 10
+ - set protocols ospf neighbor 192.0.11.12
+ - set protocols ospf area '2'
+ - set protocols ospf area 2 authentication plaintext-password
+ - set protocols ospf area 2 shortcut enable
+ - set protocols ospf area 2 area-type normal
+ - set protocols ospf area '3'
+ - set protocols ospf area 3 area-type nssa
+ - set protocols ospf area 4 range 192.0.3.0/24 cost 10
+ - set protocols ospf area 4 range 192.0.3.0/24
+ - set protocols ospf area 4 range 192.0.4.0/24 cost 12
+ - set protocols ospf area 4 range 192.0.4.0/24
+ - set protocols ospf area 4 area-type stub default-cost 20
+ - set protocols ospf area '4'
+ - set protocols ospf area 4 network 192.0.2.0/24
+ after:
+ areas:
+ - area_id: '2'
+ area_type:
+ normal: true
+ authentication: "plaintext-password"
+ shortcut: 'enable'
+ - area_id: '3'
+ area_type:
+ nssa:
+ set: true
+ - area_id: '4'
+ area_type:
+ stub:
+ default_cost: 20
+ set: true
+ network:
+ - address: '192.0.2.0/24'
+ range:
+ - address: '192.0.3.0/24'
+ cost: 10
+ - address: '192.0.4.0/24'
+ cost: 12
+ auto_cost:
+ reference_bandwidth: 2
+ default_information:
+ originate:
+ always: true
+ metric: 10
+ metric_type: 2
+ route_map: 'ingress'
+ log_adjacency_changes: 'detail'
+ max_metric:
+ router_lsa:
+ administrative: true
+ on_shutdown: 10
+ on_startup: 10
+ mpls_te:
+ enabled: true
+ router_address: '192.0.11.11'
+ neighbor:
+ - neighbor_id: '192.0.11.12'
+ poll_interval: 10
+ priority: 2
+ parameters:
+ abr_type: 'cisco'
+ opaque_lsa: true
+ rfc1583_compatibility: true
+ router_id: '192.0.1.1'
+ passive_interface:
+ - 'eth1'
+ - 'eth2'
+ redistribute:
+ - metric: 10
+ metric_type: 2
+ route_type: 'bgp'
+merged_update:
+ before:
+ areas:
+ - area_id: '2'
+ area_type:
+ normal: true
+ authentication: "plaintext-password"
+ shortcut: 'enable'
+ - area_id: '3'
+ area_type:
+ nssa:
+ set: true
+ - area_id: '4'
+ area_type:
+ stub:
+ default_cost: 20
+ set: true
+ network:
+ - address: '192.0.2.0/24'
+ range:
+ - address: '192.0.3.0/24'
+ cost: 10
+ - address: '192.0.4.0/24'
+ cost: 12
+ auto_cost:
+ reference_bandwidth: 2
+ default_information:
+ originate:
+ always: true
+ metric: 10
+ metric_type: 2
+ route_map: 'ingress'
+ log_adjacency_changes: 'detail'
+ max_metric:
+ router_lsa:
+ administrative: true
+ on_shutdown: 10
+ on_startup: 10
+ mpls_te:
+ enabled: true
+ router_address: '192.0.11.11'
+ neighbor:
+ - neighbor_id: '192.0.11.12'
+ poll_interval: 10
+ priority: 2
+ parameters:
+ abr_type: 'cisco'
+ opaque_lsa: true
+ rfc1583_compatibility: true
+ router_id: '192.0.1.1'
+ passive_interface:
+ - 'eth1'
+ - 'eth2'
+ redistribute:
+ - metric: 10
+ metric_type: 2
+ route_type: 'bgp'
+ after:
+ areas:
+ - area_id: '2'
+ area_type:
+ normal: true
+ authentication: "plaintext-password"
+ shortcut: 'enable'
+ - area_id: '3'
+ area_type:
+ nssa:
+ set: true
+ - area_id: '4'
+ network:
+ - address: '192.0.2.0/24'
+ - address: '192.0.22.0/24'
+ - address: '192.0.32.0/24'
+ range:
+ - address: '192.0.3.0/24'
+ cost: 10
+ - address: '192.0.4.0/24'
+ cost: 12
+ auto_cost:
+ reference_bandwidth: 2
+ default_information:
+ originate:
+ always: true
+ metric: 10
+ metric_type: 2
+ route_map: 'ingress'
+ log_adjacency_changes: 'detail'
+ max_metric:
+ router_lsa:
+ administrative: true
+ on_shutdown: 10
+ on_startup: 10
+ mpls_te:
+ enabled: true
+ router_address: '192.0.11.11'
+ neighbor:
+ - neighbor_id: '192.0.11.12'
+ poll_interval: 10
+ priority: 2
+ parameters:
+ abr_type: 'cisco'
+ opaque_lsa: true
+ rfc1583_compatibility: true
+ router_id: '192.0.1.1'
+ passive_interface:
+ - 'eth1'
+ - 'eth2'
+ redistribute:
+ - metric: 10
+ metric_type: 2
+ route_type: 'bgp'
+ commands:
+ - delete protocols ospf area 4 area-type stub
+ - set protocols ospf area 4 network 192.0.22.0/24
+ - set protocols ospf area 4 network 192.0.32.0/24
+populate:
+ areas:
+ - area_id: '2'
+ area_type:
+ normal: true
+ authentication: "plaintext-password"
+ shortcut: 'enable'
+ - area_id: '3'
+ area_type:
+ nssa:
+ set: true
+ - area_id: '4'
+ area_type:
+ stub:
+ default_cost: 20
+ set: true
+ network:
+ - address: '192.0.2.0/24'
+ range:
+ - address: '192.0.3.0/24'
+ cost: 10
+ - address: '192.0.4.0/24'
+ cost: 12
+ auto_cost:
+ reference_bandwidth: 2
+ default_information:
+ originate:
+ always: true
+ metric: 10
+ metric_type: 2
+ route_map: 'ingress'
+ log_adjacency_changes: 'detail'
+ max_metric:
+ router_lsa:
+ administrative: true
+ on_shutdown: 10
+ on_startup: 10
+ mpls_te:
+ enabled: true
+ router_address: '192.0.11.11'
+ neighbor:
+ - neighbor_id: '192.0.11.12'
+ poll_interval: 10
+ priority: 2
+ parameters:
+ abr_type: 'cisco'
+ opaque_lsa: true
+ rfc1583_compatibility: true
+ router_id: '192.0.1.1'
+ passive_interface:
+ - 'eth1'
+ - 'eth2'
+ redistribute:
+ - metric: 10
+ metric_type: 2
+ route_type: 'bgp'
+replaced:
+ commands:
+ - delete protocols ospf passive-interface eth2
+ - delete protocols ospf area 3
+ - delete protocols ospf area 4 range 192.0.3.0/24 cost
+ - delete protocols ospf area 4 range 192.0.3.0/24
+ - delete protocols ospf area 4 range 192.0.4.0/24 cost
+ - delete protocols ospf area 4 range 192.0.4.0/24
+ - set protocols ospf mpls-te router-address '192.0.22.22'
+ - set protocols ospf area 4 range 1.1.2.0/24 cost 10
+ - set protocols ospf area 4 range 1.1.2.0/24
+ - set protocols ospf area 4 network 192.0.12.0/24
+ - set protocols ospf area 4 network 192.0.22.0/24
+ - set protocols ospf area 4 network 192.0.32.0/24
+ after:
+ areas:
+ - area_id: '2'
+ area_type:
+ normal: true
+ authentication: "plaintext-password"
+ shortcut: 'enable'
+ - area_id: '4'
+ area_type:
+ stub:
+ default_cost: 20
+ set: true
+ network:
+ - address: '192.0.12.0/24'
+ - address: '192.0.2.0/24'
+ - address: '192.0.22.0/24'
+ - address: '192.0.32.0/24'
+ range:
+ - address: '1.1.2.0/24'
+ cost: 10
+ auto_cost:
+ reference_bandwidth: 2
+ default_information:
+ originate:
+ always: true
+ metric: 10
+ metric_type: 2
+ route_map: 'ingress'
+ log_adjacency_changes: 'detail'
+ max_metric:
+ router_lsa:
+ administrative: true
+ on_shutdown: 10
+ on_startup: 10
+ mpls_te:
+ enabled: true
+ router_address: '192.0.22.22'
+ neighbor:
+ - neighbor_id: '192.0.11.12'
+ poll_interval: 10
+ priority: 2
+ parameters:
+ abr_type: 'cisco'
+ opaque_lsa: true
+ rfc1583_compatibility: true
+ router_id: '192.0.1.1'
+ passive_interface:
+ - 'eth1'
+ redistribute:
+ - metric: 10
+ metric_type: 2
+ route_type: 'bgp'
+rendered:
+ commands:
+ - set protocols ospf mpls-te enable
+ - set protocols ospf mpls-te router-address '192.0.11.11'
+ - set protocols ospf redistribute bgp
+ - set protocols ospf redistribute bgp metric-type 2
+ - set protocols ospf redistribute bgp metric 10
+ - set protocols ospf default-information originate metric-type 2
+ - set protocols ospf default-information originate always
+ - set protocols ospf default-information originate metric 10
+ - set protocols ospf default-information originate route-map ingress
+ - set protocols ospf auto-cost reference-bandwidth '2'
+ - set protocols ospf parameters router-id '192.0.1.1'
+ - set protocols ospf parameters opaque-lsa
+ - set protocols ospf parameters abr-type 'cisco'
+ - set protocols ospf parameters rfc1583-compatibility
+ - set protocols ospf passive-interface eth1
+ - set protocols ospf passive-interface eth2
+ - set protocols ospf max-metric router-lsa on-shutdown 10
+ - set protocols ospf max-metric router-lsa administrative
+ - set protocols ospf max-metric router-lsa on-startup 10
+ - set protocols ospf log-adjacency-changes 'detail'
+ - set protocols ospf neighbor 192.0.11.12 priority 2
+ - set protocols ospf neighbor 192.0.11.12 poll-interval 10
+ - set protocols ospf neighbor 192.0.11.12
+ - set protocols ospf area '2'
+ - set protocols ospf area 2 authentication plaintext-password
+ - set protocols ospf area 2 shortcut enable
+ - set protocols ospf area 2 area-type normal
+ - set protocols ospf area '3'
+ - set protocols ospf area 3 area-type nssa
+ - set protocols ospf area 4 range 192.0.3.0/24 cost 10
+ - set protocols ospf area 4 range 192.0.3.0/24
+ - set protocols ospf area 4 range 192.0.4.0/24 cost 12
+ - set protocols ospf area 4 range 192.0.4.0/24
+ - set protocols ospf area 4 area-type stub default-cost 20
+ - set protocols ospf area '4'
+ - set protocols ospf area 4 network 192.0.2.0/24
+parsed:
+ after:
+ areas:
+ - area_id: '2'
+ area_type:
+ normal: true
+ authentication: "plaintext-password"
+ shortcut: 'enable'
+ - area_id: '3'
+ area_type:
+ nssa:
+ set: true
+ - area_id: '4'
+ area_type:
+ stub:
+ default_cost: 20
+ set: true
+ network:
+ - address: '192.0.2.0/24'
+ range:
+ - address: '192.0.3.0/24'
+ cost: 10
+ - address: '192.0.4.0/24'
+ cost: 12
+ auto_cost:
+ reference_bandwidth: 2
+ default_information:
+ originate:
+ always: true
+ metric: 10
+ metric_type: 2
+ route_map: 'ingress'
+ log_adjacency_changes: 'detail'
+ max_metric:
+ router_lsa:
+ administrative: true
+ on_shutdown: 10
+ on_startup: 10
+ mpls_te:
+ enabled: true
+ router_address: '192.0.11.11'
+ neighbor:
+ - neighbor_id: '192.0.11.12'
+ poll_interval: 10
+ priority: 2
+ parameters:
+ abr_type: 'cisco'
+ opaque_lsa: true
+ rfc1583_compatibility: true
+ router_id: '192.0.1.1'
+ passive_interface:
+ - 'eth1'
+ - 'eth2'
+ redistribute:
+ - metric: 10
+ metric_type: 2
+ route_type: 'bgp'
+deleted:
+ commands:
+ - 'delete protocols ospf'
+ after: {}
+round_trip:
+ after:
+ areas:
+ - area_id: '2'
+ area_type:
+ normal: true
+ authentication: "plaintext-password"
+ shortcut: 'enable'
+ - area_id: '4'
+ area_type:
+ stub:
+ default_cost: 20
+ set: true
+ network:
+ - address: '192.0.12.0/24'
+ - address: '192.0.2.0/24'
+ - address: '192.0.22.0/24'
+ - address: '192.0.32.0/24'
+ range:
+ - address: '1.1.2.0/24'
+ cost: 10
+ auto_cost:
+ reference_bandwidth: 2
+ default_information:
+ originate:
+ always: true
+ metric: 10
+ metric_type: 2
+ route_map: 'ingress'
+ log_adjacency_changes: 'detail'
+ max_metric:
+ router_lsa:
+ administrative: true
+ on_shutdown: 10
+ on_startup: 10
+ mpls_te:
+ enabled: true
+ router_address: '192.0.22.22'
+ neighbor:
+ - neighbor_id: '192.0.11.12'
+ poll_interval: 10
+ priority: 2
+ parameters:
+ abr_type: 'cisco'
+ opaque_lsa: true
+ rfc1583_compatibility: true
+ router_id: '192.0.1.1'
+ passive_interface:
+ - 'eth1'
+ redistribute:
+ - metric: 10
+ metric_type: 2
+ route_type: 'bgp'
diff --git a/tests/integration/targets/vyos_ospfv3/defaults/main.yaml b/tests/integration/targets/vyos_ospfv3/defaults/main.yaml
new file mode 100644
index 00000000..852a6bee
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/defaults/main.yaml
@@ -0,0 +1,3 @@
+---
+testcase: '[^_].*'
+test_items: []
diff --git a/tests/integration/targets/vyos_ospfv3/meta/main.yaml b/tests/integration/targets/vyos_ospfv3/meta/main.yaml
new file mode 100644
index 00000000..7413320e
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/meta/main.yaml
@@ -0,0 +1,3 @@
+---
+dependencies:
+ - prepare_vyos_tests
diff --git a/tests/integration/targets/vyos_ospfv3/tasks/cli.yaml b/tests/integration/targets/vyos_ospfv3/tasks/cli.yaml
new file mode 100644
index 00000000..93eb2fe4
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/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_ospfv3/tasks/main.yaml b/tests/integration/targets/vyos_ospfv3/tasks/main.yaml
new file mode 100644
index 00000000..a3db933e
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/tasks/main.yaml
@@ -0,0 +1,4 @@
+---
+- include: cli.yaml
+ tags:
+ - cli
diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_ospfv3/tests/cli/_parsed_config.cfg
new file mode 100644
index 00000000..5e012d5a
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/tests/cli/_parsed_config.cfg
@@ -0,0 +1,8 @@
+set protocols ospfv3 area 2 export-list 'export1'
+set protocols ospfv3 area 2 import-list 'import1'
+set protocols ospfv3 area 2 range '2001:db10::/32'
+set protocols ospfv3 area 2 range '2001:db20::/32'
+set protocols ospfv3 area 2 range '2001:db30::/32'
+set protocols ospfv3 area 3 range '2001:db40::/32'
+set protocols ospfv3 parameters router-id '192.0.2.10'
+set protocols ospfv3 redistribute 'bgp'
diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/_populate.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/_populate.yaml
new file mode 100644
index 00000000..fb66d0a5
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/tests/cli/_populate.yaml
@@ -0,0 +1,13 @@
+---
+- name: Setup
+ vars:
+ lines: "set protocols ospfv3 area 2 export-list 'export1' \n
+ set protocols ospfv3 area 2 import-list 'import1' \n
+ set protocols ospfv3 area 2 range '2001:db10::/32' \n
+ set protocols ospfv3 area 2 range '2001:db20::/32' \n
+ set protocols ospfv3 area 2 range '2001:db30::/32' \n
+ set protocols ospfv3 area 3 range '2001:db40::/32' \n
+ set protocols ospfv3 parameters router-id '192.0.2.10' \n
+ set protocols ospfv3 redistribute 'bgp'"
+ ansible.netcommon.cli_config:
+ config: '{{ lines }}'
diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/_remove_config.yaml
new file mode 100644
index 00000000..2a475050
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/tests/cli/_remove_config.yaml
@@ -0,0 +1,6 @@
+---
+- name: Remove Config
+ vars:
+ lines: "delete protocols ospfv3\n"
+ ansible.netcommon.cli_config:
+ config: '{{ lines }}'
diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/deleted.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/deleted.yaml
new file mode 100644
index 00000000..55bec184
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/tests/cli/deleted.yaml
@@ -0,0 +1,48 @@
+---
+- debug:
+ msg: Start vyos_ospfv3 deleted integration tests ansible_connection={{
+ ansible_connection }}
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Delete ospfv3 routes
+ register: result
+ vyos.vyos.vyos_ospfv3: &id001
+ config:
+ state: deleted
+
+ - name: Assert that the before dicts were correctly generated
+ assert:
+ that:
+ - "{{ populate == result['before'] }}"
+
+ - name: Assert that the correct set of commands were generated
+ assert:
+ that:
+ - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\
+ \ == 0 }}"
+
+ - name: Assert that the after dicts were correctly generated
+ assert:
+ that:
+ - "{{ deleted['after'] == result['after'] }}"
+
+ - name: Delete ospfv3 routes (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_ospfv3: *id001
+
+ - name: Assert that the previous task was idempotent
+ assert:
+ that:
+ - result.changed == false
+ - result.commands|length == 0
+
+ - name: Assert that the before dicts were correctly generated
+ assert:
+ that:
+ - "{{ deleted['after'] == result['before'] }}"
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/empty_config.yaml
new file mode 100644
index 00000000..fec61abf
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/tests/cli/empty_config.yaml
@@ -0,0 +1,49 @@
+---
+- debug:
+ msg: START vyos_ospfv3 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_ospfv3:
+ 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_ospfv3:
+ config:
+ state: replaced
+
+- assert:
+ that:
+ - result.msg == 'value of config parameter must not be empty for state replaced'
+
+- name: Parsed with empty running_config should give appropriate error message
+ register: result
+ ignore_errors: true
+ vyos.vyos.vyos_ospfv3:
+ 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_ospfv3:
+ 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_ospfv3/tests/cli/gathered.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/gathered.yaml
new file mode 100644
index 00000000..6645b99f
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/tests/cli/gathered.yaml
@@ -0,0 +1,25 @@
+---
+- debug:
+ msg: START vyos_ospfv3 gathered integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Gather the provided configuration with the exisiting running configuration
+ register: result
+ vyos.vyos.vyos_ospfv3:
+ config:
+ state: gathered
+
+ - name: Assert that gathered dicts was correctly generated
+ assert:
+ that:
+ - "{{ populate == result['gathered'] }}"
+
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/merged.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/merged.yaml
new file mode 100644
index 00000000..93095009
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/tests/cli/merged.yaml
@@ -0,0 +1,62 @@
+---
+- debug:
+ msg: START vyos_ospfv3 merged integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_config.yaml
+
+- block:
+
+ - name: Merge the provided configuration with the exisiting running configuration
+ register: result
+ vyos.vyos.vyos_ospfv3: &id001
+ config:
+ areas:
+ - area_id: '2'
+ export_list: 'export1'
+ import_list: 'import1'
+ range:
+ - address: '2001:db10::/32'
+ - address: '2001:db20::/32'
+ - address: '2001:db30::/32'
+ - area_id: '3'
+ range:
+ - address: '2001:db40::/32'
+ parameters:
+ router_id: '192.0.2.10'
+ redistribute:
+ - route_type: 'bgp'
+ state: merged
+
+ - name: Assert that before dicts were correctly generated
+ assert:
+ that: "{{ merged['before'] == result['before'] }}"
+
+ - name: Assert that correct set of commands were generated
+ assert:
+ that:
+ - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\
+ \ == 0 }}"
+
+ - name: Assert that after dicts was correctly generated
+ assert:
+ that:
+ - "{{ merged['after'] == result['after'] }}"
+
+ - name: Merge the provided configuration with the existing running configuration
+ (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_ospfv3: *id001
+
+ - name: Assert that the previous task was idempotent
+ assert:
+ that:
+ - result['changed'] == false
+
+ - name: Assert that before dicts were correctly generated
+ assert:
+ that:
+ - "{{ merged['after'] == result['before'] }}"
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/merged_update.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/merged_update.yaml
new file mode 100644
index 00000000..0d506b37
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/tests/cli/merged_update.yaml
@@ -0,0 +1,61 @@
+---
+- debug:
+ msg: START vyos_ospfv3 merged integration tests on connection={{ ansible_connection
+ }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Merge the provided configuration with the exisiting running configuration
+ register: result
+ vyos.vyos.vyos_ospfv3: &id001
+ config:
+ areas:
+ - area_id: '2'
+ range:
+ - address: '2001:db10::/32'
+ - area_id: '3'
+ range:
+ - address: '2001:db40::/32'
+ - address: '2001:db70::/32'
+ parameters:
+ router_id: '192.0.2.10'
+ redistribute:
+ - route_type: 'bgp'
+ state: merged
+
+ - name: Assert that before dicts were correctly generated
+ assert:
+ that: "{{ populate == result['before'] }}"
+
+ - name: Assert that correct set of commands were generated
+ assert:
+ that:
+ - "{{ merged_update['commands'] | symmetric_difference(result['commands']) |length\
+ \ == 0 }}"
+
+ - name: Assert that after dicts was correctly generated
+ assert:
+ that:
+ - "{{ merged_update['after'] == result['after'] }}"
+
+ - name: Merge the provided configuration with the existing running configuration
+ (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_ospfv3: *id001
+
+ - name: Assert that the previous task was idempotent
+ assert:
+ that:
+ - result['changed'] == false
+
+ - name: Assert that before dicts were correctly generated
+ assert:
+ that:
+ - "{{ merged_update['after'] == result['before'] }}"
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/parsed.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/parsed.yaml
new file mode 100644
index 00000000..62870831
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/tests/cli/parsed.yaml
@@ -0,0 +1,15 @@
+---
+- debug:
+ msg: START vyos_ospfv3 parsed integration tests on connection={{ ansible_connection
+ }}
+
+- name: Parse externally provided ospfv3 config to agnostic model
+ register: result
+ vyos.vyos.vyos_ospfv3:
+ running_config: "{{ lookup('file', '_parsed_config.cfg') }}"
+ state: parsed
+
+- name: Assert that config was correctly parsed
+ assert:
+ that:
+ - "{{ parsed['after'] == result['parsed'] }}"
diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/rendered.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/rendered.yaml
new file mode 100644
index 00000000..3f714ced
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/tests/cli/rendered.yaml
@@ -0,0 +1,38 @@
+---
+- debug:
+ msg: START vyos_ospfv3 rendered integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- block:
+
+ - name: Structure provided configuration into device specific commands
+ register: result
+ vyos.vyos.vyos_ospfv3:
+ config:
+ redistribute:
+ - route_type: 'bgp'
+ parameters:
+ router_id: '192.0.2.10'
+ areas:
+ - area_id: '2'
+ export_list: 'export1'
+ import_list: 'import1'
+ range:
+ - address: '2001:db10::/32'
+ - address: '2001:db20::/32'
+ - address: '2001:db30::/32'
+ - area_id: '3'
+ range:
+ - address: '2001:db40::/32'
+ state: rendered
+
+ - name: Assert that correct set of commands were generated
+ assert:
+ that:
+ - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\
+ \ |length == 0 }}"
+
+- debug:
+ msg: END vyos_ospfv3 rendered integration tests on connection={{ ansible_connection }}
diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/replaced.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/replaced.yaml
new file mode 100644
index 00000000..74d25dbf
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/tests/cli/replaced.yaml
@@ -0,0 +1,66 @@
+---
+- debug:
+ msg: START vyos_ospfv3 replaced integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+
+ - name: Replace device configurations of listed ospfv3 routes with provided configurations
+ register: result
+ vyos.vyos.vyos_ospfv3: &id001
+ config:
+ redistribute:
+ - route_type: 'bgp'
+ parameters:
+ router_id: '192.0.2.10'
+ areas:
+ - area_id: '2'
+ export_list: 'export1'
+ import_list: 'import1'
+
+ range:
+ - address: '2001:db10::/32'
+ - address: '2001:db30::/32'
+ - address: '2001:db50::/32'
+ - area_id: '4'
+ range:
+ - address: '2001:db60::/32'
+ state: replaced
+
+ - name: Assert that correct set of commands were generated
+ assert:
+ that:
+ - "{{ replaced['commands'] | symmetric_difference(result['commands'])\
+ \ |length == 0 }}"
+
+ - name: Assert that before dicts are correctly generated
+ assert:
+ that:
+ - "{{ populate == result['before'] }}"
+
+ - name: Assert that after dict is correctly generated
+ assert:
+ that:
+ - "{{ replaced['after'] == result['after'] }}"
+
+ - name: Replace device configurations of listed ospfv3 routes with provided configurarions
+ (IDEMPOTENT)
+ register: result
+ vyos.vyos.vyos_ospfv3: *id001
+
+ - name: Assert that task was idempotent
+ assert:
+ that:
+ - result['changed'] == false
+
+ - name: Assert that before dict is correctly generated
+ assert:
+ that:
+ - "{{ replaced['after'] == result['before'] }}"
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/rtt.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/rtt.yaml
new file mode 100644
index 00000000..d8175540
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/tests/cli/rtt.yaml
@@ -0,0 +1,75 @@
+---
+- debug:
+ msg: START vyos_ospfv3 round trip integration tests on connection={{
+ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- block:
+
+ - name: Apply the provided configuration (base config)
+ register: base_config
+ vyos.vyos.vyos_ospfv3:
+ config:
+ areas:
+ - area_id: '2'
+ export_list: 'export1'
+ import_list: 'import1'
+ range:
+ - address: '2001:db10::/32'
+ - address: '2001:db20::/32'
+ - address: '2001:db30::/32'
+ - area_id: '3'
+ range:
+ - address: '2001:db40::/32'
+ parameters:
+ router_id: '192.0.2.10'
+ redistribute:
+ - route_type: 'bgp'
+ state: merged
+
+ - name: Gather ospfv3 facts
+ vyos.vyos.vyos_facts:
+ gather_subset:
+ - default
+ gather_network_resources:
+ - ospfv3
+
+ - name: Apply the provided configuration (config to be reverted)
+ register: result
+ vyos.vyos.vyos_ospfv3:
+ config:
+ redistribute:
+ - route_type: 'bgp'
+ parameters:
+ router_id: '192.0.2.10'
+ areas:
+ - area_id: '2'
+ export_list: 'export1'
+ import_list: 'import1'
+
+ range:
+ - address: '2001:db10::/32'
+ - address: '2001:db30::/32'
+ - address: '2001:db50::/32'
+ - area_id: '4'
+ range:
+ - address: '2001:db60::/32'
+ state: replaced
+
+ - name: Assert that changes were applied
+ assert:
+ that: "{{ round_trip['after'] == result['after'] }}"
+
+ - name: Revert back to base config using facts round trip
+ register: revert
+ vyos.vyos.vyos_ospfv3:
+ config: "{{ ansible_facts['network_resources']['ospfv3'] }}"
+ state: replaced
+
+ - name: Assert that config was reverted
+ assert:
+ that: "{{ base_config['after'] == revert['after']}}"
+ always:
+
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_ospfv3/vars/main.yaml b/tests/integration/targets/vyos_ospfv3/vars/main.yaml
new file mode 100644
index 00000000..6ded89a8
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv3/vars/main.yaml
@@ -0,0 +1,142 @@
+---
+merged:
+ before: {}
+ commands:
+ - set protocols ospfv3 redistribute bgp
+ - set protocols ospfv3 parameters router-id '192.0.2.10'
+ - set protocols ospfv3 area 2 range 2001:db10::/32
+ - set protocols ospfv3 area 2 range 2001:db20::/32
+ - set protocols ospfv3 area 2 range 2001:db30::/32
+ - set protocols ospfv3 area '2'
+ - set protocols ospfv3 area 2 export-list export1
+ - set protocols ospfv3 area 2 import-list import1
+ - set protocols ospfv3 area '3'
+ - set protocols ospfv3 area 3 range 2001:db40::/32
+ after:
+ areas:
+ - area_id: '2'
+ export_list: 'export1'
+ import_list: 'import1'
+ range:
+ - address: '2001:db10::/32'
+ - address: '2001:db20::/32'
+ - address: '2001:db30::/32'
+ - area_id: '3'
+ range:
+ - address: '2001:db40::/32'
+ parameters:
+ router_id: '192.0.2.10'
+ redistribute:
+ - route_type: 'bgp'
+
+
+merged_update:
+ commands:
+ - set protocols ospfv3 area 3 range 2001:db70::/32
+ after:
+ areas:
+ - area_id: '2'
+ export_list: 'export1'
+ import_list: 'import1'
+ range:
+ - address: '2001:db10::/32'
+ - address: '2001:db20::/32'
+ - address: '2001:db30::/32'
+ - area_id: '3'
+ range:
+ - address: '2001:db40::/32'
+ - address: '2001:db70::/32'
+ parameters:
+ router_id: '192.0.2.10'
+ redistribute:
+ - route_type: 'bgp'
+
+populate:
+ areas:
+ - area_id: '2'
+ export_list: 'export1'
+ import_list: 'import1'
+ range:
+ - address: '2001:db10::/32'
+ - address: '2001:db20::/32'
+ - address: '2001:db30::/32'
+ - area_id: '3'
+ range:
+ - address: '2001:db40::/32'
+ parameters:
+ router_id: '192.0.2.10'
+ redistribute:
+ - route_type: 'bgp'
+replaced:
+ commands:
+ - delete protocols ospfv3 area 2 range 2001:db20::/32
+ - delete protocols ospfv3 area 3
+ - set protocols ospfv3 area 2 range 2001:db50::/32
+ - set protocols ospfv3 area '4'
+ - set protocols ospfv3 area 4 range 2001:db60::/32
+ after:
+ areas:
+ - area_id: '2'
+ export_list: 'export1'
+ import_list: 'import1'
+ range:
+ - address: '2001:db10::/32'
+ - address: '2001:db30::/32'
+ - address: '2001:db50::/32'
+ - area_id: '4'
+ range:
+ - address: '2001:db60::/32'
+ parameters:
+ router_id: '192.0.2.10'
+ redistribute:
+ - route_type: 'bgp'
+rendered:
+ commands:
+ - set protocols ospfv3 redistribute bgp
+ - set protocols ospfv3 parameters router-id '192.0.2.10'
+ - set protocols ospfv3 area 2 range 2001:db10::/32
+ - set protocols ospfv3 area 2 range 2001:db20::/32
+ - set protocols ospfv3 area 2 range 2001:db30::/32
+ - set protocols ospfv3 area '2'
+ - set protocols ospfv3 area 2 export-list export1
+ - set protocols ospfv3 area 2 import-list import1
+ - set protocols ospfv3 area '3'
+ - set protocols ospfv3 area 3 range 2001:db40::/32
+parsed:
+ after:
+ areas:
+ - area_id: '2'
+ export_list: 'export1'
+ import_list: 'import1'
+ range:
+ - address: '2001:db10::/32'
+ - address: '2001:db20::/32'
+ - address: '2001:db30::/32'
+ - area_id: '3'
+ range:
+ - address: '2001:db40::/32'
+ parameters:
+ router_id: '192.0.2.10'
+ redistribute:
+ - route_type: 'bgp'
+deleted:
+ commands:
+ - 'delete protocols ospfv3'
+ after: {}
+round_trip:
+ after:
+ areas:
+ - area_id: '2'
+ export_list: 'export1'
+ import_list: 'import1'
+ range:
+ - address: '2001:db10::/32'
+ - address: '2001:db30::/32'
+ - address: '2001:db50::/32'
+ - area_id: '4'
+ range:
+ - address: '2001:db60::/32'
+ parameters:
+ router_id: '192.0.2.10'
+ redistribute:
+ - route_type: 'bgp'
diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/deleted.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/deleted.yaml
deleted file mode 100644
index 7f098f52..00000000
--- a/tests/integration/targets/vyos_static_routes/tests/cli/deleted.yaml
+++ /dev/null
@@ -1,62 +0,0 @@
----
-- debug:
- msg: Start vyos_static_routes deleted integration tests ansible_connection={{
- ansible_connection }}
-
-- include_tasks: _populate.yaml
-
-- block:
-
- - name: Delete static route based on destiation.
- register: result
- vyos.vyos.vyos_static_routes: &id001
- config:
-
- - address_families:
-
- - afi: ipv4
- routes:
-
- - dest: 192.0.2.32/28
-
- - afi: ipv6
- routes:
-
- - dest: 2001:db8:1000::/36
- state: deleted
-
- - name: Assert that the before dicts were correctly generated
- assert:
- that:
- - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
-
- - name: Assert that the correct set of commands were generated
- assert:
- that:
- - "{{ deleted_dest['commands'] | symmetric_difference(result['commands'])\
- \ |length == 0 }}"
-
- - name: Assert that the after dicts were correctly generated
- assert:
- that:
- - "{{ deleted_dest['after'] | symmetric_difference(result['after']) |length\
- \ == 0 }}"
-
- - name: Delete attributes of given interfaces (IDEMPOTENT)
- register: result
- vyos.vyos.vyos_static_routes: *id001
-
- - name: Assert that the previous task was idempotent
- assert:
- that:
- - result.changed == false
- - result.commands|length == 0
-
- - name: Assert that the before dicts were correctly generated
- assert:
- that:
- - "{{ deleted_dest['after'] | symmetric_difference(result['before']) |length\
- \ == 0 }}"
- always:
-
- - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/deleted_nh.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/deleted_nh.yaml
deleted file mode 100644
index f6075d26..00000000
--- a/tests/integration/targets/vyos_static_routes/tests/cli/deleted_nh.yaml
+++ /dev/null
@@ -1,68 +0,0 @@
----
-- debug:
- msg: Start vyos_static_routes deleted integration tests ansible_connection={{
- ansible_connection }}
-
-- include_tasks: _populate.yaml
-
-- block:
-
- - name: Delete static route based on next_hop.
- register: result
- vyos.vyos.vyos_static_routes: &id001
- config:
-
- - address_families:
-
- - afi: ipv4
- routes:
-
- - dest: 192.0.2.32/28
- next_hops:
-
- - forward_router_address: 192.0.2.9
-
- - afi: ipv6
- routes:
-
- - dest: 2001:db8:1000::/36
- next_hops:
-
- - forward_router_address: 2001:db8:2000:2::1
- state: deleted
-
- - name: Assert that the before dicts were correctly generated
- assert:
- that:
- - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
-
- - name: Assert that the correct set of commands were generated
- assert:
- that:
- - "{{ deleted_nh['commands'] | symmetric_difference(result['commands'])\
- \ |length == 0 }}"
-
- - name: Assert that the after dicts were correctly generated
- assert:
- that:
- - "{{ deleted_nh['after'] | symmetric_difference(result['after']) |length\
- \ == 0 }}"
-
- - name: Delete attributes of given interfaces (IDEMPOTENT)
- register: result
- vyos.vyos.vyos_static_routes: *id001
-
- - name: Assert that the previous task was idempotent
- assert:
- that:
- - result.changed == false
- - result.commands|length == 0
-
- - name: Assert that the before dicts were correctly generated
- assert:
- that:
- - "{{ deleted_nh['after'] | symmetric_difference(result['before']) |length\
- \ == 0 }}"
- always:
-
- - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_static_routes/vars/main.yaml b/tests/integration/targets/vyos_static_routes/vars/main.yaml
index 93b875f2..6ce4cea6 100644
--- a/tests/integration/targets/vyos_static_routes/vars/main.yaml
+++ b/tests/integration/targets/vyos_static_routes/vars/main.yaml
@@ -94,31 +94,7 @@ rendered:
- set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'
- set protocols static route6 2001:db8:1000::/36 blackhole distance '2'
- set protocols static route6 2001:db8:1000::/36
-deleted_dest:
- commands:
- - delete protocols static route 192.0.2.32/28
- - delete protocols static route6 2001:db8:1000::/36
- after: []
-deleted_nh:
- commands:
- - delete protocols static route 192.0.2.32/28 next-hop '192.0.2.9'
- - delete protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1'
- after:
- - address_families:
- - afi: ipv4
- routes:
- - dest: 192.0.2.32/28
- blackhole_config:
- type: blackhole
- next_hops:
- - forward_router_address: 192.0.2.10
- - afi: ipv6
- routes:
- - dest: 2001:db8:1000::/36
- blackhole_config:
- distance: 2
- next_hops:
- - forward_router_address: 2001:db8:2000:2::2
+
deleted_afi_all:
commands:
- delete protocols static route