summaryrefslogtreecommitdiff
path: root/tests/integration/targets
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/targets')
-rw-r--r--tests/integration/targets/prepare_vyos_tests/tasks/main.yaml10
-rw-r--r--tests/integration/targets/vyos_config/tests/cli/save.yaml4
-rw-r--r--tests/integration/targets/vyos_config/tests/cli/simple.yaml11
-rw-r--r--tests/integration/targets/vyos_firewall_rules/tests/cli/diff_mode.yaml61
-rw-r--r--tests/integration/targets/vyos_firewall_rules/vars/pre-v1_4.yaml139
-rw-r--r--tests/integration/targets/vyos_firewall_rules/vars/v1_4.yaml148
-rw-r--r--tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml2
-rw-r--r--tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml8
-rw-r--r--tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml2
-rw-r--r--tests/integration/targets/vyos_interfaces/tests/cli/merged.yaml10
-rw-r--r--tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml8
-rw-r--r--tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml2
-rw-r--r--tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml4
-rw-r--r--tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml6
-rw-r--r--tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml6
-rw-r--r--tests/integration/targets/vyos_interfaces/vars/main.yaml25
-rw-r--r--tests/integration/targets/vyos_logging_global/tests/cli/_populate.yaml1
-rw-r--r--tests/integration/targets/vyos_ospf_interfaces/tasks/post_tasks.yml2
-rw-r--r--tests/integration/targets/vyos_ospf_interfaces/tasks/pre_tasks.yml2
-rw-r--r--tests/integration/targets/vyos_ospf_interfaces/tests/cli/_get_version.yaml1
-rw-r--r--tests/integration/targets/vyos_ospf_interfaces/tests/cli/deleted.yaml1
-rw-r--r--tests/integration/targets/vyos_ospf_interfaces/tests/cli/merged.yaml6
-rw-r--r--tests/integration/targets/vyos_ospf_interfaces/tests/cli/overridden.yaml1
-rw-r--r--tests/integration/targets/vyos_ospf_interfaces/tests/cli/rendered.yaml5
-rw-r--r--tests/integration/targets/vyos_ospf_interfaces/tests/cli/replaced.yaml1
-rw-r--r--tests/integration/targets/vyos_ospf_interfaces/tests/cli/rtt.yaml6
-rw-r--r--tests/integration/targets/vyos_ospf_interfaces/vars/pre-v1_4.yaml5
-rw-r--r--tests/integration/targets/vyos_ospf_interfaces/vars/v1_4.yaml5
-rw-r--r--tests/integration/targets/vyos_ospfv2/tasks/main.yaml8
-rw-r--r--tests/integration/targets/vyos_ospfv2/tasks/post_tasks.yaml7
-rw-r--r--tests/integration/targets/vyos_ospfv2/tasks/pre_tasks.yaml7
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/_get_version.yaml30
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/_parsed_config_1_3.cfg (renamed from tests/integration/targets/vyos_ospfv2/tests/cli/_parsed_config.cfg)4
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/_parsed_config_1_4.cfg29
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml38
-rw-r--r--tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml8
-rw-r--r--tests/integration/targets/vyos_ospfv2/vars/main.yaml97
-rw-r--r--tests/integration/targets/vyos_ospfv2/vars/pre-v1_4.yaml123
-rw-r--r--tests/integration/targets/vyos_ospfv2/vars/v1_4.yaml123
-rw-r--r--tests/integration/targets/vyos_route_maps/tests/cli/replaced.yaml1
-rw-r--r--tests/integration/targets/vyos_snmp_server/meta/main.yaml2
-rw-r--r--tests/integration/targets/vyos_snmp_server/tests/cli/_populate_config.yaml1
-rw-r--r--tests/integration/targets/vyos_snmp_server/tests/cli/_remove_config.yaml9
-rw-r--r--tests/integration/targets/vyos_snmp_server/tests/cli/merged.yaml1
-rw-r--r--tests/integration/targets/vyos_snmp_server/tests/cli/rendered.yaml1
-rw-r--r--tests/integration/targets/vyos_snmp_server/vars/main.yaml2
-rw-r--r--tests/integration/targets/vyos_system/tests/cli/basic.yaml6
-rw-r--r--tests/integration/targets/vyos_system/tests/cli/domain_search.yaml43
-rw-r--r--tests/integration/targets/vyos_system/vars/pre-v1_4.yaml4
-rw-r--r--tests/integration/targets/vyos_system/vars/v1_4.yaml4
50 files changed, 868 insertions, 162 deletions
diff --git a/tests/integration/targets/prepare_vyos_tests/tasks/main.yaml b/tests/integration/targets/prepare_vyos_tests/tasks/main.yaml
index 5800a582..276be083 100644
--- a/tests/integration/targets/prepare_vyos_tests/tasks/main.yaml
+++ b/tests/integration/targets/prepare_vyos_tests/tasks/main.yaml
@@ -1,14 +1,12 @@
---
- name: Ensure required interfaces are present in running-config
- vars:
+ vyos.vyos.vyos_config:
lines: |-
set interfaces ethernet eth0 address dhcp
set interfaces ethernet eth0 speed auto
set interfaces ethernet eth0 duplex auto
- set interfaces ethernet eth1 address 192.0.2.1/24
+ set interfaces ethernet eth1
set interfaces ethernet eth2
delete interfaces loopback lo
- ignore_errors: "{{ result.failed }}"
- register: result
- ansible.netcommon.cli_config:
- config: "{{ lines }}"
+ vars:
+ ansible_connection: ansible.netcommon.network_cli
diff --git a/tests/integration/targets/vyos_config/tests/cli/save.yaml b/tests/integration/targets/vyos_config/tests/cli/save.yaml
index e8a9035b..b39ef957 100644
--- a/tests/integration/targets/vyos_config/tests/cli/save.yaml
+++ b/tests/integration/targets/vyos_config/tests/cli/save.yaml
@@ -6,7 +6,7 @@
lines: set system host-name {{ inventory_hostname_short }}
match: none
-- name: configure hostaname and save
+- name: configure hostname and save
register: result
vyos.vyos.vyos_config:
lines: set system host-name foo
@@ -17,7 +17,7 @@
- result.changed == true
- "'set system host-name foo' in result.commands"
-- name: configure hostaname and don't save
+- name: configure hostname and don't save
register: result
vyos.vyos.vyos_config:
lines: set system host-name bar
diff --git a/tests/integration/targets/vyos_config/tests/cli/simple.yaml b/tests/integration/targets/vyos_config/tests/cli/simple.yaml
index 3db59270..1559fa2b 100644
--- a/tests/integration/targets/vyos_config/tests/cli/simple.yaml
+++ b/tests/integration/targets/vyos_config/tests/cli/simple.yaml
@@ -25,6 +25,17 @@
that:
- result.changed == false
+- name: configure simple config command while match = 'none'
+ register: result
+ vyos.vyos.vyos_config:
+ lines: set system host-name foo
+ match: none
+
+- assert:
+ that:
+ - result.changed == true
+ - "'set system host-name foo' in result.commands"
+
- name: Delete services
vyos.vyos.vyos_config: &id001
lines:
diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/diff_mode.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/diff_mode.yaml
new file mode 100644
index 00000000..43f3c88b
--- /dev/null
+++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/diff_mode.yaml
@@ -0,0 +1,61 @@
+---
+- debug:
+ msg: START vyos_firewall_rules diff mode integration tests on connection={{ ansible_connection }}
+
+- include_tasks: _remove_config.yaml
+
+- include_tasks: _populate.yaml
+
+- block:
+ - name: Replace device configurations - No Diff
+ register: result
+ diff: true
+ vyos.vyos.vyos_firewall_rules:
+ config: "{{ populate }}"
+
+ - name: Assert No Diff
+ assert:
+ that:
+ - result['changed'] == false
+ - result.diff is not defined
+
+ - name: Replace single rule's attribute and register Diff
+ register: result
+ diff: true
+ vyos.vyos.vyos_firewall_rules:
+ config: "{{ replaced_diff_01.config }}"
+ state: replaced
+
+ - name: Assert - Diff for a single rule and attribute
+ assert:
+ that:
+ - result['changed'] == true
+ - result.diff.prepared == "{{ replaced_diff_01.diff.rstrip() }}"
+
+ - name: Replace single rule's multiple attributes and register Diff
+ register: result
+ diff: true
+ vyos.vyos.vyos_firewall_rules:
+ config: "{{ replaced_diff_02.config }}"
+ state: replaced
+
+ - name: Assert - Diff for a single rule and multiple attributes
+ assert:
+ that:
+ - result['changed'] == true
+ - result.diff.prepared == "{{ replaced_diff_02.diff.rstrip() }}"
+
+ - name: Replace attributes in multiple rules and register Diff
+ register: result
+ diff: true
+ vyos.vyos.vyos_firewall_rules:
+ config: "{{ replaced_diff_03.config }}"
+ state: replaced
+
+ - name: Assert - Diff for a single rule and multiple attributes
+ assert:
+ that:
+ - result['changed'] == true
+ - result.diff.prepared == "{{ replaced_diff_03.diff.rstrip() }}"
+ always:
+ - include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_firewall_rules/vars/pre-v1_4.yaml b/tests/integration/targets/vyos_firewall_rules/vars/pre-v1_4.yaml
index c7d7398b..825afe67 100644
--- a/tests/integration/targets/vyos_firewall_rules/vars/pre-v1_4.yaml
+++ b/tests/integration/targets/vyos_firewall_rules/vars/pre-v1_4.yaml
@@ -128,3 +128,142 @@ state_dict:
new: false
invalid: false
related: true
+
+replaced_diff_01:
+ config:
+ - afi: ipv6
+ rule_sets:
+ - name: UPLINK
+ description: This is ipv6 specific rule-set
+ default_action: accept
+ rules:
+ - number: 1
+ action: accept
+ description: Fwipv6-Rule 1 is configured by Ansible
+ protocol: tcp
+ - number: 2
+ action: accept
+ description: Fwipv6-Rule 2 is configured by Ansible
+ protocol: tcp
+ - afi: ipv4
+ rule_sets:
+ - name: INBOUND
+ description: IPv4 INBOUND rule set
+ default_action: accept
+ rules:
+ - number: 101
+ action: reject
+ description: Rule 101 is configured by Ansible
+ protocol: tcp
+ - number: 102
+ action: reject
+ description: Rule 102 is configured by Ansible
+ protocol: tcp
+ - number: 103
+ action: accept
+ description: Rule 103 is configured by Ansible
+ destination:
+ group:
+ address_group: inbound
+ source:
+ address: 192.0.2.0
+ state: "{{ state_dict }}"
+ diff: |-
+ [edit firewall name INBOUND rule 101]
+ >action reject
+
+ [edit]
+
+replaced_diff_02:
+ config:
+ - afi: ipv6
+ rule_sets:
+ - name: UPLINK
+ description: This is ipv6 specific rule-set
+ default_action: accept
+ rules:
+ - number: 1
+ action: accept
+ description: Fwipv6-Rule 1 is configured by Ansible
+ protocol: tcp
+ - number: 2
+ action: accept
+ description: Fwipv6-Rule 2 is configured by Ansible
+ protocol: tcp
+ - afi: ipv4
+ rule_sets:
+ - name: INBOUND
+ description: IPv4 INBOUND rule set
+ default_action: accept
+ rules:
+ - number: 101
+ action: reject
+ description: Rule 101 is configured by Ansible
+ protocol: tcp
+ - number: 102
+ action: accept
+ description: Rule 102 is configured by Ansible
+ protocol: udp
+ - number: 103
+ action: accept
+ description: Rule 103 is configured by Ansible
+ destination:
+ group:
+ address_group: inbound
+ source:
+ address: 192.0.2.0
+ state: "{{ state_dict }}"
+ diff: |-
+ [edit firewall name INBOUND rule 102]
+ >action accept
+ >protocol udp
+
+ [edit]
+
+replaced_diff_03:
+ config:
+ - afi: ipv6
+ rule_sets:
+ - name: UPLINK
+ description: This is ipv6 specific rule-set
+ default_action: accept
+ rules:
+ - number: 1
+ action: reject
+ description: Fwipv6-Rule 1 is configured by Ansible
+ protocol: udp
+ - number: 2
+ action: accept
+ description: Fwipv6-Rule 2 is configured by Ansible
+ protocol: tcp
+ - afi: ipv4
+ rule_sets:
+ - name: INBOUND
+ description: IPv4 INBOUND rule set
+ default_action: accept
+ rules:
+ - number: 101
+ action: reject
+ description: Rule 101 is configured by Ansible
+ protocol: tcp
+ - number: 102
+ action: accept
+ description: Rule 102 is configured by Ansible
+ protocol: tcp
+ - number: 103
+ action: accept
+ description: Rule 103 is configured by Ansible
+ destination:
+ group:
+ address_group: inbound
+ source:
+ address: 192.0.2.0
+ state: "{{ state_dict }}"
+ diff: |-
+ [edit firewall ipv6-name UPLINK rule 1]
+ >action reject
+ >protocol udp
+ [edit firewall name INBOUND rule 102]
+ >protocol tcp
+
+ [edit]
diff --git a/tests/integration/targets/vyos_firewall_rules/vars/v1_4.yaml b/tests/integration/targets/vyos_firewall_rules/vars/v1_4.yaml
index 08675983..20ee461b 100644
--- a/tests/integration/targets/vyos_firewall_rules/vars/v1_4.yaml
+++ b/tests/integration/targets/vyos_firewall_rules/vars/v1_4.yaml
@@ -120,3 +120,151 @@ deleted_afi_all:
state_dict:
established: true
related: true
+
+replaced_diff_01:
+ config:
+ - afi: ipv6
+ rule_sets:
+ - name: UPLINK
+ description: This is ipv6 specific rule-set
+ default_action: accept
+ rules:
+ - number: 1
+ action: accept
+ description: Fwipv6-Rule 1 is configured by Ansible
+ protocol: tcp
+ - number: 2
+ action: accept
+ description: Fwipv6-Rule 2 is configured by Ansible
+ protocol: tcp
+ - afi: ipv4
+ rule_sets:
+ - name: INBOUND
+ description: IPv4 INBOUND rule set
+ default_action: accept
+ rules:
+ - number: 101
+ action: reject
+ description: Rule 101 is configured by Ansible
+ protocol: tcp
+ - number: 102
+ action: reject
+ description: Rule 102 is configured by Ansible
+ protocol: tcp
+ - number: 103
+ action: accept
+ description: Rule 103 is configured by Ansible
+ destination:
+ group:
+ address_group: inbound
+ source:
+ address: 192.0.2.0
+ state: "{{ state_dict }}"
+ diff: |-
+ [firewall ipv4 name INBOUND rule 101]
+ - action \"accept\"
+ + action \"reject\"
+
+
+ [edit]
+
+replaced_diff_02:
+ config:
+ - afi: ipv6
+ rule_sets:
+ - name: UPLINK
+ description: This is ipv6 specific rule-set
+ default_action: accept
+ rules:
+ - number: 1
+ action: accept
+ description: Fwipv6-Rule 1 is configured by Ansible
+ protocol: tcp
+ - number: 2
+ action: accept
+ description: Fwipv6-Rule 2 is configured by Ansible
+ protocol: tcp
+ - afi: ipv4
+ rule_sets:
+ - name: INBOUND
+ description: IPv4 INBOUND rule set
+ default_action: accept
+ rules:
+ - number: 101
+ action: reject
+ description: Rule 101 is configured by Ansible
+ protocol: tcp
+ - number: 102
+ action: accept
+ description: Rule 102 is configured by Ansible
+ protocol: udp
+ - number: 103
+ action: accept
+ description: Rule 103 is configured by Ansible
+ destination:
+ group:
+ address_group: inbound
+ source:
+ address: 192.0.2.0
+ state: "{{ state_dict }}"
+ diff: |-
+ [firewall ipv4 name INBOUND rule 102]
+ - action \"reject\"
+ + action \"accept\"
+ - protocol \"tcp\"
+ + protocol \"udp\"
+
+
+ [edit]
+
+replaced_diff_03:
+ config:
+ - afi: ipv6
+ rule_sets:
+ - name: UPLINK
+ description: This is ipv6 specific rule-set
+ default_action: accept
+ rules:
+ - number: 1
+ action: reject
+ description: Fwipv6-Rule 1 is configured by Ansible
+ protocol: udp
+ - number: 2
+ action: accept
+ description: Fwipv6-Rule 2 is configured by Ansible
+ protocol: tcp
+ - afi: ipv4
+ rule_sets:
+ - name: INBOUND
+ description: IPv4 INBOUND rule set
+ default_action: accept
+ rules:
+ - number: 101
+ action: reject
+ description: Rule 101 is configured by Ansible
+ protocol: tcp
+ - number: 102
+ action: accept
+ description: Rule 102 is configured by Ansible
+ protocol: tcp
+ - number: 103
+ action: accept
+ description: Rule 103 is configured by Ansible
+ destination:
+ group:
+ address_group: inbound
+ source:
+ address: 192.0.2.0
+ state: "{{ state_dict }}"
+ diff: |-
+ [firewall ipv4 name INBOUND rule 102]
+ - protocol \"udp\"
+ + protocol \"tcp\"
+ [firewall ipv6 name UPLINK rule 1]
+ - action \"accept\"
+ + action \"reject\"
+ - protocol \"tcp\"
+ + protocol \"udp\"
+
+
+ [edit]
diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml
index 45bd9b6a..cbc994ba 100644
--- a/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml
+++ b/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml
@@ -9,6 +9,8 @@
config: |-
{% for intf in ('eth1','eth2') %}
set interfaces ethernet "{{ intf }}" description 'Configured by Ansible'
+ set interfaces ethernet "{{ intf }}" speed 'auto'
+ set interfaces ethernet "{{ intf }}" duplex 'auto'
set interfaces ethernet "{{ intf }}" mtu '1500'
set interfaces ethernet "{{ intf }}" vif 200
set interfaces ethernet "{{ intf }}" vif 200 description 'VIF - 200'
diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml
index 620bf53f..9f0734b4 100644
--- a/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml
+++ b/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml
@@ -17,17 +17,17 @@
- name: Assert that the before dicts were correctly generated
assert:
that:
- - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
+ - populate | symmetric_difference(result['before']) |length == 0
- name: Assert that the correct set of commands were generated
assert:
that:
- - "{{ deleted['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['after'] | symmetric_difference(result['after']) |length == 0 }}"
+ - deleted['after'] | symmetric_difference(result['after']) |length == 0
- name: Delete attributes of given interfaces (IDEMPOTENT)
register: result
@@ -41,6 +41,6 @@
- name: Assert that the before dicts were correctly generated
assert:
that:
- - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}"
+ - deleted['after'] | symmetric_difference(result['before']) |length == 0
always:
- include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml
index 88e53762..46a0e166 100644
--- a/tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml
+++ b/tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml
@@ -14,7 +14,7 @@
- name: Assert that gathered dicts was correctly generated
assert:
that:
- - "{{ populate | symmetric_difference(result['gathered']) |length == 0 }}"
+ - populate | symmetric_difference(result['gathered']) |length == 0
always:
- include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/merged.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/merged.yaml
index 5c719b39..decdeca2 100644
--- a/tests/integration/targets/vyos_interfaces/tests/cli/merged.yaml
+++ b/tests/integration/targets/vyos_interfaces/tests/cli/merged.yaml
@@ -12,6 +12,8 @@
- name: eth1
description: Configured by Ansible - Interface 1
mtu: 1500
+ speed: auto
+ duplex: auto
vifs:
- vlan_id: 100
description: Eth1 - VIF 100
@@ -28,17 +30,17 @@
- name: Assert that before dicts were correctly generated
assert:
- that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}"
+ that: merged['before'] | symmetric_difference(result['before']) |length == 0
- name: Assert that correct set of commands were generated
assert:
that:
- - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
+ - merged['commands'] | symmetric_difference(result['commands']) |length == 0
- name: Assert that after dicts was correctly generated
assert:
that:
- - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}"
+ - merged['after'] | symmetric_difference(result['after']) |length == 0
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
register: result
@@ -52,6 +54,6 @@
- name: Assert that before dicts were correctly generated
assert:
that:
- - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}"
+ - merged['after'] | symmetric_difference(result['before']) |length == 0
always:
- include_tasks: _remove_config.yaml
diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml
index 7e86d3e4..5d87ab68 100644
--- a/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml
+++ b/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml
@@ -21,17 +21,17 @@
- name: Assert that before dicts were correctly generated
assert:
that:
- - "{{ populate | symmetric_difference(result['before']) |length == 0 }}"
+ - populate | symmetric_difference(result['before']) |length == 0
- name: Assert that correct commands were generated
assert:
that:
- - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
+ - overridden['commands'] | symmetric_difference(result['commands']) |length == 0
- name: Assert that after dicts were correctly generated
assert:
that:
- - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}"
+ - overridden['after'] | symmetric_difference(result['after']) |length == 0
- name: Overrides all device configuration with provided configurations (IDEMPOTENT)
register: result
@@ -45,6 +45,6 @@
- name: Assert that before dicts were correctly generated
assert:
that:
- - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}"
+ - overridden['after'] | symmetric_difference(result['before']) |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
index 0ebfd322..329d6b50 100644
--- a/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml
+++ b/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml
@@ -11,4 +11,4 @@
- name: Assert that config was correctly parsed
assert:
that:
- - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length == 0 }}"
+ - 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
index c03347fa..7b66c50e 100644
--- a/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml
+++ b/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml
@@ -11,9 +11,13 @@
config:
- name: eth0
enabled: true
+ duplex: auto
+ speed: auto
- name: eth1
description: Configured by Ansible - Interface 1
mtu: 1500
+ duplex: auto
+ speed: auto
enabled: true
vifs:
- vlan_id: 100
diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml
index 9d0a3a8b..5cfa4523 100644
--- a/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml
+++ b/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml
@@ -25,17 +25,11 @@
that:
- replaced['commands'] | symmetric_difference(result['commands']) |length == 0
- - debug:
- var: populate | symmetric_difference(result['before'])
-
- name: Assert that before dicts are correctly generated
assert:
that:
- populate | symmetric_difference(result['before']) |length == 0
- - debug:
- var: replaced['after'] | symmetric_difference(result['after'])
-
- name: Assert that after dict is correctly generated
assert:
that:
diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml
index cfe1b0f0..e6753cba 100644
--- a/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml
+++ b/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml
@@ -11,6 +11,8 @@
config:
- name: eth0
enabled: true
+ duplex: auto
+ speed: auto
- name: eth1
description: Interface - 1
@@ -62,7 +64,7 @@
- name: Assert that changes were applied
assert:
- that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}"
+ that: round_trip['after'] | symmetric_difference(result['after']) |length == 0
- name: Revert back to base config using facts round trip
register: revert
@@ -72,6 +74,6 @@
- name: Assert that config was reverted
assert:
- that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}"
+ that: base_config['after'] | symmetric_difference(revert['after']) |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 4e66747b..c65771f2 100644
--- a/tests/integration/targets/vyos_interfaces/vars/main.yaml
+++ b/tests/integration/targets/vyos_interfaces/vars/main.yaml
@@ -12,6 +12,8 @@ merged:
commands:
- set interfaces ethernet eth1 description 'Configured by Ansible - Interface 1'
- set interfaces ethernet eth1 mtu '1500'
+ - set interfaces ethernet eth1 duplex 'auto'
+ - set interfaces ethernet eth1 speed 'auto'
- set interfaces ethernet eth1 vif 100 description 'Eth1 - VIF 100'
- set interfaces ethernet eth1 vif 100 mtu '1404'
- set interfaces ethernet eth1 vif 101 description 'Eth1 - VIF 101'
@@ -27,6 +29,8 @@ merged:
description: Configured by Ansible - Interface 1
mtu: 1500
enabled: true
+ duplex: auto
+ speed: auto
vifs:
- vlan_id: 100
description: Eth1 - VIF 100
@@ -44,6 +48,8 @@ populate:
enabled: true
description: Configured by Ansible
mtu: 1500
+ duplex: auto
+ speed: auto
vifs:
- vlan_id: 200
enabled: true
@@ -52,6 +58,8 @@ populate:
enabled: true
description: Configured by Ansible
mtu: 1500
+ duplex: auto
+ speed: auto
vifs:
- vlan_id: 200
enabled: true
@@ -63,10 +71,14 @@ populate:
replaced:
commands:
- delete interfaces ethernet eth1 mtu
+ - delete interfaces ethernet eth1 speed
+ - delete interfaces ethernet eth1 duplex
- delete interfaces ethernet eth1 vif 200
- set interfaces ethernet eth1 description 'Replaced by Ansible'
- set interfaces ethernet eth1 vif 100 description 'VIF 100 - Replaced by Ansible'
- delete interfaces ethernet eth2 vif 200
+ - delete interfaces ethernet eth2 speed
+ - delete interfaces ethernet eth2 duplex
- set interfaces ethernet eth2 description 'Replaced by Ansible'
- set interfaces ethernet eth2 mtu '1400'
after:
@@ -107,8 +119,12 @@ overridden:
commands:
- delete interfaces ethernet eth1 description
- delete interfaces ethernet eth1 mtu
+ - delete interfaces ethernet eth1 speed
+ - delete interfaces ethernet eth1 duplex
- delete interfaces ethernet eth1 vif 200
- delete interfaces ethernet eth2 vif 200
+ - delete interfaces ethernet eth2 speed
+ - delete interfaces ethernet eth2 duplex
- set interfaces ethernet eth2 description 'Overridden by Ansible'
- set interfaces ethernet eth2 mtu '1402'
after:
@@ -124,6 +140,10 @@ overridden:
mtu: 1402
rendered:
commands:
+ - set interfaces ethernet eth0 duplex 'auto'
+ - set interfaces ethernet eth0 speed 'auto'
+ - set interfaces ethernet eth1 duplex 'auto'
+ - 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'
@@ -137,9 +157,13 @@ deleted:
- delete interfaces ethernet eth1 description
- delete interfaces ethernet eth1 mtu
- delete interfaces ethernet eth1 vif 200
+ - delete interfaces ethernet eth1 speed
+ - delete interfaces ethernet eth1 duplex
- delete interfaces ethernet eth2 description
- delete interfaces ethernet eth2 mtu
- delete interfaces ethernet eth2 vif 200
+ - delete interfaces ethernet eth2 speed
+ - delete interfaces ethernet eth2 duplex
after:
- name: eth0
enabled: true
@@ -149,6 +173,7 @@ deleted:
enabled: true
- name: eth2
enabled: true
+
round_trip:
after:
- name: eth0
diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/_populate.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/_populate.yaml
index 89fb8e51..a17021b4 100644
--- a/tests/integration/targets/vyos_logging_global/tests/cli/_populate.yaml
+++ b/tests/integration/targets/vyos_logging_global/tests/cli/_populate.yaml
@@ -1,4 +1,5 @@
---
+- ansible.builtin.include_tasks: _get_version.yaml
- ansible.builtin.include_tasks: _remove_config.yaml
- name: POPULATE Apply the provided configuration
diff --git a/tests/integration/targets/vyos_ospf_interfaces/tasks/post_tasks.yml b/tests/integration/targets/vyos_ospf_interfaces/tasks/post_tasks.yml
index 0883ef48..f6b009a8 100644
--- a/tests/integration/targets/vyos_ospf_interfaces/tasks/post_tasks.yml
+++ b/tests/integration/targets/vyos_ospf_interfaces/tasks/post_tasks.yml
@@ -3,5 +3,7 @@
vyos.vyos.vyos_config:
lines: |-
delete interfaces bonding bond2
+ delete interfaces ethernet eth2 vif 3
+ delete interfaces ethernet eth2 vif 18
vars:
ansible_connection: ansible.netcommon.network_cli
diff --git a/tests/integration/targets/vyos_ospf_interfaces/tasks/pre_tasks.yml b/tests/integration/targets/vyos_ospf_interfaces/tasks/pre_tasks.yml
index af74ff7a..fdb4981c 100644
--- a/tests/integration/targets/vyos_ospf_interfaces/tasks/pre_tasks.yml
+++ b/tests/integration/targets/vyos_ospf_interfaces/tasks/pre_tasks.yml
@@ -3,5 +3,7 @@
vyos.vyos.vyos_config:
lines: |-
set interfaces bonding bond2
+ set interfaces ethernet eth2 vif 3
+ set interfaces ethernet eth2 vif 18
vars:
ansible_connection: ansible.netcommon.network_cli
diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/_get_version.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/_get_version.yaml
index a7691499..50b0ec61 100644
--- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/_get_version.yaml
+++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/_get_version.yaml
@@ -26,6 +26,5 @@
- name: include correct vars
include_vars: v1_4.yaml
when: vyos_version is version('1.4.0', '>=', version_type='semver')
-
# - name: include common vars
# include_vars: main.yaml
diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/deleted.yaml
index 59fe52ac..bd70d071 100644
--- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/deleted.yaml
+++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/deleted.yaml
@@ -17,7 +17,6 @@
- assert:
that:
- - result.commands|length == 2
- result.changed == true
- result.commands|symmetric_difference(deleted.commands) == []
- result.after|symmetric_difference(ansible_facts['network_resources']['ospf_interfaces']) == []
diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/merged.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/merged.yaml
index 7b091dd7..ddff03c9 100644
--- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/merged.yaml
+++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/merged.yaml
@@ -17,6 +17,11 @@
- afi: ipv6
mtu_ignore: true
instance: 33
+ - name: eth2.3
+ address_family:
+ - afi: ipv4
+ cost: 60
+ priority: 40
- name: bond2
address_family:
- afi: ipv4
@@ -30,7 +35,6 @@
- assert:
that:
- - result.commands|length == 6
- result.changed == true
- result.commands|symmetric_difference(merged.commands) == []
- result.after|symmetric_difference(ansible_facts['network_resources']['ospf_interfaces']) == []
diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/overridden.yaml
index 7e728069..252336fc 100644
--- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/overridden.yaml
+++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/overridden.yaml
@@ -24,7 +24,6 @@
- assert:
that:
- - result.commands|length == 8
- result.changed == true
- result.commands|symmetric_difference(overridden.commands) == []
- result.after|symmetric_difference(ansible_facts['network_resources']['ospf_interfaces']) == []
diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rendered.yaml
index 4cb5f4f9..5a07c95d 100644
--- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rendered.yaml
+++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rendered.yaml
@@ -17,6 +17,11 @@
- afi: ipv6
mtu_ignore: true
instance: 33
+ - name: eth2.3
+ address_family:
+ - afi: ipv4
+ cost: 60
+ priority: 40
- name: bond2
address_family:
- afi: ipv4
diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/replaced.yaml
index 2bb8a02f..7a5b9fa8 100644
--- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/replaced.yaml
+++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/replaced.yaml
@@ -35,7 +35,6 @@
- assert:
that:
- - result.commands|length == 8
- result.changed == true
- result.commands|symmetric_difference(replaced.commands) == []
- result.after|symmetric_difference(ansible_facts['network_resources']['ospf_interfaces']) == []
diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rtt.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rtt.yaml
index c74248e0..e2464457 100644
--- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rtt.yaml
+++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rtt.yaml
@@ -19,6 +19,11 @@
- afi: ipv6
mtu_ignore: true
instance: 33
+ - name: eth2.3
+ address_family:
+ - afi: ipv4
+ cost: 60
+ priority: 40
- name: bond2
address_family:
- afi: ipv4
@@ -32,7 +37,6 @@
- assert:
that:
- - baseconfig.commands|length == 6
- baseconfig.changed == true
- baseconfig.commands|symmetric_difference(merged.commands) == []
- baseconfig.after|symmetric_difference(ansible_facts['network_resources']['ospf_interfaces']) == []
diff --git a/tests/integration/targets/vyos_ospf_interfaces/vars/pre-v1_4.yaml b/tests/integration/targets/vyos_ospf_interfaces/vars/pre-v1_4.yaml
index a9e03421..7f84e92e 100644
--- a/tests/integration/targets/vyos_ospf_interfaces/vars/pre-v1_4.yaml
+++ b/tests/integration/targets/vyos_ospf_interfaces/vars/pre-v1_4.yaml
@@ -4,6 +4,8 @@ merged_commands:
- set interfaces ethernet eth0 ip ospf priority 26
- set interfaces ethernet eth0 ipv6 ospfv3 mtu-ignore
- set interfaces ethernet eth0 ipv6 ospfv3 instance-id 33
+ - set interfaces ethernet eth2 vif 3 ip ospf cost 60
+ - set interfaces ethernet eth2 vif 3 ip ospf priority 40
- set interfaces bonding bond2 ip ospf transmit-delay 45
- set interfaces bonding bond2 ipv6 ospfv3 passive
@@ -12,6 +14,7 @@ populate_commands:
- set interfaces ethernet eth0 ip ospf priority 26
- set interfaces ethernet eth0 ipv6 ospfv3 mtu-ignore
- set interfaces ethernet eth0 ipv6 ospfv3 instance-id 33
+ - set interfaces ethernet eth2 vif 18 ip ospf cost 80
- set interfaces bonding bond2 ip ospf transmit-delay 45
- set interfaces bonding bond2 ipv6 ospfv3 passive
@@ -20,6 +23,7 @@ remove_commands:
- delete interfaces ethernet eth0 ipv6 ospfv3
- delete interfaces ethernet eth1 ip ospf
- delete interfaces ethernet eth1 ipv6 ospfv3
+ - delete interfaces ethernet eth2 vif 3 ip ospf
- delete interfaces bonding bond1 ip ospf
- delete interfaces bonding bond1 ipv6 ospfv3
- delete interfaces bonding bond2 ip ospf
@@ -41,6 +45,7 @@ replaced_commands:
overridden_commands:
- delete interfaces bonding bond2 ip ospf
- delete interfaces bonding bond2 ipv6 ospfv3
+ - delete interfaces ethernet eth2 vif 18 ip ospf
- set interfaces ethernet eth0 ip ospf transmit-delay 50
- set interfaces ethernet eth0 ip ospf network point-to-point
- set interfaces ethernet eth0 ipv6 ospfv3 dead-interval 39
diff --git a/tests/integration/targets/vyos_ospf_interfaces/vars/v1_4.yaml b/tests/integration/targets/vyos_ospf_interfaces/vars/v1_4.yaml
index 15b7f5a7..3864f33a 100644
--- a/tests/integration/targets/vyos_ospf_interfaces/vars/v1_4.yaml
+++ b/tests/integration/targets/vyos_ospf_interfaces/vars/v1_4.yaml
@@ -4,6 +4,8 @@ merged_commands:
- set protocols ospf interface eth0 priority 26
- set protocols ospfv3 interface eth0 mtu-ignore
- set protocols ospfv3 interface eth0 instance-id 33
+ - set protocols ospf interface eth2.3 cost 60
+ - set protocols ospf interface eth2.3 priority 40
- set protocols ospfv3 interface bond2 passive
- set protocols ospf interface bond2 transmit-delay 45
@@ -12,11 +14,13 @@ populate_commands:
- set protocols ospf interface eth0 priority 26
- set protocols ospfv3 interface eth0 mtu-ignore
- set protocols ospfv3 interface eth0 instance-id 33
+ - set protocols ospf interface eth2.18 cost 80
- set protocols ospfv3 interface bond2 passive
- set protocols ospf interface bond2 transmit-delay 45
remove_commands:
- delete protocols ospf interface eth0
+ - delete protocols ospf interface eth2.3
- delete protocols ospf interface bond2
- delete protocols ospfv3 interface bond2
- delete protocols ospfv3 interface eth0
@@ -36,6 +40,7 @@ replaced_commands:
overridden_commands:
- delete protocols ospf interface bond2
- delete protocols ospfv3 interface bond2
+ - delete protocols ospf interface eth2.18
- set protocols ospf interface eth0 transmit-delay 50
- set protocols ospf interface eth0 network point-to-point
- set protocols ospfv3 interface eth0 dead-interval 39
diff --git a/tests/integration/targets/vyos_ospfv2/tasks/main.yaml b/tests/integration/targets/vyos_ospfv2/tasks/main.yaml
index 9a3359ed..53afd6c2 100644
--- a/tests/integration/targets/vyos_ospfv2/tasks/main.yaml
+++ b/tests/integration/targets/vyos_ospfv2/tasks/main.yaml
@@ -1,4 +1,8 @@
---
+- name: Run preflight setup
+ ansible.builtin.import_tasks: pre_tasks.yaml
+ failed_when: false
+
- name: Run CLI tests
ansible.builtin.include_tasks: cli.yaml
tags:
@@ -9,3 +13,7 @@
when: ansible_version.full is version('2.10.0', '>=')
tags:
- network_cli
+
+- name: Run post-test cleanup tasks
+ ansible.builtin.import_tasks: post_tasks.yaml
+ failed_when: false
diff --git a/tests/integration/targets/vyos_ospfv2/tasks/post_tasks.yaml b/tests/integration/targets/vyos_ospfv2/tasks/post_tasks.yaml
new file mode 100644
index 00000000..e172db2d
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tasks/post_tasks.yaml
@@ -0,0 +1,7 @@
+---
+- name: Remove pre-requisite configuration
+ vyos.vyos.vyos_config:
+ lines: |-
+ delete policy route-map ingress
+ vars:
+ ansible_connection: ansible.netcommon.network_cli
diff --git a/tests/integration/targets/vyos_ospfv2/tasks/pre_tasks.yaml b/tests/integration/targets/vyos_ospfv2/tasks/pre_tasks.yaml
new file mode 100644
index 00000000..bdca8772
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tasks/pre_tasks.yaml
@@ -0,0 +1,7 @@
+---
+- name: Add pre-requisite configuration
+ vyos.vyos.vyos_config:
+ lines: |-
+ set policy route-map ingress
+ vars:
+ ansible_connection: ansible.netcommon.network_cli
diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/_get_version.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/_get_version.yaml
new file mode 100644
index 00000000..50b0ec61
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/_get_version.yaml
@@ -0,0 +1,30 @@
+- name: make sure to get facts
+ vyos.vyos.vyos_facts:
+ vars:
+ ansible_connection: ansible.netcommon.network_cli
+ register: vyos_facts
+ when: vyos_version is not defined
+
+- name: debug vyos_facts
+ debug:
+ var: vyos_facts
+
+- name: pull version from facts
+ set_fact:
+ vyos_version: "{{ vyos_facts.ansible_facts.ansible_net_version.split('-')[0].split(' ')[-1] }}"
+ when: vyos_version is not defined
+
+- name: fix '.0' versions
+ set_fact:
+ vyos_version: "{{ vyos_version }}.0"
+ when: vyos_version.count('.') == 1
+
+- name: include correct vars
+ include_vars: pre-v1_4.yaml
+ when: vyos_version is version('1.4.0', '<', version_type='semver')
+
+- name: include correct vars
+ include_vars: v1_4.yaml
+ when: vyos_version is version('1.4.0', '>=', version_type='semver')
+# - name: include common vars
+# include_vars: main.yaml
diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_ospfv2/tests/cli/_parsed_config_1_3.cfg
index 9cc720b4..0d8100d8 100644
--- a/tests/integration/targets/vyos_ospfv2/tests/cli/_parsed_config.cfg
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/_parsed_config_1_3.cfg
@@ -1,6 +1,6 @@
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 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'
@@ -15,7 +15,7 @@ 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 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'
diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/_parsed_config_1_4.cfg b/tests/integration/targets/vyos_ospfv2/tests/cli/_parsed_config_1_4.cfg
new file mode 100644
index 00000000..8e24ab69
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/_parsed_config_1_4.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 interface 'eth1' passive
+set protocols ospf interface 'eth2' passive
+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
index 872d3302..748dca70 100644
--- a/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml
@@ -1,37 +1,11 @@
---
- ansible.builtin.include_tasks: _remove_config.yaml
+- name: ensure facts
+ include_tasks: _get_version.yaml
+
- name: Setup
+ vyos.vyos.vyos_config:
+ lines: "{{ populate_commands }}"
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 }}"
+ ansible_connection: ansible.netcommon.network_cli
diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml
index ad5b005d..4b6e0c5c 100644
--- a/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml
+++ b/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml
@@ -2,12 +2,18 @@
- debug:
msg: START vyos_ospfv2 parsed integration tests on connection={{ ansible_connection }}
+- name: ensure facts
+ include_tasks: _get_version.yaml
+
- name: Parse externally provided ospfv2 config to agnostic model
register: result
vyos.vyos.vyos_ospfv2:
- running_config: "{{ lookup('file', '_parsed_config.cfg') }}"
+ running_config: "{{ lookup('file', parsed_config_file) }}"
state: parsed
+- debug:
+ msg: "{{ parsed['after'] }}"
+
- name: Assert that config was correctly parsed
assert:
that:
diff --git a/tests/integration/targets/vyos_ospfv2/vars/main.yaml b/tests/integration/targets/vyos_ospfv2/vars/main.yaml
index 70d25fc7..1f1b9ba8 100644
--- a/tests/integration/targets/vyos_ospfv2/vars/main.yaml
+++ b/tests/integration/targets/vyos_ospfv2/vars/main.yaml
@@ -1,43 +1,7 @@
---
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
+ commands: "{{ merged_commands }}"
after:
areas:
- area_id: "2"
@@ -94,6 +58,7 @@ merged:
- metric: 10
metric_type: 2
route_type: bgp
+
merged_update:
before:
areas:
@@ -209,6 +174,7 @@ merged_update:
- 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"
@@ -265,20 +231,9 @@ populate:
- 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
+ commands: "{{ replaced_commands }}"
after:
areas:
- area_id: "2"
@@ -331,44 +286,10 @@ replaced:
- 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
+ commands: "{{ rendered_commands }}"
+
parsed:
after:
areas:
@@ -426,10 +347,12 @@ parsed:
- metric: 10
metric_type: 2
route_type: bgp
+
deleted:
commands:
- delete protocols ospf
after: {}
+
round_trip:
after:
areas:
diff --git a/tests/integration/targets/vyos_ospfv2/vars/pre-v1_4.yaml b/tests/integration/targets/vyos_ospfv2/vars/pre-v1_4.yaml
new file mode 100644
index 00000000..a5e8a725
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/vars/pre-v1_4.yaml
@@ -0,0 +1,123 @@
+---
+merged_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
+
+populate_commands:
+ - set protocols ospf mpls-te 'enable'
+ - set protocols ospf mpls-te router-address '192.0.11.11'
+ - 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 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 area-type 'nssa'
+ - 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 area 4 area-type stub default-cost '20'
+ - set protocols ospf area 4 network '192.0.2.0/24'
+
+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
+
+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_config_file: "_parsed_config_1_3.cfg"
diff --git a/tests/integration/targets/vyos_ospfv2/vars/v1_4.yaml b/tests/integration/targets/vyos_ospfv2/vars/v1_4.yaml
new file mode 100644
index 00000000..4b7d0ab1
--- /dev/null
+++ b/tests/integration/targets/vyos_ospfv2/vars/v1_4.yaml
@@ -0,0 +1,123 @@
+---
+merged_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 interface eth1 passive
+ - set protocols ospf interface eth2 passive
+ - 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
+
+populate_commands:
+ - set protocols ospf mpls-te 'enable'
+ - set protocols ospf mpls-te router-address '192.0.11.11'
+ - 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 interface 'eth1' passive
+ - set protocols ospf interface 'eth2' passive
+ - 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 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 area-type 'nssa'
+ - 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 area 4 area-type stub default-cost '20'
+ - set protocols ospf area 4 network '192.0.2.0/24'
+
+replaced_commands:
+ - delete protocols ospf interface eth2 passive
+ - 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
+
+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 interface eth1 passive
+ - set protocols ospf interface eth2 passive
+ - 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_config_file: "_parsed_config_1_4.cfg"
diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/replaced.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/replaced.yaml
index d7d05ec1..dce0cba9 100644
--- a/tests/integration/targets/vyos_route_maps/tests/cli/replaced.yaml
+++ b/tests/integration/targets/vyos_route_maps/tests/cli/replaced.yaml
@@ -31,7 +31,6 @@
- assert:
that:
- - result.commands|length == 7
- result.changed == true
- result.commands|symmetric_difference(replaced.commands) == []
- result.after|symmetric_difference(ansible_facts['network_resources']['route_maps']) == []
diff --git a/tests/integration/targets/vyos_snmp_server/meta/main.yaml b/tests/integration/targets/vyos_snmp_server/meta/main.yaml
index ed97d539..7413320e 100644
--- a/tests/integration/targets/vyos_snmp_server/meta/main.yaml
+++ b/tests/integration/targets/vyos_snmp_server/meta/main.yaml
@@ -1 +1,3 @@
---
+dependencies:
+ - prepare_vyos_tests
diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/_populate_config.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/_populate_config.yaml
index f8aa82e8..5fade170 100644
--- a/tests/integration/targets/vyos_snmp_server/tests/cli/_populate_config.yaml
+++ b/tests/integration/targets/vyos_snmp_server/tests/cli/_populate_config.yaml
@@ -2,6 +2,7 @@
- name: setup
vyos.vyos.vyos_config:
lines:
+ - set interface ethernet eth1 address 192.0.2.1/24
- set interface ethernet eth2 address 20.1.1.1/24
- set service snmp community switches authorization rw
- set service snmp community bridges client 1.1.1.1
diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/_remove_config.yaml
index 12cfb755..d30001f9 100644
--- a/tests/integration/targets/vyos_snmp_server/tests/cli/_remove_config.yaml
+++ b/tests/integration/targets/vyos_snmp_server/tests/cli/_remove_config.yaml
@@ -6,3 +6,12 @@
ignore_errors: true
vars:
ansible_connection: ansible.netcommon.network_cli
+
+- name: remove interfaces address
+ vyos.vyos.vyos_config:
+ lines:
+ - delete interface ethernet eth1 address
+ - delete interface ethernet eth2 address
+ ignore_errors: true
+ vars:
+ ansible_connection: ansible.netcommon.network_cli
diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/merged.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/merged.yaml
index 991cb42d..9ce0679b 100644
--- a/tests/integration/targets/vyos_snmp_server/tests/cli/merged.yaml
+++ b/tests/integration/targets/vyos_snmp_server/tests/cli/merged.yaml
@@ -20,6 +20,7 @@
- address: 192.0.2.1
port: 33
snmp_v3:
+ engine_id: "000000000000000000000002"
views:
- view: default
oid: 1
diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/rendered.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/rendered.yaml
index 17334e4e..644a5571 100644
--- a/tests/integration/targets/vyos_snmp_server/tests/cli/rendered.yaml
+++ b/tests/integration/targets/vyos_snmp_server/tests/cli/rendered.yaml
@@ -20,6 +20,7 @@
- address: 192.0.2.1
port: 33
snmp_v3:
+ engine_id: "000000000000000000000002"
views:
- view: default
oid: 1
diff --git a/tests/integration/targets/vyos_snmp_server/vars/main.yaml b/tests/integration/targets/vyos_snmp_server/vars/main.yaml
index 4560271f..594d9739 100644
--- a/tests/integration/targets/vyos_snmp_server/vars/main.yaml
+++ b/tests/integration/targets/vyos_snmp_server/vars/main.yaml
@@ -15,6 +15,7 @@ merged:
- set service snmp v3 user adminuser privacy encrypted-password ********
- set service snmp v3 user adminuser group testgroup
- set service snmp v3 view default oid 1
+ - set service snmp v3 engineid 000000000000000000000002
- set service snmp contact admin2@ex.com
after:
communities:
@@ -30,6 +31,7 @@ merged:
port: 33
- address: 20.1.1.1
snmp_v3:
+ engine_id: "000000000000000000000002"
groups:
- group: testgroup
mode: ro
diff --git a/tests/integration/targets/vyos_system/tests/cli/basic.yaml b/tests/integration/targets/vyos_system/tests/cli/basic.yaml
index 29309e22..cf08f36f 100644
--- a/tests/integration/targets/vyos_system/tests/cli/basic.yaml
+++ b/tests/integration/targets/vyos_system/tests/cli/basic.yaml
@@ -55,9 +55,9 @@
ignore_errors: true
vyos.vyos.vyos_config:
lines:
- - delete system name-server name-server 192.0.2.1
- - delete system name-server name-server 192.0.2.2
- - delete system name-server name-server 192.0.2.3
+ - delete system name-server 192.0.2.1
+ - delete system name-server 192.0.2.2
+ - delete system name-server 192.0.2.3
match: none
- debug: msg="END cli/basic.yaml on connection={{ ansible_connection }}"
diff --git a/tests/integration/targets/vyos_system/tests/cli/domain_search.yaml b/tests/integration/targets/vyos_system/tests/cli/domain_search.yaml
new file mode 100644
index 00000000..2422d2c7
--- /dev/null
+++ b/tests/integration/targets/vyos_system/tests/cli/domain_search.yaml
@@ -0,0 +1,43 @@
+---
+- debug: msg="START cli/domain_search.yaml on connection={{ ansible_connection }}"
+
+- name: ensure facts
+ include_tasks: _get_version.yaml
+
+- name: setup
+ ignore_errors: true
+ vyos.vyos.vyos_system:
+ domain_search:
+ - nbg.bufanda.ke
+ state: absent
+
+- name: configure domain search setting
+ register: result
+ vyos.vyos.vyos_system:
+ domain_search:
+ - nbg.bufanda.ke
+
+- assert:
+ that:
+ - result.changed == true
+ - result.commands|length == 1
+ - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
+
+- name: configure domain search setting
+ register: result
+ vyos.vyos.vyos_system:
+ domain_search:
+ - nbg.bufanda.ke
+
+- assert:
+ that:
+ - result.changed == false
+
+- name: teardown
+ ignore_errors: true
+ vyos.vyos.vyos_system:
+ domain_search:
+ - nbg.bufanda.ke
+ state: absent
+
+- debug: msg="END cli/basic.yaml on connection={{ ansible_connection }}"
diff --git a/tests/integration/targets/vyos_system/vars/pre-v1_4.yaml b/tests/integration/targets/vyos_system/vars/pre-v1_4.yaml
new file mode 100644
index 00000000..cb41c9c6
--- /dev/null
+++ b/tests/integration/targets/vyos_system/vars/pre-v1_4.yaml
@@ -0,0 +1,4 @@
+---
+merged:
+ commands:
+ - set system domain-search domain 'nbg.bufanda.ke'
diff --git a/tests/integration/targets/vyos_system/vars/v1_4.yaml b/tests/integration/targets/vyos_system/vars/v1_4.yaml
new file mode 100644
index 00000000..96f0b7c9
--- /dev/null
+++ b/tests/integration/targets/vyos_system/vars/v1_4.yaml
@@ -0,0 +1,4 @@
+---
+merged:
+ commands:
+ - set system domain-search 'nbg.bufanda.ke'