summaryrefslogtreecommitdiff
path: root/tests/integration/targets/vyos_snmp_server
diff options
context:
space:
mode:
authoromnom62 <omnom62@outlook.com>2026-07-06 14:54:12 +1000
committerJohn Estabrook <jestabro@vyos.io>2026-08-21 14:02:19 -0500
commit45dc95873fd906c582fbbd5e6ca3838caf867399 (patch)
tree71b3e53e0080da60abf9fd2381705971dfe4d507 /tests/integration/targets/vyos_snmp_server
parent7a6b5e4f3a7a021cfa75faa7bf833741dfc09cff (diff)
downloadrest.vyos-T8989_wave4.tar.gz
rest.vyos-T8989_wave4.zip
T8989: wave4 vyos_command, dict_op refactorT8989_wave4
* T8989: vyos_command module * T8989: vyos_command module UAT and SIT * T8989: vyos_command changelog * T8989: vyos_command linter * T8989: vyos_config module * T8989: vyos_config module changelog * T8989: Wave 4 vyos_config module with integration and unit tests * T8323: vyos_system module * T8332: vyos_system SIT and UAT * T8323: vyos_vlan module * T8323: vyos_vlan module * T8323: vyos_vlan module SIT and UAT * T8323: vyos_system module * T8989: Wave 4 vyos_vlan reworked with dict_op engine * T8989: Fix dict_op single-value string list handling, add vyos_system integration tests * T8989: logging_global refactor * T8989: migrate ntp_global, logging_global, firewall_global to dict_op engine * T8989: vyos_nat module for REST API collection * T8989: vyos_nat module for REST API collection, linter fixes * T8989: vyos_ha module for REST API collection * T8989: vyos_ha module for REST API collection * T8989: vyos_ha module sanity and linter fixes * T8989: vyos_ha module sanity and linter fixes * T8989: vyos_ha module linter fixes * T8989: vyos.rest AI comment fixes * T8323: vyos_nat AI comment fixes * T8989 ai fixes * T8989: vyos_bgp_address_family dict_op * T8989: vyos_bgp_address_family vyos_bgp_global dict_op * T8989: dict_op refactor for firewall_*, nat, user * T8989: dict_op refactor for firewall_*, nat, user * T8989: dict_op refactor for ntp_global, ha * T8989: snmp_server dict_op refactor * T8989: snmp_server dict_op refactor * T8989: route_map dict_op refactor
Diffstat (limited to 'tests/integration/targets/vyos_snmp_server')
-rw-r--r--tests/integration/targets/vyos_snmp_server/tasks/httpapi.yaml2
-rw-r--r--tests/integration/targets/vyos_snmp_server/tests/httpapi/deleted.yaml4
-rw-r--r--tests/integration/targets/vyos_snmp_server/tests/httpapi/gathered.yaml4
-rw-r--r--tests/integration/targets/vyos_snmp_server/tests/httpapi/replaced.yaml4
-rw-r--r--tests/integration/targets/vyos_snmp_server/tests/httpapi/rtt.yaml77
5 files changed, 73 insertions, 18 deletions
diff --git a/tests/integration/targets/vyos_snmp_server/tasks/httpapi.yaml b/tests/integration/targets/vyos_snmp_server/tasks/httpapi.yaml
index 1ba3569..80d9e23 100644
--- a/tests/integration/targets/vyos_snmp_server/tasks/httpapi.yaml
+++ b/tests/integration/targets/vyos_snmp_server/tasks/httpapi.yaml
@@ -9,7 +9,7 @@
- name: Set test_items
ansible.builtin.set_fact:
- test_items: "{{ test_cases.files | map(attribute='path') | list }}"
+ test_items: "{{ test_cases.files | map(attribute='path') | list | sort }}"
- name: Run test case (connection=httpapi)
ansible.builtin.include_tasks: "{{ test_case_to_run }}"
diff --git a/tests/integration/targets/vyos_snmp_server/tests/httpapi/deleted.yaml b/tests/integration/targets/vyos_snmp_server/tests/httpapi/deleted.yaml
index a626a26..9c1c288 100644
--- a/tests/integration/targets/vyos_snmp_server/tests/httpapi/deleted.yaml
+++ b/tests/integration/targets/vyos_snmp_server/tests/httpapi/deleted.yaml
@@ -2,9 +2,9 @@
- debug:
msg: START vyos_snmp_server deleted integration tests on connection={{ ansible_connection }}
-- include_tasks: _populate_config.yaml
-
- block:
+ - include_tasks: _populate_config.yaml
+
- name: Delete all snmp_server configuration
register: result
vyos.rest.vyos_snmp_server: &id001
diff --git a/tests/integration/targets/vyos_snmp_server/tests/httpapi/gathered.yaml b/tests/integration/targets/vyos_snmp_server/tests/httpapi/gathered.yaml
index 770845c..5956f51 100644
--- a/tests/integration/targets/vyos_snmp_server/tests/httpapi/gathered.yaml
+++ b/tests/integration/targets/vyos_snmp_server/tests/httpapi/gathered.yaml
@@ -2,9 +2,9 @@
- debug:
msg: START vyos_snmp_server gathered integration tests on connection={{ ansible_connection }}
-- include_tasks: _populate_config.yaml
-
- block:
+ - include_tasks: _populate_config.yaml
+
- name: Gather snmp_server configuration
register: result
vyos.rest.vyos_snmp_server:
diff --git a/tests/integration/targets/vyos_snmp_server/tests/httpapi/replaced.yaml b/tests/integration/targets/vyos_snmp_server/tests/httpapi/replaced.yaml
index d989272..e659731 100644
--- a/tests/integration/targets/vyos_snmp_server/tests/httpapi/replaced.yaml
+++ b/tests/integration/targets/vyos_snmp_server/tests/httpapi/replaced.yaml
@@ -2,9 +2,9 @@
- debug:
msg: START vyos_snmp_server replaced integration tests on connection={{ ansible_connection }}
-- include_tasks: _populate_config.yaml
-
- block:
+ - include_tasks: _populate_config.yaml
+
- name: Replace snmp_server configuration
register: result
vyos.rest.vyos_snmp_server: &id001
diff --git a/tests/integration/targets/vyos_snmp_server/tests/httpapi/rtt.yaml b/tests/integration/targets/vyos_snmp_server/tests/httpapi/rtt.yaml
index 1d354b7..00bc93e 100644
--- a/tests/integration/targets/vyos_snmp_server/tests/httpapi/rtt.yaml
+++ b/tests/integration/targets/vyos_snmp_server/tests/httpapi/rtt.yaml
@@ -8,46 +8,101 @@
- name: RTT - Apply base configuration
vyos.rest.vyos_snmp_server:
config:
+ contact: admin@example.com
communities:
- name: switches
authorization_type: rw
- contact: admin@example.com
+ - name: bridges
+ clients:
+ - 1.1.1.1
+ - 12.1.1.10
listen_addresses:
- address: 20.1.1.1
+ snmp_v3:
+ engine_id: "000000000000000000000002"
+ groups:
+ - group: admins
+ mode: rw
+ seclevel: priv
+ view: all
+ users:
+ - user: admin_user
+ group: admins
+ authentication:
+ type: sha
+ plaintext_key: authpass123
+ privacy:
+ type: aes
+ plaintext_key: privpass123
+ views:
+ - view: all
+ oid: "1.3.6.1.2.1.1"
+ mask: "ff.ff"
state: merged
- - name: RTT - Gather configuration
+ - name: RTT - Gather
register: gathered
vyos.rest.vyos_snmp_server:
state: gathered
- - name: RTT - Assert gathered matches applied
+ - name: RTT - Assert base configuration present
assert:
that:
- gathered.gathered.contact == "admin@example.com"
- - gathered.gathered.communities | selectattr('name', 'eq', 'switches') | list | length == 1
+ - "'switches' in gathered.gathered.communities | map(attribute='name')"
+ - "'bridges' in gathered.gathered.communities | map(attribute='name')"
+ - gathered.gathered.snmp_v3.engine_id == "000000000000000000000002"
+ - "'admins' in gathered.gathered.snmp_v3.groups | map(attribute='group')"
+ - (gathered.gathered.snmp_v3.users | selectattr('user', 'eq', 'admin_user') | first).authentication.type == 'sha'
+ - (gathered.gathered.snmp_v3.views | selectattr('view', 'eq', 'all') | first).oid == '1.3.6.1.2.1.1'
+ - (gathered.gathered.snmp_v3.views | selectattr('view', 'eq', 'all') | first).mask == 'ff.ff'
- - name: RTT - Modify configuration
+ - name: RTT - Modify configuration (remove a stale community, add a trap target)
vyos.rest.vyos_snmp_server:
config:
+ contact: admin@example.com
communities:
- name: switches
- authorization_type: ro
- contact: ops@example.com
+ authorization_type: rw
listen_addresses:
- address: 20.1.1.1
+ trap_target:
+ address: 203.0.113.5
+ community: switches
+ port: 162
+ snmp_v3:
+ engine_id: "000000000000000000000002"
+ groups:
+ - group: admins
+ mode: rw
+ seclevel: priv
+ view: all
+ users:
+ - user: admin_user
+ group: admins
+ authentication:
+ type: sha
+ privacy:
+ type: aes
+ views:
+ - view: all
+ oid: "1.3.6.1.2.1.1"
+ mask: "ff.ff"
state: replaced
- - name: RTT - Gather modified configuration
+ - name: RTT - Gather after modify
register: gathered2
vyos.rest.vyos_snmp_server:
state: gathered
- - name: RTT - Assert modification applied correctly
+ - name: RTT - Assert stale community removed and trap target added
assert:
that:
- - gathered2.gathered.contact == "ops@example.com"
- - gathered2.gathered.communities | selectattr('name', 'eq', 'switches') | map(attribute='authorization_type') | first == 'ro'
+ - "'bridges' not in gathered2.gathered.communities | map(attribute='name')"
+ - "'switches' in gathered2.gathered.communities | map(attribute='name')"
+ - gathered2.gathered.trap_target.address == "203.0.113.5"
+ - gathered2.gathered.trap_target.community == "switches"
+ - gathered2.gathered.trap_target.port == 162
always:
- include_tasks: _remove_config.yaml