From a2fdb0a3aa3bdd9e314407e084b929bd30f19ff9 Mon Sep 17 00:00:00 2001 From: alparslanavci Date: Thu, 8 Apr 2021 11:00:27 +0100 Subject: [PATCH 1/2] Changed publicIp check to privateIp when parsing API response --- .../com/hazelcast/azure/AzureComputeApi.java | 2 +- .../hazelcast/azure/AzureComputeApiTest.java | 170 ++++++++---------- 2 files changed, 77 insertions(+), 95 deletions(-) diff --git a/src/main/java/com/hazelcast/azure/AzureComputeApi.java b/src/main/java/com/hazelcast/azure/AzureComputeApi.java index d29e5af..22b001b 100644 --- a/src/main/java/com/hazelcast/azure/AzureComputeApi.java +++ b/src/main/java/com/hazelcast/azure/AzureComputeApi.java @@ -106,7 +106,7 @@ private Map parsePrivateIpResponse(String respons JsonObject ipProps = ipConfiguration.asObject().get("properties").asObject(); String privateIp = ipProps.getString("privateIPAddress", null); String publicIpId = toJsonObject(ipProps.get("publicIPAddress")).getString("id", null); - if (!isEmpty(publicIpId)) { + if (!isEmpty(privateIp)) { interfaces.put(publicIpId, new AzureNetworkInterface(privateIp, publicIpId, tagList)); } } diff --git a/src/test/java/com/hazelcast/azure/AzureComputeApiTest.java b/src/test/java/com/hazelcast/azure/AzureComputeApiTest.java index 041653a..eb11141 100644 --- a/src/test/java/com/hazelcast/azure/AzureComputeApiTest.java +++ b/src/test/java/com/hazelcast/azure/AzureComputeApiTest.java @@ -45,6 +45,7 @@ public class AzureComputeApiTest { private static final String INSTANCE_1_PUBLIC_IP = "35.207.0.219"; private static final String INSTANCE_2_PRIVATE_IP = "10.240.0.3"; private static final String INSTANCE_2_PUBLIC_IP = "35.237.227.147"; + private static final String INSTANCE_3_PRIVATE_IP = "10.240.0.4"; private AzureComputeApi azureComputeApi; @@ -74,9 +75,11 @@ public void instancesNoScaleSetNoTag() { // then AzureAddress address1 = new AzureAddress(INSTANCE_1_PRIVATE_IP, INSTANCE_1_PUBLIC_IP); AzureAddress address2 = new AzureAddress(INSTANCE_2_PRIVATE_IP, INSTANCE_2_PUBLIC_IP); + AzureAddress address3 = new AzureAddress(INSTANCE_3_PRIVATE_IP, null); Set expected = new LinkedHashSet(2); expected.add(address1); expected.add(address2); + expected.add(address3); assertEquals(expected, result); } @@ -100,9 +103,11 @@ public void instancesWithScaleSet() { // then AzureAddress address1 = new AzureAddress(INSTANCE_1_PRIVATE_IP, INSTANCE_1_PUBLIC_IP); AzureAddress address2 = new AzureAddress(INSTANCE_2_PRIVATE_IP, INSTANCE_2_PUBLIC_IP); + AzureAddress address3 = new AzureAddress(INSTANCE_3_PRIVATE_IP, null); Set expected = new LinkedHashSet(2); expected.add(address1); expected.add(address2); + expected.add(address3); assertEquals(expected, result); } @@ -127,105 +132,82 @@ public void instancesWithTag() { expected.add(address1); assertEquals(expected, result); } + /** * Response recorded from the real Cloud Compute API call. */ private static String instancesResponseForNetworkInterfaces() { return String.format( - "{\n" - + " \"value\": [\n" - + " {\n" - + " \"name\": \"test-nic\",\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic\",\n" - + " \"location\": \"eastus\",\n" - + " \"properties\": {\n" - + " \"provisioningState\": \"Succeeded\",\n" - + " \"ipConfigurations\": [\n" - + " {\n" - + " \"name\": \"ipconfig1\",\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1\",\n" - + " \"properties\": {\n" - + " \"provisioningState\": \"Succeeded\",\n" - + " \"privateIPAddress\": \"%s\",\n" - + " \"privateIPAllocationMethod\": \"Dynamic\",\n" - + " \"publicIPAddress\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip\"\n" - + " },\n" - + " \"subnet\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default\"\n" - + " },\n" - + " \"primary\": true,\n" - + " \"privateIPAddressVersion\": \"IPv4\"\n" - + " }\n" - + " }\n" - + " ],\n" - + " \"dnsSettings\": {\n" - + " \"dnsServers\": [],\n" - + " \"appliedDnsServers\": [],\n" - + " \"internalDomainNameSuffix\": \"test.bx.internal.cloudapp.net\"\n" - + " },\n" - + " \"macAddress\": \"00-0D-3A-1B-C7-21\",\n" - + " \"enableAcceleratedNetworking\": true,\n" - + " \"enableIPForwarding\": false,\n" - + " \"networkSecurityGroup\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg\"\n" - + " },\n" - + " \"primary\": true,\n" - + " \"virtualMachine\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1\"\n" - + " }\n" - + " },\n" - + " \"tags\": {\n" - + " \"%s\": \"%s\",\n" - + " \"tag2\": \"value2\"\n" - + " },\n" - + " \"type\": \"Microsoft.Network/networkInterfaces\"\n" - + " },\n" - + " {\n" - + " \"name\": \"test-nic2\",\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic2\",\n" - + " \"location\": \"eastus\",\n" - + " \"properties\": {\n" - + " \"provisioningState\": \"Succeeded\",\n" - + " \"ipConfigurations\": [\n" - + " {\n" - + " \"name\": \"ipconfig1\",\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic2/ipConfigurations/ipconfig1\",\n" - + " \"properties\": {\n" - + " \"provisioningState\": \"Succeeded\",\n" - + " \"privateIPAddress\": \"%s\",\n" - + " \"privateIPAllocationMethod\": \"Dynamic\",\n" - + " \"publicIPAddress\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip2\"\n" - + " },\n" - + " \"subnet\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet2/subnets/default\"\n" - + " },\n" - + " \"primary\": true,\n" - + " \"privateIPAddressVersion\": \"IPv4\"\n" - + " }\n" - + " }\n" - + " ],\n" - + " \"dnsSettings\": {\n" - + " \"dnsServers\": [],\n" - + " \"appliedDnsServers\": [],\n" - + " \"internalDomainNameSuffix\": \"test2.bx.internal.cloudapp.net\"\n" - + " },\n" - + " \"macAddress\": \"00-0D-3A-1B-C7-22\",\n" - + " \"enableAcceleratedNetworking\": true,\n" - + " \"enableIPForwarding\": false,\n" - + " \"networkSecurityGroup\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg\"\n" - + " },\n" - + " \"primary\": true,\n" - + " \"virtualMachine\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm2\"\n" - + " }\n" - + " },\n" - + " \"type\": \"Microsoft.Network/networkInterfaces\"\n" - + " }\n" - + " ]\n" - + "}", INSTANCE_1_PRIVATE_IP, TAG.getKey(), TAG.getValue(), INSTANCE_2_PRIVATE_IP); + "{\n" + " \"value\": [\n" + " {\n" + " \"name\": \"test-nic\",\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic\",\n" + + " \"location\": \"eastus\",\n" + " \"properties\": {\n" + + " \"provisioningState\": \"Succeeded\",\n" + " \"ipConfigurations\": [\n" + + " {\n" + " \"name\": \"ipconfig1\",\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1\",\n" + + " \"properties\": {\n" + " \"provisioningState\": \"Succeeded\",\n" + + " \"privateIPAddress\": \"%s\",\n" + + " \"privateIPAllocationMethod\": \"Dynamic\",\n" + " \"publicIPAddress\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip\"\n" + + " },\n" + " \"subnet\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default\"\n" + + " },\n" + " \"primary\": true,\n" + + " \"privateIPAddressVersion\": \"IPv4\"\n" + " }\n" + " }\n" + + " ],\n" + " \"dnsSettings\": {\n" + " \"dnsServers\": [],\n" + + " \"appliedDnsServers\": [],\n" + + " \"internalDomainNameSuffix\": \"test.bx.internal.cloudapp.net\"\n" + " },\n" + + " \"macAddress\": \"00-0D-3A-1B-C7-21\",\n" + " \"enableAcceleratedNetworking\": true,\n" + + " \"enableIPForwarding\": false,\n" + " \"networkSecurityGroup\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg\"\n" + + " },\n" + " \"primary\": true,\n" + " \"virtualMachine\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1\"\n" + + " }\n" + " },\n" + " \"tags\": {\n" + " \"%s\": \"%s\",\n" + + " \"tag2\": \"value2\"\n" + " },\n" + + " \"type\": \"Microsoft.Network/networkInterfaces\"\n" + " },\n" + " {\n" + + " \"name\": \"test-nic2\",\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic2\",\n" + + " \"location\": \"eastus\",\n" + " \"properties\": {\n" + + " \"provisioningState\": \"Succeeded\",\n" + " \"ipConfigurations\": [\n" + + " {\n" + " \"name\": \"ipconfig1\",\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic2/ipConfigurations/ipconfig1\",\n" + + " \"properties\": {\n" + " \"provisioningState\": \"Succeeded\",\n" + + " \"privateIPAddress\": \"%s\",\n" + + " \"privateIPAllocationMethod\": \"Dynamic\",\n" + " \"publicIPAddress\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip2\"\n" + + " },\n" + " \"subnet\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet2/subnets/default\"\n" + + " },\n" + " \"primary\": true,\n" + + " \"privateIPAddressVersion\": \"IPv4\"\n" + " }\n" + " }\n" + + " ],\n" + " \"dnsSettings\": {\n" + " \"dnsServers\": [],\n" + + " \"appliedDnsServers\": [],\n" + + " \"internalDomainNameSuffix\": \"test2.bx.internal.cloudapp.net\"\n" + " },\n" + + " \"macAddress\": \"00-0D-3A-1B-C7-22\",\n" + " \"enableAcceleratedNetworking\": true,\n" + + " \"enableIPForwarding\": false,\n" + " \"networkSecurityGroup\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg\"\n" + + " },\n" + " \"primary\": true,\n" + " \"virtualMachine\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm2\"\n" + + " }\n" + " },\n" + " \"type\": \"Microsoft.Network/networkInterfaces\"\n" + " },\n" + + " {\n" + " \"name\": \"test-nic3\",\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic3\",\n" + + " \"location\": \"eastus\",\n" + " \"properties\": {\n" + + " \"provisioningState\": \"Succeeded\",\n" + " \"ipConfigurations\": [\n" + + " {\n" + " \"name\": \"ipconfig1\",\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic3/ipConfigurations/ipconfig1\",\n" + + " \"properties\": {\n" + " \"provisioningState\": \"Succeeded\",\n" + + " \"privateIPAddress\": \"%s\",\n" + + " \"privateIPAllocationMethod\": \"Dynamic\",\n" + " \"subnet\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet2/subnets/default\"\n" + + " },\n" + " \"primary\": true,\n" + + " \"privateIPAddressVersion\": \"IPv4\"\n" + " }\n" + " }\n" + + " ],\n" + " \"dnsSettings\": {\n" + " \"dnsServers\": [],\n" + + " \"appliedDnsServers\": [],\n" + + " \"internalDomainNameSuffix\": \"test3.bx.internal.cloudapp.net\"\n" + " },\n" + + " \"macAddress\": \"00-0D-3A-1B-C7-23\",\n" + " \"enableAcceleratedNetworking\": true,\n" + + " \"enableIPForwarding\": false,\n" + " \"networkSecurityGroup\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg\"\n" + + " },\n" + " \"primary\": true,\n" + " \"virtualMachine\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm2\"\n" + + " }\n" + " },\n" + " \"type\": \"Microsoft.Network/networkInterfaces\"\n" + " }\n" + + " ]\n" + "}", INSTANCE_1_PRIVATE_IP, TAG.getKey(), TAG.getValue(), INSTANCE_2_PRIVATE_IP, INSTANCE_3_PRIVATE_IP); } private String instancesResponseForPublicIPAddresses() { From 68cb460132ea542620061d2260df9615eb2e8c20 Mon Sep 17 00:00:00 2001 From: alparslanavci Date: Fri, 9 Apr 2021 09:26:35 +0100 Subject: [PATCH 2/2] Formatted JSON in test --- .../hazelcast/azure/AzureComputeApiTest.java | 204 ++++++++++++------ 1 file changed, 134 insertions(+), 70 deletions(-) diff --git a/src/test/java/com/hazelcast/azure/AzureComputeApiTest.java b/src/test/java/com/hazelcast/azure/AzureComputeApiTest.java index eb11141..b1db0b9 100644 --- a/src/test/java/com/hazelcast/azure/AzureComputeApiTest.java +++ b/src/test/java/com/hazelcast/azure/AzureComputeApiTest.java @@ -138,76 +138,140 @@ public void instancesWithTag() { */ private static String instancesResponseForNetworkInterfaces() { return String.format( - "{\n" + " \"value\": [\n" + " {\n" + " \"name\": \"test-nic\",\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic\",\n" - + " \"location\": \"eastus\",\n" + " \"properties\": {\n" - + " \"provisioningState\": \"Succeeded\",\n" + " \"ipConfigurations\": [\n" - + " {\n" + " \"name\": \"ipconfig1\",\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1\",\n" - + " \"properties\": {\n" + " \"provisioningState\": \"Succeeded\",\n" - + " \"privateIPAddress\": \"%s\",\n" - + " \"privateIPAllocationMethod\": \"Dynamic\",\n" + " \"publicIPAddress\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip\"\n" - + " },\n" + " \"subnet\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default\"\n" - + " },\n" + " \"primary\": true,\n" - + " \"privateIPAddressVersion\": \"IPv4\"\n" + " }\n" + " }\n" - + " ],\n" + " \"dnsSettings\": {\n" + " \"dnsServers\": [],\n" - + " \"appliedDnsServers\": [],\n" - + " \"internalDomainNameSuffix\": \"test.bx.internal.cloudapp.net\"\n" + " },\n" - + " \"macAddress\": \"00-0D-3A-1B-C7-21\",\n" + " \"enableAcceleratedNetworking\": true,\n" - + " \"enableIPForwarding\": false,\n" + " \"networkSecurityGroup\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg\"\n" - + " },\n" + " \"primary\": true,\n" + " \"virtualMachine\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1\"\n" - + " }\n" + " },\n" + " \"tags\": {\n" + " \"%s\": \"%s\",\n" - + " \"tag2\": \"value2\"\n" + " },\n" - + " \"type\": \"Microsoft.Network/networkInterfaces\"\n" + " },\n" + " {\n" - + " \"name\": \"test-nic2\",\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic2\",\n" - + " \"location\": \"eastus\",\n" + " \"properties\": {\n" - + " \"provisioningState\": \"Succeeded\",\n" + " \"ipConfigurations\": [\n" - + " {\n" + " \"name\": \"ipconfig1\",\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic2/ipConfigurations/ipconfig1\",\n" - + " \"properties\": {\n" + " \"provisioningState\": \"Succeeded\",\n" - + " \"privateIPAddress\": \"%s\",\n" - + " \"privateIPAllocationMethod\": \"Dynamic\",\n" + " \"publicIPAddress\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip2\"\n" - + " },\n" + " \"subnet\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet2/subnets/default\"\n" - + " },\n" + " \"primary\": true,\n" - + " \"privateIPAddressVersion\": \"IPv4\"\n" + " }\n" + " }\n" - + " ],\n" + " \"dnsSettings\": {\n" + " \"dnsServers\": [],\n" - + " \"appliedDnsServers\": [],\n" - + " \"internalDomainNameSuffix\": \"test2.bx.internal.cloudapp.net\"\n" + " },\n" - + " \"macAddress\": \"00-0D-3A-1B-C7-22\",\n" + " \"enableAcceleratedNetworking\": true,\n" - + " \"enableIPForwarding\": false,\n" + " \"networkSecurityGroup\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg\"\n" - + " },\n" + " \"primary\": true,\n" + " \"virtualMachine\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm2\"\n" - + " }\n" + " },\n" + " \"type\": \"Microsoft.Network/networkInterfaces\"\n" + " },\n" - + " {\n" + " \"name\": \"test-nic3\",\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic3\",\n" - + " \"location\": \"eastus\",\n" + " \"properties\": {\n" - + " \"provisioningState\": \"Succeeded\",\n" + " \"ipConfigurations\": [\n" - + " {\n" + " \"name\": \"ipconfig1\",\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic3/ipConfigurations/ipconfig1\",\n" - + " \"properties\": {\n" + " \"provisioningState\": \"Succeeded\",\n" - + " \"privateIPAddress\": \"%s\",\n" - + " \"privateIPAllocationMethod\": \"Dynamic\",\n" + " \"subnet\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet2/subnets/default\"\n" - + " },\n" + " \"primary\": true,\n" - + " \"privateIPAddressVersion\": \"IPv4\"\n" + " }\n" + " }\n" - + " ],\n" + " \"dnsSettings\": {\n" + " \"dnsServers\": [],\n" - + " \"appliedDnsServers\": [],\n" - + " \"internalDomainNameSuffix\": \"test3.bx.internal.cloudapp.net\"\n" + " },\n" - + " \"macAddress\": \"00-0D-3A-1B-C7-23\",\n" + " \"enableAcceleratedNetworking\": true,\n" - + " \"enableIPForwarding\": false,\n" + " \"networkSecurityGroup\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg\"\n" - + " },\n" + " \"primary\": true,\n" + " \"virtualMachine\": {\n" - + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm2\"\n" - + " }\n" + " },\n" + " \"type\": \"Microsoft.Network/networkInterfaces\"\n" + " }\n" - + " ]\n" + "}", INSTANCE_1_PRIVATE_IP, TAG.getKey(), TAG.getValue(), INSTANCE_2_PRIVATE_IP, INSTANCE_3_PRIVATE_IP); + "{\n" + + " \"value\": [\n" + + " {\n" + + " \"name\": \"test-nic\",\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic\",\n" + + " \"location\": \"eastus\",\n" + + " \"properties\": {\n" + + " \"provisioningState\": \"Succeeded\",\n" + + " \"ipConfigurations\": [\n" + + " {\n" + + " \"name\": \"ipconfig1\",\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic/ipConfigurations/ipconfig1\",\n" + + " \"properties\": {\n" + + " \"provisioningState\": \"Succeeded\",\n" + + " \"privateIPAddress\": \"%s\",\n" + + " \"privateIPAllocationMethod\": \"Dynamic\",\n" + + " \"publicIPAddress\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip\"\n" + + " },\n" + + " \"subnet\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default\"\n" + + " },\n" + + " \"primary\": true,\n" + + " \"privateIPAddressVersion\": \"IPv4\"\n" + + " }\n" + + " }\n" + + " ],\n" + + " \"dnsSettings\": {\n" + + " \"dnsServers\": [],\n" + + " \"appliedDnsServers\": [],\n" + + " \"internalDomainNameSuffix\": \"test.bx.internal.cloudapp.net\"\n" + + " },\n" + + " \"macAddress\": \"00-0D-3A-1B-C7-21\",\n" + + " \"enableAcceleratedNetworking\": true,\n" + + " \"enableIPForwarding\": false,\n" + + " \"networkSecurityGroup\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg\"\n" + + " },\n" + + " \"primary\": true,\n" + + " \"virtualMachine\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1\"\n" + + " }\n" + + " },\n" + + " \"tags\": {\n" + + " \"%s\": \"%s\",\n" + + " \"tag2\": \"value2\"\n" + + " },\n" + + " \"type\": \"Microsoft.Network/networkInterfaces\"\n" + + " },\n" + + " {\n" + + " \"name\": \"test-nic2\",\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic2\",\n" + + " \"location\": \"eastus\",\n" + + " \"properties\": {\n" + + " \"provisioningState\": \"Succeeded\",\n" + + " \"ipConfigurations\": [\n" + + " {\n" + + " \"name\": \"ipconfig1\",\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic2/ipConfigurations/ipconfig1\",\n" + + " \"properties\": {\n" + + " \"provisioningState\": \"Succeeded\",\n" + + " \"privateIPAddress\": \"%s\",\n" + + " \"privateIPAllocationMethod\": \"Dynamic\",\n" + + " \"publicIPAddress\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip2\"\n" + + " },\n" + + " \"subnet\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet2/subnets/default\"\n" + + " },\n" + + " \"primary\": true,\n" + + " \"privateIPAddressVersion\": \"IPv4\"\n" + + " }\n" + + " }\n" + + " ],\n" + + " \"dnsSettings\": {\n" + + " \"dnsServers\": [],\n" + + " \"appliedDnsServers\": [],\n" + + " \"internalDomainNameSuffix\": \"test2.bx.internal.cloudapp.net\"\n" + + " },\n" + + " \"macAddress\": \"00-0D-3A-1B-C7-22\",\n" + + " \"enableAcceleratedNetworking\": true,\n" + + " \"enableIPForwarding\": false,\n" + + " \"networkSecurityGroup\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg\"\n" + + " },\n" + + " \"primary\": true,\n" + + " \"virtualMachine\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm2\"\n" + + " }\n" + + " },\n" + + " \"type\": \"Microsoft.Network/networkInterfaces\"\n" + + " },\n" + + " {\n" + + " \"name\": \"test-nic3\",\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic3\",\n" + + " \"location\": \"eastus\",\n" + + " \"properties\": {\n" + + " \"provisioningState\": \"Succeeded\",\n" + + " \"ipConfigurations\": [\n" + + " {\n" + + " \"name\": \"ipconfig1\",\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/test-nic3/ipConfigurations/ipconfig1\",\n" + + " \"properties\": {\n" + + " \"provisioningState\": \"Succeeded\",\n" + + " \"privateIPAddress\": \"%s\",\n" + + " \"privateIPAllocationMethod\": \"Dynamic\",\n" + + " \"subnet\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet2/subnets/default\"\n" + + " },\n" + + " \"primary\": true,\n" + + " \"privateIPAddressVersion\": \"IPv4\"\n" + + " }\n" + + " }\n" + + " ],\n" + + " \"dnsSettings\": {\n" + + " \"dnsServers\": [],\n" + + " \"appliedDnsServers\": [],\n" + + " \"internalDomainNameSuffix\": \"test3.bx.internal.cloudapp.net\"\n" + + " },\n" + + " \"macAddress\": \"00-0D-3A-1B-C7-23\",\n" + + " \"enableAcceleratedNetworking\": true,\n" + + " \"enableIPForwarding\": false,\n" + + " \"networkSecurityGroup\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg\"\n" + + " },\n" + + " \"primary\": true,\n" + + " \"virtualMachine\": {\n" + + " \"id\": \"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm2\"\n" + + " }\n" + + " },\n" + + " \"type\": \"Microsoft.Network/networkInterfaces\"\n" + + " }\n" + + " ]\n" + + "}", INSTANCE_1_PRIVATE_IP, TAG.getKey(), TAG.getValue(), INSTANCE_2_PRIVATE_IP, INSTANCE_3_PRIVATE_IP); } private String instancesResponseForPublicIPAddresses() {