summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
authoromnom62 <75066712+omnom62@users.noreply.github.com>2026-08-21 23:41:34 +1000
committerGitHub <noreply@github.com>2026-08-21 08:41:34 -0500
commit6dc9d721513dca5a573c7ee01b74d703ff41f95f (patch)
treeaf2ccddbe4050547ab1f12043f3a4c06c03b4365 /tests/integration
parent0fe5f71123e5ff1d489a91486076fc875fa2810e (diff)
downloadrest.vyos-6dc9d721513dca5a573c7ee01b74d703ff41f95f.tar.gz
rest.vyos-6dc9d721513dca5a573c7ee01b74d703ff41f95f.zip
T8989: prefix_lists module
* prefix_lists module * prefix_lists module rst * t8989 prefix_lists module * Converage tests fixes * T8989: SIT updates
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/targets/vyos_prefix_lists/tests/httpapi/deleted.yaml (renamed from tests/integration/targets/vyos_prefix_lists/tests/httpapi/_deleted.yaml)0
-rw-r--r--tests/integration/targets/vyos_prefix_lists/tests/httpapi/gathered.yaml (renamed from tests/integration/targets/vyos_prefix_lists/tests/httpapi/_gathered.yaml)0
-rw-r--r--tests/integration/targets/vyos_prefix_lists/tests/httpapi/merged.yaml (renamed from tests/integration/targets/vyos_prefix_lists/tests/httpapi/_merged.yaml)0
-rw-r--r--tests/integration/targets/vyos_prefix_lists/tests/httpapi/overridden.yaml38
-rw-r--r--tests/integration/targets/vyos_prefix_lists/tests/httpapi/replaced.yaml (renamed from tests/integration/targets/vyos_prefix_lists/tests/httpapi/_replaced.yaml)0
-rw-r--r--tests/integration/targets/vyos_prefix_lists/tests/httpapi/rtt.yaml81
6 files changed, 119 insertions, 0 deletions
diff --git a/tests/integration/targets/vyos_prefix_lists/tests/httpapi/_deleted.yaml b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/deleted.yaml
index 6cfb063..6cfb063 100644
--- a/tests/integration/targets/vyos_prefix_lists/tests/httpapi/_deleted.yaml
+++ b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/deleted.yaml
diff --git a/tests/integration/targets/vyos_prefix_lists/tests/httpapi/_gathered.yaml b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/gathered.yaml
index 083cb48..083cb48 100644
--- a/tests/integration/targets/vyos_prefix_lists/tests/httpapi/_gathered.yaml
+++ b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/gathered.yaml
diff --git a/tests/integration/targets/vyos_prefix_lists/tests/httpapi/_merged.yaml b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/merged.yaml
index a70f826..a70f826 100644
--- a/tests/integration/targets/vyos_prefix_lists/tests/httpapi/_merged.yaml
+++ b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/merged.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/_replaced.yaml b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/replaced.yaml
index bd8c5c1..bd8c5c1 100644
--- a/tests/integration/targets/vyos_prefix_lists/tests/httpapi/_replaced.yaml
+++ b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/replaced.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..de816eb
--- /dev/null
+++ b/tests/integration/targets/vyos_prefix_lists/tests/httpapi/rtt.yaml
@@ -0,0 +1,81 @@
+---
+- 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
+ vars:
+ ipv4_pls: >-
+ {{ gathered.gathered
+ | selectattr('afi', 'eq', 'ipv4')
+ | map(attribute='prefix_lists')
+ | first }}
+ assert:
+ that:
+ - gathered.gathered | selectattr('afi', 'eq', 'ipv4') | list | length == 1
+ - ipv4_pls | 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
+ vars:
+ ipv4_pls2: >-
+ {{ gathered2.gathered
+ | selectattr('afi', 'eq', 'ipv4')
+ | map(attribute='prefix_lists')
+ | first }}
+ pl_entries: >-
+ {{ ipv4_pls2
+ | selectattr('name', 'eq', 'AnsibleIPv4PrefixList')
+ | map(attribute='entries')
+ | first }}
+ assert:
+ that:
+ - gathered2.gathered | selectattr('afi', 'eq', 'ipv4') | list | length == 1
+ - pl_entries | length == 1
+ - pl_entries | selectattr('sequence', 'eq', 2) | list | length == 1
+
+ always:
+ - include_tasks: _remove_config.yaml