-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[minor_change] Add support for name attribute in mso_schema_template_…
…external_epg_subnet module
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
# -*- coding: utf-8 -*- | ||
|
||
# Copyright: (c) 2021, Anvitha Jain (@anvitha-jain) <[email protected]> | ||
# Copyright: (c) 2024, Akini Ross (@akinross) <[email protected]> | ||
# 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) | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Test code for the MSO modules | ||
# Copyright: (c) 2021, Anvitha Jain (@anvitha-jain) <[email protected]> | ||
# Copyright: (c) 2024, Akini Ross (@akinross) <[email protected]> | ||
# | ||
|
||
# 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 | ||
|