CiscoDevNet / ansible-mso

Cisco MSO Ansible Collection
https://galaxy.ansible.com/cisco/mso
GNU General Public License v3.0
24 stars 28 forks source link

mso_schema_site_anp_epg_bulk_staticport.py - Add static ports to list of EPGs instead of one #424

Open BGP-Boss10 opened 1 month ago

BGP-Boss10 commented 1 month ago

Community Note

Description

New or Affected Module(s):

MSO version and MSO Platform

APIC version and APIC Platform for Site Level Resources

Collection versions

References

akinross commented 1 month ago

Hi @BGP-Boss10,

I have added it to the todo list and we will discuss this with the team. Personally I think this would be a wider discussion as in providing list capability input for objects, which is not limited to the the epg object.

Furthermore, if we were to make changes it would be in the mso_schema_site_anp_epg_staticport module because the mso_schema_site_anp_epg_bulk_staticport has been deprecated and will be removed in future release.

BGP-Boss10 commented 1 month ago

Oh my apologies, I didn't realize it was being deprecated.

I must add that this would be one of the most useful enhancements possible. I do not know of a time that I have ever added one static port to one EPG. In my playbooks, I end up looping through a variable list for both, which overloads the API and sends x number of calls. Others in the community seem to use the same workaround as me. I've had some playbooks run for over 40 minutes because of this limitation. With the enhancement I described, this would be a matter of seconds instead.

akinross commented 1 month ago

Hi @BGP-Boss10,

Not sure I follow your comment entirely, because you can add N static ports to one EPG. Also I am not sure what workaround you are referring to, could you please provide these details?

The mso_schema_site_anp_epg_bulk_staticport is deprecated because the mso_schema_site_anp_epg_staticport now allows your to add N static ports to an EPG or force replace ALL the static ports assigned to an EPG. See examples in the github repo: https://github.com/CiscoDevNet/ansible-mso/blob/master/plugins/modules/mso_schema_site_anp_epg_staticport.py#L242-L285. Or refer to the documentation for more explanation: https://galaxy.ansible.com/ui/repo/published/cisco/mso/content/module/mso_schema_site_anp_epg_staticport/.

The functionality of the module is thus a merge of the bulk and in addition of the bulk functionality it lets you add or delete multiple static ports in one task execution. These are still multiple add operations but in a single REST request. This increases the speed without risking overwriting changes that are potentially occurring in parallel.

How many EPGs and static ports are you configuring at the moment?

BGP-Boss10 commented 1 month ago

Sorry about that, I'll try to explain with a bit more context.

I am aware that we can add multiple static-ports to ONE EPG with one REST request now. The limitation is that we cannot add multiple static-ports to multiple EPGs with one REST request.

Below is an example of one of the playbooks I am using currently:

image

As you can see, I am looping through two lists "staticpath" and "EPGList". These variables are lists present in a variable file that I will show below. Please note that I would no longer have to loop through a list called "staticpath" for static-ports, as that functionality is present in the current module, as you mentioned above. I built this playbook before that feature was included in this module. Again, the limitation here is the inability for the same static-ports to be created for multiple EPGs in the same REST request, so I would have to loop through my "EPGList" and execute that same task multiple times. This isn't a problem when I am only adding static-ports to a few EPGs, but I am often adding many static-ports to many EPGs.

Example vars file:

image

Below is an example of my playbook running, you can see that as I iterate over those two lists, "staticpath" and "EPGList", there is a task item for each EPG and each static-port. Again, I now realize I can speed this up a bit by using the bulk static-port enhancement and only loop through the "EPGList" list, but if my provided list of EPGs is very long (and it often is), this can still take a long time to complete.

image

I hope I did a better job at explaining it this time, please ask for more clarification if needed.

akinross commented 1 month ago

Hi @BGP-Boss10,

Thank you for the more elaborate explanation, I will discuss this further with the team and get back to you somewhere this week.

akinross commented 1 month ago

Hi @BGP-Boss10,

We have had an discussion with the team and decided that this will not have priority for now. This is due to the increase of complexity inside the module, and determining the exact scope of the module if we include those changes.

We will keep it open that track the interest throughout the community for this issue.

Finally in case you would like to develop this part your self and you need any assistance feel free to contact me directly.

BGP-Boss10 commented 1 month ago

Thanks for getting back to me. This is disappointing as it would have been a great enhancement.

Is your team willing to work on a way to send one static port update to multiple EPGs in one REST request instead? This should be less complex.

akinross commented 1 month ago

Hi @BGP-Boss10,

I understand that it is disappointing because it does not solve your specific case and apologies for this, but as mentioned previously for now this has no priority for us.

The single static port add to multiple EPGs would still introduce a fair amount of complexity. The complexity lies not in just the add operation, but idempotency, index based removal and list shifting, query and the corresponding output, back-worths compatibility, etc...

Is the add operation the time blocking issue? Or do you also require delete/query operations? If only adding has the speed requirement, have you considered leveraging mso_rest module for this specific add operation?

BGP-Boss10 commented 3 weeks ago

I can give this a try myself, but I am not proficient in Python. I'll reach out directly.

akinross commented 3 weeks ago

Hi @BGP-Boss10,

Sure also feel free to send me an email directly. This way we can schedule a WebEx meeting if needed, which is sometimes easier to discuss topics.