-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[minor_change] Add pagination support for aci_rest module (DCNE-101) #711
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #711 +/- ##
===========================================
- Coverage 95.67% 35.72% -59.95%
===========================================
Files 270 267 -3
Lines 12405 12225 -180
Branches 1874 1849 -25
===========================================
- Hits 11868 4367 -7501
- Misses 406 7858 +7452
+ Partials 131 0 -131
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
plugins/modules/aci_rest.py
Outdated
aci.path = "{0}?page={1}&page-size={2}".format(aci.path, page, page_size) | ||
aci.url = update_qsl(aci.url, {"page": page, "page-size": page_size}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be a issue when doing setting url and path in this way when path contains other filters. As an example if path is "/api/class/fvSubnet.json?order-by=fvSubnet.descr" and you would add page information as above it would display the url as "https://173.36.219.82/api/class/fvSubnet.json?order-by=fvSubnet.descr?page=0&page-size=3"
but would sent correctly to https://173.36.219.82:443/api/class/fvSubnet.json?order-by=fvSubnet.descr&page=0&page-size=3
as temp workaround tested that leveraging the update_qsl() function will display it correctly
aci.path = "{0}?page={1}&page-size={2}".format(aci.path, page, page_size) | |
aci.url = update_qsl(aci.url, {"page": page, "page-size": page_size}) | |
aci.path = update_qsl(aci.path, {"page": page, "page-size": page_size}) | |
aci.url = update_qsl(aci.url, {"page": page, "page-size": page_size}) |
I do think however we should rootcause this, because it is likely that similar behaviour is present for rsp-subtree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I´ll look into this. thanks.
This change adds "page_size" and "page" optional paremeters to the aci_rest module in order to support pagination.
if the
page_size
parameter is set on a GET request, it controls the amount of objects to be returned on each page by the APIC response, then thepage
parameter controls which page is returned to the module.If the
page
parameter is not set, it returns the first page by default (0)