diff options
| author | omnom62 <omnom62@outlook.com> | 2026-06-28 21:49:30 +1000 |
|---|---|---|
| committer | omnom62 <omnom62@outlook.com> | 2026-06-28 21:49:30 +1000 |
| commit | d853f3ff31c2a2bee8a34f325c2972ac4f2db01a (patch) | |
| tree | 078eeec4fcaac8e038f107aec7c635a82c0b86e4 | |
| parent | e10d40b3083885b588c3d9ccddea12e8aa16fda5 (diff) | |
| download | rest.vyos-d853f3ff31c2a2bee8a34f325c2972ac4f2db01a.tar.gz rest.vyos-d853f3ff31c2a2bee8a34f325c2972ac4f2db01a.zip | |
T8989: SIT updated
20 files changed, 875 insertions, 0 deletions
diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/overridden.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/overridden.yaml new file mode 100644 index 0000000..f80add0 --- /dev/null +++ b/tests/integration/targets/vyos_banner/tests/httpapi/overridden.yaml @@ -0,0 +1,30 @@ +--- +- debug: + msg: START vyos_hostname overridden integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Override hostname configuration + register: result + vyos.rest.vyos_hostname: &id001 + config: + hostname: ansible-overridden-host + state: overridden + + - assert: + that: + - result.changed == true + + - name: Override hostname configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_hostname: *id001 + + - assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/replaced.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/replaced.yaml new file mode 100644 index 0000000..2dddc90 --- /dev/null +++ b/tests/integration/targets/vyos_banner/tests/httpapi/replaced.yaml @@ -0,0 +1,31 @@ +--- +- debug: + msg: START vyos_banner replaced integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Replace pre-login banner + register: result + vyos.rest.vyos_banner: &id001 + config: + banner: pre-login + text: "Replaced by ansible" + state: replaced + + - assert: + that: + - result.changed == true + + - name: Replace pre-login banner (IDEMPOTENT) + register: result + vyos.rest.vyos_banner: *id001 + + - assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_banner/tests/httpapi/rtt.yaml b/tests/integration/targets/vyos_banner/tests/httpapi/rtt.yaml new file mode 100644 index 0000000..233f1ef --- /dev/null +++ b/tests/integration/targets/vyos_banner/tests/httpapi/rtt.yaml @@ -0,0 +1,41 @@ +--- +- debug: + msg: START vyos_hostname round trip integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: RTT - Apply base configuration + vyos.rest.vyos_hostname: + config: + hostname: ansible-rtt-host + state: merged + + - name: RTT - Gather configuration + register: gathered + vyos.rest.vyos_hostname: + state: gathered + + - name: RTT - Assert gathered matches applied + assert: + that: + - gathered.gathered.hostname == "ansible-rtt-host" + + - name: RTT - Modify configuration + vyos.rest.vyos_hostname: + config: + hostname: ansible-rtt-modified + state: replaced + + - name: RTT - Gather modified configuration + register: gathered2 + vyos.rest.vyos_hostname: + state: gathered + + - name: RTT - Assert modification applied correctly + assert: + that: + - gathered2.gathered.hostname == "ansible-rtt-modified" + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_hostname/tests/httpapi/overridden.yaml b/tests/integration/targets/vyos_hostname/tests/httpapi/overridden.yaml new file mode 100644 index 0000000..671ac41 --- /dev/null +++ b/tests/integration/targets/vyos_hostname/tests/httpapi/overridden.yaml @@ -0,0 +1,32 @@ +--- +- debug: + msg: START vyos_interfaces overridden integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Override interface configuration + register: result + vyos.rest.vyos_interfaces: &id001 + config: + - name: eth0 + description: Ansible overridden interface + mtu: 1400 + state: overridden + + - assert: + that: + - result.changed == true + + - name: Override interface configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_interfaces: *id001 + + - assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_hostname/tests/httpapi/rtt.yaml b/tests/integration/targets/vyos_hostname/tests/httpapi/rtt.yaml new file mode 100644 index 0000000..74261f8 --- /dev/null +++ b/tests/integration/targets/vyos_hostname/tests/httpapi/rtt.yaml @@ -0,0 +1,48 @@ +--- +- debug: + msg: START vyos_interfaces round trip integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: RTT - Apply base configuration + vyos.rest.vyos_interfaces: + config: + - name: eth0 + description: Ansible RTT interface + mtu: 1450 + state: merged + + - name: RTT - Gather configuration + register: gathered + vyos.rest.vyos_interfaces: + state: gathered + + - name: RTT - Assert gathered matches applied + assert: + that: + - gathered.gathered | selectattr('name', 'eq', 'eth0') | list | length == 1 + - gathered.gathered | selectattr('name', 'eq', 'eth0') | map(attribute='description') | first == 'Ansible RTT interface' + - gathered.gathered | selectattr('name', 'eq', 'eth0') | map(attribute='mtu') | first == 1450 + + - name: RTT - Modify configuration + vyos.rest.vyos_interfaces: + config: + - name: eth0 + description: Ansible RTT modified + mtu: 1400 + state: replaced + + - name: RTT - Gather modified configuration + register: gathered2 + vyos.rest.vyos_interfaces: + state: gathered + + - name: RTT - Assert modification applied correctly + assert: + that: + - gathered2.gathered | selectattr('name', 'eq', 'eth0') | map(attribute='description') | first == 'Ansible RTT modified' + - gathered2.gathered | selectattr('name', 'eq', 'eth0') | map(attribute='mtu') | first == 1400 + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/httpapi/overridden.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/httpapi/overridden.yaml new file mode 100644 index 0000000..09d72ae --- /dev/null +++ b/tests/integration/targets/vyos_l3_interfaces/tests/httpapi/overridden.yaml @@ -0,0 +1,35 @@ +--- +- debug: + msg: START vyos_l3_interfaces overridden integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Override L3 interface configuration + register: result + vyos.rest.vyos_l3_interfaces: &id001 + config: + - name: eth0 + ipv4: + - address: dhcp + - name: lo + ipv4: + - address: 10.0.0.1/32 + state: overridden + + - assert: + that: + - result.changed == true + + - name: Override L3 interface configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_l3_interfaces: *id001 + + - assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/httpapi/rtt.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/httpapi/rtt.yaml new file mode 100644 index 0000000..c347f1a --- /dev/null +++ b/tests/integration/targets/vyos_l3_interfaces/tests/httpapi/rtt.yaml @@ -0,0 +1,48 @@ +--- +- debug: + msg: START vyos_l3_interfaces round trip integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: RTT - Apply base configuration + vyos.rest.vyos_l3_interfaces: + config: + - name: lo + ipv4: + - address: 10.0.0.1/32 + - address: 10.0.0.2/32 + state: merged + + - name: RTT - Gather configuration + register: gathered + vyos.rest.vyos_l3_interfaces: + state: gathered + + - name: RTT - Assert gathered matches applied + assert: + that: + - gathered.gathered | selectattr('name', 'eq', 'lo') | list | length == 1 + - gathered.gathered | selectattr('name', 'eq', 'lo') | map(attribute='ipv4') | first | length == 2 + + - name: RTT - Modify configuration + vyos.rest.vyos_l3_interfaces: + config: + - name: lo + ipv4: + - address: 10.0.0.1/32 + state: replaced + + - name: RTT - Gather modified configuration + register: gathered2 + vyos.rest.vyos_l3_interfaces: + state: gathered + + - name: RTT - Assert modification applied correctly + assert: + that: + - gathered2.gathered | selectattr('name', 'eq', 'lo') | map(attribute='ipv4') | first | length == 1 + - gathered2.gathered | selectattr('name', 'eq', 'lo') | map(attribute='ipv4') | first | map(attribute='address') | first == '10.0.0.1/32' + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/httpapi/overridden.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/httpapi/overridden.yaml new file mode 100644 index 0000000..3024d71 --- /dev/null +++ b/tests/integration/targets/vyos_lag_interfaces/tests/httpapi/overridden.yaml @@ -0,0 +1,32 @@ +--- +- debug: + msg: START vyos_lag_interfaces overridden integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Override LAG configuration + register: result + vyos.rest.vyos_lag_interfaces: &id001 + config: + - name: bond0 + mode: active-backup + hash_policy: layer2+3 + state: overridden + + - assert: + that: + - result.changed == true + + - name: Override LAG configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_lag_interfaces: *id001 + + - assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/httpapi/rtt.yaml b/tests/integration/targets/vyos_lag_interfaces/tests/httpapi/rtt.yaml new file mode 100644 index 0000000..4e58069 --- /dev/null +++ b/tests/integration/targets/vyos_lag_interfaces/tests/httpapi/rtt.yaml @@ -0,0 +1,56 @@ +--- +- debug: + msg: START vyos_lag_interfaces round trip integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: RTT - Apply base configuration + vyos.rest.vyos_lag_interfaces: + config: + - name: bond0 + mode: active-backup + hash_policy: layer2 + arp_monitor: + interval: 100 + target: + - 192.0.2.1 + state: merged + + - name: RTT - Gather configuration + register: gathered + vyos.rest.vyos_lag_interfaces: + state: gathered + + - name: RTT - Assert gathered matches applied + assert: + that: + - gathered.gathered | selectattr('name', 'eq', 'bond0') | list | length == 1 + - gathered.gathered | selectattr('name', 'eq', 'bond0') | map(attribute='mode') | first == 'active-backup' + - gathered.gathered | selectattr('name', 'eq', 'bond0') | map(attribute='hash_policy') | first == 'layer2' + + - name: RTT - Modify configuration + vyos.rest.vyos_lag_interfaces: + config: + - name: bond0 + mode: active-backup + hash_policy: layer2+3 + arp_monitor: + interval: 200 + target: + - 192.0.2.2 + state: replaced + + - name: RTT - Gather modified configuration + register: gathered2 + vyos.rest.vyos_lag_interfaces: + state: gathered + + - name: RTT - Assert modification applied correctly + assert: + that: + - gathered2.gathered | selectattr('name', 'eq', 'bond0') | map(attribute='hash_policy') | first == 'layer2+3' + - gathered2.gathered | selectattr('name', 'eq', 'bond0') | map(attribute='arp_monitor') | map(attribute='interval') | first == 200 + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_global/tests/httpapi/overridden.yaml b/tests/integration/targets/vyos_lldp_global/tests/httpapi/overridden.yaml new file mode 100644 index 0000000..8f85df5 --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/tests/httpapi/overridden.yaml @@ -0,0 +1,34 @@ +--- +- debug: + msg: START vyos_lldp_global overridden integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Override LLDP global configuration + register: result + vyos.rest.vyos_lldp_global: &id001 + config: + enable: true + addresses: + - 192.0.2.20 + legacy_protocols: + - cdp + state: replaced + + - assert: + that: + - result.changed == true + + - name: Override LLDP global configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_lldp_global: *id001 + + - assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_lldp_global/tests/httpapi/rtt.yaml b/tests/integration/targets/vyos_lldp_global/tests/httpapi/rtt.yaml new file mode 100644 index 0000000..421f966 --- /dev/null +++ b/tests/integration/targets/vyos_lldp_global/tests/httpapi/rtt.yaml @@ -0,0 +1,53 @@ +--- +- debug: + msg: START vyos_lldp_global round trip integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: RTT - Apply base configuration + vyos.rest.vyos_lldp_global: + config: + enable: true + addresses: + - 192.0.2.17 + legacy_protocols: + - cdp + state: merged + + - name: RTT - Gather configuration + register: gathered + vyos.rest.vyos_lldp_global: + state: gathered + + - name: RTT - Assert gathered matches applied + assert: + that: + - gathered.gathered.enable == true + - "'192.0.2.17' in gathered.gathered.addresses" + - "'cdp' in gathered.gathered.legacy_protocols" + + - name: RTT - Modify configuration + vyos.rest.vyos_lldp_global: + config: + enable: true + addresses: + - 192.0.2.20 + legacy_protocols: + - fdp + state: replaced + + - name: RTT - Gather modified configuration + register: gathered2 + vyos.rest.vyos_lldp_global: + state: gathered + + - name: RTT - Assert modification applied correctly + assert: + that: + - "'192.0.2.20' in gathered2.gathered.addresses" + - "'fdp' in gathered2.gathered.legacy_protocols" + - "'cdp' not in gathered2.gathered.legacy_protocols" + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_logging_global/tests/httpapi/overridden.yaml b/tests/integration/targets/vyos_logging_global/tests/httpapi/overridden.yaml new file mode 100644 index 0000000..e222fc3 --- /dev/null +++ b/tests/integration/targets/vyos_logging_global/tests/httpapi/overridden.yaml @@ -0,0 +1,37 @@ +--- +- debug: + msg: START vyos_logging_global overridden integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Override logging global configuration + register: result + vyos.rest.vyos_logging_global: &id001 + config: + console: + facilities: + - facility: local7 + severity: warning + global_params: + facilities: + - facility: cron + severity: debug + state: replaced + + - assert: + that: + - result.changed == true + + - name: Override logging global configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_logging_global: *id001 + + - assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_logging_global/tests/httpapi/rtt.yaml b/tests/integration/targets/vyos_logging_global/tests/httpapi/rtt.yaml new file mode 100644 index 0000000..61fcd77 --- /dev/null +++ b/tests/integration/targets/vyos_logging_global/tests/httpapi/rtt.yaml @@ -0,0 +1,56 @@ +--- +- debug: + msg: START vyos_logging_global round trip integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: RTT - Apply base configuration + vyos.rest.vyos_logging_global: + config: + console: + facilities: + - facility: local7 + severity: err + global_params: + facilities: + - facility: cron + severity: debug + state: merged + + - name: RTT - Gather configuration + register: gathered + vyos.rest.vyos_logging_global: + state: gathered + + - name: RTT - Assert gathered matches applied + assert: + that: + - gathered.gathered.console is defined + + - name: RTT - Modify configuration + vyos.rest.vyos_logging_global: + config: + console: + facilities: + - facility: local7 + severity: warning + global_params: + facilities: + - facility: cron + severity: info + state: replaced + + - name: RTT - Gather modified configuration + register: gathered2 + vyos.rest.vyos_logging_global: + state: gathered + + - name: RTT - Assert modification applied correctly + assert: + that: + - gathered2.gathered.console is defined + - gathered2.gathered.global is defined + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_ntp_global/tests/httpapi/rtt.yaml b/tests/integration/targets/vyos_ntp_global/tests/httpapi/rtt.yaml new file mode 100644 index 0000000..d05e203 --- /dev/null +++ b/tests/integration/targets/vyos_ntp_global/tests/httpapi/rtt.yaml @@ -0,0 +1,65 @@ +--- +- debug: + msg: START vyos_ntp_global round trip integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: RTT - Apply base configuration + vyos.rest.vyos_ntp_global: + config: + servers: + - server: 10.3.6.5 + options: + - noselect + - prefer + - server: server4.example.com + options: + - pool + allow_clients: + - 10.4.9.0/24 + listen_addresses: + - 10.1.9.16 + state: merged + + - name: RTT - Gather configuration + register: gathered + vyos.rest.vyos_ntp_global: + state: gathered + + - name: RTT - Assert gathered matches applied + assert: + that: + - "'10.3.6.5' in gathered.gathered.servers" + - "'10.4.9.0/24' in gathered.gathered.allow_clients" + - "'10.1.9.16' in gathered.gathered.listen_addresses" + + - name: RTT - Modify configuration + vyos.rest.vyos_ntp_global: + config: + servers: + - server: 10.3.6.5 + options: + - noselect + - server: server5.example.com + allow_clients: + - 10.4.8.0/24 + listen_addresses: + - 10.1.9.16 + state: replaced + + - name: RTT - Gather modified configuration + register: gathered2 + vyos.rest.vyos_ntp_global: + state: gathered + + - name: RTT - Assert modification applied correctly + assert: + that: + - "'server5.example.com' in gathered2.gathered.servers" + - "'server4.example.com' not in gathered2.gathered.servers" + - "'10.4.8.0/24' in gathered2.gathered.allow_clients" + - "'10.4.9.0/24' not in gathered2.gathered.allow_clients" + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_prefix_lists/tests/httpapi/overridden.yaml b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/overridden.yaml new file mode 100644 index 0000000..f895488 --- /dev/null +++ b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/overridden.yaml @@ -0,0 +1,38 @@ +--- +- debug: + msg: START vyos_prefix_lists overridden integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Override prefix_lists configuration + register: result + vyos.rest.vyos_prefix_lists: &id001 + config: + - afi: ipv4 + prefix_lists: + - name: AnsibleIPv4PrefixList + description: Overridden by ansible + entries: + - sequence: 2 + action: permit + prefix: 92.168.10.0/26 + le: 32 + state: overridden + + - assert: + that: + - result.changed == true + + - name: Override prefix_lists configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_prefix_lists: *id001 + + - assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_prefix_lists/tests/httpapi/rtt.yaml b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/rtt.yaml new file mode 100644 index 0000000..6ddeb27 --- /dev/null +++ b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/rtt.yaml @@ -0,0 +1,63 @@ +--- +- debug: + msg: START vyos_prefix_lists round trip integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: RTT - Apply base configuration + vyos.rest.vyos_prefix_lists: + config: + - afi: ipv4 + prefix_lists: + - name: AnsibleIPv4PrefixList + description: PL configured by ansible + entries: + - sequence: 2 + action: permit + prefix: 92.168.10.0/26 + le: 32 + - sequence: 3 + action: deny + prefix: 72.168.2.0/24 + ge: 26 + state: merged + + - name: RTT - Gather configuration + register: gathered + vyos.rest.vyos_prefix_lists: + state: gathered + + - name: RTT - Assert gathered matches applied + assert: + that: + - gathered.gathered | selectattr('afi', 'eq', 'ipv4') | list | length == 1 + - gathered.gathered | selectattr('afi', 'eq', 'ipv4') | map(attribute='prefix_lists') | first | selectattr('name', 'eq', 'AnsibleIPv4PrefixList') | list | length == 1 + + - name: RTT - Modify configuration + vyos.rest.vyos_prefix_lists: + config: + - afi: ipv4 + prefix_lists: + - name: AnsibleIPv4PrefixList + description: Modified by ansible + entries: + - sequence: 2 + action: permit + prefix: 92.168.10.0/26 + le: 32 + state: replaced + + - name: RTT - Gather modified configuration + register: gathered2 + vyos.rest.vyos_prefix_lists: + state: gathered + + - name: RTT - Assert modification applied correctly + assert: + that: + - gathered2.gathered | selectattr('afi', 'eq', 'ipv4') | list | length == 1 + - gathered2.gathered | selectattr('afi', 'eq', 'ipv4') | map(attribute='prefix_lists') | first | selectattr('name', 'eq', 'AnsibleIPv4PrefixList') | map(attribute='entries') | first | length == 1 + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_route_maps/tests/httpapi/overridden.yaml: b/tests/integration/targets/vyos_route_maps/tests/httpapi/overridden.yaml: new file mode 100644 index 0000000..19d5682 --- /dev/null +++ b/tests/integration/targets/vyos_route_maps/tests/httpapi/overridden.yaml: @@ -0,0 +1,35 @@ +--- +- debug: + msg: START vyos_route_maps overridden integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Override route_maps configuration + register: result + vyos.rest.vyos_route_maps: &id001 + config: + - route_map: RM-TEST-EXPORT-POLICY + entries: + - sequence: 10 + action: permit + set: + metric: "10" + state: overridden + + - assert: + that: + - result.changed == true + + - name: Override route_maps configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_route_maps: *id001 + + - assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_route_maps/tests/httpapi/rtt.yaml b/tests/integration/targets/vyos_route_maps/tests/httpapi/rtt.yaml new file mode 100644 index 0000000..641a46f --- /dev/null +++ b/tests/integration/targets/vyos_route_maps/tests/httpapi/rtt.yaml @@ -0,0 +1,53 @@ +--- +- debug: + msg: START vyos_route_maps round trip integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: RTT - Apply base configuration + vyos.rest.vyos_route_maps: + config: + - route_map: RM-TEST-EXPORT-POLICY + entries: + - sequence: 10 + action: permit + match: + peer: 192.0.2.32 + set: + metric: "5" + state: merged + + - name: RTT - Gather configuration + register: gathered + vyos.rest.vyos_route_maps: + state: gathered + + - name: RTT - Assert gathered matches applied + assert: + that: + - gathered.gathered | selectattr('route_map', 'eq', 'RM-TEST-EXPORT-POLICY') | list | length == 1 + + - name: RTT - Modify configuration + vyos.rest.vyos_route_maps: + config: + - route_map: RM-TEST-EXPORT-POLICY + entries: + - sequence: 10 + action: permit + set: + metric: "20" + state: replaced + + - name: RTT - Gather modified configuration + register: gathered2 + vyos.rest.vyos_route_maps: + state: gathered + + - name: RTT - Assert modification applied correctly + assert: + that: + - gathered2.gathered | selectattr('route_map', 'eq', 'RM-TEST-EXPORT-POLICY') | list | length == 1 + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_snmp_server/tests/httpapi/overridden.yaml b/tests/integration/targets/vyos_snmp_server/tests/httpapi/overridden.yaml new file mode 100644 index 0000000..61a3311 --- /dev/null +++ b/tests/integration/targets/vyos_snmp_server/tests/httpapi/overridden.yaml @@ -0,0 +1,35 @@ +--- +- debug: + msg: START vyos_snmp_server overridden integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + - name: Override snmp_server configuration + register: result + vyos.rest.vyos_snmp_server: &id001 + config: + communities: + - name: switches + authorization_type: rw + contact: admin@example.com + listen_addresses: + - address: 20.1.1.1 + state: replaced + + - assert: + that: + - result.changed == true + + - name: Override snmp_server configuration (IDEMPOTENT) + register: result + vyos.rest.vyos_snmp_server: *id001 + + - assert: + that: + - result.changed == false + - result.commands == [] + + always: + - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_snmp_server/tests/httpapi/rtt.yaml b/tests/integration/targets/vyos_snmp_server/tests/httpapi/rtt.yaml new file mode 100644 index 0000000..1d354b7 --- /dev/null +++ b/tests/integration/targets/vyos_snmp_server/tests/httpapi/rtt.yaml @@ -0,0 +1,53 @@ +--- +- debug: + msg: START vyos_snmp_server round trip integration tests on connection={{ ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + - name: RTT - Apply base configuration + vyos.rest.vyos_snmp_server: + config: + communities: + - name: switches + authorization_type: rw + contact: admin@example.com + listen_addresses: + - address: 20.1.1.1 + state: merged + + - name: RTT - Gather configuration + register: gathered + vyos.rest.vyos_snmp_server: + state: gathered + + - name: RTT - Assert gathered matches applied + assert: + that: + - gathered.gathered.contact == "admin@example.com" + - gathered.gathered.communities | selectattr('name', 'eq', 'switches') | list | length == 1 + + - name: RTT - Modify configuration + vyos.rest.vyos_snmp_server: + config: + communities: + - name: switches + authorization_type: ro + contact: ops@example.com + listen_addresses: + - address: 20.1.1.1 + state: replaced + + - name: RTT - Gather modified configuration + register: gathered2 + vyos.rest.vyos_snmp_server: + state: gathered + + - name: RTT - Assert modification applied correctly + assert: + that: + - gathered2.gathered.contact == "ops@example.com" + - gathered2.gathered.communities | selectattr('name', 'eq', 'switches') | map(attribute='authorization_type') | first == 'ro' + + always: + - include_tasks: _remove_config.yaml |
