VMware Networking Community
vmguy009
Contributor
Contributor

IP Set - Power NSX

I have an existing IP Set ( say 5 IP address are there)

IPset A - 1.1.1.1, 1.1.1.2, 1.1.1.3,1.1.1.4, 1.1.1.5

I will be extracting IP Address from other security group.

I want to compare these 2 IP addresses. If there is any difference then I want to replace the new IP addresses extracted from the security group to the IPSet A

EX 1 - IP Address extracted from Security group - 1.1.1.1, 1.1.1.2, 1.1.1.3,1.1.1.4, 2.2.2.2

There is difference in IP & I need to replace the IP Set with these IP "1.1.1.1, 1.1.1.2, 1.1.1.3,1.1.1.4, 2.2.2.2"

EX 2 - IP Address extracted from Security group - 1.1.1.1, 1.1.1.2, 1.1.1.3,1.1.1.4, 1.1.1.5

No diff - so no action

If there is no diff I need not do any action.

Let me know if this is possible using power NSX

Reply
0 Kudos
1 Reply
DaleCoghlan
VMware Employee
VMware Employee

PowerNSX does not have this capability built-in. You will have to fall back on using PowerShell for the logic to do the comparison.

A word of warning though. The "value" that is returned by the NSX-v API that contains the IP Addresses, is a single string. The IP Addresses are returned as comma separated values within that single string, but are returned in a random order each and every time you query it. So to do any comparisons, you will need to split them into an array first, then sort them, and then do some form of comparison operation.

Reply
0 Kudos