diff --git a/plugins/modules/mso_schema_template_external_epg_subnet.py b/plugins/modules/mso_schema_template_external_epg_subnet.py index 7339312a..c03949bd 100644 --- a/plugins/modules/mso_schema_template_external_epg_subnet.py +++ b/plugins/modules/mso_schema_template_external_epg_subnet.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- # Copyright: (c) 2021, Anvitha Jain (@anvitha-jain) +# Copyright: (c) 2024, Akini Ross (@akinross) # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function @@ -19,6 +20,7 @@ author: - Devarshi Shah (@devarshishah3) - Anvitha Jain (@anvitha-jain) +- Akini Ross (@akinross) version_added: '0.0.8' options: schema: @@ -40,6 +42,10 @@ description: - The IP range in CIDR notation. type: str + name: + description: + - The name of the External EPG Subnet. + type: str scope: description: - The scope parameter contains two sections 1. Route Control and 2. External EPG Classification. @@ -132,6 +138,7 @@ def main(): external_epg=dict(type="str", required=True), state=dict(type="str", default="present", choices=["absent", "present", "query"]), subnet=dict(type="str"), + name=dict(type="str"), scope=dict(type="list", elements="str", default=[]), aggregate=dict(type="list", elements="str", default=[]), ) @@ -149,6 +156,7 @@ def main(): template = module.params.get("template").replace(" ", "") external_epg = module.params.get("external_epg") subnet = module.params.get("subnet") + name = module.params.get("name") scope = module.params.get("scope") aggregate = module.params.get("aggregate") state = module.params.get("state") @@ -201,6 +209,7 @@ def main(): ip=subnet, scope=scope, aggregate=aggregate, + name=name, ) mso.sanitize(payload, collate=True) diff --git a/tests/integration/targets/mso_schema_template_external_epg_subnet/tasks/main.yml b/tests/integration/targets/mso_schema_template_external_epg_subnet/tasks/main.yml index 56cd80be..dc7dd6a8 100644 --- a/tests/integration/targets/mso_schema_template_external_epg_subnet/tasks/main.yml +++ b/tests/integration/targets/mso_schema_template_external_epg_subnet/tasks/main.yml @@ -1,5 +1,6 @@ # Test code for the MSO modules # Copyright: (c) 2021, Anvitha Jain (@anvitha-jain) +# Copyright: (c) 2024, Akini Ross (@akinross) # # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -188,6 +189,7 @@ template: Template 1 external_epg: ansible_test_1 subnet: 10.0.0.2/24 + name: subnet2 state: present register: add_epg_subnet_2 @@ -196,6 +198,7 @@ that: - add_epg_subnet_2 is changed - add_epg_subnet_2.current.ip == "10.0.0.2/24" + - add_epg_subnet_2.current.name == "subnet2" # QUERY ALL EPG Subnets - name: Query all EPG (check_mode) @@ -343,6 +346,14 @@ - add_epg_subnet_no_ag.msg == "MSO Error 400{{':'}} ExternalEPG{{':'}} ansible_test_1 in Schema{{':'}} ansible_test , Template{{':'}} Template1 External EPG validation error{{':'}} aggregate should be enabled only if shared-rtctrl is enabled in Scope for subnet 10.0.0.2/24" when: - version.current.version is version('4.0', '>=') + - version.current.version is version('4.3', '<') + +- name: Verify add_epg_subnet_no_ag (version >= 4.3) + ansible.builtin.assert: + that: + - add_epg_subnet_no_ag.msg == "MSO Error 400{{':'}} ExternalEPG{{':'}} ansible_test_1 in Schema{{':'}} ansible_test, Template{{':'}} Template1, External EPG validation error{{':'}} aggregate should be enabled only if shared-rtctrl is enabled in Scope for subnet 10.0.0.2/24" + when: + - version.current.version is version('4.3', '>=') - name: Execute tasks only for MSO version < 4.0 # mso_schema_validate not supported after 4.0, validation executed upon request