Skip to content

HPF PR: dev <- Azure:dev #557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.8.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.1\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.2\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
Expand Down Expand Up @@ -642,4 +642,4 @@
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network, Version=7.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.1\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.2\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
Expand Down Expand Up @@ -352,4 +352,4 @@
</PropertyGroup>
<Exec Command="$(PowerShellExe) $(PSCodeGenScriptPath) $(PSCodeGenTargetFolder) $(MSBuildProjectDirectory) $(ClientLibraryNamesSpace) $(BaseCmdletFullName) $(BaseCmdletClientName)" />
</Target>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.8.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.1\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.2\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
Expand Down Expand Up @@ -712,4 +712,4 @@
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network, Version=7.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.1\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.2\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
Expand Down Expand Up @@ -581,4 +581,4 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.8.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.1\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.2\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -182,6 +182,7 @@
<Compile Include="Routes\RemoveSubnetRouteTableTests.cs" />
<Compile Include="Routes\SetRouteTests.cs" />
<Compile Include="Routes\SetSubnetRouteTableTests.cs" />
<Compile Include="ScenarioTests\Gateway\GatewayScenarioTests.cs" />
<Compile Include="ScenarioTests\IPForwarding\IPForwardingScenarioTests.cs" />
<Compile Include="ScenarioTests\MultiVip\MultiVip.cs" />
<Compile Include="ScenarioTests\NetworkSecurityGroup\NSGScenarioTests.cs" />
Expand All @@ -193,6 +194,9 @@
<ItemGroup>
<None Include="MSSharedLibKey.snk" />
<None Include="packages.config" />
<None Include="ScenarioTests\Gateway\GatewayTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\IPForwarding\IPForwardingTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -308,6 +312,12 @@
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Test.ScenarioTests.ReservedIP\SetReservedIPAssocSimple.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Test.ScenarioTests.GatewayScenarioTests\LocalNetworkGateway.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Test.ScenarioTests.GatewayScenarioTests\LocalNetworkGatewayBgp.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="TestData\EmptyNetworkConfiguration.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand All @@ -318,6 +328,7 @@
<ItemGroup>
<Content Include="Readme.txt" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------


namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Test.ScenarioTests
{
using Microsoft.Azure.Commands.Common.Authentication;
using Microsoft.Azure.Test;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Management;
using Microsoft.WindowsAzure.Management.Compute;
using Microsoft.WindowsAzure.Management.Network;
using Microsoft.WindowsAzure.Management.Storage;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Xunit;

public class GatewayScenarioTests
{
private readonly EnvironmentSetupHelper helper = new EnvironmentSetupHelper();

[Fact]
[Trait(Category.Service, Category.Network)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void LocalNetworkGateway()
{
RunPowerShellTest("Test-LocalNetworkGateway");
}

[Fact]
[Trait(Category.Service, Category.Network)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void LocalNetworkGatewayBgp()
{
RunPowerShellTest("Test-LocalNetworkGatewayBgp");
}

#region Test setup

protected void SetupManagementClients()
{
var client = TestBase.GetServiceClient<NetworkManagementClient>(new RDFETestEnvironmentFactory());
var client2 = TestBase.GetServiceClient<ManagementClient>(new RDFETestEnvironmentFactory());
var client3 = TestBase.GetServiceClient<StorageManagementClient>(new RDFETestEnvironmentFactory());
var client4 = TestBase.GetServiceClient<ComputeManagementClient>(new RDFETestEnvironmentFactory());
helper.SetupManagementClients(client, client2, client3, client4);
}

protected void RunPowerShellTest(params string[] scripts)
{
using (UndoContext context = UndoContext.Current)
{
context.Start(TestUtilities.GetCallingClass(2), TestUtilities.GetCurrentMethodName(2));

List<string> modules = Directory.GetFiles("ScenarioTests\\Gateway".AsAbsoluteLocation(), "*.ps1").ToList();
modules.AddRange(Directory.GetFiles("ScenarioTests".AsAbsoluteLocation(), "*.ps1"));

SetupManagementClients();

helper.SetupEnvironment(AzureModule.AzureServiceManagement);
helper.SetupModules(AzureModule.AzureServiceManagement, modules.ToArray());

helper.RunPowerShellTest(scripts);
}
}
#endregion
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

########################################################################### Gateway tests ###################################################################

<#
.SYNOPSIS
Tests for local network gateway right now
#>

function Test-LocalNetworkGateway
{
# Setup
$lngname = getAssetName
$location="West US"

$subscription = Get-AzureSubscription -Current
Set-AzureSubscription -SubscriptionId $subscription.SubscriptionId

# Create a local network gateway
$ipAddr = "1.2.3.4"
$addrSpace = "10.0.0.0/8"
New-AzureLocalNetworkGateway -GatewayName $lngname -IpAddress $ipAddr -AddressSpace $addrSpace

# Retrieve a list of local network gateways, and get the one created above by name
$lnglist = Get-AzureLocalNetworkGateway
$lng = $lnglist | Where-Object { $_.GatewayName -eq $lngname }
Assert-AreEqual $lng.IpAddress $ipAddr
Assert-AreEqual $lng.AddressSpace $addrSpace

# Retrieve the local network gateway by ID
$lng = Get-AzureLocalNetworkGateway -GatewayId $lng.GatewayId
Assert-AreEqual $lng.IpAddress $ipAddr
Assert-AreEqual $lng.AddressSpace $addrSpace

# Delete the local network gateway
Remove-AzureLocalNetworkGateway -GatewayId $lng.GatewayId
}

function Test-LocalNetworkGatewayBgp
{
# Setup
$lngname = getAssetName
$location="West US"

$subscription = Get-AzureSubscription -Current
Set-AzureSubscription -SubscriptionId $subscription.SubscriptionId

# Create a local network gateway
$ipAddr = "1.2.3.4"
$addrSpace = "10.0.0.0/8"
$asn = "1234"
$bgpaddr = "10.0.0.1"
New-AzureLocalNetworkGateway -GatewayName $lngname -IpAddress $ipAddr -AddressSpace $addrSpace -Asn $asn -BgpPeeringAddress $bgpaddr

# Retrieve a list of local network gateways, and get the one created above by name
$lnglist = Get-AzureLocalNetworkGateway
$lng = $lnglist | Where-Object { $_.GatewayName -eq $lngname }
Assert-AreEqual $lng.IpAddress $ipAddr
Assert-AreEqual $lng.AddressSpace $addrSpace
Assert-AreEqual $lng.Asn $asn
Assert-AreEqual $lng.BgpPeeringAddress $bgpaddr

# Retrieve the local network gateway by ID
$lng = Get-AzureLocalNetworkGateway -GatewayId $lng.GatewayId
Assert-AreEqual $lng.IpAddress $ipAddr
Assert-AreEqual $lng.AddressSpace $addrSpace
Assert-AreEqual $lng.Asn $asn
Assert-AreEqual $lng.BgpPeeringAddress $bgpaddr

# Delete the local network gateway
Remove-AzureLocalNetworkGateway -GatewayId $lng.GatewayId
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.1\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.2\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -315,4 +315,4 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
<Import Project="..\..\..\packages\AutoMapper.3.2.1\tools\AutoMapper.targets" Condition="Exists('..\..\..\packages\AutoMapper.3.2.1\tools\AutoMapper.targets')" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -1235,9 +1235,9 @@ public IEnumerable<GetLocalNetworkGatewayContext> ListLocalNetworkGateways()
GatewayName = localNetworkGateway.GatewayName,
IpAddress = localNetworkGateway.IpAddress,
AddressSpace = localNetworkGateway.AddressSpace.ToList(),
Asn = localNetworkGateway.BgpSettings.Asn,
BgpPeeringAddress = localNetworkGateway.BgpSettings.BgpPeeringAddress,
PeerWeight = localNetworkGateway.BgpSettings.PeerWeight,
Asn = localNetworkGateway.BgpSettings != null?localNetworkGateway.BgpSettings.Asn : 0,
BgpPeeringAddress = localNetworkGateway.BgpSettings != null?localNetworkGateway.BgpSettings.BgpPeeringAddress : "",
PeerWeight = localNetworkGateway.BgpSettings != null?localNetworkGateway.BgpSettings.PeerWeight : 0,
};
});
PopulateOperationContext(response.RequestId, localNetworkGateways);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.0.1-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="12.8.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Network" version="7.1.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Network" version="7.1.2" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="System.Spatial" version="5.6.4" targetFramework="net45" />
<package id="WindowsAzure.Storage" version="6.1.0" targetFramework="net45" />
</packages>
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.8.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.1\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.2\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.RemoteApp, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -249,4 +249,4 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network, Version=7.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.1\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.1.2\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Scheduler, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -707,4 +707,4 @@
<PostBuildEvent>powershell.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)\PostBuild.ps1" "$(TargetDir)\"</PostBuildEvent>
</PropertyGroup>
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
</Project>
</Project>
Loading