feat(BOT-367): Add tenant management to security_zone module#105
Merged
Conversation
Implement CRUD operations for Apstra Tenant objects via the security_zone module. Tenants group routing zones (security zones) under a named label in the Apstra UI. Changes: - Add bp_tenants.py utility module with raw_request-based CRUD (list, get, create, update, delete, find_by_label, resolve IDs) - Extend security_zone module with 'tenant' (single) and 'tenants' (bulk) parameters for managing actual Tenant objects - state=list now returns both security_zones and tenants lists - Tenant label resolution: reference routing zones by label or ID - Full idempotency: create, update, and delete are all idempotent - Backward compatible: existing body-based SZ creation with tenant_label/tenant_description aliases unchanged Testing: - tenant_management.yml: 48-task integration test covering all acceptance criteria (AC-1 through AC-5) - security_zone.yml: 35/35 backward compatibility tests pass Resolves: BOT-367
…T-367) - Update security_zone_module.rst synopsis to mention tenant management - Add tenant and tenants parameter documentation - Add state=list choice to state parameter - Add examples for single tenant, bulk tenants, and state=list - Add return values: security_zones, tenants, tenant - Add test-tenant_management target to Makefile
prtkdaved
approved these changes
Jun 3, 2026
vgavini
approved these changes
Jun 3, 2026
Contributor
|
Hi, There is an issue with this change on ansible sanity :
Can you look ? list is not valid type for state https://docs.ansible.com/projects/ansible/latest/dev_guide/developing_modules_best_practices.html#following-ansible-conventions May be better idea to create fact for this ? https://docs.ansible.com/projects/ansible/latest/dev_guide/developing_modules_general.html?#creating-an-info-or-a-facts-module |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements BOT-367: Blueprint Enhancement - Tenant management by adding CRUD operations for Apstra Tenant objects to the
security_zonemodule.Tenants are a distinct entity in Apstra that group routing zones (security zones) under a named label, visible in the Apstra UI under Policies > Tenants.
Changes
New file:
plugins/module_utils/apstra/bp_tenants.pyraw_request(Tenant API is not exposed by the SDK)list_tenants,get_tenant,create_tenant,update_tenant,delete_tenant,find_tenant_by_label,resolve_security_zone_idsModified:
plugins/modules/security_zone.pytenantparameter (dict) — manage a single Tenant object withlabeland optionalrouting_zonestenantsparameter (list of dicts) — bulk Tenant operations with per-itemstateoverridestate=list— now returns bothsecurity_zonesandtenantslistsbodyparameter to maintain backward compatibilityNew file:
tests/tenant_management.ymlAcceptance Criteria
Testing
tenant_management.yml: 48/48 tasks passed (0 failures)security_zone.yml: 35/35 tasks passed (backward compatibility verified)API Details
Resolves: BOT-367