diff --git a/.gitignore b/.gitignore index f1ecdf3..4e50e63 100644 --- a/.gitignore +++ b/.gitignore @@ -1,108 +1,111 @@ +/tests/output/ +/changelogs/.plugin-cache.yaml + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover .hypothesis/ .pytest_cache/ # Translations *.mo *.pot #ide .vscode *.swp # Django stuff: *.log local_settings.py db.sqlite3 # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # pyenv .python-version # celery beat schedule file celerybeat-schedule # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/_populate.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/_populate.yaml index 3aca916..ecbcc70 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/_populate.yaml @@ -1,17 +1,19 @@ --- -- name: setup +- ansible.builtin.include_tasks: _remove_config.yaml + +- name: Setup vyos.vyos.vyos_config: lines: - set policy access-list 20 description 'acl20' - set policy access-list 40 description 'acl40' - set policy access-list6 10 description 'acl10' - set policy route-map map01 description 'map01' - set protocols bgp 65536 address-family ipv6-unicast aggregate-address 5000:1:1::/64 summary-only - set protocols bgp 65536 address-family ipv6-unicast network 21e0:1:1::/64 route-map 'map01' - set protocols bgp 65536 address-family ipv6-unicast redistribute ripng metric '20' - set protocols bgp 65536 neighbor 192.0.2.25 address-family ipv6-unicast route-map export 'map01' - set protocols bgp 65536 neighbor 192.0.2.25 address-family ipv6-unicast soft-reconfiguration inbound - set protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast attribute-unchanged next-hop ignore_errors: true vars: ansible_connection: ansible.netcommon.network_cli diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/deleted.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/deleted.yaml index 64f6f34..5d60f36 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/deleted.yaml @@ -1,48 +1,46 @@ --- - debug: msg: START vyos_bgp_address_family deleted integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Delete the provided configuration register: result vyos.vyos.vyos_bgp_address_family: &id001 config: as_number: "65536" address_family: - afi: "ipv6" neighbors: - neighbor_address: "203.0.113.5" - neighbor_address: "192.0.2.25" address_family: - afi: "ipv6" state: deleted - vyos.vyos.vyos_facts: gather_network_resources: bgp_address_family - assert: that: - result.commands|length == 3 - result.changed == true - result.commands|symmetric_difference(deleted.commands) == [] - result.after == ansible_facts['network_resources']['bgp_address_family'] - name: Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_address_family: *id001 - name: Assert that the previous task was idempotent assert: that: - result['changed'] == false always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/gathered.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/gathered.yaml index f05094f..a8f428f 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/gathered.yaml @@ -1,23 +1,21 @@ --- - debug: msg: START vyos_bgp_address_family gathered integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Gather config from the device in structured format. register: result vyos.vyos.vyos_bgp_address_family: state: gathered - vyos.vyos.vyos_facts: gather_network_resources: bgp_address_family - assert: that: - result.changed == false - result.gathered == ansible_facts['network_resources']['bgp_address_family'] diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/overridden.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/overridden.yaml index fdbc00b..9414494 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/overridden.yaml @@ -1,57 +1,55 @@ --- - debug: msg: START vyos_bgp_address_family overridden integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Replace the existing configuration with the provided running configuration register: result vyos.vyos.vyos_bgp_address_family: &id001 config: as_number: "65536" address_family: - afi: "ipv6" redistribute: - protocol: "static" metric: 50 neighbors: - neighbor_address: "203.0.113.5" address_family: - afi: "ipv6" allowas_in: 4 attribute_unchanged: med: true default_originate: "map01" distribute_list: - action: "export" acl: 10 state: overridden - vyos.vyos.vyos_facts: gather_network_resources: bgp_address_family - assert: that: - result.commands|length == 10 - result.changed == true - result.commands|symmetric_difference(overridden.commands) == [] - result.after == ansible_facts['network_resources']['bgp_address_family'] - name: Replace the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_address_family: *id001 - name: Assert that the previous task was idempotent assert: that: - result['changed'] == false always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/replaced.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/replaced.yaml index d782582..0a2ccd9 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/replaced.yaml @@ -1,57 +1,55 @@ --- - debug: msg: START vyos_bgp_address_family replaced integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Replace the existing configuration with the provided running configuration register: result vyos.vyos.vyos_bgp_address_family: &id001 config: as_number: "65536" address_family: - afi: "ipv6" redistribute: - protocol: "static" metric: 50 neighbors: - neighbor_address: "203.0.113.5" address_family: - afi: "ipv6" allowas_in: 4 attribute_unchanged: med: true default_originate: "map01" distribute_list: - action: "export" acl: 10 state: replaced - vyos.vyos.vyos_facts: gather_network_resources: bgp_address_family - assert: that: - result.commands|length == 9 - result.changed == true - result.commands|symmetric_difference(replaced.commands) == [] - result.after == ansible_facts['network_resources']['bgp_address_family'] - name: Replace the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_address_family: *id001 - name: Assert that the previous task was idempotent assert: that: - result['changed'] == false always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/_populate.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/_populate.yaml index ec237d9..0f281c9 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/_populate.yaml @@ -1,37 +1,39 @@ --- -- name: setup +- ansible.builtin.include_tasks: _remove_config.yaml + +- name: Setup vyos.vyos.vyos_config: lines: - set policy access-list 20 description 'acl20' - set policy access-list 40 description 'acl40' - set policy route-map map01 description 'map01' - set protocols bgp 65536 aggregate-address 192.0.2.0/24 'summary-only' - set protocols bgp 65536 aggregate-address 203.0.113.0/24 'as-set' - set protocols bgp 65536 maximum-paths ebgp '20' - set protocols bgp 65536 maximum-paths ibgp '55' - set protocols bgp 65536 neighbor 192.0.2.25 'disable-connected-check' - set protocols bgp 65536 neighbor 192.0.2.25 timers holdtime '30' - set protocols bgp 65536 neighbor 192.0.2.25 timers keepalive '10' - set protocols bgp 65536 neighbor 203.0.113.5 attribute-unchanged 'as-path' - set protocols bgp 65536 neighbor 203.0.113.5 attribute-unchanged 'med' - set protocols bgp 65536 neighbor 203.0.113.5 attribute-unchanged 'next-hop' - set protocols bgp 65536 neighbor 203.0.113.5 ebgp-multihop '2' - set protocols bgp 65536 neighbor 203.0.113.5 remote-as '101' - set protocols bgp 65536 neighbor 203.0.113.5 update-source '192.0.2.25' - set protocols bgp 65536 neighbor 5001::64 distribute-list export '20' - set protocols bgp 65536 neighbor 5001::64 distribute-list import '40' - set protocols bgp 65536 neighbor 5001::64 maximum-prefix '34' - set protocols bgp 65536 network 192.1.13.0/24 'backdoor' - set protocols bgp 65536 parameters bestpath as-path 'confed' - set protocols bgp 65536 parameters bestpath 'compare-routerid' - set protocols bgp 65536 parameters confederation identifier '66' - set protocols bgp 65536 parameters confederation peers '20' - set protocols bgp 65536 parameters confederation peers '55' - set protocols bgp 65536 parameters default 'no-ipv4-unicast' - set protocols bgp 65536 parameters router-id '192.1.2.9' - set protocols bgp 65536 redistribute connected route-map 'map01' - set protocols bgp 65536 redistribute kernel metric '45' - set protocols bgp 65536 timers keepalive '35' ignore_errors: true vars: ansible_connection: ansible.netcommon.network_cli diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/deleted.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/deleted.yaml index 8df1677..00a799e 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/deleted.yaml @@ -1,40 +1,38 @@ --- - debug: msg: START vyos_bgp_global deleted integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Delete the provided configuration register: result vyos.vyos.vyos_bgp_global: &id001 config: as_number: "65536" state: deleted - vyos.vyos.vyos_facts: gather_network_resources: bgp_global - assert: that: - result.commands|length == 9 - result.changed == true - result.commands|symmetric_difference(deleted.commands) == [] - result.after == ansible_facts['network_resources']['bgp_global'] - name: Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_global: *id001 - name: Assert that the previous task was idempotent assert: that: - result['changed'] == false always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/gathered.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/gathered.yaml index 742951f..e5eca7a 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/gathered.yaml @@ -1,22 +1,20 @@ --- - debug: msg: START vyos_bgp_global gathered integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Gather config from the device in structured format. register: result vyos.vyos.vyos_bgp_global: state: gathered - vyos.vyos.vyos_facts: gather_network_resources: bgp_global - assert: that: - result.changed == false - result.gathered == ansible_facts['network_resources']['bgp_global'] diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/purged.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/purged.yaml index 0af8775..239f748 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/purged.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/purged.yaml @@ -1,29 +1,27 @@ --- - debug: msg: START vyos_bgp_global purged integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Purge the provided configuration register: result vyos.vyos.vyos_bgp_global: &id001 config: as_number: "65536" state: purged - vyos.vyos.vyos_facts: gather_network_resources: bgp_global - assert: that: - result.commands|length == 1 - result.changed == true - "'delete protocols bgp 65536' in result.commands" - ansible_facts.network_resources.bgp_global == [] always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/replaced.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/replaced.yaml index aeb4aa7..99ea04d 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/replaced.yaml @@ -1,70 +1,68 @@ --- - debug: msg: START vyos_bgp_global replaced integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Replace the existing configuration with the provided running configuration register: result vyos.vyos.vyos_bgp_global: &id001 config: as_number: "65536" network: - address: "203.0.113.0/24" route_map: map01 redistribute: - protocol: "static" route_map: "map01" bgp_params: always_compare_med: true dampening: start_suppress_time: 5 max_suppress_time: 20 half_life: 33 re_use: 60 bestpath: as_path: "confed" compare_routerid: true default: no_ipv4_unicast: true neighbor: - address: "192.0.2.43" disable_connected_check: true advertisement_interval: 72 capability: dynamic: true timers: holdtime: 30 keepalive: 10 - address: "203.0.113.0" capability: orf: "receive" state: replaced - vyos.vyos.vyos_facts: gather_network_resources: bgp_global - assert: that: - result.commands|length == 24 - result.changed == true - result.commands|symmetric_difference(replaced.commands) == [] - result.after == ansible_facts['network_resources']['bgp_global'] - name: Replace the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_global: *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_global/tests/cli/_populate.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/_populate.yaml index 27d1aa2..d79f477 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/_populate.yaml @@ -1,19 +1,21 @@ --- +- ansible.builtin.include_tasks: _remove_config.yaml + - name: Setup vars: lines: "set firewall all-ping 'enable'\nset firewall broadcast-ping 'enable'\n\ set firewall config-trap 'enable'\nset firewall group address-group MGMT-HOSTS\ \ address '192.0.1.1'\nset firewall group address-group MGMT-HOSTS address\ \ '192.0.1.3'\nset firewall group address-group MGMT-HOSTS address '192.0.1.5'\n\ set firewall group address-group MGMT-HOSTS description 'This group has the\ \ Management hosts address list'\nset firewall group network-group MGMT description\ \ 'This group has the Management network addresses'\nset firewall group network-group\ \ MGMT network '192.0.1.0/24'\nset firewall ip-src-route 'enable'\nset firewall\ \ log-martians 'enable'\nset firewall receive-redirects 'disable'\nset firewall\ \ send-redirects 'enable'\nset firewall source-validation 'strict'\nset firewall\ \ state-policy established action 'accept'\nset firewall state-policy established\ \ log 'enable'\nset firewall state-policy invalid action 'reject'\nset firewall\ \ syn-cookies 'enable'\nset firewall twa-hazards-protection 'enable'\n" ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_global/tests/cli/deleted.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/deleted.yaml index 31620f4..df9be56 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/deleted.yaml @@ -1,47 +1,47 @@ --- - debug: msg: - Start vyos_firewall_global deleted integration tests ansible_connection={{ + START vyos_firewall_global deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - name: Delete attributes of firewall. register: result vyos.vyos.vyos_firewall_global: &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 attributes of given interfaces (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_global: *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_firewall_global/tests/cli/gathered.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/gathered.yaml index a333803..e2b60fc 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/gathered.yaml @@ -1,31 +1,29 @@ --- - debug: msg: START vyos_firewall_global gathered integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Merge the provided configuration with the existing running configuration register: result vyos.vyos.vyos_firewall_global: &id001 config: state: gathered - name: Assert that gathered dicts was correctly generated assert: that: - "{{ populate == result['gathered'] }}" - name: Gather the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_global: *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_global/tests/cli/parsed.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/parsed.yaml index 82b7330..54885ce 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/parsed.yaml @@ -1,41 +1,39 @@ --- - debug: msg: START vyos_firewall_global parsed integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Gather firewall_global facts register: firewall_global_facts vyos.vyos.vyos_facts: gather_subset: - default gather_network_resources: - firewall_global - name: Provide the running configuration for parsing (config to be parsed) register: result vyos.vyos.vyos_firewall_global: &id001 running_config: "{{ lookup('file', '_parsed_config.cfg') }}" state: parsed - name: Assert that correct parsing done assert: that: "{{ ansible_facts['network_resources']['firewall_global'] == result['parsed']\ \ }}" - name: Gather the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_global: *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_global/tests/cli/rendered.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/rendered.yaml index 16d585e..951abe1 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/rendered.yaml @@ -1,75 +1,73 @@ --- - debug: msg: START vyos_firewall_global 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_firewall_global: &id001 config: validation: strict config_trap: true log_martians: true syn_cookies: true twa_hazards_protection: true ping: all: true broadcast: true state_policy: - connection_type: established action: accept log: true - connection_type: invalid action: reject route_redirects: - afi: ipv4 ip_src_route: true icmp_redirects: send: true receive: false group: address_group: - name: SALES-HOSTS description: Sales office hosts address list members: - address: 192.0.2.1 - address: 192.0.2.2 - address: 192.0.2.3 - name: ENG-HOSTS description: Sales office hosts address list members: - address: 192.0.3.1 - address: 192.0.3.2 network_group: - name: MGMT description: This group has the Management network addresses members: - address: 192.0.1.0/24 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_firewall_global: *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_global/tests/cli/replaced.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/replaced.yaml index e213bdf..6b0ee82 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/replaced.yaml @@ -1,92 +1,90 @@ --- - debug: msg: START vyos_firewall_global replaced integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Replace device configurations of listed firewall with provided configurations register: result vyos.vyos.vyos_firewall_global: &id001 config: validation: strict config_trap: true log_martians: true syn_cookies: true twa_hazards_protection: true ping: all: true broadcast: true state_policy: - connection_type: established action: accept log: true - connection_type: invalid action: reject route_redirects: - afi: ipv4 ip_src_route: true icmp_redirects: send: true receive: false group: address_group: - name: SALES-HOSTS description: Sales office hosts address list members: - address: 192.0.2.1 - address: 192.0.2.2 - address: 192.0.2.3 - name: ENG-HOSTS description: Sales office hosts address list members: - address: 192.0.3.1 - address: 192.0.3.2 network_group: - name: MGMT description: This group has the Management network addresses members: - address: 192.0.1.0/24 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 firewall with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_global: *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_firewall_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate.yaml index 8b3dacd..3dee476 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate.yaml @@ -1,13 +1,15 @@ --- +- ansible.builtin.include_tasks: _remove_config.yaml + - name: Setup vars: lines: "set interfaces ethernet eth1 firewall in name 'INBOUND' \nset interfaces\ \ ethernet eth1 firewall out name 'OUTBOUND' \nset interfaces ethernet eth1\ \ firewall local name 'LOCAL' \nset interfaces ethernet eth1 firewall local\ \ ipv6-name 'V6-LOCAL'\nset interfaces ethernet eth2 firewall in name 'INBOUND'\n\ set interfaces ethernet eth2 firewall out name 'OUTBOUND'\nset interfaces\ \ ethernet eth2 firewall local name 'LOCAL' \nset interfaces ethernet eth2\ \ firewall local ipv6-name 'V6-LOCAL'\n" ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted.yaml index f1a0a4d..eb9bded 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted.yaml @@ -1,56 +1,56 @@ --- - debug: msg: - Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ + START vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml - include_tasks: _populate.yaml - block: - name: Delete attributes of given firewall rules. register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: - name: eth1 - name: eth2 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['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 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_interfaces: *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'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_afi.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_afi.yaml index b33aea8..8a31b2a 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_afi.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_afi.yaml @@ -1,64 +1,64 @@ --- - debug: msg: - Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ + START vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml - include_tasks: _populate.yaml - block: - name: Delete firewall interfaces based on IP address type provided. register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: - name: eth1 access_rules: - afi: ipv4 - afi: ipv6 - name: eth2 access_rules: - afi: ipv4 - afi: ipv6 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_afi['commands'] | symmetric_difference(result['commands'])\ \ |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: that: - "{{ deleted_afi['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_interfaces: *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_afi['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_all.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_all.yaml index 1293f6a..a3515b0 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_all.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_all.yaml @@ -1,53 +1,53 @@ --- - debug: msg: - Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ + START vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml - include_tasks: _populate.yaml - block: - name: Delete all the firewall interfaces. register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: 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['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 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_interfaces: *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'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_single.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_single.yaml index eb42c02..d62e27f 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_single.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_single.yaml @@ -1,59 +1,59 @@ --- - debug: msg: - Start vyos_firewall_interfaces deleted integration tests ansible_connection={{ + START vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml - include_tasks: _populate.yaml - block: - name: Delete firewall interface. register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: - name: eth1 access_rules: - afi: ipv4 rules: - direction: in name: INBOUND 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_single['commands'] | symmetric_difference(result['commands'])\ \ |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: that: - "{{ deleted_single['after'] | symmetric_difference(result['after'])\ \ |length == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_interfaces: *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_single['after'] | symmetric_difference(result['before'])\ \ |length == 0 }}" always: - include_tasks: _remove_config.yaml - include_tasks: _remove_firewall_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml index 702930c..ee0b775 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml @@ -1,16 +1,18 @@ --- +- ansible.builtin.include_tasks: _remove_config.yaml + - name: Setup vars: lines: "set interfaces ethernet \"{{ intf }}\" description 'Configured by Ansible'\n\ set interfaces ethernet \"{{ intf }}\" speed 'auto'\nset interfaces ethernet\ \ \"{{ intf }}\" duplex 'auto'\nset interfaces ethernet \"{{ intf }}\" mtu\ \ '1500'\nset interfaces ethernet \"{{ intf }}\" vif 200\nset interfaces ethernet\ \ \"{{ intf }}\" vif 200 description 'VIF - 200'\n" loop: - eth1 - eth2 loop_control: loop_var: intf ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml index 85bf4d3..f8057c8 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml @@ -1,25 +1,23 @@ --- - 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 existing 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/overridden.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml index d4052c8..66588cd 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml @@ -1,57 +1,55 @@ --- - debug: msg: START vyos_interfaces overridden integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_interfaces: &id001 config: - name: eth0 speed: auto duplex: auto - name: eth2 description: Overridden by Ansible mtu: 1200 state: overridden - name: Assert that before dicts were correctly generated assert: that: - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct commands were generated assert: that: - "{{ 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 }}" - name: Overrides all device configuration with provided configurations (IDEMPOTENT) register: result vyos.vyos.vyos_interfaces: *id001 - name: Assert that the previous task was idempotent assert: that: - result['changed'] == false - name: Assert that before dicts were correctly generated assert: that: - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml index e8f3591..41d10d0 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml @@ -1,46 +1,44 @@ --- - 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/tests/cli/replaced.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml index daf8045..a22a4c7 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml @@ -1,61 +1,59 @@ --- - debug: msg: START vyos_interfaces replaced integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Replace device configurations of listed interfaces with provided configurations register: result vyos.vyos.vyos_interfaces: &id001 config: - name: eth1 description: Replaced by Ansible vifs: - vlan_id: 100 description: VIF 100 - Replaced by Ansible - name: eth2 mtu: 1400 description: Replaced by Ansible 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 | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that after dict is correctly generated assert: that: - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_interfaces: *id001 - name: Assert that task was idempotent assert: that: - result['changed'] == false - name: Assert that before dict is correctly generated assert: that: - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/_populate.yaml index d5d8620..2a766d5 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/_populate.yaml @@ -1,10 +1,12 @@ --- +- ansible.builtin.include_tasks: _remove_config.yaml + - name: Setup vars: lines: "set interfaces ethernet eth1 address '192.0.2.14/24'\nset interfaces\ \ ethernet eth2 address '192.0.2.10/24'\nset interfaces ethernet eth2 address\ \ '192.0.2.11/24'\nset interfaces ethernet eth2 address '2001:db8::10/32'\n\ set interfaces ethernet eth2 address '2001:db8::12/32'\n" ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml index 25ce28e..9242fb5 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml @@ -1,53 +1,51 @@ --- - debug: msg: - Start vyos_interfaces deleted integration tests ansible_connection={{ ansible_connection + START vyos_interfaces deleted integration tests ansible_connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml +- include_tasks: _populate.yaml - block: - - include_tasks: _populate.yaml - - name: Delete attributes of given interfaces register: result vyos.vyos.vyos_l3_interfaces: &id001 config: - name: eth1 - name: eth2 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['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 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result vyos.vyos.vyos_l3_interfaces: *id001 - name: Assert that the previous task was idempotent assert: that: - result.changed == false - name: Assert that the before dicts were correctly generated assert: that: - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/gathered.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/gathered.yaml index ce8faba..f18f7d3 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/gathered.yaml @@ -1,33 +1,31 @@ --- - 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 existing 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/overridden.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/overridden.yaml index dc6f0ce..c12e2ae 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/overridden.yaml @@ -1,57 +1,55 @@ --- - debug: msg: START vyos_l3_interfaces merged integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml +- include_tasks: _populate.yaml - block: - - include_tasks: _populate.yaml - - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_l3_interfaces: &id001 config: - name: eth0 ipv4: - address: dhcp - name: eth1 ipv4: - address: 192.0.2.15/24 state: overridden - name: Assert that before dicts were correctly generated assert: that: - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct commands were generated assert: that: - "{{ 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 }}" - name: Overrides all device configuration with provided configurations (IDEMPOTENT) register: result vyos.vyos.vyos_l3_interfaces: *id001 - name: Assert that the previous task was idempotent assert: that: - result['changed'] == false - name: Assert that before dicts were correctly generated assert: that: - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml index 7bbf53c..2a606c3 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml @@ -1,43 +1,41 @@ --- - 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/tests/cli/replaced.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/replaced.yaml index c102602..26fe4f8 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/replaced.yaml @@ -1,59 +1,57 @@ --- - debug: msg: START vyos_l3_interfaces replaced integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml +- include_tasks: _populate.yaml - block: - - include_tasks: _populate.yaml - - name: Replace device configurations of listed interfaces with provided configurations register: result vyos.vyos.vyos_l3_interfaces: &id001 config: - name: eth1 ipv4: - address: 192.0.2.19/24 - name: eth2 ipv6: - address: 2001:db8::11/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 | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that after dict is correctly generated assert: that: - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_l3_interfaces: *id001 - name: Assert that task was idempotent assert: that: - result['changed'] == false - name: Assert that before dict is correctly generated assert: that: - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/redirection/cli/shortname.yaml index bee2a09..963ab55 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/redirection/cli/shortname.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/redirection/cli/shortname.yaml @@ -1,41 +1,39 @@ --- - debug: msg: START l3_interfaces rendered 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.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.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_lag_interfaces/tests/cli/_add_bond.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_add_bond.yaml index 00b7e6e..fa191ed 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_add_bond.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_add_bond.yaml @@ -1,6 +1,8 @@ --- +- ansible.builtin.include_tasks: _remove_bond.yaml + - name: Add Bond vars: lines: "set interfaces bonding bond0\nset interfaces bonding bond1\n" ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml index 4ad0b85..d519d28 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml @@ -1,12 +1,14 @@ --- +- ansible.builtin.include_tasks: _add_bond.yaml + - name: Setup vars: lines: "set interfaces bonding bond0\nset interfaces bonding bond0 hash-policy\ \ 'layer2'\nset interfaces bonding bond0 mode 'active-backup'\nset interfaces\ \ ethernet eth1 bond-group bond0\nset interfaces bonding bond1\nset interfaces\ \ bonding bond0 primary 'eth1'\nset interfaces bonding bond1 hash-policy 'layer2+3'\n\ set interfaces bonding bond1 mode 'active-backup'\nset interfaces ethernet\ \ eth2 bond-group bond1\nset interfaces bonding bond1 primary 'eth2'\n" ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml index dfc9920..017c56a 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_bond.yaml @@ -1,6 +1,17 @@ --- +- name: Remove Config + vars: + lines: + "delete interfaces bonding bond0 hash-policy\ndelete interfaces ethernet\ + \ eth1 bond-group bond0\ndelete interfaces bonding bond0 mode\ndelete interfaces\ + \ bonding bond0 primary\ndelete interfaces bonding bond1 hash-policy\ndelete\ + \ interfaces ethernet eth2 bond-group bond1\ndelete interfaces bonding bond1\ + \ mode\ndelete interfaces bonding bond1 primary\n" + ansible.netcommon.cli_config: + config: "{{ lines }}" + - name: Remove Bond vars: lines: "delete interfaces bonding bond0\ndelete interfaces bonding bond1\n" ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_config.yaml deleted file mode 100644 index 11432ea..0000000 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_remove_config.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- name: Remove Config - vars: - lines: - "delete interfaces bonding bond0 hash-policy\ndelete interfaces ethernet\ - \ eth1 bond-group bond0\ndelete interfaces bonding bond0 mode\ndelete interfaces\ - \ bonding bond0 primary\ndelete interfaces bonding bond1 hash-policy\ndelete\ - \ interfaces ethernet eth2 bond-group bond1\ndelete interfaces bonding bond1\ - \ mode\ndelete interfaces bonding bond1 primary\n" - ansible.netcommon.cli_config: - config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml index 56f1ed6..ae15884 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml @@ -1,51 +1,51 @@ --- - debug: msg: - Start vyos_lag_interfaces deleted integration tests ansible_connection={{ + START vyos_lag_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - name: Delete attributes of given LAG interfaces. register: result vyos.vyos.vyos_lag_interfaces: &id001 config: - name: bond0 - name: bond1 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['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 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result vyos.vyos.vyos_lag_interfaces: *id001 - name: Assert that the previous task was idempotent assert: that: - result.changed == false - name: Assert that the before dicts were correctly generated assert: that: - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml + - include_tasks: _remove_bond.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/gathered.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/gathered.yaml index 3e6d8e1..caa8f30 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/gathered.yaml @@ -1,25 +1,23 @@ --- - 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 existing 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 + - include_tasks: _remove_bond.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/merged.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/merged.yaml index 4af04ff..8e6c764 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/merged.yaml @@ -1,68 +1,64 @@ --- - debug: msg: START vyos_lag_interfaces merged integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - -- include_tasks: _remove_bond.yaml - - include_tasks: _add_bond.yaml - block: - name: Merge the provided configuration with the existing running configuration register: result vyos.vyos.vyos_lag_interfaces: &id001 config: - name: bond0 hash_policy: layer2 mode: active-backup members: - member: eth1 primary: eth1 - name: bond1 hash_policy: layer2+3 mode: active-backup members: - member: eth2 primary: eth2 state: merged - name: Assert that before dicts were correctly generated assert: 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 }}" - name: Assert that after dicts was correctly generated assert: that: - "{{ merged['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_lag_interfaces: *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'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml + - include_tasks: _remove_bond.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml index 9682fd7..93aa7d9 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml @@ -1,57 +1,53 @@ --- - debug: msg: START vyos_lag_interfaces overridden integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - -- include_tasks: _remove_bond.yaml - - include_tasks: _populate.yaml - block: - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_lag_interfaces: &id001 config: - name: bond1 mode: active-backup members: - member: eth2 primary: eth2 hash_policy: layer2 state: overridden - name: Assert that before dicts were correctly generated assert: that: - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct commands were generated assert: that: - "{{ 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 }}" - name: Overrides all device configuration with provided configurations (IDEMPOTENT) register: result vyos.vyos.vyos_lag_interfaces: *id001 - name: Assert that the previous task was idempotent assert: that: - result['changed'] == false - name: Assert that before dicts were correctly generated assert: that: - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml + - include_tasks: _remove_bond.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 index ce2df0d..412dcaf 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml @@ -1,33 +1,31 @@ --- - 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 + - include_tasks: _remove_bond.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 index 781100f..ad05199 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml @@ -1,37 +1,35 @@ --- - 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 + - include_tasks: _remove_bond.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml index c8b711b..2e6de6c 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml @@ -1,57 +1,55 @@ --- - debug: msg: START vyos_lag_interfaces replaced integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Replace device configurations of listed LAG interfaces with provided configurations register: result vyos.vyos.vyos_lag_interfaces: &id001 config: - name: bond1 mode: 802.3ad hash_policy: layer2 members: - member: eth2 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 | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that after dict is correctly generated assert: that: - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Replace device configurations of listed LAG interfaces with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_lag_interfaces: *id001 - name: Assert that task was idempotent assert: that: - result['changed'] == false - name: Assert that before dict is correctly generated assert: that: - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml + - include_tasks: _remove_bond.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml index f5f6098..0e7c178 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml @@ -1,72 +1,70 @@ --- - debug: msg: START vyos_lag_interfaces round trip integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _remove_bond.yaml - block: - name: Apply the provided configuration (base config) register: base_config vyos.vyos.vyos_lag_interfaces: config: - name: bond0 hash_policy: layer2 mode: active-backup members: - member: eth1 primary: eth1 - name: bond1 hash_policy: layer2+3 mode: active-backup members: - member: eth2 primary: eth2 state: merged - name: Gather lag_interfaces facts vyos.vyos.vyos_facts: gather_subset: - default gather_network_resources: - lag_interfaces - name: Apply the provided configuration (config to be reverted) register: result vyos.vyos.vyos_lag_interfaces: config: - name: bond0 hash_policy: layer2+3 mode: 802.3ad members: - member: eth1 - name: bond1 hash_policy: layer2 mode: xor-hash members: - member: eth2 state: merged - name: Assert that changes were applied assert: that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Revert back to base config using facts round trip register: revert vyos.vyos.vyos_lag_interfaces: config: "{{ ansible_facts['network_resources']['lag_interfaces'] }}" state: overridden - name: Assert that config was reverted assert: that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml + - include_tasks: _remove_bond.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/redirection/cli/shortname.yaml index 005aa85..876563c 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/redirection/cli/shortname.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/redirection/cli/shortname.yaml @@ -1,66 +1,62 @@ --- - debug: msg: START lag_interfaces merged on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - -- include_tasks: _remove_bond.yaml - - include_tasks: _add_bond.yaml - block: - name: Merge the provided configuration with the existing running configuration register: result vyos.vyos.lag_interfaces: &id001 config: - name: bond0 hash_policy: layer2 mode: active-backup members: - member: eth1 primary: eth1 - name: bond1 hash_policy: layer2+3 mode: active-backup members: - member: eth2 primary: eth2 state: merged - name: Assert that before dicts were correctly generated assert: 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 }}" - name: Assert that after dicts was correctly generated assert: that: - "{{ merged['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.lag_interfaces: *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'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - - include_tasks: _remove_config.yaml + - include_tasks: _remove_bond.yaml diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/_populate.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/_populate.yaml index 24c114d..eb0f21e 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/_populate.yaml @@ -1,8 +1,10 @@ --- +- ansible.builtin.include_tasks: _remove_config.yaml + - name: Setup vars: lines: "set service lldp\nset service lldp legacy-protocols 'cdp'\nset service\ \ lldp management-address '192.0.2.17'\n" ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/deleted.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/deleted.yaml index c086e2b..0d36e5f 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/deleted.yaml @@ -1,45 +1,45 @@ --- - debug: - msg: Start vyos_lldp_global deleted integration tests ansible_connection={{ + msg: START vyos_lldp_global deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - name: Delete attributes of LLDP service. register: result vyos.vyos.vyos_lldp_global: &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 attributes of given interfaces (IDEMPOTENT) register: result vyos.vyos.vyos_lldp_global: *id001 - name: Assert that the previous task was idempotent assert: that: - result.changed == false - 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_lldp_global/tests/cli/gathered.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/gathered.yaml index 7e09b6b..46e5b36 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/gathered.yaml @@ -1,23 +1,21 @@ --- - 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 existing 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/merged.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/merged.yaml index dc7b7b1..85a35f6 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/merged.yaml @@ -1,53 +1,51 @@ --- - debug: msg: START vyos_lldp_global merged integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Merge the provided configuration with the existing running configuration register: result vyos.vyos.vyos_lldp_global: &id001 config: legacy_protocols: - fdp - cdp address: 192.0.2.11 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_lldp_global: *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_lldp_global/tests/cli/replaced.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/replaced.yaml index 6859dc8..55874b7 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/replaced.yaml @@ -1,55 +1,53 @@ --- - debug: msg: START vyos_lldp_global replaced integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Replace device configurations of LLDP service with provided configurations register: result vyos.vyos.vyos_lldp_global: &id001 config: legacy_protocols: - edp - sonmp - cdp address: 192.0.2.14 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 LLDP service with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_lldp_global: *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_lldp_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate.yaml index 406d30b..2c6782b 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate.yaml @@ -1,13 +1,15 @@ --- +- ansible.builtin.include_tasks: _remove_config.yaml + - name: Setup vars: lines: "set service lldp interface eth1\nset service lldp interface eth1 location\ \ civic-based country-code US\nset service lldp interface eth1 location civic-based\ \ ca-type 0 ca-value ENGLISH\nset service lldp interface eth2\nset service\ \ lldp interface eth2 location coordinate-based latitude 33.524449N\nset service\ \ lldp interface eth2 location coordinate-based altitude 2200\nset service\ \ lldp interface eth2 location coordinate-based datum WGS84\nset service lldp\ \ interface eth2 location coordinate-based longitude 222.267255W\n" ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/deleted.yaml index c5b30af..776fa22 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/deleted.yaml @@ -1,52 +1,52 @@ --- - debug: msg: - Start vyos_lldp_interfaces deleted integration tests ansible_connection={{ + START vyos_lldp_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - name: Delete attributes of given LLDP interfaces. register: result vyos.vyos.vyos_lldp_interfaces: &id001 config: - name: eth1 - name: eth2 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['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 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result vyos.vyos.vyos_lldp_interfaces: *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'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/gathered.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/gathered.yaml index 8a59955..216f2d1 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/gathered.yaml @@ -1,24 +1,22 @@ --- - 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 existing 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/replaced.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/replaced.yaml index e76e3b2..46c91cf 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/replaced.yaml @@ -1,70 +1,68 @@ --- - debug: msg: START vyos_lldp_interfaces replaced integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Replace device configurations of listed LLDP interfaces with provided configurations register: result vyos.vyos.vyos_lldp_interfaces: &id001 config: - name: eth2 enable: false location: civic_based: country_code: US ca_info: - ca_type: 0 ca_value: ENGLISH - name: eth1 enable: false location: coordinate_based: altitude: 2200 datum: WGS84 longitude: 222.267255W latitude: 33.524449N 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 | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that after dict is correctly generated assert: that: - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Replace device configurations of listed LLDP interfaces with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_lldp_interfaces: *id001 - name: Assert that task was idempotent assert: that: - result['changed'] == false - name: Assert that before dict is correctly generated assert: that: - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - include_tasks: _remove_config.yaml 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 2f3828f..516df94 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/_populate.yaml @@ -1,53 +1,55 @@ --- +- ansible.builtin.include_tasks: _remove_config.yaml + - name: POPULATE Apply the provided configuration register: result vyos.vyos.vyos_logging_global: config: console: facilities: - facility: all - facility: local7 severity: err - facility: news severity: debug files: - path: def archive: file_num: 2 facilities: - facility: local6 severity: emerg - facility: local7 severity: emerg hosts: - hostname: 172.16.2.15 facilities: - facility: all severity: all - facility: all protocol: udp - hostname: 172.16.2.12 facilities: - facility: all protocol: udp users: - username: vyos facilities: - facility: local7 severity: debug - facility: local6 severity: alert - username: paul facilities: - facility: local7 severity: err global_params: archive: file_num: 2 size: 111 facilities: - facility: cron severity: debug - facility: local7 severity: debug state: merged diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/deleted.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/deleted.yaml index 2a0a355..cd89ac5 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/deleted.yaml @@ -1,22 +1,21 @@ --- - debug: - msg: Start Deleted integration state for vyos_logging ansible_connection={{ + msg: START Deleted integration state for vyos_logging ansible_connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - include_tasks: _populate.yaml - block: - name: TEST - [deleted] Remove all configuration vyos.vyos.vyos_logging_global: state: deleted register: result - name: TEST - [deleted] Assert that correct set of commands were generated assert: that: - "{{ deleted['commands'] | symmetric_difference(result['commands']) |\ \ length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/gathered.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/gathered.yaml index af1fa52..a4b26d4 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/gathered.yaml @@ -1,22 +1,20 @@ --- - debug: msg: START vyos_logging_global gathered integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: TEST - [gathered] Gather the provided configuration with the existing running configuration register: result vyos.vyos.vyos_logging_global: config: state: gathered - name: TEST - [gathered] Assert assert: that: - result.changed == false always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/overridden.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/overridden.yaml index e5eea38..c532b5a 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/overridden.yaml @@ -1,39 +1,37 @@ --- - debug: msg: START vyos_logging_global overridden integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: # no after state match because 1.1.8 vyos does show all commands on show command - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_logging_global: &id001 config: console: facilities: - facility: all - facility: local7 severity: err - facility: news severity: debug global_params: archive: file_num: 2 state: overridden - name: Assert that correct commands were generated assert: that: - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ \ |length == 0 }}" - name: Overrides all device configuration with provided configurations (IDEMPOTENT) register: result vyos.vyos.vyos_logging_global: *id001 always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/rendered.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/rendered.yaml index 01caca5..7858b9f 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/rendered.yaml @@ -1,49 +1,47 @@ --- - debug: msg: START vyos_logging_global 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_logging_global: &id001 config: console: facilities: - facility: all files: - path: abc archive: size: 125 hosts: - hostname: 172.16.2.15 facilities: - facility: all severity: all users: - username: vyos facilities: - facility: local7 severity: debug global_params: archive: file_num: 2 size: 111 facilities: - facility: cron severity: debug 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_ospf_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/_populate.yaml index c4749d3..e30e9fb 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/_populate.yaml @@ -1,13 +1,15 @@ --- -- name: setup +- ansible.builtin.include_tasks: _remove_config.yaml + +- name: Setup vyos.vyos.vyos_config: lines: - set interfaces ethernet eth0 ip ospf cost 50 - 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 bonding bond2 ip ospf transmit-delay 45 - set interfaces bonding bond2 ipv6 ospfv3 passive ignore_errors: true vars: ansible_connection: ansible.netcommon.network_cli 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 4efca68..679a39b 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/deleted.yaml @@ -1,40 +1,38 @@ --- - debug: msg: START vyos_ospf_interfaces deleted integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Delete the provided configuration register: result vyos.vyos.vyos_ospf_interfaces: &id001 config: - name: "bond2" state: deleted - vyos.vyos.vyos_facts: gather_network_resources: ospf_interfaces - 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']) == [] - name: Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ospf_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_ospf_interfaces/tests/cli/gathered.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/gathered.yaml index 21b6e5a..84c22cb 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/gathered.yaml @@ -1,22 +1,20 @@ --- - debug: msg: START vyos_ospf_interfaces gathered integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Gather config from the device in structured format. register: result vyos.vyos.vyos_ospf_interfaces: state: gathered - vyos.vyos.vyos_facts: gather_network_resources: ospf_interfaces - assert: that: - result.changed == false - result.gathered|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 dae9a6e..2652c40 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/overridden.yaml @@ -1,48 +1,46 @@ --- - debug: msg: START vyos_ospf_interfaces overridden integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Override the existing configuration with the provided running configuration register: result vyos.vyos.vyos_ospf_interfaces: &id001 config: - name: "eth0" address_family: - afi: "ipv4" transmit_delay: 50 priority: 26 network: "point-to-point" - afi: "ipv6" dead_interval: 39 state: overridden - vyos.vyos.vyos_facts: gather_network_resources: ospf_interfaces - 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']) == [] - name: Override the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ospf_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_ospf_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/replaced.yaml index 89c8c76..9efcdea 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/replaced.yaml @@ -1,58 +1,56 @@ --- - debug: msg: START vyos_ospf_interfaces replaced integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Replace the existing configuration with the provided running configuration register: result vyos.vyos.vyos_ospf_interfaces: &id001 config: - name: "eth0" address_family: - afi: "ipv4" transmit_delay: 50 priority: 26 network: "point-to-point" - afi: "ipv6" dead_interval: 39 - name: "bond2" address_family: - afi: "ipv4" transmit_delay: 45 bandwidth: 70 authentication: md5_key: key_id: 10 key: "1111111111232345" - afi: "ipv6" passive: true state: replaced - vyos.vyos.vyos_facts: gather_network_resources: ospf_interfaces - 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']) == [] - name: Replace the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ospf_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_ospfv2/tests/cli/_populate.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml index a445375..f17c5cb 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml @@ -1,35 +1,37 @@ --- +- ansible.builtin.include_tasks: _remove_config.yaml + - 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/deleted.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/deleted.yaml index 9fc0d70..553bb9f 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/deleted.yaml @@ -1,46 +1,46 @@ --- - debug: - msg: Start vyos_ospfv2 deleted integration tests ansible_connection={{ + msg: START vyos_ospfv2 deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - name: Delete attributes of ospfv2. register: result vyos.vyos.vyos_ospfv2: &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 attributes of given interfaces (IDEMPOTENT) register: result vyos.vyos.vyos_ospfv2: *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_ospfv2/tests/cli/gathered.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/gathered.yaml index fed8c98..a8e3149 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/gathered.yaml @@ -1,22 +1,20 @@ --- - 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 existing 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_update.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/merged_update.yaml index 30df9a4..bc82146 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/merged_update.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/merged_update.yaml @@ -1,70 +1,68 @@ --- - 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 existing 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/replaced.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/replaced.yaml index e1fc389..b348484 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/replaced.yaml @@ -1,99 +1,97 @@ --- - 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_ospfv3/tests/cli/_populate.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/_populate.yaml index 31f90ef..164fcc0 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/_populate.yaml @@ -1,13 +1,15 @@ --- +- ansible.builtin.include_tasks: _remove_config.yaml + - 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/deleted.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/deleted.yaml index e0be4c3..2e55472 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/deleted.yaml @@ -1,46 +1,46 @@ --- - debug: - msg: Start vyos_ospfv3 deleted integration tests ansible_connection={{ + 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/gathered.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/gathered.yaml index 1be8f8d..3654bbe 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/gathered.yaml @@ -1,23 +1,21 @@ --- - 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 existing 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_update.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/merged_update.yaml index c6f0e8b..02657c8 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/merged_update.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/merged_update.yaml @@ -1,61 +1,59 @@ --- - 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 existing 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/replaced.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/replaced.yaml index 08291ba..e5905f5 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/replaced.yaml @@ -1,65 +1,63 @@ --- - 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_route_maps/tests/cli/_populate.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/_populate.yaml index 9ef975f..98e0161 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/_populate.yaml @@ -1,23 +1,25 @@ --- -- name: setup +- ansible.builtin.include_tasks: _remove_config.yaml + +- name: Setup vyos.vyos.vyos_config: lines: - set policy route-map test2 rule 1 action 'permit' - set policy route-map test2 rule 1 description 'test' - set policy route-map test2 rule 2 action 'permit' - set policy route-map test2 rule 2 on-match goto '4' - set policy route-map test3 rule 1 action 'permit' - set policy route-map test3 rule 1 match metric '1' - set policy route-map test3 rule 1 match peer '192.0.2.32' - set policy route-map test3 rule 1 set community 'internet' - set policy route-map test3 rule 1 set ip-next-hop '192.0.2.33' - set policy route-map test3 rule 1 set local-preference '4' - set policy route-map test3 rule 1 set metric '5' - set policy route-map test3 rule 1 set metric-type 'type-1' - set policy route-map test3 rule 1 set origin 'egp' - set policy route-map test3 rule 1 set originator-id '192.0.2.34' - set policy route-map test3 rule 1 set tag '5' - set policy route-map test3 rule 1 set weight '4' ignore_errors: true vars: ansible_connection: ansible.netcommon.network_cli diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/deleted.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/deleted.yaml index fe68d56..84b6446 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/deleted.yaml @@ -1,41 +1,39 @@ --- - debug: msg: START vyos_route_maps deleted integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Delete the provided configuration register: result vyos.vyos.vyos_route_maps: &id001 config: state: deleted - assert: that: - result.commands|length == 2 - result.changed == true - result.commands|symmetric_difference(deleted.commands) == [] - name: Assert that the after dicts were correctly generated assert: that: - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_route_maps: *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_route_maps/tests/cli/gathered.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/gathered.yaml index 430b9d5..358f5b1 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/gathered.yaml @@ -1,22 +1,20 @@ --- - debug: msg: START vyos_route_maps gathered integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Gather config from the device in structured format. register: result vyos.vyos.vyos_route_maps: state: gathered - vyos.vyos.vyos_facts: gather_network_resources: route_maps - assert: that: - result.changed == false - result.gathered|symmetric_difference(ansible_facts['network_resources']['route_maps']) == [] diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/overridden.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/overridden.yaml index 168ef17..d33a7c4 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/overridden.yaml @@ -1,54 +1,52 @@ --- - debug: msg: START vyos_route_maps overridden integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Override the existing configuration with the provided running configuration register: result vyos.vyos.vyos_route_maps: &id001 config: - route_map: test3 entries: - sequence: 1 action: permit match: metric: 3 peer: 192.0.2.35 set: local_preference: 6 metric: 4 metric_type: "type-1" origin: egp originator_id: 192.0.2.34 tag: 4 weight: 4 state: overridden - vyos.vyos.vyos_facts: gather_network_resources: route_maps - assert: that: - result.commands|length == 8 - result.changed == true - result.commands|symmetric_difference(overridden.commands) == [] - result.after|symmetric_difference(ansible_facts['network_resources']['route_maps']) == [] - name: Override the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_route_maps: *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_route_maps/tests/cli/replaced.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/replaced.yaml index fa0380b..57a91fd 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/replaced.yaml @@ -1,54 +1,52 @@ --- - debug: msg: START vyos_route_maps replaced integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Replace the provided configuration with the existing running configuration register: result vyos.vyos.vyos_route_maps: &id001 config: - route_map: test3 entries: - sequence: 1 action: permit match: metric: 3 peer: 192.0.2.35 set: local_preference: 6 metric: 4 metric_type: "type-1" origin: egp originator_id: 192.0.2.34 tag: 4 weight: 4 state: replaced - vyos.vyos.vyos_facts: gather_network_resources: route_maps - 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']) == [] - name: Replace the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_route_maps: *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_static_routes/tests/cli/_populate.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/_populate.yaml index 4c54ef6..12e4392 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/_populate.yaml @@ -1,12 +1,14 @@ --- +- ansible.builtin.include_tasks: _remove_config.yaml + - name: Setup vars: lines: "set protocols static route 192.0.2.32/28 next-hop '192.0.2.10'\nset\ \ protocols static route 192.0.2.32/28 next-hop '192.0.2.9'\nset protocols\ \ static route 192.0.2.32/28 blackhole\nset protocols static route 192.0.2.32/28\n\ set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1'\n\ set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'\n\ set protocols static route6 2001:db8:1000::/36 blackhole distance '2'\nset\ \ protocols static route6 2001:db8:1000::/36\n" ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/gathered.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/gathered.yaml index 8435d04..6b34912 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/gathered.yaml @@ -1,33 +1,31 @@ --- - debug: msg: START vyos_static_routes gathered integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Merge the provided configuration with the existing running configuration register: result vyos.vyos.vyos_static_routes: &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_static_routes: *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_static_routes/tests/cli/overridden.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/overridden.yaml index d1bedc8..9281306 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/overridden.yaml @@ -1,55 +1,53 @@ --- - debug: msg: START vyos_static_routes overridden integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_static_routes: &id001 config: - address_families: - afi: ipv4 routes: - dest: 198.0.2.48/28 next_hops: - forward_router_address: 192.0.2.18 state: overridden - name: Assert that before dicts were correctly generated assert: that: - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct commands were generated assert: that: - "{{ 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 }}" - name: Overrides all device configuration with provided configurations (IDEMPOTENT) register: result vyos.vyos.vyos_static_routes: *id001 - name: Assert that the previous task was idempotent assert: that: - result['changed'] == false - name: Assert that before dicts were correctly generated assert: that: - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/parsed.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/parsed.yaml index 06cad97..5776f7f 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/parsed.yaml @@ -1,41 +1,39 @@ --- - debug: msg: START vyos_static_routes parsed integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Gather static_routes facts register: static_routes_facts vyos.vyos.vyos_facts: gather_subset: - default gather_network_resources: - static_routes - name: Provide the running configuration for parsing (config to be parsed) register: result vyos.vyos.vyos_static_routes: &id001 running_config: "{{ lookup('file', '_parsed_config.cfg') }}" state: parsed - name: Assert that correct parsing done assert: that: "{{ ansible_facts['network_resources']['static_routes'] | symmetric_difference(result['parsed'])\ \ |length == 0 }}" - name: Gather the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_static_routes: *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_static_routes/tests/cli/rendered.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/rendered.yaml index 81e7259..4362d1f 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/rendered.yaml @@ -1,54 +1,52 @@ --- - debug: msg: START vyos_static_routes 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_static_routes: &id001 config: - address_families: - afi: ipv4 routes: - dest: 192.0.2.32/28 blackhole_config: type: blackhole next_hops: - forward_router_address: 192.0.2.10 - forward_router_address: 192.0.2.9 - address_families: - afi: ipv6 routes: - dest: 2001:db8:1000::/36 blackhole_config: distance: 2 next_hops: - forward_router_address: 2001:db8:2000:2::1 - forward_router_address: 2001:db8:2000:2::2 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_static_routes: *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_static_routes/tests/cli/replaced.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/replaced.yaml index 50af5ed..28f80fb 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/replaced.yaml @@ -1,64 +1,62 @@ --- - debug: msg: START vyos_static_routes replaced integration tests on connection={{ ansible_connection }} -- include_tasks: _remove_config.yaml - - include_tasks: _populate.yaml - block: - name: Replace device configurations of listed static routes with provided configurations register: result vyos.vyos.vyos_static_routes: &id001 config: - address_families: - afi: ipv4 routes: - dest: 192.0.2.32/28 blackhole_config: distance: 2 next_hops: - forward_router_address: 192.0.2.7 - forward_router_address: 192.0.2.8 - forward_router_address: 192.0.2.9 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 | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that after dict is correctly generated assert: that: - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ \ == 0 }}" - name: Replace device configurations of listed static routes with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_static_routes: *id001 - name: Assert that task was idempotent assert: that: - result['changed'] == false - name: Assert that before dict is correctly generated assert: that: - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ \ == 0 }}" always: - include_tasks: _remove_config.yaml