Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

aci_rest needs to support pagination #398

Open
nurseandthenerd opened this issue Mar 16, 2023 · 1 comment
Open

aci_rest needs to support pagination #398

nurseandthenerd opened this issue Mar 16, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@nurseandthenerd
Copy link

nurseandthenerd commented Mar 16, 2023

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

When querying an api endpoint with a large number of results the request needs to be paginated when required.

{
"msg": "APIC Error 400: Unable to process the query, result dataset is too big",
"changed": false,
"status": -1,
"error": {
"code": "400",
"text": "Unable to process the query, result dataset is too big"
},
"invocation": {
"module_args": {
"hostname": "apic",
"username": "ansible",
"private_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"certificate_name": "ansible_tower",
"validate_certs": false,
"use_proxy": false,
"method": "get",
"path": "/api/node/class/fvAEPg.json?order-by=fvAEPg.dn&rsp-subtree=full",
"host": "apic",
"output_level": "normal",
"timeout": 30,
"use_ssl": true,
"port": null,
"password": null,
"output_path": null,
"annotation": null,
"owner_key": null,
"owner_tag": null,
"src": null,
"content": null,
"protocol": "https"
}
},
"_ansible_no_log": false
}

Affected Module Name(s):

aci_rest

APIC version and APIC Platform

V 4.2(3l) on-prem

Collection versions

cisco.aci latest

Output/ Error message

Unable to process the query, result dataset is too big

Expected Behavior

all results returned

Actual Behavior

nothing. module returned error from the apic api

Playbook tasks to Reproduce

  • name: get fvAEPg
    cisco.aci.aci_rest:聽聽聽聽
    hostname: "{{ apic_address }}"聽聽聽聽
    username: "{{ apic_user }}"聽聽聽聽
    private_key: "{{ apic_key_path }}"聽聽聽聽
    certificate_name: "{{ apic_cert_name }}"聽聽聽聽
    validate_certs: no聽聽聽聽
    use_proxy: no聽聽聽聽
    method: get聽聽聽聽
    path: /api/node/class/fvAEPg.json?order-by=fvAEPg.dn&rsp-subtree=full
    register: response聽聽changed_when: False

Important Factoids

module was working fine. issue just started happening. there have been no ansible code changes. i think the number of AEPGs just grew so the resultant data returned from the API is just too large now.

References

from https://www.cisco.com/c/en/us/td/docs/switches/datacenter/aci/apic/sw/3-x/rest-api-config/b_Cisco_APIC_REST_API_Configuration_Guide_3x/b_Cisco_APIC_REST_API_Configuration_Guide_chapter_01.html

Paginating the Results
By adding the page-size operator to the query URI, you can divide the query results into groups (pages) of objects using the following syntax. The operand specifies the number of objects in each group.

page-size = number-of-objects-per-page

By adding the page operator in the query URI, you can specify a single group to be returned using the following syntax. The pages start from number 0.

page = page-number

This example shows you how to specify 15 fault instances per page in descending order, returning only the first page:

GET https://apic-ip-address/api/class/faultInfo.json?order-by=faultInst.severity|desc&page=0&page-size=15

@nurseandthenerd nurseandthenerd added the bug Something isn't working label Mar 16, 2023
@lhercot lhercot added enhancement New feature or request and removed bug Something isn't working labels Mar 16, 2023
@lhercot
Copy link
Member

lhercot commented Mar 16, 2023

@nurseandthenerd aci_rest gives you the ability to implement pagination by yourself in your playbook. You have full control on the URL and are able to pass the pagination attributes as needed.

I would also recommend to reduce the amount of child classes your retrieve by not using rsp-subtree=full or filtering it by using rsp-subtree-class

We will consider this request an enhancement request and will prioritize it accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants