/// <summary> /// Compares the response of GetMetadata with the expected response. /// </summary> /// <param name="input">The metadata value of forwardedIps.</param> /// <param name="expected">The expected response of GetMetadata</param> private static void GetMetadataTest(string inputMAC, string[] inputIPs, Dictionary <PhysicalAddress, List <IPAddress> > expected) { NetworkInterfacesJson networkInterface = MetadataJsonHelpers.GetNetworkInterfacesJson(inputMAC, inputIPs); NetworkInterfacesJson[] networkInterfaces = new NetworkInterfacesJson[] { networkInterface }; GetMetadataNetworkInterfacesTest(networkInterfaces, expected); }
private static MetadataJson CreateTestMetadata(string[] forwardAddresses, bool disableAddressManager = true) { AttributesJson attributes = MetadataJsonHelpers.GetAttributesJson( disableAddressManager: disableAddressManager); InstanceJson instance = MetadataJsonHelpers.GetInstanceMetadataJson( attributes, new[] { MetadataJsonHelpers.GetNetworkInterfacesJson(inputIPs: forwardAddresses) }); return(MetadataJsonHelpers.GetMetadataJson(instance: instance)); }
public void GetMetadataNetworkInterfacesTest() { string[] forwardedIps = new string[] { "1.1.1.1", "2.2.2.2" }; NetworkInterfacesJson[] networkInterfaces = new NetworkInterfacesJson[] { MetadataJsonHelpers.GetNetworkInterfacesJson("00-11-22-33-44-55", forwardedIps), }; GetMetadataNetworkInterfacesTest( input: networkInterfaces, expected: new Dictionary <PhysicalAddress, List <IPAddress> > { { PhysicalAddress.Parse("00-11-22-33-44-55"), new List <IPAddress> { IPAddress.Parse("1.1.1.1"), IPAddress.Parse("2.2.2.2") } } }); }