Skip to content

Commit b27a842

Browse files
samiiblhercot
authored andcommitted
[ignore] Fix source ip prefix description.
1 parent cff8ce7 commit b27a842

File tree

3 files changed

+25
-27
lines changed

3 files changed

+25
-27
lines changed

plugins/module_utils/schemas.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,23 @@ def get_template_from_schema(self, schema_name, schema_id, template_name, templa
3131
self.schemas_by_id[new_schema.id] = new_schema
3232
self.schemas_by_name[new_schema.schema_name] = new_schema
3333
return new_schema
34+
35+
def get_epg_uuid(self, epg_obj, epg_uuid):
36+
"""
37+
Returns the EPG UUID in a given schema, template and ANP.
38+
39+
:param epg_obj: A dictionary containing the epg reference object. -> Dict
40+
:param epg_uuid: The EPG UUID to return if specified. -> Str
41+
:return: The EPG UUID if found, otherwise it fails the module. -> Str
42+
"""
43+
if epg_uuid:
44+
return epg_uuid
45+
schema = self.get_template_from_schema(
46+
epg_obj.get("schema"),
47+
epg_obj.get("schema_id"),
48+
epg_obj.get("template"),
49+
epg_obj.get("template_id"),
50+
)
51+
schema.set_template_anp(epg_obj.get("anp"), epg_obj.get("anp_uuid"), fail_module=True)
52+
schema.set_template_anp_epg(epg_obj.get("name"), fail_module=True)
53+
return schema.schema_objects.get("template_anp_epg").details.get("uuid")

plugins/module_utils/utils.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -194,25 +194,3 @@ def delete_none_values(obj_to_sanitize, recursive=True):
194194

195195
else:
196196
raise TypeError("Object to sanitize must be of type list or dict. Got {}".format(type(obj_to_sanitize)))
197-
198-
199-
def get_epg_uuid(schemas, epg_obj, epg_uuid):
200-
"""
201-
Returns the EPG UUID in a given schema, template and ANP.
202-
203-
:param schemas: The mso schemas object. -> MSOSchemas
204-
:param epg_obj: A dictionary containing the epg reference object. -> Dict
205-
:param epg_uuid: The EPG UUID to return if specified. -> Str
206-
:return: The EPG UUID if found, otherwise it fails the module. -> Str
207-
"""
208-
if epg_uuid:
209-
return epg_uuid
210-
schema = schemas.get_template_from_schema(
211-
epg_obj.get("schema"),
212-
epg_obj.get("schema_id"),
213-
epg_obj.get("template"),
214-
epg_obj.get("template_id"),
215-
)
216-
schema.set_template_anp(epg_obj.get("anp"), epg_obj.get("anp_uuid"), fail_module=True)
217-
schema.set_template_anp_epg(epg_obj.get("name"), fail_module=True)
218-
return schema.schema_objects.get("template_anp_epg").details.get("uuid")

plugins/modules/ndo_tenant_span_session.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@
186186
type: str
187187
source_ip_prefix:
188188
description:
189-
- The destination IP address prefix to route SPAN Session packets.
189+
- The prefix used to assign source IP addresses to ERSPAN packets which can be used to identify which Leaf or Spine is sending the traffic.
190+
- This can be any IP. If the prefix is used, the node ID of the source node is used for the undefined bits of the prefix.
190191
type: str
191192
span_version:
192193
description:
@@ -372,7 +373,7 @@
372373
from ansible_collections.cisco.mso.plugins.module_utils.schemas import MSOSchemas
373374
from ansible_collections.cisco.mso.plugins.module_utils.template import MSOTemplate, KVPair
374375
from ansible_collections.cisco.mso.plugins.module_utils.constants import TARGET_DSCP_MAP, ENABLED_OR_DISABLED_TO_BOOL_STRING_MAP
375-
from ansible_collections.cisco.mso.plugins.module_utils.utils import append_update_ops_data, get_epg_uuid
376+
from ansible_collections.cisco.mso.plugins.module_utils.utils import append_update_ops_data
376377
import copy
377378

378379

@@ -507,7 +508,7 @@ def main():
507508
mso_values["sourceGroup"] = source_group
508509
if destination_epg:
509510
mso_values["destination"]["remote"] = dict(
510-
epgRef=get_epg_uuid(mso_schemas, destination_epg.get("epg"), destination_epg.get("epg_uuid")),
511+
epgRef=mso_schemas.get_epg_uuid(destination_epg.get("epg"), destination_epg.get("epg_uuid")),
511512
spanVersion=destination_epg.get("span_version"),
512513
enforceSpanVersion=destination_epg.get("enforce_span_version"),
513514
destIPAddress=destination_epg.get("destination_ip"),
@@ -518,7 +519,6 @@ def main():
518519
)
519520

520521
if match:
521-
522522
mso_update_values = {
523523
"name": name,
524524
"description": description,
@@ -577,7 +577,7 @@ def format_sources(schemas, sources):
577577
source_values = {
578578
"name": source.get("name"),
579579
"direction": source.get("direction"),
580-
"epg": get_epg_uuid(schemas, source.get("epg"), source.get("epg_uuid")),
580+
"epg": schemas.get_epg_uuid(source.get("epg"), source.get("epg_uuid")),
581581
}
582582
source_list.append(source_values)
583583
return source_list

0 commit comments

Comments
 (0)