Skip to content

Commit

Permalink
Merge pull request #43 from Azure/dev
Browse files Browse the repository at this point in the history
.
  • Loading branch information
huangpf committed Jul 10, 2015
2 parents 48cbb97 + 0bfed89 commit 7cb3b11
Show file tree
Hide file tree
Showing 15 changed files with 1,557 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.3-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.7-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.2.4.0-preview\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<package id="Microsoft.Azure.Graph.RBAC" version="1.7.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="0.19.2-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Compute" version="7.0.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.3-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.7-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.1-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Storage" version="2.4.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Test.Framework" version="1.0.5571.32271-prerelease" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.7.0.0-preview\lib\net40\Microsoft.Azure.Management.Compute.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.3-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<Private>True</Private>
<Reference Include="Microsoft.Azure.Management.Network">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.7-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.2.4.0-preview\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<package id="Microsoft.Azure.Graph.RBAC" version="1.7.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="0.19.2-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Compute" version="7.0.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.3-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.7-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.1-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Storage" version="2.4.0-preview" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.19.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.4-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<Reference Include="Microsoft.Azure.Management.Network">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.7-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.1-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
Expand Down Expand Up @@ -222,6 +221,9 @@
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.NetworkInterfaceTests\TestNetworkInterfaceCRUDUsingId.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.NetworkInterfaceTests\TestNetworkInterfaceIDns.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.NetworkInterfaceTests\TestNetworkInterfaceSet.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,12 @@ public void TestNetworkInterfaceSet()
{
NetworkResourcesController.NewInstance.RunPsTest("Test-NetworkInterfaceSet");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestNetworkInterfaceIDns()
{
NetworkResourcesController.NewInstance.RunPsTest("Test-NetworkInterfaceIDns");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -375,4 +375,64 @@ function Test-NetworkInterfaceSet
# Cleanup
Clean-ResourceGroup $rgname
}
}

<#
.SYNOPSIS
Tests creating new simple public networkinterface with Idns.
#>
function Test-NetworkInterfaceIDns
{
# Setup
$rgname = Get-ResourceGroupName
$vnetName = Get-ResourceName
$subnetName = Get-ResourceName
$publicIpName = Get-ResourceName
$nicName = Get-ResourceName
$domainNameLabel = Get-ResourceName
$rglocation = Get-ProviderLocation ResourceManagement
$resourceTypeParent = "Microsoft.Network/networkInterfaces"
<#
uncomment after IDNS is enabled in all locations
$location = Get-ProviderLocation $resourceTypeParent
#>
$location = "centralus"

try
{
# Create the resource group
$resourceGroup = New-AzureResourceGroup -Name $rgname -Location $rglocation -Tags @{Name = "testtag"; Value = "testval"}

# Create the Virtual Network
$subnet = New-AzureVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.1.0/24
$vnet = New-AzurevirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $location -AddressPrefix 10.0.0.0/16 -Subnet $subnet

# Create NetworkInterface
$actualNic = New-AzureNetworkInterface -Name $nicName -ResourceGroupName $rgname -Location $location -Subnet $vnet.Subnets[0] -InternalDnsNameLabel "idnstest"
$expectedNic = Get-AzureNetworkInterface -Name $nicName -ResourceGroupName $rgname

Assert-AreEqual $expectedNic.ResourceGroupName $actualNic.ResourceGroupName
Assert-AreEqual $expectedNic.Name $actualNic.Name
Assert-AreEqual $expectedNic.Location $actualNic.Location
Assert-AreEqual "Succeeded" $expectedNic.ProvisioningState
Assert-AreEqual $expectedNic.IpConfigurations[0].Name $actualNic.IpConfigurations[0].Name
Assert-AreEqual $expectedNic.IpConfigurations[0].PublicIpAddress.Id $actualNic.IpConfigurations[0].PublicIpAddress.Id
Assert-AreEqual $expectedNic.IpConfigurations[0].Subnet.Id $actualNic.IpConfigurations[0].Subnet.Id
Assert-NotNull $expectedNic.IpConfigurations[0].PrivateIpAddress
Assert-AreEqual "Dynamic" $expectedNic.IpConfigurations[0].PrivateIpAllocationMethod
Assert-AreEqual "idnstest" $expectedNic.DnsSettings.InternalDnsNameLabel
Assert-Null $expectedNic.DnsSettings.InternalFqdn

# Delete NetworkInterface
$delete = Remove-AzureNetworkInterface -ResourceGroupName $rgname -name $nicName -PassThru -Force
Assert-AreEqual true $delete

$list = Get-AzureNetworkInterface -ResourceGroupName $rgname
Assert-AreEqual 0 @($list).Count
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Graph.RBAC" version="1.7.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="0.19.2-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.4-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.7-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.1-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Test.Framework" version="1.0.5571.32271-prerelease" targetFramework="net45" />
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.0.5571.32271-prerelease" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.19.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.4-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.7-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -207,7 +207,7 @@
<Compile Include="Models\PSProbeProtocol.cs" />
<Compile Include="Models\PSAddressSpace.cs" />
<Compile Include="Models\PSDhcpOptions.cs" />
<Compile Include="Models\PSDnsSettings.cs" />
<Compile Include="Models\PSNetworkInterfaceDnsSettings.cs" />
<Compile Include="Models\PSNetworkInterface.cs" />
<Compile Include="Models\PSNetworkInterfaceIpConfiguration.cs" />
<Compile Include="Models\PSProvisioningState.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ protected override void Configure()
// NetworkInterface
// CNM to MNM
Mapper.CreateMap<CNM.PSNetworkInterface, MNM.NetworkInterface>();
Mapper.CreateMap<CNM.PSDnsSettings, MNM.DnsSettings>();
Mapper.CreateMap<CNM.PSNetworkInterfaceDnsSettings, MNM.NetworkInterfaceDnsSettings>();
Mapper.CreateMap<CNM.PSNetworkInterfaceIpConfiguration, MNM.NetworkInterfaceIpConfiguration>();

// MNM to CNM
Mapper.CreateMap<MNM.NetworkInterface, CNM.PSNetworkInterface>();
Mapper.CreateMap<MNM.DnsSettings, CNM.PSDnsSettings>();
Mapper.CreateMap<MNM.NetworkInterfaceDnsSettings, CNM.PSNetworkInterfaceDnsSettings>();
Mapper.CreateMap<MNM.NetworkInterfaceIpConfiguration, CNM.PSNetworkInterfaceIpConfiguration>();

// LoadBalancer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class PSNetworkInterface : PSTopLevelResource

public List<PSNetworkInterfaceIpConfiguration> IpConfigurations { get; set; }

public PSDnsSettings DnsSettings { get; set; }
public PSNetworkInterfaceDnsSettings DnsSettings { get; set; }

public string MacAddress { get; set; }

Expand All @@ -49,7 +49,7 @@ public string IpConfigurationsText
[JsonIgnore]
public string DnsSettingsText
{
get { return JsonConvert.SerializeObject(DnsSettings, Formatting.Indented); }
get { return JsonConvert.SerializeObject(this.DnsSettings, Formatting.Indented); }
}

[JsonIgnore]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@

namespace Microsoft.Azure.Commands.Network.Models
{
public class PSDnsSettings
public class PSNetworkInterfaceDnsSettings
{
public List<string> DnsServers { get; set; }

public List<string> AppliedDnsServers { get; set; }

public string InternalDnsNameLabel { get; set; }

public string InternalFqdn { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ public class NewAzureNetworkInterfaceCommand : NetworkInterfaceBaseCmdlet
HelpMessage = "The list of Dns Servers")]
public List<string> DnsServer { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The Internal Dns name")]
public string InternalDnsNameLabel { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
Expand Down Expand Up @@ -261,10 +267,18 @@ private PSNetworkInterface CreateNetworkInterface()
}
}

if (this.DnsServer != null)
if (this.DnsServer != null || this.InternalDnsNameLabel != null)
{
networkInterface.DnsSettings = new PSDnsSettings();
networkInterface.DnsSettings.DnsServers = this.DnsServer;
networkInterface.DnsSettings = new PSNetworkInterfaceDnsSettings();
if (this.DnsServer != null)
{
networkInterface.DnsSettings.DnsServers = this.DnsServer;
}
if (this.InternalDnsNameLabel != null)
{
networkInterface.DnsSettings.InternalDnsNameLabel = this.InternalDnsNameLabel;
}

}

networkInterface.IpConfigurations.Add(nicIpConfiguration);
Expand Down
3 changes: 1 addition & 2 deletions src/ResourceManager/Network/Commands.Network/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Graph.RBAC" version="1.7.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="0.19.2-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.4-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.7-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.1-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.0-preview" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
Expand Down

0 comments on commit 7cb3b11

Please sign in to comment.