I have an existing IP Set ( say 5 IP address are there)
IPset A - 18.104.22.168, 22.214.171.124, 126.96.36.199,188.8.131.52, 184.108.40.206
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 - 220.127.116.11, 18.104.22.168, 22.214.171.124,126.96.36.199, 188.8.131.52
There is difference in IP & I need to replace the IP Set with these IP "184.108.40.206, 220.127.116.11, 18.104.22.168,22.214.171.124, 126.96.36.199"
EX 2 - IP Address extracted from Security group - 188.8.131.52, 184.108.40.206, 220.127.116.11,18.104.22.168, 22.214.171.124
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
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.