Wednesday, June 1, 2022

How to filter NSX-T GET API call

 I faced a small issue today. I am creating all the NSX-T segments by Terraform and one of my customers asked me to enable DHCP relay on his segment, and he told me that we will need to do that in the future for other NSX-T segments.


As I am lazy, I started to think how can I automate this kind of requests. and I found 2 possibilities:

1. Providing him a way to edit in his Terraform config. file , and by this way he will have a high priv. on the NSX-T which is not a good idea at all.

2. Create for him a VRO workflow to write in it the segment name and the workflow will add the DHCP relay configuration to his segment.


I decided to proceed with the second option. and I found 2 issues:

1. I have to add a life cycle in the NSX-T segment resource in the Terraform. to avoid rolling back during the next apply :-)

2. I have to get the LSW by its name via API , to be able to edit in it and make post API with the DHCP relay config.


The second point was really tough point. because the segments have been created via terraform and they have random ID in their API path. so I have to find a way to get the segment with its name not with its API path


making GET API call to the below URL after editing it with your data, will get for you the segment 


https://YOUR_NSX_T_FQDN/policy/api/v1/search/query?query=display_name:YOUR_SEGMENT_NAME

NSX-T (local log in) with VIDM integration

We will explain how to log in with a local account to your NSX-T which integrated with VIDM. We integrated our NSX-T into the VIDM. We had a...