VMware NSX API using page size 0 returns unexpected results
search cancel

VMware NSX API using page size 0 returns unexpected results

book

Article ID: 322667

calendar_today

Updated On:

Products

VMware NSX Networking

Issue/Introduction

Symptoms:
  • You have groups setup with members as virtual machines.
  • When you click on View Members of the group it shows the virtual machine and IP address.
  • When you want to query what groups a particular IP address is a member of, you use the following API:
https://<manager-ip>/policy/api/v1/infra/ip-address-group-associations?ip_address=<ip-address>&page_size=0
  • This API returns the following results:
{
    "results": [
        {
            "target_id": "/infra/domains/default/groups/test-vm",
            "target_display_name": "test-vm",
            "target_type": "DOMAIN_GROUP",
            "is_valid": true,
            "path": "/infra/domains/default/groups/test-vm"
        }
    ],
    "result_count": 1,
    "sort_by": "target_display_name",
    "sort_ascending": true
}
  • When using the the page_size 0, you expect to only see the result_count and no results.


Environment

VMware NSX-T Data Center
VMware NSX-T Data Center 2.x
VMware NSX-T Data Center 3.x
VMware NSX-T Data Center 4.x

Cause

When the page_size is set to zero, the API by default was set to display a page size of 5000 and 1000 if no page_size was set, which resulted in displaying the membership results.

Resolution

This is a known issue impacting VMware NSX.

Workaround:
If you wish to only see the result count and not all the membership results, you can set the page_size to 1, this implies you will have 1 membership result, but you can see the result_count.