diff options
author | Nilashish Chakraborty <nilashishchakraborty8@gmail.com> | 2024-06-25 14:54:01 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-25 14:54:01 +0530 |
commit | b872b6f21d14ff10c221d84217eb568318e9ad8b (patch) | |
tree | 0aacdea877a7e2b209735cd0f7c0b9d62a9446f7 /tests | |
parent | 37baff3d4d547911bec1387218edfd477ca79062 (diff) | |
download | vyos.vyos-b872b6f21d14ff10c221d84217eb568318e9ad8b.tar.gz vyos.vyos-b872b6f21d14ff10c221d84217eb568318e9ad8b.zip |
`vyos.vyos` is no longer deprecated! 🎉 (#348)
* Remove deprecation notice for vyos.vyos
Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
* Add changelog
Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
* fix review comments
Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
* chore: auto fixes from pre-commit.com hooks
---------
Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diffstat (limited to 'tests')
256 files changed, 1807 insertions, 2377 deletions
diff --git a/tests/integration/targets/prepare_vyos_tests/tasks/main.yaml b/tests/integration/targets/prepare_vyos_tests/tasks/main.yaml index c5b0d54..2ed8d8c 100644 --- a/tests/integration/targets/prepare_vyos_tests/tasks/main.yaml +++ b/tests/integration/targets/prepare_vyos_tests/tasks/main.yaml @@ -1,10 +1,14 @@ --- - name: Ensure required interfaces are present in running-config vars: - lines: - "set interfaces ethernet eth0 address dhcp\nset interfaces ethernet eth0\ - \ speed auto\nset interfaces ethernet eth0 duplex auto\nset interfaces ethernet\ - \ eth1\nset interfaces ethernet eth2\ndelete interfaces loopback lo\n" - ignore_errors: true # noqa ignore-errors + lines: |- + set interfaces ethernet eth0 address dhcp + set interfaces ethernet eth0 speed auto + set interfaces ethernet eth0 duplex auto + set interfaces ethernet eth1 + set interfaces ethernet eth2 + delete interfaces loopback lo + ignore_errors: "{{ result.failed }}" + register: result ansible.netcommon.cli_config: config: "{{ lines }}" 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 5d60f36..15bfe84 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,8 +1,6 @@ --- - debug: - msg: - START vyos_bgp_address_family deleted integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_address_family deleted integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -13,12 +11,12 @@ config: as_number: "65536" address_family: - - afi: "ipv6" + - afi: ipv6 neighbors: - - neighbor_address: "203.0.113.5" - - neighbor_address: "192.0.2.25" + - neighbor_address: 203.0.113.5 + - neighbor_address: 192.0.2.25 address_family: - - afi: "ipv6" + - afi: ipv6 state: deleted - vyos.vyos.vyos_facts: @@ -31,9 +29,7 @@ - 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) + - name: Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_address_family: *id001 diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/empty_config.yaml index 04a6aac..9b6fa3a 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/empty_config.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_bgp_address_family empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_address_family empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -46,8 +44,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result 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 a8f428f..a8a81d0 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,8 +1,6 @@ --- - debug: - msg: - START vyos_bgp_address_family gathered integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_address_family gathered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/merged.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/merged.yaml index cf0f821..4e66a78 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/merged.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_bgp_address_family merged integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_address_family merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -14,31 +13,31 @@ config: as_number: "65536" address_family: - - afi: "ipv6" + - afi: ipv6 redistribute: - - protocol: "static" + - protocol: static metric: 50 neighbors: - - neighbor_address: "203.0.113.5" + - neighbor_address: 203.0.113.5 address_family: - - afi: "ipv6" + - afi: ipv6 allowas_in: 4 attribute_unchanged: med: true - default_originate: "map01" + default_originate: map01 distribute_list: - - action: "export" + - action: export acl: 10 - - neighbor_address: "192.0.2.25" + - neighbor_address: 192.0.2.25 address_family: - - afi: "ipv6" + - afi: ipv6 maximum_prefix: 45 nexthop_self: true route_map: - - action: "export" - route_map: "map01" - - action: "import" - route_map: "map01" + - action: export + route_map: map01 + - action: import + route_map: map01 state: merged - vyos.vyos.vyos_facts: @@ -53,9 +52,7 @@ - result.before == {} - result.after == merged.after - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_address_family: *id001 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 9414494..90b40de 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,8 +1,6 @@ --- - debug: - msg: - START vyos_bgp_address_family overridden integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_address_family overridden integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -13,20 +11,20 @@ config: as_number: "65536" address_family: - - afi: "ipv6" + - afi: ipv6 redistribute: - - protocol: "static" + - protocol: static metric: 50 neighbors: - - neighbor_address: "203.0.113.5" + - neighbor_address: 203.0.113.5 address_family: - - afi: "ipv6" + - afi: ipv6 allowas_in: 4 attribute_unchanged: med: true - default_originate: "map01" + default_originate: map01 distribute_list: - - action: "export" + - action: export acl: 10 state: overridden @@ -40,9 +38,7 @@ - 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) + - name: Replace the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_address_family: *id001 diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/parsed.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/parsed.yaml index 6bd9c77..da9c141 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_bgp_address_family parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_bgp_address_family parsed integration tests on connection={{ ansible_connection }} - name: Provide the running configuration for parsing (config to be parsed) register: result diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/rendered.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/rendered.yaml index 8c6ac5c..0ef116e 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/rendered.yaml @@ -1,41 +1,39 @@ --- - debug: - msg: - START vyos_bgp_address_family rendered integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_address_family rendered integration tests on connection={{ ansible_connection }} - block: - name: Render the given config in the form of native config. register: result - vyos.vyos.vyos_bgp_address_family: &id001 + vyos.vyos.vyos_bgp_address_family: config: as_number: "65536" address_family: - - afi: "ipv6" + - afi: ipv6 redistribute: - - protocol: "static" + - protocol: static metric: 50 neighbors: - - neighbor_address: "203.0.113.5" + - neighbor_address: 203.0.113.5 address_family: - - afi: "ipv6" + - afi: ipv6 allowas_in: 4 attribute_unchanged: med: true - default_originate: "map01" + default_originate: map01 distribute_list: - - action: "export" + - action: export acl: 10 - - neighbor_address: "192.0.2.25" + - neighbor_address: 192.0.2.25 address_family: - - afi: "ipv6" + - afi: ipv6 maximum_prefix: 45 nexthop_self: true route_map: - - action: "export" - route_map: "map01" - - action: "import" - route_map: "map01" + - action: export + route_map: map01 + - action: import + route_map: map01 state: rendered - assert: 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 0a2ccd9..9b6f330 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,8 +1,6 @@ --- - debug: - msg: - START vyos_bgp_address_family replaced integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_address_family replaced integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -13,20 +11,20 @@ config: as_number: "65536" address_family: - - afi: "ipv6" + - afi: ipv6 redistribute: - - protocol: "static" + - protocol: static metric: 50 neighbors: - - neighbor_address: "203.0.113.5" + - neighbor_address: 203.0.113.5 address_family: - - afi: "ipv6" + - afi: ipv6 allowas_in: 4 attribute_unchanged: med: true - default_originate: "map01" + default_originate: map01 distribute_list: - - action: "export" + - action: export acl: 10 state: replaced @@ -40,9 +38,7 @@ - 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) + - name: Replace the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_address_family: *id001 diff --git a/tests/integration/targets/vyos_bgp_address_family/tests/cli/rtt.yaml b/tests/integration/targets/vyos_bgp_address_family/tests/cli/rtt.yaml index e0c4131..baab61b 100644 --- a/tests/integration/targets/vyos_bgp_address_family/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/tests/cli/rtt.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_bgp_address_family rtt integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_address_family rtt integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -14,31 +13,31 @@ config: as_number: "65536" address_family: - - afi: "ipv6" + - afi: ipv6 redistribute: - - protocol: "static" + - protocol: static metric: 50 neighbors: - - neighbor_address: "203.0.113.5" + - neighbor_address: 203.0.113.5 address_family: - - afi: "ipv6" + - afi: ipv6 allowas_in: 4 attribute_unchanged: med: true - default_originate: "map01" + default_originate: map01 distribute_list: - - action: "export" + - action: export acl: 10 - - neighbor_address: "192.0.2.25" + - neighbor_address: 192.0.2.25 address_family: - - afi: "ipv6" + - afi: ipv6 maximum_prefix: 45 nexthop_self: true route_map: - - action: "export" - route_map: "map01" - - action: "import" - route_map: "map01" + - action: export + route_map: map01 + - action: import + route_map: map01 state: merged - vyos.vyos.vyos_facts: @@ -57,18 +56,18 @@ config: as_number: "65536" address_family: - - afi: "ipv6" + - afi: ipv6 aggregate_address: - summary_only: true - prefix: "21e0:1:1::/64" + prefix: 21e0:1:1::/64 networks: - - prefix: "21e0:1:1::/64" - route_map: "map01" + - prefix: 21e0:1:1::/64 + route_map: map01 neighbors: - address_family: - - afi: "ipv6" + - afi: ipv6 remove_private_as: true - neighbor_address: "203.0.113.5" + neighbor_address: 203.0.113.5 - name: Revert back to base config using facts round trip register: revert diff --git a/tests/integration/targets/vyos_bgp_address_family/vars/main.yaml b/tests/integration/targets/vyos_bgp_address_family/vars/main.yaml index aed6de6..448918a 100644 --- a/tests/integration/targets/vyos_bgp_address_family/vars/main.yaml +++ b/tests/integration/targets/vyos_bgp_address_family/vars/main.yaml @@ -12,32 +12,32 @@ merged: - set protocols bgp 65536 neighbor 192.0.2.25 address-family ipv6-unicast route-map import map01 after: address_family: - - afi: "ipv6" + - afi: ipv6 redistribute: - metric: 50 - protocol: "static" + protocol: static as_number: 65536 neighbors: - address_family: - - afi: "ipv6" + - afi: ipv6 maximum_prefix: 45 nexthop_self: true route_map: - - action: "export" - route_map: "map01" - - action: "import" - route_map: "map01" - neighbor_address: "192.0.2.25" + - action: export + route_map: map01 + - action: import + route_map: map01 + neighbor_address: 192.0.2.25 - address_family: - - afi: "ipv6" + - afi: ipv6 allowas_in: 4 attribute_unchanged: med: true - default_originate: "map01" + default_originate: map01 distribute_list: - acl: 10 - action: "export" - neighbor_address: "203.0.113.5" + action: export + neighbor_address: 203.0.113.5 replaced: commands: @@ -73,27 +73,27 @@ deleted: populate: config: address_family: - - afi: "ipv6" + - afi: ipv6 aggregate_address: - summary_only: true - prefix: "5000:1:1::/64" + prefix: 5000:1:1::/64 networks: - - prefix: "21e0:1:1::/64" - route_map: "map01" + - prefix: 21e0:1:1::/64 + route_map: map01 redistribute: - metric: 20 - protocol: "ripng" + protocol: ripng as_number: 65536 neighbors: - address_family: - - afi: "ipv6" + - afi: ipv6 route_map: - - action: "export" - route_map: "map01" + - action: export + route_map: map01 soft_reconfiguration: true - neighbor_address: "192.0.2.25" + neighbor_address: 192.0.2.25 - address_family: - - afi: "ipv6" + - afi: ipv6 attribute_unchanged: next_hop: true - neighbor_address: "203.0.113.5" + neighbor_address: 203.0.113.5 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 00a799e..5920c8f 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/deleted.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_bgp_global deleted integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_global deleted integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -23,9 +22,7 @@ - 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) + - name: Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_global: *id001 diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/deleted_af.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/deleted_af.yaml index edee16b..88e6be0 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/deleted_af.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/deleted_af.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_bgp_global replaced integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_global replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -11,7 +10,7 @@ - name: Delete the existing configuration, in presence of an af under neighbor. register: result ignore_errors: true - vyos.vyos.vyos_bgp_global: &id001 + vyos.vyos.vyos_bgp_global: config: as_number: "65536" state: deleted diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/empty_config.yaml index 7e52d1c..7be1f69 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/empty_config.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_bgp_global empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_global empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -34,8 +33,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result 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 e5eca7a..82fead7 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/gathered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_bgp_global gathered integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_global gathered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/merged.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/merged.yaml index ce332a0..388bbcc 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/merged.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_bgp_global merged integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_global merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -14,32 +13,32 @@ config: as_number: "65536" aggregate_address: - - prefix: "203.0.113.0/24" + - prefix: 203.0.113.0/24 as_set: true - - prefix: "192.0.2.0/24" + - prefix: 192.0.2.0/24 summary_only: true network: - - address: "192.1.13.0/24" + - address: 192.1.13.0/24 backdoor: true redistribute: - - protocol: "kernel" + - protocol: kernel metric: 45 - - protocol: "connected" - route_map: "map01" + - protocol: connected + route_map: map01 maximum_paths: - - path: "ebgp" + - path: ebgp count: 20 - - path: "ibgp" + - path: ibgp count: 55 timers: keepalive: 35 bgp_params: bestpath: - as_path: "confed" + as_path: confed compare_routerid: true default: no_ipv4_unicast: true - router_id: "192.1.2.9" + router_id: 192.1.2.9 state: merged - vyos.vyos.vyos_facts: @@ -54,9 +53,7 @@ - result.before == {} - result.after == merged.after - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_global: *id001 diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/parsed.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/parsed.yaml index ef8856d..eca85ce 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_bgp_global parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_bgp_global parsed integration tests on connection={{ ansible_connection }} - name: Provide the running configuration for parsing (config to be parsed) register: result 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 239f748..71748f5 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/purged.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/purged.yaml @@ -1,14 +1,13 @@ --- - debug: - msg: START vyos_bgp_global purged integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_global purged integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - name: Purge the provided configuration register: result - vyos.vyos.vyos_bgp_global: &id001 + vyos.vyos.vyos_bgp_global: config: as_number: "65536" state: purged diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/rendered.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/rendered.yaml index 534227f..f37ef88 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/rendered.yaml @@ -1,41 +1,40 @@ --- - debug: - msg: START vyos_bgp_global merged integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_global merged integration tests on connection={{ ansible_connection }} - block: - name: Render given bgp_global configuration register: result - vyos.vyos.vyos_bgp_global: &id001 + vyos.vyos.vyos_bgp_global: config: as_number: "65536" aggregate_address: - - prefix: "203.0.113.0/24" + - prefix: 203.0.113.0/24 as_set: true - - prefix: "192.0.2.0/24" + - prefix: 192.0.2.0/24 summary_only: true network: - - address: "192.1.13.0/24" + - address: 192.1.13.0/24 backdoor: true redistribute: - - protocol: "kernel" + - protocol: kernel metric: 45 - - protocol: "connected" - route_map: "map01" + - protocol: connected + route_map: map01 maximum_paths: - - path: "ebgp" + - path: ebgp count: 20 - - path: "ibgp" + - path: ibgp count: 55 timers: keepalive: 35 bgp_params: bestpath: - as_path: "confed" + as_path: confed compare_routerid: true default: no_ipv4_unicast: true - router_id: "192.1.2.9" + router_id: 192.1.2.9 state: rendered - assert: 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 99ea04d..ae2c5c7 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/replaced.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_bgp_global replaced integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_global replaced integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -12,11 +11,11 @@ config: as_number: "65536" network: - - address: "203.0.113.0/24" + - address: 203.0.113.0/24 route_map: map01 redistribute: - - protocol: "static" - route_map: "map01" + - protocol: static + route_map: map01 bgp_params: always_compare_med: true dampening: @@ -25,12 +24,12 @@ half_life: 33 re_use: 60 bestpath: - as_path: "confed" + as_path: confed compare_routerid: true default: no_ipv4_unicast: true neighbor: - - address: "192.0.2.43" + - address: 192.0.2.43 disable_connected_check: true advertisement_interval: 72 capability: @@ -38,9 +37,9 @@ timers: holdtime: 30 keepalive: 10 - - address: "203.0.113.0" + - address: 203.0.113.0 capability: - orf: "receive" + orf: receive state: replaced - vyos.vyos.vyos_facts: @@ -53,9 +52,7 @@ - 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) + - name: Replace the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_bgp_global: *id001 diff --git a/tests/integration/targets/vyos_bgp_global/tests/cli/replaced_af.yaml b/tests/integration/targets/vyos_bgp_global/tests/cli/replaced_af.yaml index e66aae7..c9b2319 100644 --- a/tests/integration/targets/vyos_bgp_global/tests/cli/replaced_af.yaml +++ b/tests/integration/targets/vyos_bgp_global/tests/cli/replaced_af.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_bgp_global replaced integration tests on connection={{ - ansible_connection }} + msg: START vyos_bgp_global replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -11,15 +10,15 @@ - name: Replace the existing af configuration with the provided running configuration register: result ignore_errors: true - vyos.vyos.vyos_bgp_global: &id001 + vyos.vyos.vyos_bgp_global: config: as_number: "65536" network: - - address: "203.0.113.0/24" + - address: 203.0.113.0/24 route_map: map01 redistribute: - - protocol: "static" - route_map: "map01" + - protocol: static + route_map: map01 bgp_params: always_compare_med: true dampening: @@ -28,12 +27,12 @@ half_life: 33 re_use: 60 bestpath: - as_path: "confed" + as_path: confed compare_routerid: true default: no_ipv4_unicast: true neighbor: - - address: "192.0.2.43" + - address: 192.0.2.43 disable_connected_check: true advertisement_interval: 72 capability: @@ -41,9 +40,9 @@ timers: holdtime: 30 keepalive: 10 - - address: "203.0.113.0" + - address: 203.0.113.0 capability: - orf: "receive" + orf: receive state: replaced - assert: diff --git a/tests/integration/targets/vyos_bgp_global/vars/main.yaml b/tests/integration/targets/vyos_bgp_global/vars/main.yaml index fec5e43..e195c2d 100644 --- a/tests/integration/targets/vyos_bgp_global/vars/main.yaml +++ b/tests/integration/targets/vyos_bgp_global/vars/main.yaml @@ -15,31 +15,31 @@ merged: - set protocols bgp 65536 timers keepalive 35 after: aggregate_address: - - prefix: "192.0.2.0/24" + - prefix: 192.0.2.0/24 summary_only: true - - prefix: "203.0.113.0/24" + - prefix: 203.0.113.0/24 as_set: true as_number: 65536 bgp_params: bestpath: - as_path: "confed" + as_path: confed compare_routerid: true default: no_ipv4_unicast: true - router_id: "192.1.2.9" + router_id: 192.1.2.9 maximum_paths: - count: 20 - path: "ebgp" + path: ebgp - count: 55 - path: "ibgp" + path: ibgp network: - - address: "192.1.13.0/24" + - address: 192.1.13.0/24 backdoor: true redistribute: - - protocol: "connected" - route_map: "map01" + - protocol: connected + route_map: map01 - metric: 45 - protocol: "kernel" + protocol: kernel timers: keepalive: 35 @@ -96,14 +96,14 @@ rendered: populate: global: aggregate_address: - - prefix: "192.0.2.0/24" + - prefix: 192.0.2.0/24 summary_only: true - - prefix: "203.0.113.0/24" + - prefix: 203.0.113.0/24 as_set: true as_number: 65536 bgp_params: bestpath: - as_path: "confed" + as_path: confed compare_routerid: true confederation: - identifier: 66 @@ -111,40 +111,40 @@ populate: - peers: 55 default: no_ipv4_unicast: true - router_id: "192.1.2.9" + router_id: 192.1.2.9 maximum_paths: - count: 20 - path: "ebgp" + path: ebgp - count: 55 - path: "ibgp" + path: ibgp neighbor: - - address: "192.0.2.25" + - address: 192.0.2.25 disable_connected_check: true timers: holdtime: 30 keepalive: 10 - - address: "203.0.113.5" + - address: 203.0.113.5 attribute_unchanged: as_path: true med: true next_hop: true ebgp_multihop: 2 remote_as: 101 - update_source: "192.0.2.25" - - address: "5001::64" + update_source: 192.0.2.25 + - address: 5001::64 distribute_list: - acl: 20 - action: "export" + action: export - acl: 40 - action: "import" + action: import maximum_prefix: 34 network: - - address: "192.1.13.0/24" + - address: 192.1.13.0/24 backdoor: true redistribute: - - protocol: "connected" - route_map: "map01" + - protocol: connected + route_map: map01 - metric: 45 - protocol: "kernel" + protocol: kernel timers: keepalive: 35 diff --git a/tests/integration/targets/vyos_config/tests/cli_config/cli_basic.yaml b/tests/integration/targets/vyos_config/tests/cli_config/cli_basic.yaml index 55a96aa..1523725 100644 --- a/tests/integration/targets/vyos_config/tests/cli_config/cli_basic.yaml +++ b/tests/integration/targets/vyos_config/tests/cli_config/cli_basic.yaml @@ -1,7 +1,5 @@ --- -- debug: - msg="START cli_config/cli_basic.yaml on connection={{ ansible_connection - }}" +- debug: msg="START cli_config/cli_basic.yaml on connection={{ ansible_connection }}" - name: setup - remove interface description ansible.netcommon.cli_config: &id002 @@ -27,5 +25,4 @@ - name: teardown ansible.netcommon.cli_config: *id002 -- debug: msg="END cli_config/cli_basic.yaml on connection={{ ansible_connection - }}" +- debug: msg="END cli_config/cli_basic.yaml on connection={{ ansible_connection }}" diff --git a/tests/integration/targets/vyos_config/tests/cli_config/cli_comment.yaml b/tests/integration/targets/vyos_config/tests/cli_config/cli_comment.yaml index 470553f..d6bfda6 100644 --- a/tests/integration/targets/vyos_config/tests/cli_config/cli_comment.yaml +++ b/tests/integration/targets/vyos_config/tests/cli_config/cli_comment.yaml @@ -1,7 +1,5 @@ --- -- debug: - msg="START cli_config/cli_comment.yaml on connection={{ ansible_connection - }}" +- debug: msg="START cli_config/cli_comment.yaml on connection={{ ansible_connection }}" - name: setup ansible.netcommon.cli_config: &id001 @@ -29,6 +27,4 @@ - name: teardown ansible.netcommon.cli_config: *id001 -- debug: - msg="END cli_config/cli_comment.yaml on connection={{ ansible_connection - }}" +- debug: msg="END cli_config/cli_comment.yaml on connection={{ ansible_connection }}" diff --git a/tests/integration/targets/vyos_config/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_config/tests/redirection/cli/shortname.yaml index e5bb8dd..33fb3be 100644 --- a/tests/integration/targets/vyos_config/tests/redirection/cli/shortname.yaml +++ b/tests/integration/targets/vyos_config/tests/redirection/cli/shortname.yaml @@ -57,8 +57,8 @@ - name: Remove interface description and delete temp user vyos.vyos.config: &cleanup lines: - - "delete interfaces ethernet eth0 description TEST-INTF" - - "delete system login user test_user" + - delete interfaces ethernet eth0 description TEST-INTF + - delete system login user test_user - name: Use src with module alias register: result @@ -71,7 +71,7 @@ - '"set interfaces ethernet eth0 description TEST-INTF" in result.commands' - '"set system login user test_user" in result.commands' -- name: "Restore hostname to {{ inventory_hostname }} and delete temp user" +- name: Restore hostname to {{ inventory_hostname }} and delete temp user vyos.vyos.config: *cleanup - name: use module alias to take configuration backup diff --git a/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml b/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml index f6e8208..232132e 100644 --- a/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml +++ b/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml @@ -51,8 +51,13 @@ assert: that: - result.changed == false - - "{{ result['ansible_facts']['available_network_resources'] | symmetric_difference(result['ansible_facts']['ansible_net_gather_network_resources']) |length\ - \ == 0 }}" + - "{{ + result['ansible_facts']['available_network_resources'] + | symmetric_difference( + result['ansible_facts']['ansible_net_gather_network_resources'] + ) + | length == 0 + }}" - name: test getting default facts register: result 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 d79f477..865bf2f 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/_populate.yaml @@ -3,19 +3,45 @@ - 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" + lines: >- + set firewall all-ping 'enable' + + set firewall broadcast-ping 'enable' + + set firewall config-trap 'enable' + + set firewall group address-group MGMT-HOSTS address '192.0.1.1' + + set firewall group address-group MGMT-HOSTS address '192.0.1.3' + + set firewall group address-group MGMT-HOSTS address '192.0.1.5' + + set firewall group address-group MGMT-HOSTS description 'This group has + the Management hosts address list' + + set firewall group network-group MGMT description 'This group has the + Management network addresses' + + set firewall group network-group MGMT network '192.0.1.0/24' + + set firewall ip-src-route 'enable' + + set firewall log-martians 'enable' + + set firewall receive-redirects 'disable' + + set firewall send-redirects 'enable' + + set firewall source-validation 'strict' + + set firewall state-policy established action 'accept' + + set firewall state-policy established log 'enable' + + set firewall state-policy invalid action 'reject' + + set firewall syn-cookies 'enable' + + set firewall twa-hazards-protection 'enable' 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 df9be56..19fc83d 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/deleted.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_global deleted integration tests ansible_connection={{ - ansible_connection }} + msg: START vyos_firewall_global deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -21,8 +19,7 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: diff --git a/tests/integration/targets/vyos_firewall_global/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/empty_config.yaml index 643a99e..5b66f8c 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/empty_config.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_global empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_global empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -35,8 +33,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result 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 e2b60fc..6a7e134 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/gathered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_firewall_global gathered integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_global gathered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml diff --git a/tests/integration/targets/vyos_firewall_global/tests/cli/merged.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/merged.yaml index 67a16ce..4fb2a2d 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/merged.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_global merged integration tests on connection={{ ansible_connection - }} + msg: START vyos_firewall_global merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -56,17 +54,14 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - "{{ merged['after'] == result['after'] }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_global: *id001 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 54885ce..59851c3 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_global parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_firewall_global parsed integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -23,9 +21,7 @@ - name: Assert that correct parsing done assert: - that: - "{{ ansible_facts['network_resources']['firewall_global'] == result['parsed']\ - \ }}" + that: "{{ ansible_facts['network_resources']['firewall_global'] == result['parsed'] }}" - name: Gather the existing running configuration (IDEMPOTENT) register: result 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 951abe1..34796b8 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/rendered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_firewall_global rendered integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_global rendered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -58,8 +57,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ - \ |length == 0 }}" + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length == 0 }}" - name: Structure provided configuration into device specific commands (IDEMPOTENT) register: result 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 6b0ee82..ec71139 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/replaced.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_firewall_global replaced integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_global replaced integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -58,8 +57,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that before dicts are correctly generated assert: @@ -71,9 +69,7 @@ that: - "{{ replaced['after'] == result['after'] }}" - - name: - Replace device configurations of listed firewall with provided configurarions - (IDEMPOTENT) + - name: Replace device configurations of listed firewall with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_global: *id001 diff --git a/tests/integration/targets/vyos_firewall_global/tests/cli/rtt.yaml b/tests/integration/targets/vyos_firewall_global/tests/cli/rtt.yaml index ff24402..f48e432 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/cli/rtt.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_global round trip integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_global round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_global/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_firewall_global/tests/redirection/cli/shortname.yaml index 4e134d9..721a138 100644 --- a/tests/integration/targets/vyos_firewall_global/tests/redirection/cli/shortname.yaml +++ b/tests/integration/targets/vyos_firewall_global/tests/redirection/cli/shortname.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START shortname integration tests on connection={{ ansible_connection - }} + msg: START shortname integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -55,17 +54,14 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - "{{ merged['after'] == result['after'] }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.firewall_global: *id001 diff --git a/tests/integration/targets/vyos_firewall_global/vars/main.yaml b/tests/integration/targets/vyos_firewall_global/vars/main.yaml index 9ec7a6e..b996a94 100644 --- a/tests/integration/targets/vyos_firewall_global/vars/main.yaml +++ b/tests/integration/targets/vyos_firewall_global/vars/main.yaml @@ -5,12 +5,10 @@ merged: - set firewall group address-group MGMT-HOSTS address 192.0.1.1 - set firewall group address-group MGMT-HOSTS address 192.0.1.3 - set firewall group address-group MGMT-HOSTS address 192.0.1.5 - - set firewall group address-group MGMT-HOSTS description 'This group has the - Management hosts address list' + - set firewall group address-group MGMT-HOSTS description 'This group has the Management hosts address list' - set firewall group address-group MGMT-HOSTS - set firewall group network-group MGMT network 192.0.1.0/24 - - set firewall group network-group MGMT description 'This group has the Management - network addresses' + - set firewall group network-group MGMT description 'This group has the Management network addresses' - set firewall group network-group MGMT - set firewall ip-src-route 'enable' - set firewall receive-redirects 'disable' @@ -103,13 +101,11 @@ replaced: - set firewall group address-group SALES-HOSTS address 192.0.2.1 - set firewall group address-group SALES-HOSTS address 192.0.2.2 - set firewall group address-group SALES-HOSTS address 192.0.2.3 - - set firewall group address-group SALES-HOSTS description 'Sales office hosts - address list' + - set firewall group address-group SALES-HOSTS description 'Sales office hosts address list' - set firewall group address-group SALES-HOSTS - set firewall group address-group ENG-HOSTS address 192.0.3.1 - set firewall group address-group ENG-HOSTS address 192.0.3.2 - - set firewall group address-group ENG-HOSTS description 'Sales office hosts address - list' + - set firewall group address-group ENG-HOSTS description 'Sales office hosts address list' - set firewall group address-group ENG-HOSTS after: config_trap: true @@ -158,17 +154,14 @@ rendered: - set firewall group address-group SALES-HOSTS address 192.0.2.1 - set firewall group address-group SALES-HOSTS address 192.0.2.2 - set firewall group address-group SALES-HOSTS address 192.0.2.3 - - set firewall group address-group SALES-HOSTS description 'Sales office hosts - address list' + - set firewall group address-group SALES-HOSTS description 'Sales office hosts address list' - set firewall group address-group SALES-HOSTS - set firewall group address-group ENG-HOSTS address 192.0.3.1 - set firewall group address-group ENG-HOSTS address 192.0.3.2 - - set firewall group address-group ENG-HOSTS description 'Sales office hosts address - list' + - set firewall group address-group ENG-HOSTS description 'Sales office hosts address list' - set firewall group address-group ENG-HOSTS - set firewall group network-group MGMT network 192.0.1.0/24 - - set firewall group network-group MGMT description 'This group has the Management - network addresses' + - set firewall group network-group MGMT description 'This group has the Management network addresses' - set firewall group network-group MGMT - set firewall ip-src-route 'enable' - set firewall receive-redirects 'disable' 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 3dee476..c5e2f4f 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate.yaml @@ -3,13 +3,14 @@ - 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" + lines: |- + set interfaces ethernet eth1 firewall in name 'INBOUND' + set interfaces ethernet eth1 firewall out name 'OUTBOUND' + set interfaces ethernet eth1 firewall local name 'LOCAL' + set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL' + set interfaces ethernet eth2 firewall in name 'INBOUND' + set interfaces ethernet eth2 firewall out name 'OUTBOUND' + set interfaces ethernet eth2 firewall local name 'LOCAL' + set interfaces ethernet eth2 firewall local ipv6-name 'V6-LOCAL' ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate_rule_sets.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate_rule_sets.yaml index d2fd3ee..b1e9425 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate_rule_sets.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_populate_rule_sets.yaml @@ -1,8 +1,6 @@ --- - name: Setup vars: - lines: - "set firewall name 'INBOUND'\nset firewall name 'OUTBOUND'\nset firewall\ - \ name 'LOCAL'\nset firewall ipv6-name 'V6-LOCAL'\n" + lines: "set firewall name 'INBOUND'\nset firewall name 'OUTBOUND'\nset firewall name 'LOCAL'\nset firewall ipv6-name 'V6-LOCAL'\n" ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_config.yaml index c95fc00..6074960 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_config.yaml @@ -1,8 +1,6 @@ --- - name: Remove Config vars: - lines: - "delete interfaces ethernet eth1 firewall\ndelete interfaces ethernet\ - \ eth2 firewall\n" + lines: "delete interfaces ethernet eth1 firewall\ndelete interfaces ethernet eth2 firewall\n" ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_firewall_config.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_firewall_config.yaml index da1b02c..f77e6b7 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_firewall_config.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_remove_firewall_config.yaml @@ -1,7 +1,6 @@ --- - name: Remove Config vars: - lines: "delete firewall name INBOUND\ndelete firewall name OUTBOUND\ndelete\ - \ firewall name LOCAL\ndelete firewall ipv6-name V6-LOCAL\n" + lines: "delete firewall name INBOUND\ndelete firewall name OUTBOUND\ndelete firewall name LOCAL\ndelete firewall 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 eb9bded..2b94c08 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_interfaces deleted integration tests ansible_connection={{ - ansible_connection }} + msg: START vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml @@ -26,14 +24,12 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: that: - - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result @@ -48,8 +44,7 @@ - name: Assert that the before dicts were correctly generated assert: that: - - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_afi.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_afi.yaml index 8a31b2a..065fcf2 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,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_interfaces deleted integration tests ansible_connection={{ - ansible_connection }} + msg: START vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml @@ -34,14 +32,12 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted_afi['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ 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 }}" + - "{{ deleted_afi['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result @@ -56,8 +52,7 @@ - name: Assert that the before dicts were correctly generated assert: that: - - "{{ deleted_afi['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ deleted_afi['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_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 a3515b0..f6cdae4 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,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_interfaces deleted integration tests ansible_connection={{ - ansible_connection }} + msg: START vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml @@ -23,14 +21,12 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: that: - - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result @@ -45,8 +41,7 @@ - name: Assert that the before dicts were correctly generated assert: that: - - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_single.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/deleted_single.yaml index d62e27f..6aa5032 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,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_interfaces deleted integration tests ansible_connection={{ - ansible_connection }} + msg: START vyos_firewall_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml @@ -29,14 +27,12 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted_single['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ 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 }}" + - "{{ deleted_single['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result @@ -51,8 +47,7 @@ - name: Assert that the before dicts were correctly generated assert: that: - - "{{ deleted_single['after'] | symmetric_difference(result['before'])\ - \ |length == 0 }}" + - "{{ deleted_single['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/empty_config.yaml index 1b9eb34..0799a67 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/empty_config.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_interfaces empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_interfaces empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -46,8 +44,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/gathered.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/gathered.yaml index 2593a67..145ad73 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/gathered.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_interfaces gathered integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_interfaces gathered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -22,8 +20,7 @@ - name: Assert that gathered dicts was correctly generated assert: that: - - "{{ populate | symmetric_difference(result['gathered']) |length == 0\ - \ }}" + - "{{ populate | symmetric_difference(result['gathered']) |length == 0 }}" - name: Gather the existing running configuration (IDEMPOTENT) register: result diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/merged.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/merged.yaml index 10c8f01..145fcef 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/merged.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_interfaces merged integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_interfaces merged integration tests on connection={{ ansible_connection }} - include_tasks: _populate_rule_sets.yaml @@ -52,25 +50,19 @@ - name: Assert that before dicts were correctly generated assert: - that: - "{{ merged['before'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_interfaces: *id001 @@ -82,8 +74,7 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/merged_edit.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/merged_edit.yaml index 1a53cab..fbbb81a 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/merged_edit.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/merged_edit.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_interfaces merged integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_interfaces merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -30,25 +28,19 @@ - name: Assert that before dicts were correctly generated assert: - that: - "{{ populate | symmetric_difference(result['before']) |length == 0\ - \ }}" + that: "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct set of commands were generated assert: that: - - "{{ merged_edit['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ merged_edit['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - - "{{ merged_edit['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ merged_edit['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_interfaces: *id001 @@ -60,8 +52,7 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ merged_edit['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ merged_edit['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/overridden.yaml index 5776718..82508ba 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/overridden.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_interfaces overridden integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_interfaces overridden integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -33,14 +31,12 @@ - name: Assert that correct commands were generated assert: that: - - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Overrides all device configuration with provided configurations (IDEMPOTENT) register: result @@ -54,8 +50,7 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/parsed.yaml index 105c647..339e64e 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_interfaces parsed integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_interfaces parsed integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -29,9 +27,7 @@ - name: Assert that correct parsing done assert: - that: - "{{ ansible_facts['network_resources']['firewall_interfaces'] | symmetric_difference(result['parsed'])\ - \ |length == 0 }}" + that: "{{ ansible_facts['network_resources']['firewall_interfaces'] | symmetric_difference(result['parsed']) |length == 0 }}" - name: Gather the existing running configuration (IDEMPOTENT) register: result diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rendered.yaml index 3283ec6..3b815eb 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rendered.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_interfaces rendered integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_interfaces rendered integration tests on connection={{ ansible_connection }} - block: - name: Structure provided configuration into device specific commands @@ -49,8 +47,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ - \ |length == 0 }}" + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length == 0 }}" - name: Structure provided configuration into device specific commands (IDEMPOTENT) register: result diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/replaced.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/replaced.yaml index d82a0f6..bca14cf 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/replaced.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_interfaces replaced integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_interfaces replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -13,8 +11,7 @@ - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed firewall rules with provided - configurations + - name: Replace device configurations of listed firewall rules with provided configurations register: result vyos.vyos.vyos_firewall_interfaces: &id001 config: @@ -41,8 +38,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that before dicts are correctly generated assert: @@ -52,11 +48,9 @@ - name: Assert that after dict is correctly generated assert: that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: Replace device configurations of listed firewall rules with provided - configurarions (IDEMPOTENT) + - name: Replace device configurations of listed firewall rules with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_interfaces: *id001 @@ -68,8 +62,7 @@ - name: Assert that before dict is correctly generated assert: that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rtt.yaml b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rtt.yaml index ff3abb1..d64a987 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/rtt.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_interfaces round trip integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_interfaces round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -66,9 +64,7 @@ - name: Assert that changes were applied assert: - that: - "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Revert back to base config using facts round trip register: revert @@ -78,9 +74,7 @@ - name: Assert that config was reverted assert: - that: - "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ - \ == 0 }}" + that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/_populate.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/_populate.yaml index 12adf4f..31e0d13 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/_populate.yaml @@ -1,28 +1,31 @@ --- - name: Setup vars: - lines: - "set firewall group address-group 'inbound'\nset firewall ipv6-name UPLINK\ - \ default-action 'accept'\nset firewall ipv6-name UPLINK description 'This\ - \ is ipv6 specific rule-set'\nset firewall ipv6-name UPLINK rule 1 action\ - \ 'accept'\nset firewall ipv6-name UPLINK rule 1 description 'Fwipv6-Rule\ - \ 1 is configured by Ansible'\nset firewall ipv6-name UPLINK rule 1 ipsec\ - \ 'match-ipsec'\nset firewall ipv6-name UPLINK rule 2 action 'accept'\nset\ - \ firewall ipv6-name UPLINK rule 2 description 'Fwipv6-Rule 2 is configured\ - \ by Ansible'\nset firewall ipv6-name UPLINK rule 2 ipsec 'match-ipsec'\n\ - set firewall name INBOUND default-action 'accept'\nset firewall name INBOUND\ - \ description 'IPv4 INBOUND rule set'\nset firewall name INBOUND rule 101\ - \ action 'accept'\nset firewall name INBOUND rule 101 description 'Rule 101\ - \ is configured by Ansible'\nset firewall name INBOUND rule 101 ipsec 'match-ipsec'\n\ - set firewall name INBOUND rule 102 action 'reject'\nset firewall name INBOUND\ - \ rule 102 description 'Rule 102 is configured by Ansible'\nset firewall name\ - \ INBOUND rule 102 ipsec 'match-ipsec'\nset firewall name INBOUND rule 103\ - \ action 'accept'\nset firewall name INBOUND rule 103 description 'Rule 103\ - \ is configured by Ansible'\nset firewall name INBOUND rule 103 destination\ - \ group address-group 'inbound'\nset firewall name INBOUND rule 103 source\ - \ address '192.0.2.0'\nset firewall name INBOUND rule 103 state established\ - \ 'enable'\nset firewall name INBOUND rule 103 state invalid 'disable'\nset\ - \ firewall name INBOUND rule 103 state new 'disable'\nset firewall name INBOUND\ - \ rule 103 state related 'enable'\n" + lines: |- + set firewall group address-group 'inbound' + set firewall ipv6-name UPLINK default-action 'accept' + set firewall ipv6-name UPLINK description 'This is ipv6 specific rule-set' + set firewall ipv6-name UPLINK rule 1 action 'accept' + set firewall ipv6-name UPLINK rule 1 description 'Fwipv6-Rule 1 is configured by Ansible' + set firewall ipv6-name UPLINK rule 1 ipsec 'match-ipsec' + set firewall ipv6-name UPLINK rule 2 action 'accept' + set firewall ipv6-name UPLINK rule 2 description 'Fwipv6-Rule 2 is configured by Ansible' + set firewall ipv6-name UPLINK rule 2 ipsec 'match-ipsec' + set firewall name INBOUND default-action 'accept' + set firewall name INBOUND description 'IPv4 INBOUND rule set' + set firewall name INBOUND rule 101 action 'accept' + set firewall name INBOUND rule 101 description 'Rule 101 is configured by Ansible' + set firewall name INBOUND rule 101 ipsec 'match-ipsec' + set firewall name INBOUND rule 102 action 'reject' + set firewall name INBOUND rule 102 description 'Rule 102 is configured by Ansible' + set firewall name INBOUND rule 102 ipsec 'match-ipsec' + set firewall name INBOUND rule 103 action 'accept' + set firewall name INBOUND rule 103 description 'Rule 103 is configured by Ansible' + set firewall name INBOUND rule 103 destination group address-group 'inbound' + set firewall name INBOUND rule 103 source address '192.0.2.0' + set firewall name INBOUND rule 103 state established 'enable' + set firewall name INBOUND rule 103 state invalid 'disable' + set firewall name INBOUND rule 103 state new 'disable' + set firewall name INBOUND rule 103 state related 'enable' ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted.yaml index 6a830f9..97b3ae8 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - Start vyos_firewall_rules deleted integration tests ansible_connection={{ - ansible_connection }} + msg: Start vyos_firewall_rules deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -27,14 +25,12 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted_rs['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ deleted_rs['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: that: - - "{{ deleted_rs['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ deleted_rs['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result @@ -49,7 +45,6 @@ - name: Assert that the before dicts were correctly generated assert: that: - - "{{ deleted_rs['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ deleted_rs['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_afi.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_afi.yaml index e104171..c7a2278 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_afi.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_afi.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - Start vyos_firewall_rules deleted integration tests ansible_connection={{ - ansible_connection }} + msg: Start vyos_firewall_rules deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -24,14 +22,12 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted_afi_all['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ deleted_afi_all['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: that: - - "{{ deleted_afi_all['after'] | symmetric_difference(result['after'])\ - \ |length == 0 }}" + - "{{ deleted_afi_all['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result @@ -46,7 +42,6 @@ - name: Assert that the before dicts were correctly generated assert: that: - - "{{ deleted_afi_all['after'] | symmetric_difference(result['before'])\ - \ |length == 0 }}" + - "{{ deleted_afi_all['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_all.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_all.yaml index 9df5127..c55a4c5 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_all.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/deleted_all.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - Start vyos_firewall_rules deleted integration tests ansible_connection={{ - ansible_connection }} + msg: Start vyos_firewall_rules deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -21,14 +19,12 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted_afi_all['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ deleted_afi_all['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: that: - - "{{ deleted_afi_all['after'] | symmetric_difference(result['after'])\ - \ |length == 0 }}" + - "{{ deleted_afi_all['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result @@ -43,7 +39,6 @@ - name: Assert that the before dicts were correctly generated assert: that: - - "{{ deleted_afi_all['after'] | symmetric_difference(result['before'])\ - \ |length == 0 }}" + - "{{ deleted_afi_all['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/empty_config.yaml index ba71e71..064296a 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/empty_config.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_rules empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_rules empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -46,8 +44,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/gathered.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/gathered.yaml index b824198..29096eb 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/gathered.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_rules gathered integration tests on connection={{ ansible_connection - }} + msg: START vyos_firewall_rules gathered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -18,8 +16,7 @@ - name: Assert that gathered dicts was correctly generated assert: that: - - "{{ populate | symmetric_difference(result['gathered']) |length == 0\ - \ }}" + - "{{ populate | symmetric_difference(result['gathered']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/merged.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/merged.yaml index 48fdff7..674b437 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/merged.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_rules merged integration tests on connection={{ ansible_connection - }} + msg: START vyos_firewall_rules merged integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -67,31 +65,24 @@ - name: Assert that before dicts were correctly generated assert: - that: - "{{ merged['before'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that fact was correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(ansible_facts['network_resources']['firewall_rules']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(ansible_facts['network_resources']['firewall_rules']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_rules: *id001 @@ -103,7 +94,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/overridden.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/overridden.yaml index aac79e5..6e1b3a3 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/overridden.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_firewall_rules overridden integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_rules overridden integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -37,14 +36,12 @@ - name: Assert that correct commands were generated assert: that: - - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Overrides all device configuration with provided configurations (IDEMPOTENT) register: result @@ -58,7 +55,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml index 3e4c972..e6eae78 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_rules parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_firewall_rules parsed integration tests on connection={{ ansible_connection }} - name: Parse externally provided Firewall rules config to agnostic model register: result @@ -13,5 +11,4 @@ - name: Assert that config was correctly parsed assert: that: - - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length ==\ - \ 0 }}" + - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length == 0 }}" diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml index d376744..36feb69 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/rendered.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_firewall_rules rendered integration tests on connection={{ ansible_connection - }} + msg: START vyos_firewall_rules rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -51,8 +49,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ - \ |length == 0 }}" + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length == 0 }}" - debug: msg: END vyos_firewall_rules rendered integration tests on connection={{ ansible_connection }} diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/replaced.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/replaced.yaml index 850aa60..5959c22 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/replaced.yaml @@ -1,16 +1,13 @@ --- - debug: - msg: - START vyos_firewall_rules replaced integration tests on connection={{ ansible_connection - }} + msg: START vyos_firewall_rules replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed firewall rules with provided - configurations + - name: Replace device configurations of listed firewall rules with provided configurations register: result vyos.vyos.vyos_firewall_rules: &id001 config: @@ -40,8 +37,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that before dicts are correctly generated assert: @@ -51,11 +47,9 @@ - name: Assert that after dict is correctly generated assert: that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: Replace device configurations of listed firewall rules with provided - configurarions (IDEMPOTENT) + - name: Replace device configurations of listed firewall rules with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_firewall_rules: *id001 @@ -67,7 +61,6 @@ - name: Assert that before dict is correctly generated assert: that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/tests/cli/rtt.yaml b/tests/integration/targets/vyos_firewall_rules/tests/cli/rtt.yaml index f3f4252..dcf5b28 100644 --- a/tests/integration/targets/vyos_firewall_rules/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_firewall_rules/tests/cli/rtt.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_firewall_rules round trip integration tests on connection={{ - ansible_connection }} + msg: START vyos_firewall_rules round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -74,9 +73,7 @@ - name: Assert that changes were applied assert: - that: - "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Revert back to base config using facts round trip register: revert @@ -86,8 +83,6 @@ - name: Assert that config was reverted assert: - that: - "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ - \ == 0 }}" + that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_firewall_rules/vars/main.yaml b/tests/integration/targets/vyos_firewall_rules/vars/main.yaml index 3bd1512..e2b3e10 100644 --- a/tests/integration/targets/vyos_firewall_rules/vars/main.yaml +++ b/tests/integration/targets/vyos_firewall_rules/vars/main.yaml @@ -6,13 +6,11 @@ merged: - set firewall ipv6-name UPLINK description 'This is ipv6 specific rule-set' - set firewall ipv6-name UPLINK rule 1 action 'accept' - set firewall ipv6-name UPLINK rule 1 - - set firewall ipv6-name UPLINK rule 1 description 'Fwipv6-Rule 1 is configured - by Ansible' + - set firewall ipv6-name UPLINK rule 1 description 'Fwipv6-Rule 1 is configured by Ansible' - set firewall ipv6-name UPLINK rule 1 ipsec 'match-ipsec' - set firewall ipv6-name UPLINK rule 2 action 'accept' - set firewall ipv6-name UPLINK rule 2 - - set firewall ipv6-name UPLINK rule 2 description 'Fwipv6-Rule 2 is configured - by Ansible' + - set firewall ipv6-name UPLINK rule 2 description 'Fwipv6-Rule 2 is configured by Ansible' - set firewall ipv6-name UPLINK rule 2 ipsec 'match-ipsec' - set firewall name INBOUND default-action 'accept' - set firewall name INBOUND description 'IPv4 INBOUND rule set' diff --git a/tests/integration/targets/vyos_hostname/tests/cli/deleted.yaml b/tests/integration/targets/vyos_hostname/tests/cli/deleted.yaml index 2c052f4..cefaccf 100644 --- a/tests/integration/targets/vyos_hostname/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_hostname/tests/cli/deleted.yaml @@ -24,9 +24,7 @@ that: - result.after == {} - - name: - Delete the existing configuration with the provided running configuration - (IDEMPOTENT) + - name: Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_hostname: *id001 diff --git a/tests/integration/targets/vyos_hostname/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_hostname/tests/cli/empty_config.yaml index 8efead2..e829ac9 100644 --- a/tests/integration/targets/vyos_hostname/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_hostname/tests/cli/empty_config.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_hostname empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_hostname empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -45,8 +44,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result diff --git a/tests/integration/targets/vyos_hostname/tests/cli/gathered.yaml b/tests/integration/targets/vyos_hostname/tests/cli/gathered.yaml index f3eacad..2d31670 100644 --- a/tests/integration/targets/vyos_hostname/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_hostname/tests/cli/gathered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_hostname gathered integration tests on connection={{ - ansible_connection }} + msg: START vyos_hostname gathered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_hostname/tests/cli/merged.yaml b/tests/integration/targets/vyos_hostname/tests/cli/merged.yaml index 14ed1df..c1e4f25 100644 --- a/tests/integration/targets/vyos_hostname/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_hostname/tests/cli/merged.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_hostname merged integration tests on connection={{ - ansible_connection }} + msg: START vyos_hostname merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -10,7 +9,7 @@ register: result vyos.vyos.vyos_hostname: &id001 config: - hostname: "vyosTest" + hostname: vyosTest state: merged - vyos.vyos.vyos_facts: @@ -29,9 +28,7 @@ that: - result.before == {} - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_hostname: *id001 diff --git a/tests/integration/targets/vyos_hostname/tests/cli/overridden.yaml b/tests/integration/targets/vyos_hostname/tests/cli/overridden.yaml index a50ef64..15065b4 100644 --- a/tests/integration/targets/vyos_hostname/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_hostname/tests/cli/overridden.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_hostname overridden integration tests on connection={{ - ansible_connection }} + msg: START vyos_hostname overridden integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -12,7 +11,7 @@ register: result vyos.vyos.vyos_hostname: &id001 config: - hostname: "vyosTest" + hostname: vyosTest state: overridden - vyos.vyos.vyos_facts: @@ -26,9 +25,7 @@ - result.after == ansible_facts['network_resources']['hostname'] - result.after == merged.after - - name: - override the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: override the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_hostname: *id001 diff --git a/tests/integration/targets/vyos_hostname/tests/cli/parsed.yaml b/tests/integration/targets/vyos_hostname/tests/cli/parsed.yaml index b1aa806..377f121 100644 --- a/tests/integration/targets/vyos_hostname/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_hostname/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_hostname parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_hostname parsed integration tests on connection={{ ansible_connection }} - name: Provide the running configuration for parsing (config to be parsed) register: result diff --git a/tests/integration/targets/vyos_hostname/tests/cli/rendered.yaml b/tests/integration/targets/vyos_hostname/tests/cli/rendered.yaml index 25c81b2..bfad4a8 100644 --- a/tests/integration/targets/vyos_hostname/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_hostname/tests/cli/rendered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_hostname rendered integration tests on connection={{ - ansible_connection }} + msg: START vyos_hostname rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -10,7 +9,7 @@ register: result vyos.vyos.vyos_hostname: config: - hostname: "vyosTest" + hostname: vyosTest state: rendered - assert: diff --git a/tests/integration/targets/vyos_hostname/tests/cli/replaced.yaml b/tests/integration/targets/vyos_hostname/tests/cli/replaced.yaml index 7d9b522..18b5ee5 100644 --- a/tests/integration/targets/vyos_hostname/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_hostname/tests/cli/replaced.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_hostname replaced integration tests on connection={{ - ansible_connection }} + msg: START vyos_hostname replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -12,7 +11,7 @@ register: result vyos.vyos.vyos_hostname: &id001 config: - hostname: "vyosTest" + hostname: vyosTest state: replaced - vyos.vyos.vyos_facts: @@ -26,9 +25,7 @@ - result.after == ansible_facts['network_resources']['hostname'] - result.after == merged.after - - name: - Replace the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Replace the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_hostname: *id001 diff --git a/tests/integration/targets/vyos_hostname/vars/main.yaml b/tests/integration/targets/vyos_hostname/vars/main.yaml index ca02d03..2ea481d 100644 --- a/tests/integration/targets/vyos_hostname/vars/main.yaml +++ b/tests/integration/targets/vyos_hostname/vars/main.yaml @@ -4,7 +4,7 @@ merged: commands: - set system host-name vyosTest after: - hostname: "vyosTest" + hostname: vyosTest deleted: commands: diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml index ee0b775..cb4e86c 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/_populate.yaml @@ -3,12 +3,13 @@ - 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" + lines: |- + set interfaces ethernet "{{ intf }}" description 'Configured by Ansible' + set interfaces ethernet "{{ intf }}" speed 'auto' + set interfaces ethernet "{{ intf }}" duplex 'auto' + set interfaces ethernet "{{ intf }}" mtu '1500' + set interfaces ethernet "{{ intf }}" vif 200 + set interfaces ethernet "{{ intf }}" vif 200 description 'VIF - 200' loop: - eth1 - eth2 diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/_remove_config.yaml index 6353d1c..ed2b424 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/_remove_config.yaml @@ -1,12 +1,13 @@ --- - name: Remove Config vars: - lines: - "delete interfaces ethernet \"{{ intf }}\" description\ndelete interfaces\ - \ ethernet \"{{ intf }}\" speed\ndelete interfaces ethernet \"{{ intf }}\"\ - \ duplex\ndelete interfaces ethernet \"{{ intf }}\" mtu\ndelete interfaces\ - \ ethernet \"{{ intf }}\" disable\ndelete interfaces ethernet \"{{ intf }}\"\ - \ vif\n" + lines: |- + delete interfaces ethernet "{{ intf }}" description + delete interfaces ethernet "{{ intf }}" speed + delete interfaces ethernet "{{ intf }}" duplex + delete interfaces ethernet "{{ intf }}" mtu + delete interfaces ethernet "{{ intf }}" disable + delete interfaces ethernet "{{ intf }}" vif loop: - eth1 - eth2 diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml index 2c12ff2..620bf53 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/deleted.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - Start vyos_interfaces deleted integration tests ansible_connection={{ ansible_connection - }} + msg: Start vyos_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -24,14 +22,12 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: that: - - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result @@ -45,7 +41,6 @@ - name: Assert that the before dicts were correctly generated assert: that: - - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/empty_config.yaml index 652f158..f8133d6 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/empty_config.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_interfaces empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_interfaces empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -45,8 +44,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml index f8057c8..88e5376 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/gathered.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_interfaces gathered integration tests on connection={{ ansible_connection - }} + msg: START vyos_interfaces gathered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -16,8 +14,7 @@ - name: Assert that gathered dicts was correctly generated assert: that: - - "{{ populate | symmetric_difference(result['gathered']) |length == 0\ - \ }}" + - "{{ populate | symmetric_difference(result['gathered']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/merged.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/merged.yaml index 39f4938..194d9bc 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/merged.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_interfaces merged integration tests on connection={{ ansible_connection - }} + msg: START vyos_interfaces merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -32,25 +30,19 @@ - name: Assert that before dicts were correctly generated assert: - that: - "{{ merged['before'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_interfaces: *id001 @@ -62,7 +54,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml index 66588cd..f8915d3 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/overridden.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_interfaces overridden integration tests on connection={{ ansible_connection - }} + msg: START vyos_interfaces overridden integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -28,14 +26,12 @@ - name: Assert that correct commands were generated assert: that: - - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Overrides all device configuration with provided configurations (IDEMPOTENT) register: result @@ -49,7 +45,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml index a22fb60..0ebfd32 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_interfaces parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_interfaces parsed integration tests on connection={{ ansible_connection }} - name: Parse externally provided interfaces config to agnostic model register: result @@ -13,5 +11,4 @@ - name: Assert that config was correctly parsed assert: that: - - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length ==\ - \ 0 }}" + - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length == 0 }}" diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml index 41d10d0..cd8cdf6 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/rendered.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_interfaces rendered integration tests on connection={{ ansible_connection - }} + msg: START vyos_interfaces rendered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -38,7 +36,6 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ - \ |length == 0 }}" + - "{{ 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 a22a4c7..f6cfda4 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/replaced.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_interfaces replaced integration tests on connection={{ ansible_connection - }} + msg: START vyos_interfaces replaced integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -25,8 +23,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that before dicts are correctly generated assert: @@ -36,12 +33,9 @@ - name: Assert that after dict is correctly generated assert: that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Replace device configurations of listed interfaces with provided configurarions - (IDEMPOTENT) + - name: Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_interfaces: *id001 @@ -53,7 +47,6 @@ - name: Assert that before dict is correctly generated assert: that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml b/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml index 5aefbb4..5073a34 100644 --- a/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/cli/rtt.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_interfaces round trip integration tests on connection={{ ansible_connection - }} + msg: START vyos_interfaces round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -64,9 +62,7 @@ - name: Assert that changes were applied assert: - that: - "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Revert back to base config using facts round trip register: revert @@ -76,8 +72,6 @@ - name: Assert that config was reverted assert: - that: - "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ - \ == 0 }}" + that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_interfaces/tests/redirection/cli/shortname.yaml index 810601a..fcab967 100644 --- a/tests/integration/targets/vyos_interfaces/tests/redirection/cli/shortname.yaml +++ b/tests/integration/targets/vyos_interfaces/tests/redirection/cli/shortname.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START shortname integration tests on connection={{ ansible_connection - }} + msg: START shortname integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -31,25 +30,19 @@ - name: Assert that before dicts were correctly generated assert: - that: - "{{ merged['before'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.interfaces: *id001 @@ -61,7 +54,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_interfaces/vars/main.yaml b/tests/integration/targets/vyos_interfaces/vars/main.yaml index 83d0e59..7bf9b25 100644 --- a/tests/integration/targets/vyos_interfaces/vars/main.yaml +++ b/tests/integration/targets/vyos_interfaces/vars/main.yaml @@ -10,16 +10,14 @@ merged: - name: eth2 enabled: true commands: - - set interfaces ethernet eth1 description 'Configured by Ansible - Interface - 1' + - set interfaces ethernet eth1 description 'Configured by Ansible - Interface 1' - set interfaces ethernet eth1 mtu '1500' - set interfaces ethernet eth1 duplex 'auto' - set interfaces ethernet eth1 speed 'auto' - set interfaces ethernet eth1 vif 100 description 'Eth1 - VIF 100' - set interfaces ethernet eth1 vif 100 mtu '400' - set interfaces ethernet eth1 vif 101 description 'Eth1 - VIF 101' - - set interfaces ethernet eth2 description 'Configured by Ansible - Interface - 2 (ADMIN DOWN)' + - set interfaces ethernet eth2 description 'Configured by Ansible - Interface 2 (ADMIN DOWN)' - set interfaces ethernet eth2 mtu '600' - set interfaces ethernet eth2 disable after: 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 2a766d5..6f6c506 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/_populate.yaml @@ -3,10 +3,11 @@ - 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" + lines: |- + set interfaces ethernet eth1 address '192.0.2.14/24' + set interfaces ethernet eth2 address '192.0.2.10/24' + set interfaces ethernet eth2 address '192.0.2.11/24' + set interfaces ethernet eth2 address '2001:db8::10/32' + set interfaces ethernet eth2 address '2001:db8::12/32' ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/_remove_config.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/_remove_config.yaml index c5acac9..aa5a628 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/_remove_config.yaml @@ -1,9 +1,7 @@ --- - name: Remove Config vars: - lines: - "delete interfaces ethernet \"{{ intf }}\" address\ndelete interfaces\ - \ ethernet \"{{ intf }}\" vif\n" + lines: "delete interfaces ethernet \"{{ intf }}\" address\ndelete interfaces ethernet \"{{ intf }}\" vif\n" loop: - eth1 - eth2 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 9242fb5..df21b43 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_interfaces deleted integration tests ansible_connection={{ ansible_connection - }} + msg: START vyos_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -24,14 +22,12 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: that: - - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result @@ -45,7 +41,6 @@ - name: Assert that the before dicts were correctly generated assert: that: - - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml index 15393fb..94b6c13 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/empty_config.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_l3_interfaces empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_l3_interfaces empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -46,8 +44,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result 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 f18f7d3..41a53d8 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/gathered.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_l3_interfaces gathered integration tests on connection={{ ansible_connection - }} + msg: START vyos_l3_interfaces gathered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -16,8 +14,7 @@ - name: Assert that gathered dicts was correctly generated assert: that: - - "{{ populate | symmetric_difference(result['gathered']) |length == 0\ - \ }}" + - "{{ populate | symmetric_difference(result['gathered']) |length == 0 }}" - name: Gather the existing running configuration (IDEMPOTENT) register: result diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/merged.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/merged.yaml index d1f7bf0..4ec4d0f 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/merged.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_l3_interfaces merged integration tests on connection={{ ansible_connection - }} + msg: START vyos_l3_interfaces merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -30,25 +28,19 @@ - name: Assert that before dicts were correctly generated assert: - that: - "{{ merged['before'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_l3_interfaces: *id001 @@ -60,7 +52,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/overridden.yaml index c12e2ae..8334a61 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/overridden.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_l3_interfaces merged integration tests on connection={{ ansible_connection - }} + msg: START vyos_l3_interfaces merged integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -28,14 +26,12 @@ - name: Assert that correct commands were generated assert: that: - - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Overrides all device configuration with provided configurations (IDEMPOTENT) register: result @@ -49,7 +45,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/parsed.yaml index 6640271..969359f 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_l3_nterfaces parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_l3_nterfaces parsed integration tests on connection={{ ansible_connection }} - name: Parse externally provided interfaces config to agnostic model register: result @@ -13,5 +11,4 @@ - name: Assert that config was correctly parsed assert: that: - - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length ==\ - \ 0 }}" + - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length == 0 }}" diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml index 2a606c3..199879f 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/rendered.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_l3_interfaces rendered integration tests on connection={{ ansible_connection - }} + msg: START vyos_l3_interfaces rendered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -26,8 +24,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ - \ |length == 0 }}" + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length == 0 }}" - name: Structure provided configuration into device specific commands (IDEMPOTENT) register: result 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 26fe4f8..502175f 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/replaced.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_l3_interfaces replaced integration tests on connection={{ ansible_connection - }} + msg: START vyos_l3_interfaces replaced integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -23,8 +21,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that before dicts are correctly generated assert: @@ -34,12 +31,9 @@ - name: Assert that after dict is correctly generated assert: that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Replace device configurations of listed interfaces with provided configurarions - (IDEMPOTENT) + - name: Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_l3_interfaces: *id001 @@ -51,7 +45,6 @@ - name: Assert that before dict is correctly generated assert: that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ 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 963ab55..6debbee 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 @@ -24,8 +24,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ - \ |length == 0 }}" + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length == 0 }}" - name: Structure provided configuration into device specific commands (IDEMPOTENT) register: result 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 d519d28..be0d635 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_populate.yaml @@ -3,12 +3,16 @@ - 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" + lines: |- + set interfaces bonding bond0 + set interfaces bonding bond0 hash-policy 'layer2' + set interfaces bonding bond0 mode 'active-backup' + set interfaces ethernet eth1 bond-group bond0 + set interfaces bonding bond1 + set interfaces bonding bond0 primary 'eth1' + set interfaces bonding bond1 hash-policy 'layer2+3' + set interfaces bonding bond1 mode 'active-backup' + set interfaces ethernet eth2 bond-group bond1 + set interfaces bonding bond1 primary 'eth2' 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 017c56a..e22a6ca 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,17 +1,21 @@ ---- - 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" + lines: |- + delete interfaces bonding bond0 hash-policy + delete interfaces ethernet eth1 bond-group bond0 + delete interfaces bonding bond0 mode + delete interfaces bonding bond0 primary + delete interfaces bonding bond1 hash-policy + delete interfaces ethernet eth2 bond-group bond1 + delete interfaces bonding bond1 mode + delete interfaces bonding bond1 primary ansible.netcommon.cli_config: config: "{{ lines }}" - name: Remove Bond vars: - lines: "delete interfaces bonding bond0\ndelete interfaces bonding bond1\n" + lines: | + delete interfaces bonding bond0 + delete interfaces bonding bond1 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 ae15884..e30be07 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/deleted.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lag_interfaces deleted integration tests ansible_connection={{ - ansible_connection }} + msg: START vyos_lag_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -24,14 +22,12 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: that: - - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result @@ -45,7 +41,6 @@ - name: Assert that the before dicts were correctly generated assert: that: - - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_bond.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml index 22ac8a8..efe8936 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/empty_config.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lag_interfaces empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_lag_interfaces empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -46,8 +44,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result 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 caa8f30..f6c281f 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/gathered.yaml @@ -1,23 +1,20 @@ --- - debug: - msg: - START vyos_lag_interfaces gathered integration tests on connection={{ ansible_connection - }} + msg: START vyos_lag_interfaces gathered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - name: Gather the provided configuration with the existing running configuration register: result - vyos.vyos.vyos_lag_interfaces: &id001 + vyos.vyos.vyos_lag_interfaces: config: state: gathered - name: Assert that gathered dicts was correctly generated assert: that: - - "{{ populate | symmetric_difference(result['gathered']) |length == 0\ - \ }}" + - "{{ populate | symmetric_difference(result['gathered']) |length == 0 }}" always: - include_tasks: _remove_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 8e6c764..64ac9a4 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/merged.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lag_interfaces merged integration tests on connection={{ ansible_connection - }} + msg: START vyos_lag_interfaces merged integration tests on connection={{ ansible_connection }} - include_tasks: _add_bond.yaml @@ -28,25 +26,19 @@ - name: Assert that before dicts were correctly generated assert: - that: - "{{ merged['before'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_lag_interfaces: *id001 @@ -58,7 +50,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_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 93aa7d9..482d54d 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/overridden.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_lag_interfaces overridden integration tests on connection={{ - ansible_connection }} + msg: START vyos_lag_interfaces overridden integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -26,14 +25,12 @@ - name: Assert that correct commands were generated assert: that: - - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Overrides all device configuration with provided configurations (IDEMPOTENT) register: result @@ -47,7 +44,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_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 412dcaf..81a7b46 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lag_interfaces parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_lag_interfaces parsed integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -23,9 +21,7 @@ - name: Assert that correct parsing done assert: - that: - "{{ ansible_facts['network_resources']['lag_interfaces'] | symmetric_difference(result['parsed'])\ - \ |length == 0 }}" + that: "{{ ansible_facts['network_resources']['lag_interfaces'] | symmetric_difference(result['parsed']) |length == 0 }}" always: - 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 ad05199..7d86a3a 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rendered.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lag_interfaces rendered integration tests on connection={{ ansible_connection - }} + msg: START vyos_lag_interfaces rendered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -28,8 +26,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ - \ |length == 0 }}" + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length == 0 }}" always: - 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 2e6de6c..66e55df 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/replaced.yaml @@ -1,14 +1,11 @@ --- - debug: - msg: - START vyos_lag_interfaces replaced integration tests on connection={{ ansible_connection - }} + msg: START vyos_lag_interfaces replaced integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed LAG interfaces with provided - configurations + - name: Replace device configurations of listed LAG interfaces with provided configurations register: result vyos.vyos.vyos_lag_interfaces: &id001 config: @@ -22,8 +19,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that before dicts are correctly generated assert: @@ -33,11 +29,9 @@ - name: Assert that after dict is correctly generated assert: that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: Replace device configurations of listed LAG interfaces with provided - configurarions (IDEMPOTENT) + - name: Replace device configurations of listed LAG interfaces with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_lag_interfaces: *id001 @@ -49,7 +43,6 @@ - name: Assert that before dict is correctly generated assert: that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - 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 0e7c178..5e9dc75 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/rtt.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_lag_interfaces round trip integration tests on connection={{ - ansible_connection }} + msg: START vyos_lag_interfaces round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_bond.yaml @@ -51,9 +50,7 @@ - name: Assert that changes were applied assert: - that: - "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Revert back to base config using facts round trip register: revert @@ -63,8 +60,6 @@ - name: Assert that config was reverted assert: - that: - "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ - \ == 0 }}" + that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" always: - include_tasks: _remove_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 876563c..40c5fe2 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 @@ -26,25 +26,19 @@ - name: Assert that before dicts were correctly generated assert: - that: - "{{ merged['before'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.lag_interfaces: *id001 @@ -56,7 +50,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_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 eb0f21e..2547872 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/_populate.yaml @@ -3,8 +3,6 @@ - name: Setup vars: - lines: - "set service lldp\nset service lldp legacy-protocols 'cdp'\nset service\ - \ lldp management-address '192.0.2.17'\n" + 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/_remove_config.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/_remove_config.yaml index 7e5b37c..406bc79 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/_remove_config.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/_remove_config.yaml @@ -1,8 +1,6 @@ --- - name: Remove Config vars: - lines: - "delete service lldp legacy-protocols\ndelete service lldp management-address\n\ - delete service lldp\n" + lines: "delete service lldp legacy-protocols\ndelete service lldp management-address\ndelete service lldp\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 0d36e5f..9cf87b8 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/deleted.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_lldp_global deleted integration tests ansible_connection={{ - ansible_connection }} + msg: START vyos_lldp_global deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -20,8 +19,7 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml index 0333fa4..c3811f6 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/empty_config.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_lldp_global empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_lldp_global empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -34,8 +33,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result 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 46e5b36..9c24e58 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/gathered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_lldp_global gathered integration tests on connection={{ - ansible_connection }} + msg: START vyos_lldp_global gathered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.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 85a35f6..a2e8e6b 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/merged.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lldp_global merged integration tests on connection={{ ansible_connection - }} + msg: START vyos_lldp_global merged integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -24,17 +22,14 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - "{{ merged['after'] == result['after'] }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_lldp_global: *id001 diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml index 1047f30..f8fe762 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lldp_global parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_lldp_global parsed integration tests on connection={{ ansible_connection }} - name: Parse externally provided LLDP global config to agnostic model register: result diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml index 59ff032..b293214 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/rendered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_lldp_global rendered integration tests on connection={{ - ansible_connection }} + msg: START vyos_lldp_global rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -19,8 +18,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ - \ |length == 0 }}" + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length == 0 }}" 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 55874b7..c74aa46 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/replaced.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lldp_global replaced integration tests on connection={{ ansible_connection - }} + msg: START vyos_lldp_global replaced integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -21,8 +19,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that before dicts are correctly generated assert: @@ -34,9 +31,7 @@ that: - "{{ replaced['after'] == result['after'] }}" - - name: - Replace device configurations of LLDP service with provided configurarions - (IDEMPOTENT) + - name: Replace device configurations of LLDP service with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_lldp_global: *id001 diff --git a/tests/integration/targets/vyos_lldp_global/tests/cli/rtt.yaml b/tests/integration/targets/vyos_lldp_global/tests/cli/rtt.yaml index b0bd603..10fe454 100644 --- a/tests/integration/targets/vyos_lldp_global/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_lldp_global/tests/cli/rtt.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lldp_global round trip integration tests on connection={{ ansible_connection - }} + msg: START vyos_lldp_global round trip integration tests on connection={{ ansible_connection }} - 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 2c6782b..5ed9e98 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate.yaml @@ -3,13 +3,14 @@ - 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" + 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/_populate_intf.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate_intf.yaml index 208f21e..c1e3a8c 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate_intf.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_populate_intf.yaml @@ -1,9 +1,10 @@ --- - name: Setup vars: - lines: - "set service lldp interface eth2\nset service lldp interface eth2 location\ - \ civic-based country-code US\nset service lldp interface eth2 location civic-based\ - \ ca-type 0 ca-value ENGLISH\nset service lldp interface eth2 disable\n" + lines: >- + "set service lldp interface eth2 + \nset service lldp interface eth2 location civic-based country-code US + \nset service lldp interface eth2 location civic-based ca-type 0 ca-value ENGLISH + \nset service lldp interface eth2 disable" 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 776fa22..c522704 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/deleted.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lldp_interfaces deleted integration tests ansible_connection={{ - ansible_connection }} + msg: START vyos_lldp_interfaces deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -24,14 +22,12 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: that: - - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result @@ -46,7 +42,6 @@ - name: Assert that the before dicts were correctly generated assert: that: - - "{{ deleted['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/empty_config.yaml index 6c097e3..209f828 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/empty_config.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lldp_interfaces empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_lldp_interfaces empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -46,8 +44,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result 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 216f2d1..7b8e778 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/gathered.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lldp_interfaces gathered integration tests on connection={{ ansible_connection - }} + msg: START vyos_lldp_interfaces gathered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -16,7 +14,6 @@ - name: Assert that gathered dicts was correctly generated assert: that: - - "{{ populate | symmetric_difference(result['gathered']) |length == 0\ - \ }}" + - "{{ populate | symmetric_difference(result['gathered']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/merged.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/merged.yaml index 30c46ec..ecf7597 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/merged.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lldp_interfaces merged integration tests on connection={{ ansible_connection - }} + msg: START vyos_lldp_interfaces merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -30,25 +28,19 @@ - name: Assert that before dicts were correctly generated assert: - that: - "{{ merged['before'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_lldp_interfaces: *id001 @@ -60,7 +52,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/overridden.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/overridden.yaml index e077e01..7050481 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/overridden.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lldp_interfaces overridden integration tests on connection={{ - ansible_connection }} + msg: START vyos_lldp_interfaces overridden integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -21,20 +19,17 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ populate_intf | symmetric_difference(result['before']) |length ==\ - \ 0 }}" + - "{{ populate_intf | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct commands were generated assert: that: - - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Overrides all device configuration with provided configurations (IDEMPOTENT) register: result @@ -48,7 +43,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/parsed.yaml index a32e9d5..c312934 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lldp_nterfaces parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_lldp_nterfaces parsed integration tests on connection={{ ansible_connection }} - name: Parse externally provided interfaces config to agnostic model register: result @@ -13,5 +11,4 @@ - name: Assert that config was correctly parsed assert: that: - - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length ==\ - \ 0 }}" + - "{{ parsed['after'] | symmetric_difference(result['parsed']) |length == 0 }}" diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rendered.yaml index 87bed90..3eb2538 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rendered.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lldp_interfaces rendered integration tests on connection={{ ansible_connection - }} + msg: START vyos_lldp_interfaces rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -30,7 +28,6 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ - \ |length == 0 }}" + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |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 46c91cf..e914c99 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/replaced.yaml @@ -1,14 +1,11 @@ --- - debug: - msg: START vyos_lldp_interfaces replaced integration tests on connection={{ - ansible_connection }} + msg: START vyos_lldp_interfaces replaced integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - - name: - Replace device configurations of listed LLDP interfaces with provided - configurations + - name: Replace device configurations of listed LLDP interfaces with provided configurations register: result vyos.vyos.vyos_lldp_interfaces: &id001 config: @@ -34,8 +31,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that before dicts are correctly generated assert: @@ -45,12 +41,9 @@ - name: Assert that after dict is correctly generated assert: that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Replace device configurations of listed LLDP interfaces with provided - configurarions (IDEMPOTENT) + - name: Replace device configurations of listed LLDP interfaces with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_lldp_interfaces: *id001 @@ -62,7 +55,6 @@ - name: Assert that before dict is correctly generated assert: that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rtt.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rtt.yaml index e23253b..6cf5d69 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/rtt.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_lldp_interfaces round trip integration tests on connection={{ - ansible_connection }} + msg: START vyos_lldp_interfaces round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -42,9 +40,7 @@ - name: Assert that changes were applied assert: - that: - "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Revert back to base config using facts round trip register: revert @@ -54,8 +50,6 @@ - name: Assert that config was reverted assert: - that: - "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ - \ == 0 }}" + that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_lldp_interfaces/tests/redirection/cli/shortname.yaml index 0b06a74..c21192a 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/redirection/cli/shortname.yaml +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/redirection/cli/shortname.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START shortaname integration tests on connection={{ - ansible_connection }} + msg: START shortaname integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -20,20 +19,17 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ populate_intf | symmetric_difference(result['before']) |length ==\ - \ 0 }}" + - "{{ populate_intf | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct commands were generated assert: that: - - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Overrides all device configuration with provided configurations (IDEMPOTENT) register: result @@ -47,7 +43,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/deleted.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/deleted.yaml index cd89ac5..d6bb462 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/deleted.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START Deleted integration state for vyos_logging ansible_connection={{ - ansible_connection }} + msg: START Deleted integration state for vyos_logging ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -14,8 +13,7 @@ - name: TEST - [deleted] Assert that correct set of commands were generated assert: that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |\ - \ length == 0 }}" + - "{{ 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/empty_config.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/empty_config.yaml index 2764ed6..60d283f 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/empty_config.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_logging_global empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_logging_global empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -46,8 +44,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result 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 a4b26d4..68084cd 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/gathered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_logging_global gathered integration tests on connection={{ - ansible_connection }} + msg: START vyos_logging_global gathered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/merged.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/merged.yaml index 8d2283c..b4d3856 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/merged.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_logging_global merged integration tests on connection={{ ansible_connection - }} + msg: START vyos_logging_global merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -44,12 +42,9 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_logging_global: *id001 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 c532b5a..eacdca2 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/overridden.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_logging_global overridden integration tests on connection={{ - ansible_connection }} + msg: START vyos_logging_global overridden integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -26,8 +25,7 @@ - name: Assert that correct commands were generated assert: that: - - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Overrides all device configuration with provided configurations (IDEMPOTENT) register: result 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 7858b9f..3746dd7 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/rendered.yaml @@ -1,15 +1,13 @@ --- - debug: - msg: - START vyos_logging_global rendered integration tests on connection={{ ansible_connection - }} + msg: START vyos_logging_global rendered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - name: Structure provided configuration into device specific commands register: result - vyos.vyos.vyos_logging_global: &id001 + vyos.vyos.vyos_logging_global: config: console: facilities: @@ -40,8 +38,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ - \ |length == 0 }}" + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_logging_global/vars/main.yaml b/tests/integration/targets/vyos_logging_global/vars/main.yaml index ae8b853..8d22af0 100644 --- a/tests/integration/targets/vyos_logging_global/vars/main.yaml +++ b/tests/integration/targets/vyos_logging_global/vars/main.yaml @@ -77,7 +77,6 @@ deleted: commands: - delete system syslog after: {} - parsed: after: console: diff --git a/tests/integration/targets/vyos_ntp_global/tests/cli/deleted.yaml b/tests/integration/targets/vyos_ntp_global/tests/cli/deleted.yaml index 81f406c..de5cbae 100644 --- a/tests/integration/targets/vyos_ntp_global/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_ntp_global/tests/cli/deleted.yaml @@ -24,9 +24,7 @@ that: - result.after == populate.config - - name: - Delete the existing configuration with the provided running configuration - (IDEMPOTENT) + - name: Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ntp_global: *id001 diff --git a/tests/integration/targets/vyos_ntp_global/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_ntp_global/tests/cli/empty_config.yaml index ec29f16..40c2554 100644 --- a/tests/integration/targets/vyos_ntp_global/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_ntp_global/tests/cli/empty_config.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ntp_global empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_ntp_global empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -45,8 +44,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result diff --git a/tests/integration/targets/vyos_ntp_global/tests/cli/gathered.yaml b/tests/integration/targets/vyos_ntp_global/tests/cli/gathered.yaml index 3c9032b..4b72fe4 100644 --- a/tests/integration/targets/vyos_ntp_global/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_ntp_global/tests/cli/gathered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ntp_global gathered integration tests on connection={{ - ansible_connection }} + msg: START vyos_ntp_global gathered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ntp_global/tests/cli/merged.yaml b/tests/integration/targets/vyos_ntp_global/tests/cli/merged.yaml index ad36012..4d2994d 100644 --- a/tests/integration/targets/vyos_ntp_global/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_ntp_global/tests/cli/merged.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ntp_global merged integration tests on connection={{ - ansible_connection }} + msg: START vyos_ntp_global merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -42,9 +41,7 @@ that: - result.before == populate.config - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ntp_global: *id001 diff --git a/tests/integration/targets/vyos_ntp_global/tests/cli/overridden.yaml b/tests/integration/targets/vyos_ntp_global/tests/cli/overridden.yaml index 43def13..1b8d415 100644 --- a/tests/integration/targets/vyos_ntp_global/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_ntp_global/tests/cli/overridden.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ntp_global overridden integration tests on connection={{ - ansible_connection }} + msg: START vyos_ntp_global overridden integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -37,9 +36,7 @@ - result.after == ansible_facts['network_resources']['ntp_global'] - result.after == overridden.after - - name: - Override the existing configuration with the provided running configuration - (IDEMPOTENT) + - name: Override the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ntp_global: *id001 diff --git a/tests/integration/targets/vyos_ntp_global/tests/cli/parsed.yaml b/tests/integration/targets/vyos_ntp_global/tests/cli/parsed.yaml index 09524b0..daf20f9 100644 --- a/tests/integration/targets/vyos_ntp_global/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_ntp_global/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_ntp_global parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_ntp_global parsed integration tests on connection={{ ansible_connection }} - name: Provide the running configuration for parsing (config to be parsed) register: result diff --git a/tests/integration/targets/vyos_ntp_global/tests/cli/rendered.yaml b/tests/integration/targets/vyos_ntp_global/tests/cli/rendered.yaml index 8705509..29ed3ad 100644 --- a/tests/integration/targets/vyos_ntp_global/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_ntp_global/tests/cli/rendered.yaml @@ -1,14 +1,13 @@ --- - debug: - msg: START vyos_ntp_global rendered integration tests on connection={{ - ansible_connection }} + msg: START vyos_ntp_global rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - block: - name: Structure provided configuration into device specific commands register: result - vyos.vyos.vyos_ntp_global: &id001 + vyos.vyos.vyos_ntp_global: config: servers: - server: server5 diff --git a/tests/integration/targets/vyos_ntp_global/tests/cli/replaced.yaml b/tests/integration/targets/vyos_ntp_global/tests/cli/replaced.yaml index 8d1241b..3942a34 100644 --- a/tests/integration/targets/vyos_ntp_global/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_ntp_global/tests/cli/replaced.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ntp_global replaced integration tests on connection={{ - ansible_connection }} + msg: START vyos_ntp_global replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -27,9 +26,7 @@ - result.after == ansible_facts['network_resources']['ntp_global'] - result.after == replaced.after - - name: - Replace the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Replace the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ntp_global: *id001 diff --git a/tests/integration/targets/vyos_ntp_global/tests/cli/rtt.yaml b/tests/integration/targets/vyos_ntp_global/tests/cli/rtt.yaml index 86f75f4..6137c21 100644 --- a/tests/integration/targets/vyos_ntp_global/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_ntp_global/tests/cli/rtt.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ntp_global rtt integration tests on connection={{ - ansible_connection }} + msg: START vyos_ntp_global rtt integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/deleted.yaml index 679a39b..59fe52a 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/deleted.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospf_interfaces deleted integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospf_interfaces deleted integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -10,7 +9,7 @@ register: result vyos.vyos.vyos_ospf_interfaces: &id001 config: - - name: "bond2" + - name: bond2 state: deleted - vyos.vyos.vyos_facts: @@ -23,9 +22,7 @@ - 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) + - name: Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ospf_interfaces: *id001 diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/empty_config.yaml index f99b8fe..27273b4 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/empty_config.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_ospf_interfaces empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospf_interfaces empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -46,8 +44,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result 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 84c22cb..69c5d10 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/gathered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospf_interfaces gathered integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospf_interfaces gathered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/merged.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/merged.yaml index 1dcbac6..7b091dd 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/merged.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospf_interfaces merged integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospf_interfaces merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -10,19 +9,19 @@ register: result vyos.vyos.vyos_ospf_interfaces: &id001 config: - - name: "eth0" + - name: eth0 address_family: - - afi: "ipv4" + - afi: ipv4 cost: 50 priority: 26 - - afi: "ipv6" + - afi: ipv6 mtu_ignore: true instance: 33 - - name: "bond2" + - name: bond2 address_family: - - afi: "ipv4" + - afi: ipv4 transmit_delay: 45 - - afi: "ipv6" + - afi: ipv6 passive: true state: merged @@ -36,9 +35,7 @@ - result.commands|symmetric_difference(merged.commands) == [] - result.after|symmetric_difference(ansible_facts['network_resources']['ospf_interfaces']) == [] - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ospf_interfaces: *id001 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 2652c40..7e72806 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/overridden.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_ospf_interfaces overridden integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospf_interfaces overridden integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -11,13 +9,13 @@ register: result vyos.vyos.vyos_ospf_interfaces: &id001 config: - - name: "eth0" + - name: eth0 address_family: - - afi: "ipv4" + - afi: ipv4 transmit_delay: 50 priority: 26 - network: "point-to-point" - - afi: "ipv6" + network: point-to-point + - afi: ipv6 dead_interval: 39 state: overridden @@ -31,9 +29,7 @@ - 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) + - name: Override the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ospf_interfaces: *id001 diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/parsed.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/parsed.yaml index c260ec4..0d13f76 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_ospfv3_interfaces parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_ospfv3_interfaces parsed integration tests on connection={{ ansible_connection }} - name: Provide the running configuration for parsing (config to be parsed) register: result diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rendered.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rendered.yaml index 2c27672..4cb5f4f 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rendered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospf_interfaces rendered integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospf_interfaces rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -10,19 +9,19 @@ register: result vyos.vyos.vyos_ospf_interfaces: config: - - name: "eth0" + - name: eth0 address_family: - - afi: "ipv4" + - afi: ipv4 cost: 50 priority: 26 - - afi: "ipv6" + - afi: ipv6 mtu_ignore: true instance: 33 - - name: "bond2" + - name: bond2 address_family: - - afi: "ipv4" + - afi: ipv4 transmit_delay: 45 - - afi: "ipv6" + - afi: ipv6 passive: true state: rendered 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 9efcdea..2bb8a02 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/replaced.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospf_interfaces replaced integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospf_interfaces replaced integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -10,24 +9,24 @@ register: result vyos.vyos.vyos_ospf_interfaces: &id001 config: - - name: "eth0" + - name: eth0 address_family: - - afi: "ipv4" + - afi: ipv4 transmit_delay: 50 priority: 26 - network: "point-to-point" - - afi: "ipv6" + network: point-to-point + - afi: ipv6 dead_interval: 39 - - name: "bond2" + - name: bond2 address_family: - - afi: "ipv4" + - afi: ipv4 transmit_delay: 45 bandwidth: 70 authentication: md5_key: key_id: 10 key: "1111111111232345" - - afi: "ipv6" + - afi: ipv6 passive: true state: replaced @@ -41,9 +40,7 @@ - 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) + - name: Replace the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ospf_interfaces: *id001 diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rtt.yaml b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rtt.yaml index 5f6374d..42da6ac 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/rtt.yaml @@ -1,28 +1,27 @@ --- - debug: - msg: START vyos_ospf_interfaces rtt integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospf_interfaces rtt integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - block: - name: Merge the provided configuration with the existing running configuration register: baseconfig - vyos.vyos.vyos_ospf_interfaces: &id001 + vyos.vyos.vyos_ospf_interfaces: config: - - name: "eth0" + - name: eth0 address_family: - - afi: "ipv4" + - afi: ipv4 cost: 50 priority: 26 - - afi: "ipv6" + - afi: ipv6 mtu_ignore: true instance: 33 - - name: "bond2" + - name: bond2 address_family: - - afi: "ipv4" + - afi: ipv4 transmit_delay: 45 - - afi: "ipv6" + - afi: ipv6 passive: true state: merged @@ -40,13 +39,13 @@ register: result vyos.vyos.vyos_ospf_interfaces: config: - - name: "eth0" + - name: eth0 address_family: - - afi: "ipv4" + - afi: ipv4 transmit_delay: 50 priority: 26 - network: "point-to-point" - - afi: "ipv6" + network: point-to-point + - afi: ipv6 dead_interval: 39 - name: Revert back to base config using facts round trip diff --git a/tests/integration/targets/vyos_ospf_interfaces/vars/main.yaml b/tests/integration/targets/vyos_ospf_interfaces/vars/main.yaml index f585cbc..5c618ee 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/vars/main.yaml +++ b/tests/integration/targets/vyos_ospf_interfaces/vars/main.yaml @@ -9,19 +9,19 @@ merged: - set interfaces bonding bond2 ipv6 ospfv3 passive after: - address_family: - - afi: "ipv4" + - afi: ipv4 transmit_delay: 45 - - afi: "ipv6" + - afi: ipv6 passive: true - name: "bond2" + name: bond2 - address_family: - - afi: "ipv4" + - afi: ipv4 cost: 50 priority: 26 - - afi: "ipv6" + - afi: ipv6 instance: "33" mtu_ignore: true - name: "eth0" + name: eth0 replaced: commands: @@ -36,24 +36,24 @@ replaced: after: - address_family: - - afi: "ipv4" + - afi: ipv4 authentication: md5_key: key: "1111111111232345" key_id: 10 bandwidth: 70 transmit_delay: 45 - - afi: "ipv6" + - afi: ipv6 passive: true - name: "bond2" + name: bond2 - address_family: - - afi: "ipv4" - network: "point-to-point" + - afi: ipv4 + network: point-to-point priority: 26 transmit_delay: 50 - - afi: "ipv6" + - afi: ipv6 dead_interval: 39 - name: "eth0" + name: eth0 overridden: commands: @@ -68,13 +68,13 @@ overridden: after: - address_family: - - afi: "ipv4" - network: "point-to-point" + - afi: ipv4 + network: point-to-point priority: 26 transmit_delay: 50 - - afi: "ipv6" + - afi: ipv6 dead_interval: 39 - name: "eth0" + name: eth0 deleted: commands: @@ -82,13 +82,13 @@ deleted: - delete interfaces bonding bond2 ipv6 ospfv3 after: - address_family: - - afi: "ipv4" + - afi: ipv4 cost: 50 priority: 26 - - afi: "ipv6" + - afi: ipv6 instance: "33" mtu_ignore: true - name: "eth0" + name: eth0 rendered: commands: diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml index f17c5cb..872d330 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/_populate.yaml @@ -3,35 +3,35 @@ - name: Setup vars: - lines: "set protocols ospf mpls-te 'enable' \n - set protocols ospf mpls-te router-address '192.0.11.11' \n - set protocols ospf redistribute bgp metric-type '2' \n - set protocols ospf redistribute bgp metric '10'\n - set protocols ospf default-information originate metric-type '2' \n - set protocols ospf default-information originate 'always' \n - set protocols ospf default-information originate metric '10' \n - set protocols ospf default-information originate route-map 'ingress' \n - set protocols ospf auto-cost reference-bandwidth '2' \n - set protocols ospf parameters router-id '192.0.1.1' \n - set protocols ospf parameters 'opaque-lsa' \n - set protocols ospf parameters abr-type 'cisco' \n - set protocols ospf parameters 'rfc1583-compatibility' \n - set protocols ospf passive-interface 'eth1' \n - set protocols ospf passive-interface 'eth2' \n - set protocols ospf max-metric router-lsa on-shutdown '10' \n - set protocols ospf max-metric router-lsa 'administrative' \n - set protocols ospf max-metric router-lsa on-startup '10' \n - set protocols ospf log-adjacency-changes 'detail' \n - set protocols ospf neighbor 192.0.11.12 priority '2' \n - set protocols ospf neighbor 192.0.11.12 poll-interval '10' \n - set protocols ospf area 2 authentication 'plaintext-password' \n - set protocols ospf area 2 shortcut 'enable' \n - set protocols ospf area 2 area-type 'normal' \n - set protocols ospf area 3 area-type 'nssa' \n - set protocols ospf area 4 range 192.0.3.0/24 cost '10' \n - set protocols ospf area 4 range 192.0.4.0/24 cost '12' \n - set protocols ospf area 4 area-type stub default-cost '20' \n - set protocols ospf area 4 network '192.0.2.0/24'" - + 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 553bb9f..6a24aae 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/deleted.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospfv2 deleted integration tests ansible_connection={{ - ansible_connection }} + msg: START vyos_ospfv2 deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -20,8 +19,7 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/empty_config.yaml index 4566bf4..5c5d42c 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/empty_config.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospfv2 empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospfv2 empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -34,8 +33,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/gathered.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/gathered.yaml index a8e3149..239d2e0 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/gathered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospfv2 gathered integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospfv2 gathered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/merged.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/merged.yaml index 8aced96..67f688d 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/merged.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_ospfv2 merged integration tests on connection={{ ansible_connection - }} + msg: START vyos_ospfv2 merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -11,7 +9,7 @@ register: result vyos.vyos.vyos_ospfv2: &id001 config: - log_adjacency_changes: "detail" + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -22,34 +20,34 @@ always: true metric: 10 metric_type: 2 - route_map: "ingress" + route_map: ingress mpls_te: enabled: true - router_address: "192.0.11.11" + router_address: 192.0.11.11 auto_cost: reference_bandwidth: 2 neighbor: - - neighbor_id: "192.0.11.12" + - neighbor_id: 192.0.11.12 poll_interval: 10 priority: 2 redistribute: - - route_type: "bgp" + - route_type: bgp metric: 10 metric_type: 2 passive_interface: - - "eth1" - - "eth2" + - eth1 + - eth2 parameters: - router_id: "192.0.1.1" + router_id: 192.0.1.1 opaque_lsa: true rfc1583_compatibility: true - abr_type: "cisco" + abr_type: cisco areas: - area_id: "2" area_type: normal: true - authentication: "plaintext-password" - shortcut: "enable" + authentication: plaintext-password + shortcut: enable - area_id: "3" area_type: nssa: @@ -59,11 +57,11 @@ stub: default_cost: 20 network: - - address: "192.0.2.0/24" + - address: 192.0.2.0/24 range: - - address: "192.0.3.0/24" + - address: 192.0.3.0/24 cost: 10 - - address: "192.0.4.0/24" + - address: 192.0.4.0/24 cost: 12 state: merged @@ -74,17 +72,14 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - "{{ merged['after'] == result['after'] }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ospfv2: *id001 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 bc82146..60243c3 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/merged_update.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/merged_update.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_ospfv2 merged integration tests on connection={{ ansible_connection - }} + msg: START vyos_ospfv2 merged integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -11,14 +9,14 @@ register: result vyos.vyos.vyos_ospfv2: &id001 config: - log_adjacency_changes: "detail" + log_adjacency_changes: detail max_metric: router_lsa: administrative: true on_shutdown: 10 on_startup: 10 passive_interface: - - "eth1" + - eth1 areas: - area_id: "3" area_type: @@ -29,9 +27,9 @@ stub: set: false network: - - address: "192.0.2.0/24" - - address: "192.0.22.0/24" - - address: "192.0.32.0/24" + - 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 @@ -41,17 +39,14 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ merged_update['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ 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) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ospfv2: *id001 diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml index ac5c203..ad5b005 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_ospfv2 parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_ospfv2 parsed integration tests on connection={{ ansible_connection }} - name: Parse externally provided ospfv2 config to agnostic model register: result diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/rendered.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/rendered.yaml index e11aa6a..2372300 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/rendered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospfv2 rendered integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospfv2 rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -10,7 +9,7 @@ register: result vyos.vyos.vyos_ospfv2: config: - log_adjacency_changes: "detail" + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -21,34 +20,34 @@ always: true metric: 10 metric_type: 2 - route_map: "ingress" + route_map: ingress mpls_te: enabled: true - router_address: "192.0.11.11" + router_address: 192.0.11.11 auto_cost: reference_bandwidth: 2 neighbor: - - neighbor_id: "192.0.11.12" + - neighbor_id: 192.0.11.12 poll_interval: 10 priority: 2 redistribute: - - route_type: "bgp" + - route_type: bgp metric: 10 metric_type: 2 passive_interface: - - "eth1" - - "eth2" + - eth1 + - eth2 parameters: - router_id: "192.0.1.1" + router_id: 192.0.1.1 opaque_lsa: true rfc1583_compatibility: true - abr_type: "cisco" + abr_type: cisco areas: - area_id: "2" area_type: normal: true - authentication: "plaintext-password" - shortcut: "enable" + authentication: plaintext-password + shortcut: enable - area_id: "3" area_type: nssa: @@ -58,18 +57,17 @@ stub: default_cost: 20 network: - - address: "192.0.2.0/24" + - address: 192.0.2.0/24 range: - - address: "192.0.3.0/24" + - address: 192.0.3.0/24 cost: 10 - - address: "192.0.4.0/24" + - address: 192.0.4.0/24 cost: 12 state: rendered - name: Assert that correct set of commands were generated assert: that: - - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ - \ |length == 0 }}" + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length == 0 }}" - debug: msg: END vyos_ospfv2 rendered integration tests on connection={{ ansible_connection }} diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/replaced.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/replaced.yaml index b348484..93d7efe 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/replaced.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospfv2 replaced integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospfv2 replaced integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -10,7 +9,7 @@ register: result vyos.vyos.vyos_ospfv2: &id001 config: - log_adjacency_changes: "detail" + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -21,52 +20,51 @@ always: true metric: 10 metric_type: 2 - route_map: "ingress" + route_map: ingress mpls_te: enabled: true - router_address: "192.0.22.22" + router_address: 192.0.22.22 auto_cost: reference_bandwidth: 2 neighbor: - - neighbor_id: "192.0.11.12" + - neighbor_id: 192.0.11.12 poll_interval: 10 priority: 2 redistribute: - - route_type: "bgp" + - route_type: bgp metric: 10 metric_type: 2 passive_interface: - - "eth1" + - eth1 parameters: - router_id: "192.0.1.1" + router_id: 192.0.1.1 opaque_lsa: true rfc1583_compatibility: true - abr_type: "cisco" + abr_type: cisco areas: - area_id: "2" area_type: normal: true - authentication: "plaintext-password" - shortcut: "enable" + 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" + - 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" + - 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 }}" + - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that before dicts are correctly generated assert: @@ -78,9 +76,7 @@ that: - "{{ replaced['after'] == result['after'] }}" - - name: - Replace device configurations of listed ospfv2 routes with provided configurarions - (IDEMPOTENT) + - name: Replace device configurations of listed ospfv2 routes with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_ospfv2: *id001 diff --git a/tests/integration/targets/vyos_ospfv2/tests/cli/rtt.yaml b/tests/integration/targets/vyos_ospfv2/tests/cli/rtt.yaml index 9407ffa..60f96f5 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/cli/rtt.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospfv2 round trip integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospfv2 round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -10,7 +9,7 @@ register: base_config vyos.vyos.vyos_ospfv2: config: - log_adjacency_changes: "detail" + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -21,34 +20,34 @@ always: true metric: 10 metric_type: 2 - route_map: "ingress" + route_map: ingress mpls_te: enabled: true - router_address: "192.0.11.11" + router_address: 192.0.11.11 auto_cost: reference_bandwidth: 2 neighbor: - - neighbor_id: "192.0.11.12" + - neighbor_id: 192.0.11.12 poll_interval: 10 priority: 2 redistribute: - - route_type: "bgp" + - route_type: bgp metric: 10 metric_type: 2 passive_interface: - - "eth1" - - "eth2" + - eth1 + - eth2 parameters: - router_id: "192.0.1.1" + router_id: 192.0.1.1 opaque_lsa: true rfc1583_compatibility: true - abr_type: "cisco" + abr_type: cisco areas: - area_id: "2" area_type: normal: true - authentication: "plaintext-password" - shortcut: "enable" + authentication: plaintext-password + shortcut: enable - area_id: "3" area_type: nssa: @@ -58,11 +57,11 @@ stub: default_cost: 20 network: - - address: "192.0.2.0/24" + - address: 192.0.2.0/24 range: - - address: "192.0.3.0/24" + - address: 192.0.3.0/24 cost: 10 - - address: "192.0.4.0/24" + - address: 192.0.4.0/24 cost: 12 state: merged @@ -81,20 +80,20 @@ - area_id: "2" area_type: normal: true - authentication: "plaintext-password" - shortcut: "enable" + authentication: plaintext-password + shortcut: enable - area_id: "4" area_type: stub: default_cost: 20 set: true network: - - address: "192.0.12.0/24" - - address: "192.0.2.0/24" - - address: "192.0.22.0/24" - - address: "192.0.32.0/24" + - address: 192.0.12.0/24 + - address: 192.0.2.0/24 + - address: 192.0.22.0/24 + - address: 192.0.32.0/24 range: - - address: "1.1.2.0/24" + - address: 1.1.2.0/24 cost: 10 auto_cost: reference_bandwidth: 2 @@ -103,8 +102,8 @@ always: true metric: 10 metric_type: 2 - route_map: "ingress" - log_adjacency_changes: "detail" + route_map: ingress + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -112,22 +111,22 @@ on_startup: 10 mpls_te: enabled: true - router_address: "192.0.22.22" + router_address: 192.0.22.22 neighbor: - - neighbor_id: "192.0.11.12" + - neighbor_id: 192.0.11.12 poll_interval: 10 priority: 2 parameters: - abr_type: "cisco" + abr_type: cisco opaque_lsa: true rfc1583_compatibility: true - router_id: "192.0.1.1" + router_id: 192.0.1.1 passive_interface: - - "eth1" + - eth1 redistribute: - metric: 10 metric_type: 2 - route_type: "bgp" + route_type: bgp state: replaced - name: Assert that changes were applied diff --git a/tests/integration/targets/vyos_ospfv2/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_ospfv2/tests/redirection/cli/shortname.yaml index 15295d1..89f734e 100644 --- a/tests/integration/targets/vyos_ospfv2/tests/redirection/cli/shortname.yaml +++ b/tests/integration/targets/vyos_ospfv2/tests/redirection/cli/shortname.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START shortname integration tests on connection={{ ansible_connection - }} + msg: START shortname integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -10,7 +9,7 @@ register: result vyos.vyos.ospfv2: &id001 config: - log_adjacency_changes: "detail" + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -21,34 +20,34 @@ always: true metric: 10 metric_type: 2 - route_map: "ingress" + route_map: ingress mpls_te: enabled: true - router_address: "192.0.11.11" + router_address: 192.0.11.11 auto_cost: reference_bandwidth: 2 neighbor: - - neighbor_id: "192.0.11.12" + - neighbor_id: 192.0.11.12 poll_interval: 10 priority: 2 redistribute: - - route_type: "bgp" + - route_type: bgp metric: 10 metric_type: 2 passive_interface: - - "eth1" - - "eth2" + - eth1 + - eth2 parameters: - router_id: "192.0.1.1" + router_id: 192.0.1.1 opaque_lsa: true rfc1583_compatibility: true - abr_type: "cisco" + abr_type: cisco areas: - area_id: "2" area_type: normal: true - authentication: "plaintext-password" - shortcut: "enable" + authentication: plaintext-password + shortcut: enable - area_id: "3" area_type: nssa: @@ -58,11 +57,11 @@ stub: default_cost: 20 network: - - address: "192.0.2.0/24" + - address: 192.0.2.0/24 range: - - address: "192.0.3.0/24" + - address: 192.0.3.0/24 cost: 10 - - address: "192.0.4.0/24" + - address: 192.0.4.0/24 cost: 12 state: merged @@ -73,17 +72,14 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - "{{ merged['after'] == result['after'] }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.ospfv2: *id001 diff --git a/tests/integration/targets/vyos_ospfv2/vars/main.yaml b/tests/integration/targets/vyos_ospfv2/vars/main.yaml index da81c19..70d25fc 100644 --- a/tests/integration/targets/vyos_ospfv2/vars/main.yaml +++ b/tests/integration/targets/vyos_ospfv2/vars/main.yaml @@ -43,8 +43,8 @@ merged: - area_id: "2" area_type: normal: true - authentication: "plaintext-password" - shortcut: "enable" + authentication: plaintext-password + shortcut: enable - area_id: "3" area_type: nssa: @@ -55,11 +55,11 @@ merged: default_cost: 20 set: true network: - - address: "192.0.2.0/24" + - address: 192.0.2.0/24 range: - - address: "192.0.3.0/24" + - address: 192.0.3.0/24 cost: 10 - - address: "192.0.4.0/24" + - address: 192.0.4.0/24 cost: 12 auto_cost: reference_bandwidth: 2 @@ -68,8 +68,8 @@ merged: always: true metric: 10 metric_type: 2 - route_map: "ingress" - log_adjacency_changes: "detail" + route_map: ingress + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -77,31 +77,31 @@ merged: on_startup: 10 mpls_te: enabled: true - router_address: "192.0.11.11" + router_address: 192.0.11.11 neighbor: - - neighbor_id: "192.0.11.12" + - neighbor_id: 192.0.11.12 poll_interval: 10 priority: 2 parameters: - abr_type: "cisco" + abr_type: cisco opaque_lsa: true rfc1583_compatibility: true - router_id: "192.0.1.1" + router_id: 192.0.1.1 passive_interface: - - "eth1" - - "eth2" + - eth1 + - eth2 redistribute: - metric: 10 metric_type: 2 - route_type: "bgp" + route_type: bgp merged_update: before: areas: - area_id: "2" area_type: normal: true - authentication: "plaintext-password" - shortcut: "enable" + authentication: plaintext-password + shortcut: enable - area_id: "3" area_type: nssa: @@ -112,11 +112,11 @@ merged_update: default_cost: 20 set: true network: - - address: "192.0.2.0/24" + - address: 192.0.2.0/24 range: - - address: "192.0.3.0/24" + - address: 192.0.3.0/24 cost: 10 - - address: "192.0.4.0/24" + - address: 192.0.4.0/24 cost: 12 auto_cost: reference_bandwidth: 2 @@ -125,8 +125,8 @@ merged_update: always: true metric: 10 metric_type: 2 - route_map: "ingress" - log_adjacency_changes: "detail" + route_map: ingress + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -134,43 +134,43 @@ merged_update: on_startup: 10 mpls_te: enabled: true - router_address: "192.0.11.11" + router_address: 192.0.11.11 neighbor: - - neighbor_id: "192.0.11.12" + - neighbor_id: 192.0.11.12 poll_interval: 10 priority: 2 parameters: - abr_type: "cisco" + abr_type: cisco opaque_lsa: true rfc1583_compatibility: true - router_id: "192.0.1.1" + router_id: 192.0.1.1 passive_interface: - - "eth1" - - "eth2" + - eth1 + - eth2 redistribute: - metric: 10 metric_type: 2 - route_type: "bgp" + route_type: bgp after: areas: - area_id: "2" area_type: normal: true - authentication: "plaintext-password" - shortcut: "enable" + authentication: plaintext-password + shortcut: enable - area_id: "3" area_type: nssa: set: true - area_id: "4" network: - - address: "192.0.2.0/24" - - address: "192.0.22.0/24" - - address: "192.0.32.0/24" + - address: 192.0.2.0/24 + - address: 192.0.22.0/24 + - address: 192.0.32.0/24 range: - - address: "192.0.3.0/24" + - address: 192.0.3.0/24 cost: 10 - - address: "192.0.4.0/24" + - address: 192.0.4.0/24 cost: 12 auto_cost: reference_bandwidth: 2 @@ -179,8 +179,8 @@ merged_update: always: true metric: 10 metric_type: 2 - route_map: "ingress" - log_adjacency_changes: "detail" + route_map: ingress + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -188,23 +188,23 @@ merged_update: on_startup: 10 mpls_te: enabled: true - router_address: "192.0.11.11" + router_address: 192.0.11.11 neighbor: - - neighbor_id: "192.0.11.12" + - neighbor_id: 192.0.11.12 poll_interval: 10 priority: 2 parameters: - abr_type: "cisco" + abr_type: cisco opaque_lsa: true rfc1583_compatibility: true - router_id: "192.0.1.1" + router_id: 192.0.1.1 passive_interface: - - "eth1" - - "eth2" + - eth1 + - eth2 redistribute: - metric: 10 metric_type: 2 - route_type: "bgp" + route_type: bgp commands: - delete protocols ospf area 4 area-type stub - set protocols ospf area 4 network 192.0.22.0/24 @@ -214,8 +214,8 @@ populate: - area_id: "2" area_type: normal: true - authentication: "plaintext-password" - shortcut: "enable" + authentication: plaintext-password + shortcut: enable - area_id: "3" area_type: nssa: @@ -226,11 +226,11 @@ populate: default_cost: 20 set: true network: - - address: "192.0.2.0/24" + - address: 192.0.2.0/24 range: - - address: "192.0.3.0/24" + - address: 192.0.3.0/24 cost: 10 - - address: "192.0.4.0/24" + - address: 192.0.4.0/24 cost: 12 auto_cost: reference_bandwidth: 2 @@ -239,8 +239,8 @@ populate: always: true metric: 10 metric_type: 2 - route_map: "ingress" - log_adjacency_changes: "detail" + route_map: ingress + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -248,23 +248,23 @@ populate: on_startup: 10 mpls_te: enabled: true - router_address: "192.0.11.11" + router_address: 192.0.11.11 neighbor: - - neighbor_id: "192.0.11.12" + - neighbor_id: 192.0.11.12 poll_interval: 10 priority: 2 parameters: - abr_type: "cisco" + abr_type: cisco opaque_lsa: true rfc1583_compatibility: true - router_id: "192.0.1.1" + router_id: 192.0.1.1 passive_interface: - - "eth1" - - "eth2" + - eth1 + - eth2 redistribute: - metric: 10 metric_type: 2 - route_type: "bgp" + route_type: bgp replaced: commands: - delete protocols ospf passive-interface eth2 @@ -284,20 +284,20 @@ replaced: - area_id: "2" area_type: normal: true - authentication: "plaintext-password" - shortcut: "enable" + authentication: plaintext-password + shortcut: enable - area_id: "4" area_type: stub: default_cost: 20 set: true network: - - address: "192.0.12.0/24" - - address: "192.0.2.0/24" - - address: "192.0.22.0/24" - - address: "192.0.32.0/24" + - address: 192.0.12.0/24 + - address: 192.0.2.0/24 + - address: 192.0.22.0/24 + - address: 192.0.32.0/24 range: - - address: "1.1.2.0/24" + - address: 1.1.2.0/24 cost: 10 auto_cost: reference_bandwidth: 2 @@ -306,8 +306,8 @@ replaced: always: true metric: 10 metric_type: 2 - route_map: "ingress" - log_adjacency_changes: "detail" + route_map: ingress + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -315,22 +315,22 @@ replaced: on_startup: 10 mpls_te: enabled: true - router_address: "192.0.22.22" + router_address: 192.0.22.22 neighbor: - - neighbor_id: "192.0.11.12" + - neighbor_id: 192.0.11.12 poll_interval: 10 priority: 2 parameters: - abr_type: "cisco" + abr_type: cisco opaque_lsa: true rfc1583_compatibility: true - router_id: "192.0.1.1" + router_id: 192.0.1.1 passive_interface: - - "eth1" + - eth1 redistribute: - metric: 10 metric_type: 2 - route_type: "bgp" + route_type: bgp rendered: commands: - set protocols ospf mpls-te enable @@ -375,8 +375,8 @@ parsed: - area_id: "2" area_type: normal: true - authentication: "plaintext-password" - shortcut: "enable" + authentication: plaintext-password + shortcut: enable - area_id: "3" area_type: nssa: @@ -387,11 +387,11 @@ parsed: default_cost: 20 set: true network: - - address: "192.0.2.0/24" + - address: 192.0.2.0/24 range: - - address: "192.0.3.0/24" + - address: 192.0.3.0/24 cost: 10 - - address: "192.0.4.0/24" + - address: 192.0.4.0/24 cost: 12 auto_cost: reference_bandwidth: 2 @@ -400,8 +400,8 @@ parsed: always: true metric: 10 metric_type: 2 - route_map: "ingress" - log_adjacency_changes: "detail" + route_map: ingress + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -409,26 +409,26 @@ parsed: on_startup: 10 mpls_te: enabled: true - router_address: "192.0.11.11" + router_address: 192.0.11.11 neighbor: - - neighbor_id: "192.0.11.12" + - neighbor_id: 192.0.11.12 poll_interval: 10 priority: 2 parameters: - abr_type: "cisco" + abr_type: cisco opaque_lsa: true rfc1583_compatibility: true - router_id: "192.0.1.1" + router_id: 192.0.1.1 passive_interface: - - "eth1" - - "eth2" + - eth1 + - eth2 redistribute: - metric: 10 metric_type: 2 - route_type: "bgp" + route_type: bgp deleted: commands: - - "delete protocols ospf" + - delete protocols ospf after: {} round_trip: after: @@ -436,20 +436,20 @@ round_trip: - area_id: "2" area_type: normal: true - authentication: "plaintext-password" - shortcut: "enable" + authentication: plaintext-password + shortcut: enable - area_id: "4" area_type: stub: default_cost: 20 set: true network: - - address: "192.0.12.0/24" - - address: "192.0.2.0/24" - - address: "192.0.22.0/24" - - address: "192.0.32.0/24" + - address: 192.0.12.0/24 + - address: 192.0.2.0/24 + - address: 192.0.22.0/24 + - address: 192.0.32.0/24 range: - - address: "1.1.2.0/24" + - address: 1.1.2.0/24 cost: 10 auto_cost: reference_bandwidth: 2 @@ -458,8 +458,8 @@ round_trip: always: true metric: 10 metric_type: 2 - route_map: "ingress" - log_adjacency_changes: "detail" + route_map: ingress + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -467,19 +467,19 @@ round_trip: on_startup: 10 mpls_te: enabled: true - router_address: "192.0.22.22" + router_address: 192.0.22.22 neighbor: - - neighbor_id: "192.0.11.12" + - neighbor_id: 192.0.11.12 poll_interval: 10 priority: 2 parameters: - abr_type: "cisco" + abr_type: cisco opaque_lsa: true rfc1583_compatibility: true - router_id: "192.0.1.1" + router_id: 192.0.1.1 passive_interface: - - "eth1" + - eth1 redistribute: - metric: 10 metric_type: 2 - route_type: "bgp" + route_type: bgp diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/_populate.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/_populate.yaml index 164fcc0..c484a7f 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/_populate.yaml @@ -3,13 +3,14 @@ - 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'" + 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 2e55472..3f8ad58 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/deleted.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospfv3 deleted integration tests ansible_connection={{ - ansible_connection }} + msg: START vyos_ospfv3 deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -20,8 +19,7 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/empty_config.yaml index fec61ab..4097f79 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/empty_config.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospfv3 empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospfv3 empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -34,8 +33,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/gathered.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/gathered.yaml index 3654bbe..ed70f9c 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/gathered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospfv3 gathered integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospfv3 gathered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/merged.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/merged.yaml index 7bbc3c6..28d596f 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/merged.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_ospfv3 merged integration tests on connection={{ ansible_connection - }} + msg: START vyos_ospfv3 merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -13,19 +11,19 @@ config: areas: - area_id: "2" - export_list: "export1" - import_list: "import1" + export_list: export1 + import_list: import1 range: - - address: "2001:db10::/32" - - address: "2001:db20::/32" - - address: "2001:db30::/32" + - address: 2001:db10::/32 + - address: 2001:db20::/32 + - address: 2001:db30::/32 - area_id: "3" range: - - address: "2001:db40::/32" + - address: 2001:db40::/32 parameters: - router_id: "192.0.2.10" + router_id: 192.0.2.10 redistribute: - - route_type: "bgp" + - route_type: bgp state: merged - name: Assert that before dicts were correctly generated @@ -35,17 +33,14 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - "{{ merged['after'] == result['after'] }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ospfv3: *id001 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 02657c8..c2d9ee0 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/merged_update.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/merged_update.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_ospfv3 merged integration tests on connection={{ ansible_connection - }} + msg: START vyos_ospfv3 merged integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -14,15 +12,15 @@ areas: - area_id: "2" range: - - address: "2001:db10::/32" + - address: 2001:db10::/32 - area_id: "3" range: - - address: "2001:db40::/32" - - address: "2001:db70::/32" + - address: 2001:db40::/32 + - address: 2001:db70::/32 parameters: - router_id: "192.0.2.10" + router_id: 192.0.2.10 redistribute: - - route_type: "bgp" + - route_type: bgp state: merged - name: Assert that before dicts were correctly generated @@ -32,17 +30,14 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ merged_update['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ 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) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_ospfv3: *id001 diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/parsed.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/parsed.yaml index 1bec41a..5981efb 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_ospfv3 parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_ospfv3 parsed integration tests on connection={{ ansible_connection }} - name: Parse externally provided ospfv3 config to agnostic model register: result diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/rendered.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/rendered.yaml index b921bda..243f8ed 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/rendered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospfv3 rendered integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospfv3 rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -11,27 +10,26 @@ vyos.vyos.vyos_ospfv3: config: redistribute: - - route_type: "bgp" + - route_type: bgp parameters: - router_id: "192.0.2.10" + router_id: 192.0.2.10 areas: - area_id: "2" - export_list: "export1" - import_list: "import1" + export_list: export1 + import_list: import1 range: - - address: "2001:db10::/32" - - address: "2001:db20::/32" - - address: "2001:db30::/32" + - address: 2001:db10::/32 + - address: 2001:db20::/32 + - address: 2001:db30::/32 - area_id: "3" range: - - address: "2001:db40::/32" + - address: 2001:db40::/32 state: rendered - name: Assert that correct set of commands were generated assert: that: - - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ - \ |length == 0 }}" + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length == 0 }}" - debug: msg: END vyos_ospfv3 rendered integration tests on connection={{ ansible_connection }} diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/replaced.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/replaced.yaml index e5905f5..3643826 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/replaced.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospfv3 replaced integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospfv3 replaced integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -11,28 +10,27 @@ vyos.vyos.vyos_ospfv3: &id001 config: redistribute: - - route_type: "bgp" + - route_type: bgp parameters: - router_id: "192.0.2.10" + router_id: 192.0.2.10 areas: - area_id: "2" - export_list: "export1" - import_list: "import1" + export_list: export1 + import_list: import1 range: - - address: "2001:db10::/32" - - address: "2001:db30::/32" - - address: "2001:db50::/32" + - address: 2001:db10::/32 + - address: 2001:db30::/32 + - address: 2001:db50::/32 - area_id: "4" range: - - address: "2001:db60::/32" + - 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 }}" + - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that before dicts are correctly generated assert: @@ -44,9 +42,7 @@ that: - "{{ replaced['after'] == result['after'] }}" - - name: - Replace device configurations of listed ospfv3 routes with provided configurarions - (IDEMPOTENT) + - name: Replace device configurations of listed ospfv3 routes with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_ospfv3: *id001 diff --git a/tests/integration/targets/vyos_ospfv3/tests/cli/rtt.yaml b/tests/integration/targets/vyos_ospfv3/tests/cli/rtt.yaml index 2142aad..793f890 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/cli/rtt.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_ospfv3 round trip integration tests on connection={{ - ansible_connection }} + msg: START vyos_ospfv3 round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -12,19 +11,19 @@ config: areas: - area_id: "2" - export_list: "export1" - import_list: "import1" + export_list: export1 + import_list: import1 range: - - address: "2001:db10::/32" - - address: "2001:db20::/32" - - address: "2001:db30::/32" + - address: 2001:db10::/32 + - address: 2001:db20::/32 + - address: 2001:db30::/32 - area_id: "3" range: - - address: "2001:db40::/32" + - address: 2001:db40::/32 parameters: - router_id: "192.0.2.10" + router_id: 192.0.2.10 redistribute: - - route_type: "bgp" + - route_type: bgp state: merged - name: Gather ospfv3 facts @@ -39,21 +38,21 @@ vyos.vyos.vyos_ospfv3: config: redistribute: - - route_type: "bgp" + - route_type: bgp parameters: - router_id: "192.0.2.10" + router_id: 192.0.2.10 areas: - area_id: "2" - export_list: "export1" - import_list: "import1" + export_list: export1 + import_list: import1 range: - - address: "2001:db10::/32" - - address: "2001:db30::/32" - - address: "2001:db50::/32" + - address: 2001:db10::/32 + - address: 2001:db30::/32 + - address: 2001:db50::/32 - area_id: "4" range: - - address: "2001:db60::/32" + - address: 2001:db60::/32 state: replaced - name: Assert that changes were applied diff --git a/tests/integration/targets/vyos_ospfv3/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_ospfv3/tests/redirection/cli/shortname.yaml index 65935e6..51239b1 100644 --- a/tests/integration/targets/vyos_ospfv3/tests/redirection/cli/shortname.yaml +++ b/tests/integration/targets/vyos_ospfv3/tests/redirection/cli/shortname.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START shortname integration tests on connection={{ ansible_connection - }} + msg: START shortname integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -12,19 +11,19 @@ config: areas: - area_id: "2" - export_list: "export1" - import_list: "import1" + export_list: export1 + import_list: import1 range: - - address: "2001:db10::/32" - - address: "2001:db20::/32" - - address: "2001:db30::/32" + - address: 2001:db10::/32 + - address: 2001:db20::/32 + - address: 2001:db30::/32 - area_id: "3" range: - - address: "2001:db40::/32" + - address: 2001:db40::/32 parameters: - router_id: "192.0.2.10" + router_id: 192.0.2.10 redistribute: - - route_type: "bgp" + - route_type: bgp state: merged - name: Assert that before dicts were correctly generated @@ -34,17 +33,14 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - "{{ merged['after'] == result['after'] }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.ospfv3: *id001 diff --git a/tests/integration/targets/vyos_ospfv3/vars/main.yaml b/tests/integration/targets/vyos_ospfv3/vars/main.yaml index 3793760..21fce2d 100644 --- a/tests/integration/targets/vyos_ospfv3/vars/main.yaml +++ b/tests/integration/targets/vyos_ospfv3/vars/main.yaml @@ -15,19 +15,19 @@ merged: after: areas: - area_id: "2" - export_list: "export1" - import_list: "import1" + export_list: export1 + import_list: import1 range: - - address: "2001:db10::/32" - - address: "2001:db20::/32" - - address: "2001:db30::/32" + - address: 2001:db10::/32 + - address: 2001:db20::/32 + - address: 2001:db30::/32 - area_id: "3" range: - - address: "2001:db40::/32" + - address: 2001:db40::/32 parameters: - router_id: "192.0.2.10" + router_id: 192.0.2.10 redistribute: - - route_type: "bgp" + - route_type: bgp merged_update: commands: @@ -35,37 +35,37 @@ merged_update: after: areas: - area_id: "2" - export_list: "export1" - import_list: "import1" + export_list: export1 + import_list: import1 range: - - address: "2001:db10::/32" - - address: "2001:db20::/32" - - address: "2001:db30::/32" + - address: 2001:db10::/32 + - address: 2001:db20::/32 + - address: 2001:db30::/32 - area_id: "3" range: - - address: "2001:db40::/32" - - address: "2001:db70::/32" + - address: 2001:db40::/32 + - address: 2001:db70::/32 parameters: - router_id: "192.0.2.10" + router_id: 192.0.2.10 redistribute: - - route_type: "bgp" + - route_type: bgp populate: areas: - area_id: "2" - export_list: "export1" - import_list: "import1" + export_list: export1 + import_list: import1 range: - - address: "2001:db10::/32" - - address: "2001:db20::/32" - - address: "2001:db30::/32" + - address: 2001:db10::/32 + - address: 2001:db20::/32 + - address: 2001:db30::/32 - area_id: "3" range: - - address: "2001:db40::/32" + - address: 2001:db40::/32 parameters: - router_id: "192.0.2.10" + router_id: 192.0.2.10 redistribute: - - route_type: "bgp" + - route_type: bgp replaced: commands: - delete protocols ospfv3 area 2 range 2001:db20::/32 @@ -76,19 +76,19 @@ replaced: after: areas: - area_id: "2" - export_list: "export1" - import_list: "import1" + export_list: export1 + import_list: import1 range: - - address: "2001:db10::/32" - - address: "2001:db30::/32" - - address: "2001:db50::/32" + - address: 2001:db10::/32 + - address: 2001:db30::/32 + - address: 2001:db50::/32 - area_id: "4" range: - - address: "2001:db60::/32" + - address: 2001:db60::/32 parameters: - router_id: "192.0.2.10" + router_id: 192.0.2.10 redistribute: - - route_type: "bgp" + - route_type: bgp rendered: commands: - set protocols ospfv3 redistribute bgp @@ -105,37 +105,37 @@ parsed: after: areas: - area_id: "2" - export_list: "export1" - import_list: "import1" + export_list: export1 + import_list: import1 range: - - address: "2001:db10::/32" - - address: "2001:db20::/32" - - address: "2001:db30::/32" + - address: 2001:db10::/32 + - address: 2001:db20::/32 + - address: 2001:db30::/32 - area_id: "3" range: - - address: "2001:db40::/32" + - address: 2001:db40::/32 parameters: - router_id: "192.0.2.10" + router_id: 192.0.2.10 redistribute: - - route_type: "bgp" + - route_type: bgp deleted: commands: - - "delete protocols ospfv3" + - delete protocols ospfv3 after: {} round_trip: after: areas: - area_id: "2" - export_list: "export1" - import_list: "import1" + export_list: export1 + import_list: import1 range: - - address: "2001:db10::/32" - - address: "2001:db30::/32" - - address: "2001:db50::/32" + - address: 2001:db10::/32 + - address: 2001:db30::/32 + - address: 2001:db50::/32 - area_id: "4" range: - - address: "2001:db60::/32" + - address: 2001:db60::/32 parameters: - router_id: "192.0.2.10" + router_id: 192.0.2.10 redistribute: - - route_type: "bgp" + - route_type: bgp diff --git a/tests/integration/targets/vyos_prefix_lists/tests/cli/_populate_config.yaml b/tests/integration/targets/vyos_prefix_lists/tests/cli/_populate_config.yaml index 9be477d..6135462 100644 --- a/tests/integration/targets/vyos_prefix_lists/tests/cli/_populate_config.yaml +++ b/tests/integration/targets/vyos_prefix_lists/tests/cli/_populate_config.yaml @@ -2,21 +2,21 @@ - name: Populate config vyos.vyos.vyos_config: lines: - - "set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible'" - - "set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'permit'" - - "set policy prefix-list AnsibleIPv4PrefixList rule 2 description 'Rule 2 given by ansible'" - - "set policy prefix-list AnsibleIPv4PrefixList rule 2 le '32'" - - "set policy prefix-list AnsibleIPv4PrefixList rule 2 prefix '92.168.10.0/26'" - - "set policy prefix-list AnsibleIPv4PrefixList rule 3 action 'deny'" - - "set policy prefix-list AnsibleIPv4PrefixList rule 3 description 'Rule 3'" - - "set policy prefix-list AnsibleIPv4PrefixList rule 3 ge '26'" - - "set policy prefix-list AnsibleIPv4PrefixList rule 3 prefix '72.168.2.0/24'" - - "set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks'" - - "set policy prefix-list6 AllowIPv6Prefix rule 5 action 'permit'" - - "set policy prefix-list6 AllowIPv6Prefix rule 5 description 'Permit rule'" - - "set policy prefix-list6 AllowIPv6Prefix rule 5 le '37'" - - "set policy prefix-list6 AllowIPv6Prefix rule 5 prefix '2001:db8:8000::/35'" - - "set policy prefix-list6 DenyIPv6Prefix description 'Configured by ansible for disallowing IPv6 networks'" - - "set policy prefix-list6 DenyIPv6Prefix rule 8 action 'deny'" - - "set policy prefix-list6 DenyIPv6Prefix rule 8 le '37'" - - "set policy prefix-list6 DenyIPv6Prefix rule 8 prefix '2001:db8:2000::/35'" + - set policy prefix-list AnsibleIPv4PrefixList description 'PL configured by ansible' + - set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'permit' + - set policy prefix-list AnsibleIPv4PrefixList rule 2 description 'Rule 2 given by ansible' + - set policy prefix-list AnsibleIPv4PrefixList rule 2 le '32' + - set policy prefix-list AnsibleIPv4PrefixList rule 2 prefix '92.168.10.0/26' + - set policy prefix-list AnsibleIPv4PrefixList rule 3 action 'deny' + - set policy prefix-list AnsibleIPv4PrefixList rule 3 description 'Rule 3' + - set policy prefix-list AnsibleIPv4PrefixList rule 3 ge '26' + - set policy prefix-list AnsibleIPv4PrefixList rule 3 prefix '72.168.2.0/24' + - set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks' + - set policy prefix-list6 AllowIPv6Prefix rule 5 action 'permit' + - set policy prefix-list6 AllowIPv6Prefix rule 5 description 'Permit rule' + - set policy prefix-list6 AllowIPv6Prefix rule 5 le '37' + - set policy prefix-list6 AllowIPv6Prefix rule 5 prefix '2001:db8:8000::/35' + - set policy prefix-list6 DenyIPv6Prefix description 'Configured by ansible for disallowing IPv6 networks' + - set policy prefix-list6 DenyIPv6Prefix rule 8 action 'deny' + - set policy prefix-list6 DenyIPv6Prefix rule 8 le '37' + - set policy prefix-list6 DenyIPv6Prefix rule 8 prefix '2001:db8:2000::/35' diff --git a/tests/integration/targets/vyos_prefix_lists/tests/cli/deleted.yaml b/tests/integration/targets/vyos_prefix_lists/tests/cli/deleted.yaml index efcb14c..b0c0ac9 100644 --- a/tests/integration/targets/vyos_prefix_lists/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_prefix_lists/tests/cli/deleted.yaml @@ -11,7 +11,7 @@ - name: Delete all prefix-lists ignore_errors: true register: result - vyos.vyos.vyos_prefix_lists: &id006 + vyos.vyos.vyos_prefix_lists: &id001 config: state: deleted @@ -24,8 +24,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dict is correctly generated assert: @@ -34,7 +33,7 @@ - name: Delete all prefix-lists (IDEMPOTENT) register: result - vyos.vyos.vyos_prefix_lists: *id006 + vyos.vyos.vyos_prefix_lists: *id001 - name: Assert that task was idempotent assert: @@ -51,7 +50,7 @@ register: result vyos.vyos.vyos_prefix_lists: config: - - afi: "ipv6" + - afi: ipv6 state: deleted - name: Assert that before dicts are correctly generated @@ -83,12 +82,12 @@ register: result vyos.vyos.vyos_prefix_lists: config: - - afi: "ipv4" + - afi: ipv4 prefix_lists: - - name: "AnsibleIPv4PrefixList" - - afi: "ipv6" + - name: AnsibleIPv4PrefixList + - afi: ipv6 prefix_lists: - - name: "DenyIPv6Prefix" + - name: DenyIPv6Prefix state: deleted - name: Assert that before dicts are correctly generated diff --git a/tests/integration/targets/vyos_prefix_lists/tests/cli/merged.yaml b/tests/integration/targets/vyos_prefix_lists/tests/cli/merged.yaml index ef94743..1240db5 100644 --- a/tests/integration/targets/vyos_prefix_lists/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_prefix_lists/tests/cli/merged.yaml @@ -9,40 +9,40 @@ register: result vyos.vyos.vyos_prefix_lists: &id001 config: - - afi: "ipv4" + - afi: ipv4 prefix_lists: - - name: "AnsibleIPv4PrefixList" - description: "PL configured by ansible" + - name: AnsibleIPv4PrefixList + description: PL configured by ansible entries: - sequence: 2 - description: "Rule 2 given by ansible" - action: "permit" - prefix: "92.168.10.0/26" + description: Rule 2 given by ansible + action: permit + prefix: 92.168.10.0/26 le: 32 - sequence: 3 - description: "Rule 3" - action: "deny" - prefix: "72.168.2.0/24" + description: Rule 3 + action: deny + prefix: 72.168.2.0/24 ge: 26 - - afi: "ipv6" + - afi: ipv6 prefix_lists: - - name: "AllowIPv6Prefix" - description: "Configured by ansible for allowing IPv6 networks" + - name: AllowIPv6Prefix + description: Configured by ansible for allowing IPv6 networks entries: - sequence: 5 - description: "Permit rule" - action: "permit" - prefix: "2001:db8:8000::/35" + description: Permit rule + action: permit + prefix: 2001:db8:8000::/35 le: 37 - name: DenyIPv6Prefix - description: "Configured by ansible for disallowing IPv6 networks" + description: Configured by ansible for disallowing IPv6 networks entries: - sequence: 8 action: deny - prefix: "2001:db8:2000::/35" + prefix: 2001:db8:2000::/35 le: 37 state: merged @@ -53,8 +53,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts were correctly generated assert: diff --git a/tests/integration/targets/vyos_prefix_lists/tests/cli/overridden.yaml b/tests/integration/targets/vyos_prefix_lists/tests/cli/overridden.yaml index 7bcd26b..7c00001 100644 --- a/tests/integration/targets/vyos_prefix_lists/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_prefix_lists/tests/cli/overridden.yaml @@ -9,24 +9,24 @@ - block: - name: Override all prefix-lists configuration with provided configuration register: result - vyos.vyos.vyos_prefix_lists: &id003 + vyos.vyos.vyos_prefix_lists: &id001 config: - - afi: "ipv4" + - afi: ipv4 prefix_lists: - - name: "AnsibleIPv4PrefixList" + - name: AnsibleIPv4PrefixList description: Rule 3 overridden by ansible entries: - sequence: 2 - action: "deny" + action: deny ge: 26 - prefix: "82.168.2.0/24" + prefix: 82.168.2.0/24 - - name: "OverriddenPrefixList" + - name: OverriddenPrefixList description: Configuration overridden by ansible entries: - sequence: 10 action: permit - prefix: "203.0.113.96/27" + prefix: 203.0.113.96/27 le: 32 state: overridden @@ -40,8 +40,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts were correctly generated assert: @@ -50,7 +49,7 @@ - name: Override all prefix-lists configuration with provided configuration (IDEMPOTENT) register: result - vyos.vyos.vyos_prefix_lists: *id003 + vyos.vyos.vyos_prefix_lists: *id001 - name: Assert that task was idempotent assert: diff --git a/tests/integration/targets/vyos_prefix_lists/tests/cli/rendered.yaml b/tests/integration/targets/vyos_prefix_lists/tests/cli/rendered.yaml index 12a0deb..284abce 100644 --- a/tests/integration/targets/vyos_prefix_lists/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_prefix_lists/tests/cli/rendered.yaml @@ -6,46 +6,45 @@ register: result vyos.vyos.vyos_prefix_lists: config: - - afi: "ipv4" + - afi: ipv4 prefix_lists: - - name: "AnsibleIPv4PrefixList" - description: "PL configured by ansible" + - name: AnsibleIPv4PrefixList + description: PL configured by ansible entries: - sequence: 2 - description: "Rule 2 given by ansible" - action: "permit" - prefix: "92.168.10.0/26" + description: Rule 2 given by ansible + action: permit + prefix: 92.168.10.0/26 le: 32 - sequence: 3 - description: "Rule 3" - action: "deny" - prefix: "72.168.2.0/24" + description: Rule 3 + action: deny + prefix: 72.168.2.0/24 ge: 26 - - afi: "ipv6" + - afi: ipv6 prefix_lists: - - name: "AllowIPv6Prefix" - description: "Configured by ansible for allowing IPv6 networks" + - name: AllowIPv6Prefix + description: Configured by ansible for allowing IPv6 networks entries: - sequence: 5 - description: "Permit rule" - action: "permit" - prefix: "2001:db8:8000::/35" + description: Permit rule + action: permit + prefix: 2001:db8:8000::/35 le: 37 - name: DenyIPv6Prefix - description: "Configured by ansible for disallowing IPv6 networks" + description: Configured by ansible for disallowing IPv6 networks entries: - sequence: 8 action: deny - prefix: "2001:db8:2000::/35" + prefix: 2001:db8:2000::/35 le: 37 state: rendered - name: Assert that correct set of commands were rendered assert: that: - - "{{ merged['commands'] | symmetric_difference(result['rendered']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['rendered']) |length == 0 }}" - result.changed == False diff --git a/tests/integration/targets/vyos_prefix_lists/tests/cli/replaced.yaml b/tests/integration/targets/vyos_prefix_lists/tests/cli/replaced.yaml index fc9f5da..9145eb7 100644 --- a/tests/integration/targets/vyos_prefix_lists/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_prefix_lists/tests/cli/replaced.yaml @@ -9,17 +9,17 @@ - block: - name: Replace prefix-lists configurations of listed prefix-lists with provided configurations register: result - vyos.vyos.vyos_prefix_lists: &id002 + vyos.vyos.vyos_prefix_lists: &id001 config: - - afi: "ipv4" + - afi: ipv4 prefix_lists: - - name: "AnsibleIPv4PrefixList" - description: "Configuration replaced by ansible" + - name: AnsibleIPv4PrefixList + description: Configuration replaced by ansible entries: - sequence: 3 - description: "Rule 3 replaced by ansible" - action: "permit" - prefix: "82.168.2.0/24" + description: Rule 3 replaced by ansible + action: permit + prefix: 82.168.2.0/24 ge: 26 state: replaced @@ -33,8 +33,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts were correctly generated assert: @@ -45,7 +44,7 @@ - name: Replace prefix-lists configurations of listed prefix-lists with provided configurations (IDEMPOTENT) register: result - vyos.vyos.vyos_prefix_lists: *id002 + vyos.vyos.vyos_prefix_lists: *id001 - name: Assert that task was idempotent assert: diff --git a/tests/integration/targets/vyos_prefix_lists/tests/cli/rtt.yaml b/tests/integration/targets/vyos_prefix_lists/tests/cli/rtt.yaml index 2be2515..df7eb25 100644 --- a/tests/integration/targets/vyos_prefix_lists/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_prefix_lists/tests/cli/rtt.yaml @@ -9,40 +9,40 @@ register: base_config vyos.vyos.vyos_prefix_lists: config: - - afi: "ipv4" + - afi: ipv4 prefix_lists: - - name: "AnsibleIPv4PrefixList" - description: "PL configured by ansible" + - name: AnsibleIPv4PrefixList + description: PL configured by ansible entries: - sequence: 2 - description: "Rule 2 given by ansible" - action: "permit" - prefix: "92.168.10.0/26" + description: Rule 2 given by ansible + action: permit + prefix: 92.168.10.0/26 le: 32 - sequence: 3 - description: "Rule 3" - action: "deny" - prefix: "72.168.2.0/24" + description: Rule 3 + action: deny + prefix: 72.168.2.0/24 ge: 26 - - afi: "ipv6" + - afi: ipv6 prefix_lists: - - name: "AllowIPv6Prefix" - description: "Configured by ansible for allowing IPv6 networks" + - name: AllowIPv6Prefix + description: Configured by ansible for allowing IPv6 networks entries: - sequence: 5 - description: "Permit rule" - action: "permit" - prefix: "2001:db8:8000::/35" + description: Permit rule + action: permit + prefix: 2001:db8:8000::/35 le: 37 - name: DenyIPv6Prefix - description: "Configured by ansible for disallowing IPv6 networks" + description: Configured by ansible for disallowing IPv6 networks entries: - sequence: 8 action: deny - prefix: "2001:db8:2000::/35" + prefix: 2001:db8:2000::/35 le: 37 state: merged @@ -57,15 +57,15 @@ register: result vyos.vyos.vyos_prefix_lists: config: - - afi: "ipv4" + - afi: ipv4 prefix_lists: - - name: "AnsibleIPv4PrefixList" - description: "Configuration replaced by ansible" + - name: AnsibleIPv4PrefixList + description: Configuration replaced by ansible entries: - sequence: 3 - description: "Rule 3 replaced by ansible" - action: "permit" - prefix: "82.168.2.0/24" + description: Rule 3 replaced by ansible + action: permit + prefix: 82.168.2.0/24 ge: 26 state: replaced diff --git a/tests/integration/targets/vyos_prefix_lists/vars/main.yaml b/tests/integration/targets/vyos_prefix_lists/vars/main.yaml index 3a30342..7127749 100644 --- a/tests/integration/targets/vyos_prefix_lists/vars/main.yaml +++ b/tests/integration/targets/vyos_prefix_lists/vars/main.yaml @@ -1,7 +1,6 @@ --- merged: before: [] - commands: - set policy prefix-list6 AllowIPv6Prefix - set policy prefix-list6 AllowIPv6Prefix description 'Configured by ansible for allowing IPv6 networks' @@ -106,15 +105,13 @@ overridden: - delete policy prefix-list6 DenyIPv6Prefix - set policy prefix-list AnsibleIPv4PrefixList description 'Rule 3 overridden by ansible' - set policy prefix-list AnsibleIPv4PrefixList rule 2 action 'deny' - - delete policy prefix-list AnsibleIPv4PrefixList rule 2 description 'Rule 2 given - by ansible' + - delete policy prefix-list AnsibleIPv4PrefixList rule 2 description 'Rule 2 given by ansible' - set policy prefix-list AnsibleIPv4PrefixList rule 2 ge '26' - delete policy prefix-list AnsibleIPv4PrefixList rule 2 le '32' - set policy prefix-list AnsibleIPv4PrefixList rule 2 prefix '82.168.2.0/24' - delete policy prefix-list AnsibleIPv4PrefixList rule 3 - set policy prefix-list OverriddenPrefixList - - set policy prefix-list OverriddenPrefixList description 'Configuration overridden - by ansible' + - set policy prefix-list OverriddenPrefixList description 'Configuration overridden by ansible' - set policy prefix-list OverriddenPrefixList rule 10 - set policy prefix-list OverriddenPrefixList rule 10 action 'permit' - set policy prefix-list OverriddenPrefixList rule 10 le '32' 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 84b6446..09a81cc 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/deleted.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_route_maps deleted integration tests on connection={{ - ansible_connection }} + msg: START vyos_route_maps deleted integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -21,12 +20,9 @@ - name: Assert that the after dicts were correctly generated assert: that: - - "{{ deleted['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Delete the existing configuration with the provided running configuration - (IDEMPOTENT) + - name: Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_route_maps: *id001 diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/empty_config.yaml index 6d992b8..13b45ac 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/empty_config.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_route_maps empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_route_maps empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -45,8 +44,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result 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 358f5b1..b2a0fa5 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/gathered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_route_maps gathered integration tests on connection={{ - ansible_connection }} + msg: START vyos_route_maps gathered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/merged.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/merged.yaml index d679800..21205c4 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/merged.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_route_maps merged integration tests on connection={{ - ansible_connection }} + msg: START vyos_route_maps merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -13,7 +12,7 @@ - route_map: test1 entries: - sequence: 1 - description: "test" + description: test action: permit continue_sequence: 2 - route_map: test3 @@ -26,7 +25,7 @@ set: local_preference: 4 metric: 5 - metric_type: "type-1" + metric_type: type-1 origin: egp originator_id: 192.0.2.34 tag: 5 @@ -46,12 +45,9 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ merged['before'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_route_maps: *id001 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 d33a7c4..1d57173 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/overridden.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_route_maps overridden integration tests on connection={{ - ansible_connection }} + msg: START vyos_route_maps overridden integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -20,7 +19,7 @@ set: local_preference: 6 metric: 4 - metric_type: "type-1" + metric_type: type-1 origin: egp originator_id: 192.0.2.34 tag: 4 @@ -37,9 +36,7 @@ - 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) + - name: Override the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_route_maps: *id001 diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/parsed.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/parsed.yaml index f098347..c41b513 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_route_maps parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_route_maps parsed integration tests on connection={{ ansible_connection }} - name: Provide the running configuration for parsing (config to be parsed) register: result diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/rendered.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/rendered.yaml index f9e599f..00a0199 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/rendered.yaml @@ -1,19 +1,18 @@ --- - debug: - msg: START vyos_route_maps rendered integration tests on connection={{ - ansible_connection }} + msg: START vyos_route_maps rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml - block: - name: Structure provided configuration into device specific commands register: result - vyos.vyos.vyos_route_maps: &id001 + vyos.vyos.vyos_route_maps: config: - route_map: test1 entries: - sequence: 1 - description: "test" + description: test action: permit continue_sequence: 2 - route_map: test3 @@ -26,7 +25,7 @@ set: local_preference: 4 metric: 5 - metric_type: "type-1" + metric_type: type-1 origin: egp originator_id: 192.0.2.34 tag: 5 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 57a91fd..d7d05ec 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/replaced.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_route_maps replaced integration tests on connection={{ - ansible_connection }} + msg: START vyos_route_maps replaced integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -20,7 +19,7 @@ set: local_preference: 6 metric: 4 - metric_type: "type-1" + metric_type: type-1 origin: egp originator_id: 192.0.2.34 tag: 4 @@ -37,9 +36,7 @@ - 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) + - name: Replace the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_route_maps: *id001 diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/rtt.yaml b/tests/integration/targets/vyos_route_maps/tests/cli/rtt.yaml index 6b1616b..af16ddb 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_route_maps/tests/cli/rtt.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_route_maps merged integration tests on connection={{ - ansible_connection }} + msg: START vyos_route_maps merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -13,7 +12,7 @@ - route_map: test1 entries: - sequence: 1 - description: "test" + description: test action: permit continue_sequence: 2 - route_map: test3 @@ -26,7 +25,7 @@ set: local_preference: 4 metric: 5 - metric_type: "type-1" + metric_type: type-1 origin: egp originator_id: 192.0.2.34 tag: 5 @@ -57,7 +56,7 @@ set: local_preference: 6 metric: 4 - metric_type: "type-1" + metric_type: type-1 origin: egp originator_id: 192.0.2.34 tag: 4 diff --git a/tests/integration/targets/vyos_route_maps/vars/main.yaml b/tests/integration/targets/vyos_route_maps/vars/main.yaml index 47658f4..838cc5e 100644 --- a/tests/integration/targets/vyos_route_maps/vars/main.yaml +++ b/tests/integration/targets/vyos_route_maps/vars/main.yaml @@ -17,26 +17,26 @@ merged: - set policy route-map test3 rule 1 match peer 192.0.2.32 after: - - route_map: "test3" + - route_map: test3 entries: - sequence: 1 - action: "permit" + action: permit match: metric: 1 - peer: "192.0.2.32" + peer: 192.0.2.32 set: local_preference: "4" metric: "5" - metric_type: "type-1" + metric_type: type-1 origin: egp - originator_id: "192.0.2.34" + originator_id: 192.0.2.34 tag: "5" weight: "4" - - route_map: "test1" + - route_map: test1 entries: - sequence: 1 - description: "test" - action: "permit" + description: test + action: permit continue_sequence: 2 replaced: @@ -53,7 +53,7 @@ replaced: - route_map: test2 entries: - sequence: 1 - description: "test" + description: test action: permit - sequence: 1 action: permit @@ -69,7 +69,7 @@ replaced: set: local_preference: 6 metric: 4 - metric_type: "type-1" + metric_type: type-1 origin: egp originator_id: 192.0.2.34 tag: 4 @@ -97,7 +97,7 @@ overridden: set: local_preference: 6 metric: 4 - metric_type: "type-1" + metric_type: type-1 origin: egp originator_id: 192.0.2.34 tag: 4 diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/deleted.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/deleted.yaml index 8cd2c8a..e6ac9b9 100644 --- a/tests/integration/targets/vyos_snmp_server/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_snmp_server/tests/cli/deleted.yaml @@ -24,9 +24,7 @@ that: - result.after == {} - - name: - Delete the existing configuration with the provided running configuration - (IDEMPOTENT) + - name: Delete the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_snmp_server: *id001 diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/empty_config.yaml index 558b53f..e213efd 100644 --- a/tests/integration/targets/vyos_snmp_server/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_snmp_server/tests/cli/empty_config.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_snmp_server empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_snmp_server empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -45,8 +44,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/gathered.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/gathered.yaml index 7cdf3c4..60bddee 100644 --- a/tests/integration/targets/vyos_snmp_server/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_snmp_server/tests/cli/gathered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_snmp_server gathered integration tests on connection={{ - ansible_connection }} + msg: START vyos_snmp_server gathered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/merged.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/merged.yaml index 06627b0..7f8139d 100644 --- a/tests/integration/targets/vyos_snmp_server/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_snmp_server/tests/cli/merged.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_snmp_server merged integration tests on connection={{ - ansible_connection }} + msg: START vyos_snmp_server merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -11,24 +10,24 @@ vyos.vyos.vyos_snmp_server: &id001 config: communities: - - name: "switches" - authorization_type: "rw" - - name: "bridges" - clients: ["1.1.1.1", "12.1.1.10"] - contact: "admin2@ex.com" + - name: switches + authorization_type: rw + - name: bridges + clients: [1.1.1.1, 12.1.1.10] + contact: admin2@ex.com listen_addresses: - - address: "20.1.1.1" - - address: "100.1.2.1" + - address: 20.1.1.1 + - address: 100.1.2.1 port: 33 snmp_v3: users: - user: adminuser authentication: - plaintext_key: "abc1234567" - type: "sha" + plaintext_key: abc1234567 + type: sha privacy: - plaintext_key: "abc1234567" - type: "aes" + plaintext_key: abc1234567 + type: aes state: merged - vyos.vyos.vyos_facts: @@ -47,9 +46,7 @@ that: - result.before == {} - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_snmp_server: *id001 diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/overridden.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/overridden.yaml index b1d6565..2dc6eda 100644 --- a/tests/integration/targets/vyos_snmp_server/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_snmp_server/tests/cli/overridden.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_snmp_server overridden integration tests on connection={{ - ansible_connection }} + msg: START vyos_snmp_server overridden integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -13,31 +12,31 @@ vyos.vyos.vyos_snmp_server: &id001 config: communities: - - name: "bridges" - networks: ["1.1.1.0/24", "12.1.1.0/24"] - location: "RDU" + - name: bridges + networks: [1.1.1.0/24, 12.1.1.0/24] + location: RDU listen_addresses: - - address: "100.1.2.1" + - address: 100.1.2.1 port: 33 snmp_v3: users: - user: adminuser engine_id: "33" authentication: - plaintext_key: "abc1234567" - type: "sha" + plaintext_key: abc1234567 + type: sha privacy: - plaintext_key: "abc1234567" - type: "aes" + plaintext_key: abc1234567 + type: aes - user: guestuser2 authentication: - plaintext_key: "opq1234567" - type: "sha" + plaintext_key: opq1234567 + type: sha privacy: - plaintext_key: "opq1234567" - type: "aes" + plaintext_key: opq1234567 + type: aes views: - - view: "default" + - view: default oid: 1 state: overridden @@ -50,9 +49,7 @@ - result.after == ansible_facts['network_resources']['snmp_server'] - result.commands|length == 13 - - name: - Override the existing configuration with the provided running configuration - (IDEMPOTENT) + - name: Override the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_snmp_server: *id001 diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/parsed.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/parsed.yaml index 4ecc1ac..bd1b1c3 100644 --- a/tests/integration/targets/vyos_snmp_server/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_snmp_server/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_snmp_server parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_snmp_server parsed integration tests on connection={{ ansible_connection }} - name: Provide the running configuration for parsing (config to be parsed) register: result diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/rendered.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/rendered.yaml index e238827..f3d9254 100644 --- a/tests/integration/targets/vyos_snmp_server/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_snmp_server/tests/cli/rendered.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_snmp_server rendered integration tests on connection={{ - ansible_connection }} + msg: START vyos_snmp_server rendered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -11,24 +10,24 @@ vyos.vyos.vyos_snmp_server: config: communities: - - name: "switches" - authorization_type: "rw" - - name: "bridges" - clients: ["1.1.1.1", "12.1.1.10"] - contact: "admin2@ex.com" + - name: switches + authorization_type: rw + - name: bridges + clients: [1.1.1.1, 12.1.1.10] + contact: admin2@ex.com listen_addresses: - - address: "20.1.1.1" - - address: "100.1.2.1" + - address: 20.1.1.1 + - address: 100.1.2.1 port: 33 snmp_v3: users: - user: adminuser authentication: - plaintext_key: "abc1234567" - type: "sha" + plaintext_key: abc1234567 + type: sha privacy: - plaintext_key: "abc1234567" - type: "aes" + plaintext_key: abc1234567 + type: aes state: rendered - assert: diff --git a/tests/integration/targets/vyos_snmp_server/tests/cli/replaced.yaml b/tests/integration/targets/vyos_snmp_server/tests/cli/replaced.yaml index 2bfcaf6..3b75992 100644 --- a/tests/integration/targets/vyos_snmp_server/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_snmp_server/tests/cli/replaced.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_snmp_server replaced integration tests on connection={{ - ansible_connection }} + msg: START vyos_snmp_server replaced integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -13,31 +12,31 @@ vyos.vyos.vyos_snmp_server: &id001 config: communities: - - name: "bridges" - networks: ["1.1.1.0/24", "12.1.1.0/24"] - location: "RDU" + - name: bridges + networks: [1.1.1.0/24, 12.1.1.0/24] + location: RDU listen_addresses: - - address: "100.1.2.1" + - address: 100.1.2.1 port: 33 snmp_v3: users: - user: adminuser engine_id: "33" authentication: - plaintext_key: "abc1234567" - type: "sha" + plaintext_key: abc1234567 + type: sha privacy: - plaintext_key: "abc1234567" - type: "aes" + plaintext_key: abc1234567 + type: aes - user: guestuser2 authentication: - plaintext_key: "opq1234567" - type: "sha" + plaintext_key: opq1234567 + type: sha privacy: - plaintext_key: "opq1234567" - type: "aes" + plaintext_key: opq1234567 + type: aes views: - - view: "default" + - view: default oid: 1 state: replaced @@ -50,9 +49,7 @@ - result.after == ansible_facts['network_resources']['snmp_server'] - result.commands|length == 13 - - name: - Replace the existing configuration with the provided running configuration - (IDEMPOTENT) + - name: Replace the existing configuration with the provided running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_snmp_server: *id001 diff --git a/tests/integration/targets/vyos_snmp_server/vars/main.yaml b/tests/integration/targets/vyos_snmp_server/vars/main.yaml index 060421b..3034390 100644 --- a/tests/integration/targets/vyos_snmp_server/vars/main.yaml +++ b/tests/integration/targets/vyos_snmp_server/vars/main.yaml @@ -17,23 +17,23 @@ merged: - clients: - 1.1.1.1 - 12.1.1.10 - name: "bridges" - - authorization_type: "rw" - name: "switches" - contact: "admin2@ex.com" + name: bridges + - authorization_type: rw + name: switches + contact: admin2@ex.com listen_addresses: - - address: "100.1.2.1" + - address: 100.1.2.1 port: 33 - - address: "20.1.1.1" + - address: 20.1.1.1 snmp_v3: users: - authentication: - plaintext_key: "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER" - type: "sha" + plaintext_key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER + type: sha privacy: - plaintext_key: "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER" - type: "aes" - user: "adminuser" + plaintext_key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER + type: aes + user: adminuser overridden: commands: @@ -53,74 +53,73 @@ overridden: after: communities: - - name: "bridges" + - name: bridges networks: - - "1.1.1.0/24" - - "12.1.1.0/24" - - name: "switches" + - 1.1.1.0/24 + - 12.1.1.0/24 + - name: switches listen_addresses: - - address: "100.1.2.1" + - address: 100.1.2.1 port: 33 - location: "RDU, NC" + location: RDU, NC snmp_v3: users: - authentication: - plaintext_key: "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER" - type: "sha" + plaintext_key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER + type: sha privacy: - plaintext_key: "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER" - type: "aes" - user: "adminuser" + plaintext_key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER + type: aes + user: adminuser - authentication: - plaintext_key: "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER" - type: "sha" + plaintext_key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER + type: sha privacy: - plaintext_key: "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER" - type: "aes" - user: "guestuser2" + plaintext_key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER + type: aes + user: guestuser2 views: - oid: 1 - view: "default" + view: default deleted: commands: - delete service snmp after: {} - parsed: after: communities: - - authorization_type: "ro" + - authorization_type: ro clients: - 203.0.113.10 - 203.0.113.20 - name: "routers" + name: routers networks: - 192.0.2.0/24 - 2001::/64 - contact: "admin@example.com" + contact: admin@example.com listen_addresses: - - address: "172.16.254.36" + - address: 172.16.254.36 port: 161 - - address: "2001::1" - location: "UK, London" + - address: 2001::1 + location: UK, London snmp_v3: engine_id: "000000000000000000000002" groups: - - group: "default" - mode: "ro" - view: "default" + - group: default + mode: ro + view: default users: - authentication: - plaintext_key: "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER" - type: "sha" - group: "default" + plaintext_key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER + type: sha + group: default privacy: - plaintext_key: "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER" - type: "aes" - user: "vyos" + plaintext_key: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER + type: aes + user: vyos views: - oid: "1" - view: "default" + view: default trap_target: - address: "203.0.113.10" + address: 203.0.113.10 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 12e4392..fdd6b1a 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/_populate.yaml @@ -3,12 +3,14 @@ - 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" + lines: >- + "set protocols static route 192.0.2.32/28 next-hop '192.0.2.10'\n + set protocols static route 192.0.2.32/28 next-hop '192.0.2.9'\n + set protocols static route 192.0.2.32/28 blackhole\n + set 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'\n + set protocols static route6 2001:db8:1000::/36" ansible.netcommon.cli_config: config: "{{ lines }}" diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/deleted_afi.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/deleted_afi.yaml index 491f9c3..bcfa049 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/deleted_afi.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/deleted_afi.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - Start vyos_static_routes deleted integration tests ansible_connection={{ - ansible_connection }} + msg: Start vyos_static_routes deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -25,14 +23,12 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted_afi_all['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ deleted_afi_all['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: that: - - "{{ deleted_afi_all['after'] | symmetric_difference(result['after'])\ - \ |length == 0 }}" + - "{{ deleted_afi_all['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result @@ -47,7 +43,6 @@ - name: Assert that the before dicts were correctly generated assert: that: - - "{{ deleted_afi_all['after'] | symmetric_difference(result['before'])\ - \ |length == 0 }}" + - "{{ deleted_afi_all['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/deleted_all.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/deleted_all.yaml index bddb528..ebc9192 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/deleted_all.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/deleted_all.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - Start vyos_static_routes deleted integration tests ansible_connection={{ - ansible_connection }} + msg: Start vyos_static_routes deleted integration tests ansible_connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -21,14 +19,12 @@ - name: Assert that the correct set of commands were generated assert: that: - - "{{ deleted_afi_all['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ deleted_afi_all['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated assert: that: - - "{{ deleted_afi_all['after'] | symmetric_difference(result['after'])\ - \ |length == 0 }}" + - "{{ deleted_afi_all['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Delete attributes of given interfaces (IDEMPOTENT) register: result @@ -43,7 +39,6 @@ - name: Assert that the before dicts were correctly generated assert: that: - - "{{ deleted_afi_all['after'] | symmetric_difference(result['before'])\ - \ |length == 0 }}" + - "{{ deleted_afi_all['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/empty_config.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/empty_config.yaml index 6fded87..31ca9e6 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/empty_config.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/empty_config.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_static_routes empty_config integration tests on connection={{ - ansible_connection }} + msg: START vyos_static_routes empty_config integration tests on connection={{ ansible_connection }} - name: Merged with empty config should give appropriate error message register: result @@ -46,8 +44,7 @@ - assert: that: - - result.msg == 'value of running_config parameter must not be empty for state - parsed' + - result.msg == 'value of running_config parameter must not be empty for state parsed' - name: Rendered with empty config should give appropriate error message register: result 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 6b34912..0af88be 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/gathered.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/gathered.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_static_routes gathered integration tests on connection={{ ansible_connection - }} + msg: START vyos_static_routes gathered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -16,8 +14,7 @@ - name: Assert that gathered dicts was correctly generated assert: that: - - "{{ populate | symmetric_difference(result['gathered']) |length == 0\ - \ }}" + - "{{ populate | symmetric_difference(result['gathered']) |length == 0 }}" - name: Gather the existing running configuration (IDEMPOTENT) register: result diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/merged.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/merged.yaml index 19e71fa..273f460 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/merged.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_static_routes merged integration tests on connection={{ ansible_connection - }} + msg: START vyos_static_routes merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -36,25 +34,19 @@ - name: Assert that before dicts were correctly generated assert: - that: - "{{ merged['before'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.vyos_static_routes: *id001 @@ -66,7 +58,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/overridden.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/overridden.yaml index 9281306..da5aff4 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/overridden.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_static_routes overridden integration tests on connection={{ - ansible_connection }} + msg: START vyos_static_routes overridden integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -26,14 +25,12 @@ - name: Assert that correct commands were generated assert: that: - - "{{ overridden['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Overrides all device configuration with provided configurations (IDEMPOTENT) register: result @@ -47,7 +44,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/parsed.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/parsed.yaml index 5776f7f..9881bd0 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/parsed.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/parsed.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_static_routes parsed integration tests on connection={{ ansible_connection - }} + msg: START vyos_static_routes parsed integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -23,9 +21,7 @@ - name: Assert that correct parsing done assert: - that: - "{{ ansible_facts['network_resources']['static_routes'] | symmetric_difference(result['parsed'])\ - \ |length == 0 }}" + that: "{{ ansible_facts['network_resources']['static_routes'] | symmetric_difference(result['parsed']) |length == 0 }}" - name: Gather the existing running configuration (IDEMPOTENT) register: result 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 4362d1f..761cff7 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/rendered.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START vyos_static_routes rendered integration tests on connection={{ ansible_connection - }} + msg: START vyos_static_routes rendered integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml @@ -37,8 +35,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ rendered['commands'] | symmetric_difference(result['rendered'])\ - \ |length == 0 }}" + - "{{ rendered['commands'] | symmetric_difference(result['rendered']) |length == 0 }}" - name: Structure provided configuration into device specific commands (IDEMPOTENT) register: result 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 28f80fb..26150e5 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/replaced.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/replaced.yaml @@ -1,14 +1,11 @@ --- - debug: - msg: - START vyos_static_routes replaced integration tests on connection={{ ansible_connection - }} + msg: START vyos_static_routes replaced integration tests on connection={{ ansible_connection }} - include_tasks: _populate.yaml - block: - - name: Replace device configurations of listed static routes with provided - configurations + - name: Replace device configurations of listed static routes with provided configurations register: result vyos.vyos.vyos_static_routes: &id001 config: @@ -29,8 +26,7 @@ - name: Assert that correct set of commands were generated assert: that: - - "{{ replaced['commands'] | symmetric_difference(result['commands'])\ - \ |length == 0 }}" + - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that before dicts are correctly generated assert: @@ -40,11 +36,9 @@ - name: Assert that after dict is correctly generated assert: that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: Replace device configurations of listed static routes with provided - configurarions (IDEMPOTENT) + - name: Replace device configurations of listed static routes with provided configurarions (IDEMPOTENT) register: result vyos.vyos.vyos_static_routes: *id001 @@ -56,7 +50,6 @@ - name: Assert that before dict is correctly generated assert: that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_static_routes/tests/cli/rtt.yaml b/tests/integration/targets/vyos_static_routes/tests/cli/rtt.yaml index 64e8044..2f8d475 100644 --- a/tests/integration/targets/vyos_static_routes/tests/cli/rtt.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/cli/rtt.yaml @@ -1,7 +1,6 @@ --- - debug: - msg: START vyos_static_routes round trip integration tests on connection={{ - ansible_connection }} + msg: START vyos_static_routes round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -60,9 +59,7 @@ - name: Assert that changes were applied assert: - that: - "{{ round_trip['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" - name: Revert back to base config using facts round trip register: revert @@ -72,8 +69,6 @@ - name: Assert that config was reverted assert: - that: - "{{ base_config['after'] | symmetric_difference(revert['after']) |length\ - \ == 0 }}" + that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_static_routes/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_static_routes/tests/redirection/cli/shortname.yaml index 364866e..9bf6cbb 100644 --- a/tests/integration/targets/vyos_static_routes/tests/redirection/cli/shortname.yaml +++ b/tests/integration/targets/vyos_static_routes/tests/redirection/cli/shortname.yaml @@ -1,8 +1,6 @@ --- - debug: - msg: - START shortname merged integration tests on connection={{ ansible_connection - }} + msg: START shortname merged integration tests on connection={{ ansible_connection }} - include_tasks: _remove_config.yaml @@ -36,25 +34,19 @@ - name: Assert that before dicts were correctly generated assert: - that: - "{{ merged['before'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - name: Assert that correct set of commands were generated assert: that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length\ - \ == 0 }}" + - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that after dicts was correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - name: - Merge the provided configuration with the existing running configuration - (IDEMPOTENT) + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result vyos.vyos.static_routes: *id001 @@ -66,7 +58,6 @@ - name: Assert that before dicts were correctly generated assert: that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length\ - \ == 0 }}" + - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_user/tests/cli/auth.yaml b/tests/integration/targets/vyos_user/tests/cli/auth.yaml index 87eaba6..a3178bf 100644 --- a/tests/integration/targets/vyos_user/tests/cli/auth.yaml +++ b/tests/integration/targets/vyos_user/tests/cli/auth.yaml @@ -9,18 +9,18 @@ - name: test login via ssh with new user expect: - command: - ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_port | default(22) - }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper + command: >- + ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_port | default(22) }} \ + -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper show version' responses: (?i)password: pass123 - name: test login via ssh with invalid password (should fail) expect: - command: - ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_port | default(22) - }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper + command: >- + ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_port | default(22) }} \ + -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper show version' responses: (?i)password: badpass diff --git a/tests/integration/targets/vyos_user/tests/cli/basic.yaml b/tests/integration/targets/vyos_user/tests/cli/basic.yaml index edd3b5c..096edc0 100644 --- a/tests/integration/targets/vyos_user/tests/cli/basic.yaml +++ b/tests/integration/targets/vyos_user/tests/cli/basic.yaml @@ -34,8 +34,7 @@ - assert: that: - result.changed == true - - result.commands == ["set system login user ansibletest2 level operator", - "set system login user ansibletest3 level operator"] + - result.commands == ["set system login user ansibletest2 level operator", "set system login user ansibletest3 level operator"] - name: Add user again (Idempotent) register: result @@ -79,5 +78,4 @@ - assert: that: - result.changed == true - - result.commands == ["delete system login user ansibletest1", "delete system - login user ansibletest2", "delete system login user ansibletest3"] + - result.commands == ["delete system login user ansibletest1", "delete system login user ansibletest2", "delete system login user ansibletest3"] diff --git a/tests/unit/mock/loader.py b/tests/unit/mock/loader.py index 2828f38..67b84c6 100644 --- a/tests/unit/mock/loader.py +++ b/tests/unit/mock/loader.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type import os diff --git a/tests/unit/mock/path.py b/tests/unit/mock/path.py index 3962f24..1f1b7f0 100644 --- a/tests/unit/mock/path.py +++ b/tests/unit/mock/path.py @@ -1,8 +1,10 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type from ansible.utils.path import unfrackpath from ansible_collections.vyos.vyos.tests.unit.compat.mock import MagicMock + mock_unfrackpath_noop = MagicMock(spec_set=unfrackpath, side_effect=lambda x, *args, **kwargs: x) diff --git a/tests/unit/mock/procenv.py b/tests/unit/mock/procenv.py index 06987e3..d7f3dc9 100644 --- a/tests/unit/mock/procenv.py +++ b/tests/unit/mock/procenv.py @@ -19,10 +19,12 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type import json import sys + from contextlib import contextmanager from io import BytesIO, StringIO diff --git a/tests/unit/mock/vault_helper.py b/tests/unit/mock/vault_helper.py index 4c6c890..6006ba9 100644 --- a/tests/unit/mock/vault_helper.py +++ b/tests/unit/mock/vault_helper.py @@ -14,6 +14,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from ansible.module_utils._text import to_bytes diff --git a/tests/unit/mock/yaml_helper.py b/tests/unit/mock/yaml_helper.py index 540055d..2e85759 100644 --- a/tests/unit/mock/yaml_helper.py +++ b/tests/unit/mock/yaml_helper.py @@ -1,9 +1,11 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type import io import yaml + from ansible.module_utils.six import PY3 from ansible.parsing.yaml.dumper import AnsibleDumper from ansible.parsing.yaml.loader import AnsibleLoader @@ -115,10 +117,14 @@ class YamlTestUtils(object): yaml_string_obj_from_string = yaml.dump(obj_from_string, Dumper=AnsibleDumper) else: yaml_string_obj_from_stream = yaml.dump( - obj_from_stream, Dumper=AnsibleDumper, encoding=None + obj_from_stream, + Dumper=AnsibleDumper, + encoding=None, ) yaml_string_obj_from_string = yaml.dump( - obj_from_string, Dumper=AnsibleDumper, encoding=None + obj_from_string, + Dumper=AnsibleDumper, + encoding=None, ) assert yaml_string == yaml_string_obj_from_stream diff --git a/tests/unit/modules/conftest.py b/tests/unit/modules/conftest.py index 013d198..41465c3 100644 --- a/tests/unit/modules/conftest.py +++ b/tests/unit/modules/conftest.py @@ -2,11 +2,13 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function + __metaclass__ = type import json import pytest + from ansible.module_utils._text import to_bytes from ansible.module_utils.common._collections_compat import MutableMapping from ansible.module_utils.six import string_types diff --git a/tests/unit/modules/network/vyos/test_vyos_banner.py b/tests/unit/modules/network/vyos/test_vyos_banner.py index f054ee0..d418a27 100644 --- a/tests/unit/modules/network/vyos/test_vyos_banner.py +++ b/tests/unit/modules/network/vyos/test_vyos_banner.py @@ -16,6 +16,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -33,12 +34,12 @@ class TestVyosBannerModule(TestVyosModule): super(TestVyosBannerModule, self).setUp() self.mock_get_config = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_banner.get_config" + "ansible_collections.vyos.vyos.plugins.modules.vyos_banner.get_config", ) self.get_config = self.mock_get_config.start() self.mock_load_config = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_banner.load_config" + "ansible_collections.vyos.vyos.plugins.modules.vyos_banner.load_config", ) self.load_config = self.mock_load_config.start() diff --git a/tests/unit/modules/network/vyos/test_vyos_bgp_address_family.py b/tests/unit/modules/network/vyos/test_vyos_bgp_address_family.py index 9ef28aa..87b3ad9 100644 --- a/tests/unit/modules/network/vyos/test_vyos_bgp_address_family.py +++ b/tests/unit/modules/network/vyos/test_vyos_bgp_address_family.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -34,13 +35,13 @@ class TestVyosBgpafModule(TestVyosModule): def setUp(self): super(TestVyosBgpafModule, self).setUp() self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection", ) self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_execute_show_command = patch( "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts." - + "bgp_address_family.bgp_address_family.Bgp_address_familyFacts.get_device_data" + + "bgp_address_family.bgp_address_family.Bgp_address_familyFacts.get_device_data", ) self.execute_show_command = self.mock_execute_show_command.start() @@ -95,12 +96,12 @@ class TestVyosBgpafModule(TestVyosModule): dict( afi="ipv6", attribute_unchanged=dict(next_hop=True), - ) + ), ], ), ], - ) - ) + ), + ), ) self.execute_module(changed=False, commands=[]) @@ -142,12 +143,12 @@ class TestVyosBgpafModule(TestVyosModule): dict(action="export", path_list="list01"), ], capability=dict(orf="send"), - ) + ), ], ), ], - ) - ) + ), + ), ) commands = [ "set protocols bgp 65536 address-family ipv4-unicast aggregate-address 192.0.2.0/24 as-setipv4-unicast aggregate-address 192.0.2.0/24 summary-only", @@ -196,12 +197,12 @@ class TestVyosBgpafModule(TestVyosModule): dict( afi="ipv6", attribute_unchanged=dict(next_hop=True), - ) + ), ], ), ], ), - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -257,12 +258,12 @@ class TestVyosBgpafModule(TestVyosModule): dict(action="export", path_list="list01"), ], capability=dict(orf="send"), - ) + ), ], ), ], ), - ) + ), ) commands = [ "delete protocols bgp 65536 neighbor 203.0.113.5 address-family ipv6-unicast attribute-unchanged", @@ -316,12 +317,12 @@ class TestVyosBgpafModule(TestVyosModule): dict( afi="ipv6", attribute_unchanged=dict(next_hop=True), - ) + ), ], ), ], ), - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -360,7 +361,7 @@ class TestVyosBgpafModule(TestVyosModule): ), ], ), - ) + ), ) commands = [ "delete protocols bgp 65536 neighbor 203.0.113.5 address-family", @@ -400,7 +401,7 @@ class TestVyosBgpafModule(TestVyosModule): ), ], ), - ) + ), ) commands = [ "delete protocols bgp 65536 address-family ipv4-unicast", @@ -445,7 +446,7 @@ class TestVyosBgpafModule(TestVyosModule): ), ], ), - ) + ), ) result = self.execute_module(failed=True) self.assertIn("Only one bgp instance is allowed per device", result["msg"]) @@ -487,12 +488,12 @@ class TestVyosBgpafModule(TestVyosModule): dict( afi="ipv6", attribute_unchanged=dict(next_hop=True), - ) + ), ], ), ], ), - ) + ), ) rendered_cmds = [ @@ -554,7 +555,7 @@ class TestVyosBgpafModule(TestVyosModule): { "afi": "ipv6", "attribute_unchanged": {"next_hop": True}, - } + }, ], }, ], @@ -593,7 +594,7 @@ class TestVyosBgpafModule(TestVyosModule): { "afi": "ipv6", "attribute_unchanged": {"next_hop": True}, - } + }, ], }, ], diff --git a/tests/unit/modules/network/vyos/test_vyos_bgp_global.py b/tests/unit/modules/network/vyos/test_vyos_bgp_global.py index 830fd38..99d17ce 100644 --- a/tests/unit/modules/network/vyos/test_vyos_bgp_global.py +++ b/tests/unit/modules/network/vyos/test_vyos_bgp_global.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -35,22 +36,22 @@ class TestVyosBgpglobalModule(TestVyosModule): super(TestVyosBgpglobalModule, self).setUp() self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection", ) self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_execute_show_command_config = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.config.bgp_global.bgp_global.Bgp_global._get_config" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.config.bgp_global.bgp_global.Bgp_global._get_config", ) self.execute_show_command_config = self.mock_execute_show_command_config.start() self.mock_get_resource_connection_facts = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection", ) self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.bgp_global.bgp_global.Bgp_globalFacts.get_device_data" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.bgp_global.bgp_global.Bgp_globalFacts.get_device_data", ) self.execute_show_command = self.mock_execute_show_command.start() @@ -117,7 +118,7 @@ class TestVyosBgpglobalModule(TestVyosModule): ], ), state="merged", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -141,7 +142,7 @@ class TestVyosBgpglobalModule(TestVyosModule): dict(action="export", acl=31), dict(action="import", acl=9), ], - ) + ), ], bgp_params=dict( confederation=[dict(peers=20), dict(identifier=66)], @@ -149,7 +150,7 @@ class TestVyosBgpglobalModule(TestVyosModule): ), ), state="merged", - ) + ), ) commands = [ "set protocols bgp 65536 neighbor 2001:db8::2 distribute-list export 31", @@ -205,7 +206,7 @@ class TestVyosBgpglobalModule(TestVyosModule): ], ), state="replaced", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -242,7 +243,7 @@ class TestVyosBgpglobalModule(TestVyosModule): ), ), state="replaced", - ) + ), ) commands = [ "delete protocols bgp 65536 parameters default", @@ -308,7 +309,7 @@ class TestVyosBgpglobalModule(TestVyosModule): ), ), state="replaced", - ) + ), ) result = self.execute_module(failed=True) self.assertIn("Only one bgp instance is allowed per device", result["msg"]) @@ -345,7 +346,7 @@ class TestVyosBgpglobalModule(TestVyosModule): ), ), state="replaced", - ) + ), ) result = self.execute_module(failed=True, filename="vyos_bgp_global_af_config.cfg") self.assertIn( @@ -397,7 +398,7 @@ class TestVyosBgpglobalModule(TestVyosModule): ], ), state="rendered", - ) + ), ) rendered_cmds = [ "set protocols bgp 65536 neighbor 10.0.0.4 disable-connected-check", diff --git a/tests/unit/modules/network/vyos/test_vyos_command.py b/tests/unit/modules/network/vyos/test_vyos_command.py index 40db158..2c7cd32 100644 --- a/tests/unit/modules/network/vyos/test_vyos_command.py +++ b/tests/unit/modules/network/vyos/test_vyos_command.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -34,7 +35,7 @@ class TestVyosCommandModule(TestVyosModule): def setUp(self): super(TestVyosCommandModule, self).setUp() self.mock_run_commands = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_command.run_commands" + "ansible_collections.vyos.vyos.plugins.modules.vyos_command.run_commands", ) self.run_commands = self.mock_run_commands.start() diff --git a/tests/unit/modules/network/vyos/test_vyos_config.py b/tests/unit/modules/network/vyos/test_vyos_config.py index 743acab..4f1cac6 100644 --- a/tests/unit/modules/network/vyos/test_vyos_config.py +++ b/tests/unit/modules/network/vyos/test_vyos_config.py @@ -19,6 +19,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import MagicMock, patch @@ -37,22 +38,22 @@ class TestVyosConfigModule(TestVyosModule): super(TestVyosConfigModule, self).setUp() self.mock_get_config = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_config.get_config" + "ansible_collections.vyos.vyos.plugins.modules.vyos_config.get_config", ) self.get_config = self.mock_get_config.start() self.mock_load_config = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_config.load_config" + "ansible_collections.vyos.vyos.plugins.modules.vyos_config.load_config", ) self.load_config = self.mock_load_config.start() self.mock_run_commands = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_config.run_commands" + "ansible_collections.vyos.vyos.plugins.modules.vyos_config.run_commands", ) self.run_commands = self.mock_run_commands.start() self.mock_get_connection = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_config.get_connection" + "ansible_collections.vyos.vyos.plugins.modules.vyos_config.get_connection", ) self.get_connection = self.mock_get_connection.start() @@ -91,7 +92,7 @@ class TestVyosConfigModule(TestVyosModule): "delete interfaces ethernet eth0 address", ] self.conn.get_diff = MagicMock( - return_value=self.cliconf_obj.get_diff(candidate, self.running_config) + return_value=self.cliconf_obj.get_diff(candidate, self.running_config), ) self.execute_module(changed=True, commands=commands) @@ -116,7 +117,7 @@ class TestVyosConfigModule(TestVyosModule): set_module_args(dict(lines=commands)) candidate = "\n".join(commands) self.conn.get_diff = MagicMock( - return_value=self.cliconf_obj.get_diff(candidate, self.running_config) + return_value=self.cliconf_obj.get_diff(candidate, self.running_config), ) self.execute_module(changed=True, commands=commands) @@ -136,6 +137,6 @@ class TestVyosConfigModule(TestVyosModule): set_module_args(dict(lines=lines, match="none")) candidate = "\n".join(lines) self.conn.get_diff = MagicMock( - return_value=self.cliconf_obj.get_diff(candidate, None, diff_match="none") + return_value=self.cliconf_obj.get_diff(candidate, None, diff_match="none"), ) self.execute_module(changed=True, commands=lines, sort=False) diff --git a/tests/unit/modules/network/vyos/test_vyos_facts.py b/tests/unit/modules/network/vyos/test_vyos_facts.py index 691d7cf..dd3a796 100644 --- a/tests/unit/modules/network/vyos/test_vyos_facts.py +++ b/tests/unit/modules/network/vyos/test_vyos_facts.py @@ -17,8 +17,10 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type import json + from unittest.mock import patch from ansible_collections.vyos.vyos.plugins.modules import vyos_facts @@ -33,17 +35,17 @@ class TestVyosFactsModule(TestVyosModule): def setUp(self): super(TestVyosFactsModule, self).setUp() self.mock_run_commands = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.legacy.base.run_commands" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.legacy.base.run_commands", ) self.run_commands = self.mock_run_commands.start() self.mock_get_resource_connection = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection", ) self.get_resource_connection = self.mock_get_resource_connection.start() self.mock_get_capabilities = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.legacy.base.get_capabilities" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.legacy.base.get_capabilities", ) self.get_capabilities = self.mock_get_capabilities.start() self.get_capabilities.return_value = { diff --git a/tests/unit/modules/network/vyos/test_vyos_firewall_global.py b/tests/unit/modules/network/vyos/test_vyos_firewall_global.py index 71b3a18..25c5632 100644 --- a/tests/unit/modules/network/vyos/test_vyos_firewall_global.py +++ b/tests/unit/modules/network/vyos/test_vyos_firewall_global.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -34,27 +35,27 @@ class TestVyosFirewallRulesModule(TestVyosModule): def setUp(self): super(TestVyosFirewallRulesModule, self).setUp() self.mock_get_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config", ) self.get_config = self.mock_get_config.start() self.mock_load_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config", ) self.load_config = self.mock_load_config.start() self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection", ) self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection", ) self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.firewall_global.firewall_global.Firewall_globalFacts.get_device_data" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.firewall_global.firewall_global.Firewall_globalFacts.get_device_data", ) self.execute_show_command = self.mock_execute_show_command.start() @@ -96,7 +97,7 @@ class TestVyosFirewallRulesModule(TestVyosModule): afi="ipv4", ip_src_route=True, icmp_redirects=dict(send=True, receive=False), - ) + ), ], group=dict( address_group=[ @@ -141,12 +142,12 @@ class TestVyosFirewallRulesModule(TestVyosModule): name="TELNET", description="This group has the telnet ports", members=[dict(port="23")], - ) + ), ], ), ), state="merged", - ) + ), ) commands = [ "set firewall group address-group MGMT-HOSTS address 192.0.1.1", @@ -228,12 +229,12 @@ class TestVyosFirewallRulesModule(TestVyosModule): name="SSH", description="This group has the ssh ports", members=[dict(port="22")], - ) + ), ], - ) + ), ), state="merged", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -282,12 +283,12 @@ class TestVyosFirewallRulesModule(TestVyosModule): name="SSH", description="This group has the ssh ports", members=[dict(port="2222")], - ) + ), ], - ) + ), ), state="replaced", - ) + ), ) commands = [ "delete firewall group address-group RND-HOSTS address 192.0.2.3", @@ -346,12 +347,12 @@ class TestVyosFirewallRulesModule(TestVyosModule): name="SSH", description="This group has the ssh ports", members=[dict(port="22")], - ) + ), ], - ) + ), ), state="replaced", - ) + ), ) self.execute_module(changed=False, commands=[]) diff --git a/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py b/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py index 10d93ca..3034d58 100644 --- a/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py +++ b/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -34,28 +35,28 @@ class TestVyosFirewallInterfacesModule(TestVyosModule): def setUp(self): super(TestVyosFirewallInterfacesModule, self).setUp() self.mock_get_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config", ) self.get_config = self.mock_get_config.start() self.mock_load_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config", ) self.load_config = self.mock_load_config.start() self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection", ) self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection", ) self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos." - "facts.firewall_interfaces.firewall_interfaces.Firewall_interfacesFacts.get_device_data" + "facts.firewall_interfaces.firewall_interfaces.Firewall_interfacesFacts.get_device_data", ) self.execute_show_command = self.mock_execute_show_command.start() @@ -113,7 +114,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule): ), ], state="merged", - ) + ), ) commands = [ "set interfaces ethernet eth1 firewall in name 'INBOUND'", @@ -167,7 +168,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule): ), ], state="merged", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -178,10 +179,10 @@ class TestVyosFirewallInterfacesModule(TestVyosModule): dict( name="eth0", access_rules=[dict(afi="ipv4"), dict(afi="ipv6")], - ) + ), ], state="deleted", - ) + ), ) commands = [ "delete interfaces ethernet eth0 firewall in name", @@ -259,7 +260,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule): ), ], state="replaced", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -308,7 +309,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule): ), ], state="replaced", - ) + ), ) commands = [ "delete interfaces ethernet eth0 firewall out name", @@ -330,12 +331,12 @@ class TestVyosFirewallInterfacesModule(TestVyosModule): dict( afi="ipv4", rules=[dict(name="INBOUND", direction="in")], - ) + ), ], - ) + ), ], state="overridden", - ) + ), ) commands = [ "delete interfaces ethernet eth0 firewall", @@ -384,6 +385,6 @@ class TestVyosFirewallInterfacesModule(TestVyosModule): ), ], state="overridden", - ) + ), ) self.execute_module(changed=False, commands=[]) diff --git a/tests/unit/modules/network/vyos/test_vyos_firewall_rules.py b/tests/unit/modules/network/vyos/test_vyos_firewall_rules.py index 18da678..b43b11c 100644 --- a/tests/unit/modules/network/vyos/test_vyos_firewall_rules.py +++ b/tests/unit/modules/network/vyos/test_vyos_firewall_rules.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -34,35 +35,35 @@ class TestVyosFirewallRulesModule(TestVyosModule): def setUp(self): super(TestVyosFirewallRulesModule, self).setUp() self.mock_get_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config", ) self.get_config = self.mock_get_config.start() self.mock_load_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config", ) self.load_config = self.mock_load_config.start() self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection", ) self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection", ) self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.static_routes.static_routes.Static_routesFacts.get_device_data" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.static_routes.static_routes.Static_routesFacts.get_device_data", ) self.mock_execute_show_command = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.firewall_rules.firewall_rules.Firewall_rulesFacts.get_device_data" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.firewall_rules.firewall_rules.Firewall_rulesFacts.get_device_data", ) self.execute_show_command = self.mock_execute_show_command.start() self.mock_get_os_version = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.config.firewall_rules.firewall_rules.Firewall_rules._get_os_version" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.config.firewall_rules.firewall_rules.Firewall_rules._get_os_version", ) self.get_os_version = self.mock_get_os_version.start() self.get_os_version.return_value = "Vyos 1.2" @@ -126,7 +127,7 @@ class TestVyosFirewallRulesModule(TestVyosModule): ), ], state="merged", - ) + ), ) commands = [ "set firewall ipv6-name V6-INBOUND default-action 'reject'", @@ -186,7 +187,7 @@ class TestVyosFirewallRulesModule(TestVyosModule): ), ], state="merged", - ) + ), ) commands = [ "set firewall ipv6-name V6-INBOUND default-action 'reject'", @@ -224,14 +225,14 @@ class TestVyosFirewallRulesModule(TestVyosModule): protocol="icmp", fragment="match-frag", disable=True, - ) + ), ], ), ], - ) + ), ], state="merged", - ) + ), ) commands = [ "set firewall name INBOUND default-action 'accept'", @@ -278,14 +279,14 @@ class TestVyosFirewallRulesModule(TestVyosModule): invalid=True, new=True, ), - ) + ), ], ), ], - ) + ), ], state="merged", - ) + ), ) commands = [ "set firewall name INBOUND rule 101 protocol 'tcp'", @@ -323,23 +324,23 @@ class TestVyosFirewallRulesModule(TestVyosModule): address_group="OUT-ADDR-GROUP", network_group="OUT-NET-GROUP", port_group="OUT-PORT-GROUP", - ) + ), ), source=dict( group=dict( address_group="IN-ADDR-GROUP", network_group="IN-NET-GROUP", port_group="IN-PORT-GROUP", - ) + ), ), - ) + ), ], ), ], - ) + ), ], state="merged", - ) + ), ) commands = [ "set firewall name INBOUND rule 101 source group address-group IN-ADDR-GROUP", @@ -374,14 +375,14 @@ class TestVyosFirewallRulesModule(TestVyosModule): utc=True, ), tcp=dict(flags="ALL"), - ) + ), ], ), ], - ) + ), ], state="merged", - ) + ), ) commands = [ "set firewall name INBOUND rule 101", @@ -417,14 +418,14 @@ class TestVyosFirewallRulesModule(TestVyosModule): protocol="icmp", disabled=True, icmp=dict(type_name="echo-request"), - ) + ), ], ), ], - ) + ), ], state="merged", - ) + ), ) commands = [ "set firewall ipv6-name INBOUND default-action 'accept'", @@ -470,14 +471,14 @@ class TestVyosFirewallRulesModule(TestVyosModule): invalid=True, new=True, ), - ) + ), ], ), ], - ) + ), ], state="merged", - ) + ), ) commands = [ "set firewall ipv6-name INBOUND rule 101 protocol 'tcp'", @@ -515,23 +516,23 @@ class TestVyosFirewallRulesModule(TestVyosModule): address_group="OUT-ADDR-GROUP", network_group="OUT-NET-GROUP", port_group="OUT-PORT-GROUP", - ) + ), ), source=dict( group=dict( address_group="IN-ADDR-GROUP", network_group="IN-NET-GROUP", port_group="IN-PORT-GROUP", - ) + ), ), - ) + ), ], ), ], - ) + ), ], state="merged", - ) + ), ) commands = [ "set firewall ipv6-name INBOUND rule 101 source group address-group IN-ADDR-GROUP", @@ -566,14 +567,14 @@ class TestVyosFirewallRulesModule(TestVyosModule): utc=True, ), tcp=dict(flags="ALL"), - ) + ), ], ), ], - ) + ), ], state="merged", - ) + ), ) commands = [ "set firewall ipv6-name INBOUND rule 101", @@ -602,14 +603,14 @@ class TestVyosFirewallRulesModule(TestVyosModule): number="101", protocol="icmp", icmp=dict(type_name="port-unreachable"), - ) + ), ], ), ], - ) + ), ], state="merged", - ) + ), ) commands = [ "set firewall ipv6-name INBOUND rule 101 icmpv6 type port-unreachable", @@ -632,14 +633,14 @@ class TestVyosFirewallRulesModule(TestVyosModule): number="101", protocol="icmp", icmp=dict(type=1, code=1), - ) + ), ], ), ], - ) + ), ], state="merged", - ) + ), ) commands = [ "set firewall name INBOUND rule 101 icmp type 1", @@ -663,14 +664,14 @@ class TestVyosFirewallRulesModule(TestVyosModule): number="101", protocol="icmp", icmp=dict(type_name="echo-request"), - ) + ), ], ), ], - ) + ), ], state="merged", - ) + ), ) commands = [ "set firewall name INBOUND rule 101 icmp type-name echo-request", @@ -684,7 +685,7 @@ class TestVyosFirewallRulesModule(TestVyosModule): dict( config=[dict(afi="ipv4", rule_sets=[dict(name="V4-INGRESS")])], state="deleted", - ) + ), ) commands = ["delete firewall name V4-INGRESS"] self.execute_module(changed=True, commands=commands) @@ -697,7 +698,7 @@ class TestVyosFirewallRulesModule(TestVyosModule): dict(afi="ipv6", rule_sets=[dict(name="V6-INGRESS")]), ], state="deleted", - ) + ), ) commands = [ "delete firewall name V4-INGRESS", @@ -718,7 +719,7 @@ class TestVyosFirewallRulesModule(TestVyosModule): dict(afi="ipv6", rule_sets=[dict(name="V6-ING")]), ], state="deleted", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -771,14 +772,14 @@ class TestVyosFirewallRulesModule(TestVyosModule): dict( icmp=dict(type_name="echo-request"), number=20, - ) + ), ], ), ], ), ], state="replaced", - ) + ), ) commands = [ "delete firewall name V4-INGRESS rule 101 disable", @@ -836,14 +837,14 @@ class TestVyosFirewallRulesModule(TestVyosModule): dict( icmp=dict(type_name="echo-request"), number=20, - ) + ), ], ), ], ), ], state="replaced", - ) + ), ) commands = [ "delete firewall name V4-INGRESS enable-default-log", @@ -871,7 +872,7 @@ class TestVyosFirewallRulesModule(TestVyosModule): protocol="icmp", fragment="match-frag", disabled=True, - ) + ), ], ), dict( @@ -894,14 +895,14 @@ class TestVyosFirewallRulesModule(TestVyosModule): dict( icmp=dict(type_name="echo-request"), number=20, - ) + ), ], ), ], ), ], state="replaced", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -933,7 +934,7 @@ class TestVyosFirewallRulesModule(TestVyosModule): ), ], state="replaced", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -958,7 +959,7 @@ class TestVyosFirewallRulesModule(TestVyosModule): protocol="icmp", fragment="match-frag", disabled=True, - ) + ), ], ), dict( @@ -981,14 +982,14 @@ class TestVyosFirewallRulesModule(TestVyosModule): dict( icmp=dict(type_name="echo-request"), number=20, - ) + ), ], ), ], ), ], state="merged", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -1019,7 +1020,7 @@ class TestVyosFirewallRulesModule(TestVyosModule): address_group="IN-ADDR-GROUP", network_group="IN-NET-GROUP", port_group="IN-PORT-GROUP", - ) + ), ), ), dict( @@ -1050,7 +1051,7 @@ class TestVyosFirewallRulesModule(TestVyosModule): ), ], state="overridden", - ) + ), ) commands = [ "delete firewall ipv6-name V6-INGRESS", @@ -1103,7 +1104,7 @@ class TestVyosFirewallRulesModule(TestVyosModule): protocol="icmp", fragment="match-frag", disabled=True, - ) + ), ], ), dict( @@ -1126,14 +1127,14 @@ class TestVyosFirewallRulesModule(TestVyosModule): dict( icmp=dict(type_name="echo-request"), number=20, - ) + ), ], ), ], ), ], state="overridden", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -1159,14 +1160,14 @@ class TestVyosFirewallRulesModule(TestVyosModule): protocol="icmp", disabled=True, icmp=dict(type_name="echo-request"), - ) + ), ], ), ], - ) + ), ], state="merged", - ) + ), ) commands = [ "set firewall ipv6-name INBOUND default-action 'accept'", diff --git a/tests/unit/modules/network/vyos/test_vyos_hostname.py b/tests/unit/modules/network/vyos/test_vyos_hostname.py index c7edc26..a056f6b 100644 --- a/tests/unit/modules/network/vyos/test_vyos_hostname.py +++ b/tests/unit/modules/network/vyos/test_vyos_hostname.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -35,17 +36,17 @@ class TestVyosHostnameModule(TestVyosModule): super(TestVyosHostnameModule, self).setUp() self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection", ) self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection", ) self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.hostname.hostname.HostnameFacts.get_config" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.hostname.hostname.HostnameFacts.get_config", ) self.execute_show_command = self.mock_execute_show_command.start() diff --git a/tests/unit/modules/network/vyos/test_vyos_interfaces.py b/tests/unit/modules/network/vyos/test_vyos_interfaces.py index 06bbefa..affb4f8 100644 --- a/tests/unit/modules/network/vyos/test_vyos_interfaces.py +++ b/tests/unit/modules/network/vyos/test_vyos_interfaces.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -34,28 +35,28 @@ class TestVyosFirewallInterfacesModule(TestVyosModule): def setUp(self): super(TestVyosFirewallInterfacesModule, self).setUp() self.mock_get_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config", ) self.get_config = self.mock_get_config.start() self.mock_load_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config", ) self.load_config = self.mock_load_config.start() self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection", ) self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection", ) self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos." - "facts.interfaces.interfaces.InterfacesFacts.get_device_data" + "facts.interfaces.interfaces.InterfacesFacts.get_device_data", ) self.execute_show_command = self.mock_execute_show_command.start() @@ -82,7 +83,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule): dict(name="wg01", description="wg - 1", enabled=True), ], state="merged", - ) + ), ) commands = [ @@ -103,7 +104,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule): ), ], state="merged", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -122,7 +123,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule): dict(name="eth1", description="Configured by Ansible"), ], state="merged", - ) + ), ) commands = [ @@ -147,7 +148,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule): dict(name="eth1", description="Configured by Ansible"), ], state="replaced", - ) + ), ) commands = [ @@ -172,7 +173,7 @@ class TestVyosFirewallInterfacesModule(TestVyosModule): dict(name="eth1", description="Configured by Ansible"), ], state="overridden", - ) + ), ) commands = [ diff --git a/tests/unit/modules/network/vyos/test_vyos_logging_global.py b/tests/unit/modules/network/vyos/test_vyos_logging_global.py index 209844e..872769e 100644 --- a/tests/unit/modules/network/vyos/test_vyos_logging_global.py +++ b/tests/unit/modules/network/vyos/test_vyos_logging_global.py @@ -5,6 +5,7 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type from textwrap import dedent @@ -23,17 +24,17 @@ class TestVyosLoggingGlobalModule(TestVyosModule): super(TestVyosLoggingGlobalModule, self).setUp() self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection", ) self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection", ) self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.logging_global.logging_global.Logging_globalFacts.get_logging_data" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.logging_global.logging_global.Logging_globalFacts.get_logging_data", ) self.execute_show_command = self.mock_execute_show_command.start() @@ -68,7 +69,7 @@ class TestVyosLoggingGlobalModule(TestVyosModule): set system syslog user paul facility local7 level 'err' set system syslog user vyos facility local6 level 'alert' set system syslog user vyos facility local7 level 'debug' - """ + """, ) playbook = dict( config=dict( @@ -77,7 +78,7 @@ class TestVyosLoggingGlobalModule(TestVyosModule): dict(facility="all"), dict(facility="local7", severity="err"), dict(facility="news", severity="debug"), - ] + ], ), files=[ dict(path="xyz"), @@ -127,7 +128,7 @@ class TestVyosLoggingGlobalModule(TestVyosModule): dict(facility="local7", severity="debug"), ], ), - ) + ), ) compare_cmds = [] playbook["state"] = "merged" @@ -140,7 +141,7 @@ class TestVyosLoggingGlobalModule(TestVyosModule): def test_vyos_logging_global_merged(self): self.execute_show_command.return_value = dedent( """\ - """ + """, ) playbook = dict( config=dict( @@ -149,7 +150,7 @@ class TestVyosLoggingGlobalModule(TestVyosModule): dict(facility="all"), dict(facility="local7", severity="err"), dict(facility="news", severity="debug"), - ] + ], ), files=[ dict(path="xyz"), @@ -199,7 +200,7 @@ class TestVyosLoggingGlobalModule(TestVyosModule): dict(facility="local7", severity="debug"), ], ), - ) + ), ) compare_cmds = [ "set system syslog user paul facility local7 level err", @@ -254,7 +255,7 @@ class TestVyosLoggingGlobalModule(TestVyosModule): set system syslog user paul facility local7 level 'err' set system syslog user vyos facility local6 level 'alert' set system syslog user vyos facility local7 level 'debug' - """ + """, ) playbook = dict(config=dict()) compare_cmds = ["delete system syslog"] @@ -291,7 +292,7 @@ class TestVyosLoggingGlobalModule(TestVyosModule): set system syslog user paul facility local7 level 'err' set system syslog user vyos facility local6 level 'alert' set system syslog user vyos facility local7 level 'debug' - """ + """, ) playbook = dict( config=dict( @@ -304,9 +305,9 @@ class TestVyosLoggingGlobalModule(TestVyosModule): dict(facility="local6", severity="err"), dict(facility="local7", severity="emerg"), ], - ) + ), ], - ) + ), ) compare_cmds = [ "delete system syslog console facility all", @@ -344,7 +345,7 @@ class TestVyosLoggingGlobalModule(TestVyosModule): self.execute_show_command.return_value = dedent( """\ set system syslog console facility local6 - """ + """, ) playbook = dict(config=dict(console=dict(facilities=[dict(facility="local6")]))) compare_cmds = [] @@ -359,7 +360,7 @@ class TestVyosLoggingGlobalModule(TestVyosModule): """\ set system syslog console set system syslog global - """ + """, ) playbook = dict( config=dict( @@ -372,9 +373,9 @@ class TestVyosLoggingGlobalModule(TestVyosModule): dict(facility="local6", severity="err"), dict(facility="local7", severity="emerg"), ], - ) + ), ], - ) + ), ) compare_cmds = [ "set system syslog console facility local7 level emerg", @@ -397,13 +398,13 @@ class TestVyosLoggingGlobalModule(TestVyosModule): dict( hostname="10.0.2.16", facilities=[dict(facility="local6")], - ) + ), ], users=[ dict(username="vyos"), dict(username="paul", facilities=[dict(facility="local7")]), ], - ) + ), ) compare_cmds = [ "set system syslog console facility all", @@ -424,10 +425,10 @@ class TestVyosLoggingGlobalModule(TestVyosModule): """\ set system syslog console facility all set system syslog file xyz - """ + """, ), state="parsed", - ) + ), ) parsed = dict( console=dict(facilities=[dict(facility="all")]), @@ -441,7 +442,7 @@ class TestVyosLoggingGlobalModule(TestVyosModule): self.execute_show_command.return_value = dedent( """\ set system syslog console facility all - """ + """, ) set_module_args(dict(state="gathered")) gathered = dict(console=dict(facilities=[dict(facility="all")])) diff --git a/tests/unit/modules/network/vyos/test_vyos_ntp_global.py b/tests/unit/modules/network/vyos/test_vyos_ntp_global.py index 37c851d..6609c2f 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ntp_global.py +++ b/tests/unit/modules/network/vyos/test_vyos_ntp_global.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -35,17 +36,17 @@ class TestVyosNTPModule(TestVyosModule): super(TestVyosNTPModule, self).setUp() self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection", ) self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection", ) self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.ntp_global.ntp_global.Ntp_globalFacts.get_config" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.ntp_global.ntp_global.Ntp_globalFacts.get_config", ) self.execute_show_command = self.mock_execute_show_command.start() @@ -81,7 +82,7 @@ class TestVyosNTPModule(TestVyosModule): ], ), state="merged", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -105,7 +106,7 @@ class TestVyosNTPModule(TestVyosModule): ], ), state="merged", - ) + ), ) commands = [ @@ -146,7 +147,7 @@ class TestVyosNTPModule(TestVyosModule): ], ), state="replaced", - ) + ), ) commands = [ "delete system ntp allow-clients address 10.1.1.0/24", @@ -183,7 +184,7 @@ class TestVyosNTPModule(TestVyosModule): ], ), state="replaced", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -202,7 +203,7 @@ class TestVyosNTPModule(TestVyosModule): ], ), state="overridden", - ) + ), ) commands = [ "delete system ntp allow-clients address 10.1.1.0/24", @@ -234,7 +235,7 @@ class TestVyosNTPModule(TestVyosModule): ], ), state="overridden", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -253,7 +254,7 @@ class TestVyosNTPModule(TestVyosModule): ], ), state="rendered", - ) + ), ) rendered_commands = [ "set system ntp allow-clients address 10.7.7.0/24", @@ -334,7 +335,7 @@ class TestVyosNTPModule(TestVyosModule): ], ), state="deleted", - ) + ), ) commands = [ "delete system ntp allow-clients", diff --git a/tests/unit/modules/network/vyos/test_vyos_ospf_interfaces.py b/tests/unit/modules/network/vyos/test_vyos_ospf_interfaces.py index 248b98e..1d12a3c 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ospf_interfaces.py +++ b/tests/unit/modules/network/vyos/test_vyos_ospf_interfaces.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -34,12 +35,12 @@ class TestVyosOspfInterfacesModule(TestVyosModule): def setUp(self): super(TestVyosOspfInterfacesModule, self).setUp() self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection", ) self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_execute_show_command = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.ospf_interfaces.ospf_interfaces.Ospf_interfacesFacts.get_device_data" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.ospf_interfaces.ospf_interfaces.Ospf_interfacesFacts.get_device_data", ) self.execute_show_command = self.mock_execute_show_command.start() @@ -91,7 +92,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule): ), ], state="merged", - ) + ), ) commands = [ "set interfaces bonding bond2 ip ospf transmit-delay 9", @@ -124,7 +125,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule): ], ), ], - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -149,7 +150,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule): ], ), ], - ) + ), ) commands = [ "set interfaces ethernet eth0 ipv6 ospfv3 cost 500", @@ -185,7 +186,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule): ), ], state="replaced", - ) + ), ) commands = [ "set interfaces bonding bond2 ip ospf transmit-delay 9", @@ -220,7 +221,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule): ), ], state="replaced", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -251,7 +252,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule): ), ], state="overridden", - ) + ), ) commands = [ "set interfaces bonding bond2 ip ospf transmit-delay 9", @@ -288,7 +289,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule): ), ], state="overridden", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -301,7 +302,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule): ), ], state="deleted", - ) + ), ) commands = ["delete interfaces ethernet eth0 ipv6 ospfv3"] self.execute_module(changed=True, commands=commands) @@ -315,7 +316,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule): ), ], state="deleted", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -347,7 +348,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule): ), ], state="rendered", - ) + ), ) commands = [ "set interfaces ethernet eth0 ip ospf cost 100", @@ -389,7 +390,7 @@ class TestVyosOspfInterfacesModule(TestVyosModule): "md5_key": { "key": "1111111111232345", "key_id": 10, - } + }, }, "bandwidth": 70, "transmit_delay": 45, diff --git a/tests/unit/modules/network/vyos/test_vyos_ospfv2.py b/tests/unit/modules/network/vyos/test_vyos_ospfv2.py index d2ddb40..ec4018e 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ospfv2.py +++ b/tests/unit/modules/network/vyos/test_vyos_ospfv2.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -34,27 +35,27 @@ class TestVyosOspfv2Module(TestVyosModule): def setUp(self): super(TestVyosOspfv2Module, self).setUp() self.mock_get_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config", ) self.get_config = self.mock_get_config.start() self.mock_load_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config", ) self.load_config = self.mock_load_config.start() self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection", ) self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection", ) self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.ospfv2.ospfv2.Ospfv2Facts.get_device_data" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.ospfv2.ospfv2.Ospfv2Facts.get_device_data", ) self.execute_show_command = self.mock_execute_show_command.start() @@ -103,7 +104,7 @@ class TestVyosOspfv2Module(TestVyosModule): ], ), state="merged", - ) + ), ) commands = [ "set protocols ospf mpls-te enable", @@ -147,7 +148,7 @@ class TestVyosOspfv2Module(TestVyosModule): ], ), state="merged", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -177,7 +178,7 @@ class TestVyosOspfv2Module(TestVyosModule): ], ), state="merged", - ) + ), ) commands = [ "delete protocols ospf area 14 area-type stub", @@ -212,7 +213,7 @@ class TestVyosOspfv2Module(TestVyosModule): ], ), state="replaced", - ) + ), ) commands = [ "set protocols ospf mpls-te enable", @@ -255,7 +256,7 @@ class TestVyosOspfv2Module(TestVyosModule): ], ), state="replaced", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -346,7 +347,7 @@ set protocols ospf redistribute bgp metric-type '2'""" "metric": 10, "metric_type": 2, "route_map": "ingress", - } + }, }, "log_adjacency_changes": "detail", "max_metric": { @@ -354,7 +355,7 @@ set protocols ospf redistribute bgp metric-type '2'""" "administrative": True, "on_shutdown": 10, "on_startup": 10, - } + }, }, "mpls_te": {"enabled": True, "router_address": "192.0.11.11"}, "neighbor": [ @@ -362,7 +363,7 @@ set protocols ospf redistribute bgp metric-type '2'""" "neighbor_id": "192.0.11.12", "poll_interval": 10, "priority": 2, - } + }, ], "parameters": { "abr_type": "cisco", @@ -401,7 +402,7 @@ set protocols ospf redistribute bgp metric-type '2'""" ], ), state="rendered", - ) + ), ) commands = [ "set protocols ospf mpls-te enable", diff --git a/tests/unit/modules/network/vyos/test_vyos_ospfv3.py b/tests/unit/modules/network/vyos/test_vyos_ospfv3.py index 0002451..1cf0260 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ospfv3.py +++ b/tests/unit/modules/network/vyos/test_vyos_ospfv3.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -34,27 +35,27 @@ class TestVyosOspfv3Module(TestVyosModule): def setUp(self): super(TestVyosOspfv3Module, self).setUp() self.mock_get_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config", ) self.get_config = self.mock_get_config.start() self.mock_load_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config", ) self.load_config = self.mock_load_config.start() self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection", ) self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection", ) self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.ospfv3.ospfv3.Ospfv3Facts.get_device_data" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.ospfv3.ospfv3.Ospfv3Facts.get_device_data", ) self.execute_show_command = self.mock_execute_show_command.start() @@ -101,7 +102,7 @@ class TestVyosOspfv3Module(TestVyosModule): ], ), state="merged", - ) + ), ) commands = [ "set protocols ospfv3 redistribute bgp", @@ -139,7 +140,7 @@ class TestVyosOspfv3Module(TestVyosModule): ], ), state="merged", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -170,7 +171,7 @@ class TestVyosOspfv3Module(TestVyosModule): ], ), state="merged", - ) + ), ) commands = [ "set protocols ospfv3 redistribute bgp", @@ -203,7 +204,7 @@ class TestVyosOspfv3Module(TestVyosModule): ], ), state="replaced", - ) + ), ) commands = [ "set protocols ospfv3 redistribute bgp", @@ -238,7 +239,7 @@ class TestVyosOspfv3Module(TestVyosModule): ], ), state="replaced", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -321,7 +322,7 @@ set protocols ospfv3 redistribute 'bgp'""" ], ), state="rendered", - ) + ), ) commands = [ "set protocols ospfv3 redistribute bgp", diff --git a/tests/unit/modules/network/vyos/test_vyos_ping.py b/tests/unit/modules/network/vyos/test_vyos_ping.py index 25bb6cf..2821696 100644 --- a/tests/unit/modules/network/vyos/test_vyos_ping.py +++ b/tests/unit/modules/network/vyos/test_vyos_ping.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -34,7 +35,7 @@ class TestVyosPingModule(TestVyosModule): def setUp(self): super(TestVyosPingModule, self).setUp() self.mock_run_commands = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_ping.run_commands" + "ansible_collections.vyos.vyos.plugins.modules.vyos_ping.run_commands", ) self.run_commands = self.mock_run_commands.start() diff --git a/tests/unit/modules/network/vyos/test_vyos_prefix_lists.py b/tests/unit/modules/network/vyos/test_vyos_prefix_lists.py index 5c488ec..3da58f7 100644 --- a/tests/unit/modules/network/vyos/test_vyos_prefix_lists.py +++ b/tests/unit/modules/network/vyos/test_vyos_prefix_lists.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from textwrap import dedent @@ -47,12 +48,12 @@ class TestVyosPrefixListsModule(TestVyosModule): super(TestVyosPrefixListsModule, self).setUp() self.mock_get_resource_connection = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection", ) self.get_resource_connection = self.mock_get_resource_connection.start() self.mock_get_config = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.prefix_lists.prefix_lists.Prefix_listsFacts.get_config" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.prefix_lists.prefix_lists.Prefix_listsFacts.get_config", ) self.get_config = self.mock_get_config.start() @@ -65,7 +66,7 @@ class TestVyosPrefixListsModule(TestVyosModule): def test_vyos_prefix_lists_linear_merged(self): self.get_config.return_value = dedent( """\ - """ + """, ) set_module_args( dict( @@ -151,7 +152,7 @@ class TestVyosPrefixListsModule(TestVyosModule): ), ], state="merged", - ) + ), ) commands = [ "set policy prefix-list plist1", @@ -236,7 +237,7 @@ class TestVyosPrefixListsModule(TestVyosModule): set policy prefix-list6 plist4 rule 50 set policy prefix-list6 plist4 rule 50 action 'deny' set policy prefix-list6 plist4 rule 50 prefix '2001:db8:4000::/36' - """ + """, ) set_module_args( dict( @@ -322,7 +323,7 @@ class TestVyosPrefixListsModule(TestVyosModule): ), ], state="merged", - ) + ), ) result = self.execute_module(changed=False) self.assertEqual(result["commands"], []) @@ -368,7 +369,7 @@ class TestVyosPrefixListsModule(TestVyosModule): set policy prefix-list6 plist4 rule 50 set policy prefix-list6 plist4 rule 50 action 'deny' set policy prefix-list6 plist4 rule 50 prefix '2001:db8:4000::/36' - """ + """, ) set_module_args( dict( @@ -392,12 +393,12 @@ class TestVyosPrefixListsModule(TestVyosModule): prefix="72.168.2.0/24", ), ], - ) + ), ], - ) + ), ], state="replaced", - ) + ), ) commands = [ "delete policy prefix-list plist1 rule 10 description 'Test rule 10'", @@ -447,7 +448,7 @@ class TestVyosPrefixListsModule(TestVyosModule): set policy prefix-list6 plist4 rule 50 set policy prefix-list6 plist4 rule 50 action 'deny' set policy prefix-list6 plist4 rule 50 prefix '2001:db8:4000::/36' - """ + """, ) set_module_args( dict( @@ -462,14 +463,14 @@ class TestVyosPrefixListsModule(TestVyosModule): sequence=10, action="permit", prefix="82.168.10.0/26", - ) + ), ], - ) + ), ], - ) + ), ], state="replaced", - ) + ), ) commands = [ "delete policy prefix-list plist1 description 'Test plist1'", @@ -521,7 +522,7 @@ class TestVyosPrefixListsModule(TestVyosModule): set policy prefix-list6 plist4 rule 50 set policy prefix-list6 plist4 rule 50 action 'deny' set policy prefix-list6 plist4 rule 50 prefix '2001:db8:4000::/36' - """ + """, ) set_module_args( dict( @@ -536,14 +537,14 @@ class TestVyosPrefixListsModule(TestVyosModule): sequence=10, action="deny", prefix="102.168.10.0/26", - ) + ), ], - ) + ), ], - ) + ), ], state="overridden", - ) + ), ) commands = [ "delete policy prefix-list plist1 description 'Test plist1'", @@ -599,7 +600,7 @@ class TestVyosPrefixListsModule(TestVyosModule): set policy prefix-list6 plist4 rule 50 set policy prefix-list6 plist4 rule 50 action 'deny' set policy prefix-list6 plist4 rule 50 prefix '2001:db8:4000::/36' - """ + """, ) set_module_args( dict( @@ -614,14 +615,14 @@ class TestVyosPrefixListsModule(TestVyosModule): sequence=50, action="permit", prefix="102.168.10.0/26", - ) + ), ], - ) + ), ], - ) + ), ], state="overridden", - ) + ), ) commands = [ "set policy prefix-list plist5", @@ -677,7 +678,7 @@ class TestVyosPrefixListsModule(TestVyosModule): set policy prefix-list6 plist4 rule 50 set policy prefix-list6 plist4 rule 50 action 'deny' set policy prefix-list6 plist4 rule 50 prefix '2001:db8:4000::/36' - """ + """, ) set_module_args(dict(state="deleted")) commands = [ @@ -730,7 +731,7 @@ class TestVyosPrefixListsModule(TestVyosModule): set policy prefix-list6 plist4 rule 50 set policy prefix-list6 plist4 rule 50 action 'deny' set policy prefix-list6 plist4 rule 50 prefix '2001:db8:4000::/36' - """ + """, ) set_module_args(dict(config=[dict(afi="ipv4")], state="deleted")) commands = [ @@ -781,13 +782,13 @@ class TestVyosPrefixListsModule(TestVyosModule): set policy prefix-list6 plist4 rule 50 set policy prefix-list6 plist4 rule 50 action 'deny' set policy prefix-list6 plist4 rule 50 prefix '2001:db8:4000::/36' - """ + """, ) set_module_args( dict( config=[dict(afi="ipv6", prefix_lists=[dict(name="plist3")])], state="deleted", - ) + ), ) commands = ["delete policy prefix-list6 plist3"] result = self.execute_module(changed=True) @@ -834,7 +835,7 @@ class TestVyosPrefixListsModule(TestVyosModule): set policy prefix-list6 plist4 rule 50 set policy prefix-list6 plist4 rule 50 action 'deny' set policy prefix-list6 plist4 rule 50 prefix '2001:db8:4000::/36' - """ + """, ) set_module_args( dict( @@ -843,7 +844,7 @@ class TestVyosPrefixListsModule(TestVyosModule): dict(afi="ipv6", prefix_lists=[dict(name="plist3")]), ], state="deleted", - ) + ), ) commands = [ "delete policy prefix-list plist2", @@ -893,7 +894,7 @@ class TestVyosPrefixListsModule(TestVyosModule): set policy prefix-list6 plist4 rule 50 set policy prefix-list6 plist4 rule 50 action 'deny' set policy prefix-list6 plist4 rule 50 prefix '2001:db8:4000::/36' - """ + """, ) set_module_args(dict(running_config=cfg, state="parsed")) parsed = [ @@ -1066,7 +1067,7 @@ class TestVyosPrefixListsModule(TestVyosModule): ), ], state="rendered", - ) + ), ) rendered = [ "set policy prefix-list plist1", @@ -1151,7 +1152,7 @@ class TestVyosPrefixListsModule(TestVyosModule): set policy prefix-list6 plist4 rule 50 set policy prefix-list6 plist4 rule 50 action 'deny' set policy prefix-list6 plist4 rule 50 prefix '2001:db8:4000::/36' - """ + """, ) set_module_args(dict(state="gathered")) gathered = [ diff --git a/tests/unit/modules/network/vyos/test_vyos_route_maps.py b/tests/unit/modules/network/vyos/test_vyos_route_maps.py index adac6c3..ce13dcf 100644 --- a/tests/unit/modules/network/vyos/test_vyos_route_maps.py +++ b/tests/unit/modules/network/vyos/test_vyos_route_maps.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -35,17 +36,17 @@ class TestVyosRouteMapsModule(TestVyosModule): super(TestVyosRouteMapsModule, self).setUp() self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection", ) self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection", ) self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.route_maps.route_maps.Route_mapsFacts.get_config" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.route_maps.route_maps.Route_mapsFacts.get_config", ) self.execute_show_command = self.mock_execute_show_command.start() @@ -100,12 +101,12 @@ class TestVyosRouteMapsModule(TestVyosModule): tag=5, weight=4, ), - ) + ), ], - ) + ), ], state="merged", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -144,12 +145,12 @@ class TestVyosRouteMapsModule(TestVyosModule): tag=4, weight=4, ), - ) + ), ], - ) + ), ], state="merged", - ) + ), ) commands = [ "set policy route-map test2 rule 1 action permit", @@ -209,12 +210,12 @@ class TestVyosRouteMapsModule(TestVyosModule): tag=4, weight=4, ), - ) + ), ], ), ], state="replaced", - ) + ), ) commands = [ "delete policy route-map test3 rule 1 match interface eth2", @@ -261,12 +262,12 @@ class TestVyosRouteMapsModule(TestVyosModule): tag=5, weight=4, ), - ) + ), ], ), ], state="replaced", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -299,12 +300,12 @@ class TestVyosRouteMapsModule(TestVyosModule): tag=4, weight=4, ), - ) + ), ], - ) + ), ], state="overridden", - ) + ), ) commands = [ "delete policy route-map test3", @@ -361,12 +362,12 @@ class TestVyosRouteMapsModule(TestVyosModule): tag=5, weight=4, ), - ) + ), ], ), ], state="overridden", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -404,7 +405,7 @@ class TestVyosRouteMapsModule(TestVyosModule): tag=5, weight=4, ), - ) + ), ], ), dict( @@ -425,7 +426,7 @@ class TestVyosRouteMapsModule(TestVyosModule): ), ], state="rendered", - ) + ), ) rendered_cmds = [ "set policy route-map test3 rule 1 action permit", @@ -504,7 +505,7 @@ class TestVyosRouteMapsModule(TestVyosModule): "tag": "5", "weight": "4", }, - } + }, ], "route_map": "test3", }, @@ -544,7 +545,7 @@ class TestVyosRouteMapsModule(TestVyosModule): "tag": "5", "weight": "4", }, - } + }, ], "route_map": "test3", }, @@ -572,12 +573,12 @@ class TestVyosRouteMapsModule(TestVyosModule): tag=5, weight=4, ), - ) + ), ], ), ], state="deleted", - ) + ), ) commands = ["delete policy route-map test3"] self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/modules/network/vyos/test_vyos_snmp_server.py b/tests/unit/modules/network/vyos/test_vyos_snmp_server.py index b6d61b1..4314465 100644 --- a/tests/unit/modules/network/vyos/test_vyos_snmp_server.py +++ b/tests/unit/modules/network/vyos/test_vyos_snmp_server.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -35,17 +36,17 @@ class TestVyosSnmpServerModule(TestVyosModule): super(TestVyosSnmpServerModule, self).setUp() self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module_base.get_resource_connection", ) self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection", ) self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.snmp_server.snmp_server.Snmp_serverFacts.get_config" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.snmp_server.snmp_server.Snmp_serverFacts.get_config", ) self.execute_show_command = self.mock_execute_show_command.start() @@ -74,7 +75,7 @@ class TestVyosSnmpServerModule(TestVyosModule): dict( name="bridges", networks=["12.1.1.0/24", "1.1.1.0/24"], - ) + ), ], listen_addresses=[ dict(address="100.1.2.1", port=33), @@ -92,11 +93,11 @@ class TestVyosSnmpServerModule(TestVyosModule): authentication=dict(type="sha", plaintext_key="opq1234567"), privacy=dict(type="aes", plaintext_key="opq1234567"), ), - ] + ], ), ), state="merged", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -108,7 +109,7 @@ class TestVyosSnmpServerModule(TestVyosModule): dict( name="bridges", networks=["12.1.1.0/24", "1.1.1.0/24"], - ) + ), ], listen_addresses=[ dict(address="100.1.2.1", port=33), @@ -126,11 +127,11 @@ class TestVyosSnmpServerModule(TestVyosModule): authentication=dict(type="sha", plaintext_key="opq1234567"), privacy=dict(type="aes", plaintext_key="opq1234567"), ), - ] + ], ), ), state="replaced", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -142,7 +143,7 @@ class TestVyosSnmpServerModule(TestVyosModule): dict( name="bridges", networks=["12.1.1.0/24", "1.1.1.0/24"], - ) + ), ], listen_addresses=[ dict(address="100.1.2.1", port=33), @@ -160,11 +161,11 @@ class TestVyosSnmpServerModule(TestVyosModule): authentication=dict(type="sha", plaintext_key="opq1234567"), privacy=dict(type="aes", plaintext_key="opq1234567"), ), - ] + ], ), ), state="overridden", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -193,7 +194,7 @@ class TestVyosSnmpServerModule(TestVyosModule): mode="rw", seclevel="priv", view="view1", - ) + ), ], trap_targets=[ dict( @@ -205,7 +206,7 @@ class TestVyosSnmpServerModule(TestVyosModule): ), ), state="merged", - ) + ), ) commands = [ "set service snmp community routers client 1.1.1.0/24", @@ -249,7 +250,7 @@ class TestVyosSnmpServerModule(TestVyosModule): mode="rw", seclevel="priv", view="view1", - ) + ), ], trap_targets=[ dict( @@ -261,7 +262,7 @@ class TestVyosSnmpServerModule(TestVyosModule): ), ), state="replaced", - ) + ), ) commands = [ "set service snmp community routers client 1.1.1.0/24", @@ -318,7 +319,7 @@ class TestVyosSnmpServerModule(TestVyosModule): mode="rw", seclevel="priv", view="view1", - ) + ), ], trap_targets=[ dict( @@ -330,7 +331,7 @@ class TestVyosSnmpServerModule(TestVyosModule): ), ), state="overridden", - ) + ), ) commands = [ "set service snmp community routers client 1.1.1.0/24", @@ -366,7 +367,7 @@ class TestVyosSnmpServerModule(TestVyosModule): set_module_args( dict( state="deleted", - ) + ), ) commands = ["delete service snmp"] self.execute_module(changed=True, commands=commands) @@ -396,7 +397,7 @@ class TestVyosSnmpServerModule(TestVyosModule): mode="rw", seclevel="priv", view="view1", - ) + ), ], trap_targets=[ dict( @@ -408,7 +409,7 @@ class TestVyosSnmpServerModule(TestVyosModule): ), ), state="rendered", - ) + ), ) commands = [ "set service snmp community routers client 1.1.1.0/24", @@ -471,7 +472,7 @@ class TestVyosSnmpServerModule(TestVyosModule): "mode": "rw", "seclevel": "priv", "view": "view1", - } + }, ], }, "trap_source": "1.1.1.1", @@ -512,7 +513,7 @@ class TestVyosSnmpServerModule(TestVyosModule): }, "user": "guest_user", }, - ] + ], }, } self.assertEqual(gathered_list, result["gathered"]) diff --git a/tests/unit/modules/network/vyos/test_vyos_static_routes.py b/tests/unit/modules/network/vyos/test_vyos_static_routes.py index 96137bd..b38d979 100644 --- a/tests/unit/modules/network/vyos/test_vyos_static_routes.py +++ b/tests/unit/modules/network/vyos/test_vyos_static_routes.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -34,27 +35,27 @@ class TestVyosStaticRoutesModule(TestVyosModule): def setUp(self): super(TestVyosStaticRoutesModule, self).setUp() self.mock_get_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config", ) self.get_config = self.mock_get_config.start() self.mock_load_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config", ) self.load_config = self.mock_load_config.start() self.mock_get_resource_connection_config = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base.get_resource_connection", ) self.get_resource_connection_config = self.mock_get_resource_connection_config.start() self.mock_get_resource_connection_facts = patch( - "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection", ) self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start() self.mock_execute_show_command = patch( - "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.static_routes.static_routes.Static_routesFacts.get_device_data" + "ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.static_routes.static_routes.Static_routesFacts.get_device_data", ) self.execute_show_command = self.mock_execute_show_command.start() @@ -93,14 +94,14 @@ class TestVyosStaticRoutesModule(TestVyosModule): interface="eth0", ), ], - ) + ), ], - ) - ] - ) + ), + ], + ), ], state="merged", - ) + ), ) commands = [ "set protocols static route 192.0.2.48/28", @@ -126,14 +127,14 @@ class TestVyosStaticRoutesModule(TestVyosModule): dict(forward_router_address="192.0.2.9"), dict(forward_router_address="192.0.2.10"), ], - ) + ), ], - ) - ] - ) + ), + ], + ), ], state="merged", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -158,14 +159,14 @@ class TestVyosStaticRoutesModule(TestVyosModule): admin_distance=10, ), ], - ) + ), ], - ) - ] - ) + ), + ], + ), ], state="replaced", - ) + ), ) commands = [ "set protocols static route 192.0.2.48/28", @@ -191,14 +192,14 @@ class TestVyosStaticRoutesModule(TestVyosModule): dict(forward_router_address="192.0.2.9"), dict(forward_router_address="192.0.2.10"), ], - ) + ), ], - ) - ] - ) + ), + ], + ), ], state="replaced", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -218,14 +219,14 @@ class TestVyosStaticRoutesModule(TestVyosModule): dict(forward_router_address="192.0.2.9"), dict(forward_router_address="192.0.2.10"), ], - ) + ), ], - ) - ] - ) + ), + ], + ), ], state="overridden", - ) + ), ) commands = [ "delete protocols static route 192.0.2.32/28", @@ -250,14 +251,14 @@ class TestVyosStaticRoutesModule(TestVyosModule): dict(forward_router_address="192.0.2.9"), dict(forward_router_address="192.0.2.10"), ], - ) + ), ], - ) - ] - ) + ), + ], + ), ], state="overridden", - ) + ), ) self.execute_module(changed=False, commands=[]) @@ -266,7 +267,7 @@ class TestVyosStaticRoutesModule(TestVyosModule): dict( config=[dict(address_families=[dict(afi="ipv4")])], state="deleted", - ) + ), ) commands = ["delete protocols static route"] self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/modules/network/vyos/test_vyos_system.py b/tests/unit/modules/network/vyos/test_vyos_system.py index 252172d..cf405ca 100644 --- a/tests/unit/modules/network/vyos/test_vyos_system.py +++ b/tests/unit/modules/network/vyos/test_vyos_system.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -35,12 +36,12 @@ class TestVyosSystemModule(TestVyosModule): super(TestVyosSystemModule, self).setUp() self.mock_get_config = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_system.get_config" + "ansible_collections.vyos.vyos.plugins.modules.vyos_system.get_config", ) self.get_config = self.mock_get_config.start() self.mock_load_config = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_system.load_config" + "ansible_collections.vyos.vyos.plugins.modules.vyos_system.load_config", ) self.load_config = self.mock_load_config.start() @@ -97,7 +98,7 @@ class TestVyosSystemModule(TestVyosModule): host_name="router", domain_name="example.com", name_server=["8.8.8.8", "8.8.4.4"], - ) + ), ) result = self.execute_module() self.assertEqual([], result["commands"]) diff --git a/tests/unit/modules/network/vyos/test_vyos_user.py b/tests/unit/modules/network/vyos/test_vyos_user.py index 2387296..7029720 100644 --- a/tests/unit/modules/network/vyos/test_vyos_user.py +++ b/tests/unit/modules/network/vyos/test_vyos_user.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from unittest.mock import patch @@ -35,12 +36,12 @@ class TestVyosUserModule(TestVyosModule): super(TestVyosUserModule, self).setUp() self.mock_get_config = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_user.get_config" + "ansible_collections.vyos.vyos.plugins.modules.vyos_user.get_config", ) self.get_config = self.mock_get_config.start() self.mock_load_config = patch( - "ansible_collections.vyos.vyos.plugins.modules.vyos_user.load_config" + "ansible_collections.vyos.vyos.plugins.modules.vyos_user.load_config", ) self.load_config = self.mock_load_config.start() @@ -87,7 +88,7 @@ class TestVyosUserModule(TestVyosModule): [ "delete system login user ansible", "delete system login user admin", - ] + ], ), ) @@ -97,7 +98,7 @@ class TestVyosUserModule(TestVyosModule): name="test", configured_password="test", update_password="on_create", - ) + ), ) result = self.execute_module(changed=True) self.assertEqual( @@ -111,7 +112,7 @@ class TestVyosUserModule(TestVyosModule): name="ansible", configured_password="test", update_password="on_create", - ) + ), ) self.execute_module() @@ -121,7 +122,7 @@ class TestVyosUserModule(TestVyosModule): name="ansible", configured_password="test", update_password="always", - ) + ), ) result = self.execute_module(changed=True) self.assertEqual( diff --git a/tests/unit/modules/network/vyos/vyos_module.py b/tests/unit/modules/network/vyos/vyos_module.py index b1bdc2e..60d94b5 100644 --- a/tests/unit/modules/network/vyos/vyos_module.py +++ b/tests/unit/modules/network/vyos/vyos_module.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type import json @@ -29,6 +30,7 @@ from ansible_collections.vyos.vyos.tests.unit.modules.utils import ( ModuleTestCase, ) + fixture_path = os.path.join(os.path.dirname(__file__), "fixtures") fixture_data = {} diff --git a/tests/unit/modules/utils.py b/tests/unit/modules/utils.py index a7dd0b3..6489f13 100644 --- a/tests/unit/modules/utils.py +++ b/tests/unit/modules/utils.py @@ -1,8 +1,10 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type import json import unittest + from unittest.mock import patch from ansible.module_utils import basic @@ -41,7 +43,9 @@ def fail_json(*args, **kwargs): class ModuleTestCase(unittest.TestCase): def setUp(self): self.mock_module = patch.multiple( - basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + basic.AnsibleModule, + exit_json=exit_json, + fail_json=fail_json, ) self.mock_module.start() self.mock_sleep = patch("time.sleep") |