Skip to content
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 @@ -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.11-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.12-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="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Compute" version="8.2.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.11-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.12-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-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.5715.36130-prerelease" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,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.11-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.12-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 @@ -10,7 +10,7 @@
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Compute" version="8.2.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.11-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.12-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-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 @@ -67,8 +67,8 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\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.11-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.12-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 @@ -150,6 +150,7 @@
<Compile Include="ScenarioTests\ApplicationGatewayTests.cs" />
<Compile Include="ScenarioTests\NetworkInterfaceTests.cs" />
<Compile Include="ScenarioTests\LoadBalancerTests.cs" />
<Compile Include="ScenarioTests\ExpressRouteCircuitTests.cs" />
<Compile Include="ScenarioTests\RouteTableTests.cs" />
<Compile Include="ScenarioTests\NetworkSecurityGroupTests.cs" />
<Compile Include="ScenarioTests\TestDnsAvailabilityTest.cs" />
Expand All @@ -176,6 +177,9 @@
<None Include="ScenarioTests\LoadBalancerTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\ExpressRouteCircuitTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\RouteTableTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -203,6 +207,12 @@
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.ApplicationGatewayTests\TestApplicationGatewayCRUD.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.ExpressRouteCircuitTests\TestExpressRouteCircuitCRUD.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.ExpressRouteCircuitTests\TestExpressRouteCircuitPeeringCRUD.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.LoadBalancerTests\TestCreateEmptyLoadBalancer.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// ----------------------------------------------------------------------------------
//
// 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.
// ----------------------------------------------------------------------------------

using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Commands.Network.Test.ScenarioTests
{
public class ExpressRouteCircuitTests : Microsoft.WindowsAzure.Commands.Test.Utilities.Common.RMTestBase
{
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestExpressRouteCircuitCRUD()
{
NetworkResourcesController.NewInstance.RunPsTest("Test-ExpressRouteCircuitCRUD");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestExpressRouteCircuitPeeringCRUD()
{
NetworkResourcesController.NewInstance.RunPsTest("Test-ExpressRouteCircuitPeeringCRUD");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
# ----------------------------------------------------------------------------------
#
# 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.
# ----------------------------------------------------------------------------------

<#
.SYNOPSIS
Tests ExpressRouteCircuitCRUD.
#>
function Test-ExpressRouteCircuitCRUD
{
# Setup
$rgname = Get-ResourceGroupName
$circuitName = Get-ResourceName
$rglocation = Get-ProviderLocation ResourceManagement
$resourceTypeParent = "Microsoft.Network/expressRouteCircuits"
$location = Get-ProviderLocation $resourceTypeParent
$location = "brazilSouth"
try
{
# Create the resource group
$resourceGroup = New-AzureRmResourceGroup -Name $rgname -Location $rglocation

# Create the ExpressRouteCircuit
$circuit = New-AzureRmExpressRouteCircuit -Name $circuitName -Location $location -ResourceGroupName $rgname -SkuName "standard_meteredData" -SkuTier Standard -SkuFamily MeteredData -ServiceProviderName "equinix" -PeeringLocation "Silicon Valley" -BandwidthInMbps 1000;

# get Circuit
$getCircuit = Get-AzureRmExpressRouteCircuit -Name $circuitName -ResourceGroupName $rgname

#verification
Assert-AreEqual $rgName $getCircuit.ResourceGroupName
Assert-AreEqual $circuitName $getCircuit.Name
Assert-NotNull $getCircuit.Location
Assert-NotNull $getCircuit.Etag
Assert-AreEqual 0 @($getCircuit.Peerings).Count
Assert-AreEqual "standard_meteredData" $getCircuit.Sku.Name
Assert-AreEqual "Standard" $getCircuit.Sku.Tier
Assert-AreEqual "MeteredData" $getCircuit.Sku.Family
Assert-AreEqual "equinix" $getCircuit.ServiceProviderProperties.ServiceProviderName
Assert-AreEqual "Silicon Valley" $getCircuit.ServiceProviderProperties.PeeringLocation
Assert-AreEqual "1000" $getCircuit.ServiceProviderProperties.BandwidthInMbps

# list
$list = Get-AzureRmExpressRouteCircuit -ResourceGroupName $rgname
Assert-AreEqual 1 @($list).Count
Assert-AreEqual $list[0].ResourceGroupName $getCircuit.ResourceGroupName
Assert-AreEqual $list[0].Name $getCircuit.Name
Assert-AreEqual $list[0].Location $getCircuit.Location
Assert-AreEqual $list[0].Etag $getCircuit.Etag
Assert-AreEqual @($list[0].Peerings).Count @($getCircuit.Peerings).Count

# set
$getCircuit.ServiceProviderProperties.BandwidthInMbps = 500

$getCircuit = $getCircuit | Set-AzureRmExpressRouteCircuit
Assert-AreEqual $rgName $getCircuit.ResourceGroupName
Assert-AreEqual $circuitName $getCircuit.Name
Assert-NotNull $getCircuit.Location
Assert-NotNull $getCircuit.Etag
Assert-AreEqual 0 @($getCircuit.Peerings).Count
Assert-AreEqual "standard_meteredData" $getCircuit.Sku.Name
Assert-AreEqual "Standard" $getCircuit.Sku.Tier
Assert-AreEqual "MeteredData" $getCircuit.Sku.Family
Assert-AreEqual "equinix" $getCircuit.ServiceProviderProperties.ServiceProviderName
Assert-AreEqual "Silicon Valley" $getCircuit.ServiceProviderProperties.PeeringLocation
Assert-AreEqual "500" $getCircuit.ServiceProviderProperties.BandwidthInMbps

# Delete Circuit
$delete = Remove-AzureRmExpressRouteCircuit -ResourceGroupName $rgname -name $circuitName -PassThru -Force
Assert-AreEqual true $delete

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

<#
.SYNOPSIS
Tests ExpressRouteCircuitPeeringCRUD.
#>
function Test-ExpressRouteCircuitPeeringCRUD
{
# Setup
$rgname = Get-ResourceGroupName
$circuitName = Get-ResourceName
$rglocation = Get-ProviderLocation ResourceManagement
$resourceTypeParent = "Microsoft.Network/expressRouteCircuits"
$location = Get-ProviderLocation $resourceTypeParent
$location = "brazilSouth"
try
{
# Create the resource group
$resourceGroup = New-AzureRmResourceGroup -Name $rgname -Location $rglocation

# Create the ExpressRouteCircuit with peering
$peering = New-AzureRmExpressRouteCircuitPeeringConfig -Name AzurePrivatePeering -PeeringType AzurePrivatePeering -PeerASN 100 -PrimaryPeerAddressPrefix "192.168.1.0/30" -SecondaryPeerAddressPrefix "192.168.2.0/30" -VlanId 200
$circuit = New-AzureRmExpressRouteCircuit -Name $circuitName -Location $location -ResourceGroupName $rgname -SkuName "standard_meteredData" -SkuTier Standard -SkuFamily MeteredData -ServiceProviderName "equinix" -PeeringLocation "Silicon Valley" -BandwidthInMbps 1000 -Peering $peering

#verification
Assert-AreEqual $rgName $circuit.ResourceGroupName
Assert-AreEqual $circuitName $circuit.Name
Assert-NotNull $circuit.Location
Assert-NotNull $circuit.Etag
Assert-AreEqual 1 @($circuit.Peerings).Count
Assert-AreEqual "standard_meteredData" $circuit.Sku.Name
Assert-AreEqual "Standard" $circuit.Sku.Tier
Assert-AreEqual "MeteredData" $circuit.Sku.Family
Assert-AreEqual "equinix" $circuit.ServiceProviderProperties.ServiceProviderName
Assert-AreEqual "Silicon Valley" $circuit.ServiceProviderProperties.PeeringLocation
Assert-AreEqual "1000" $circuit.ServiceProviderProperties.BandwidthInMbps

# Verify the peering
Assert-AreEqual "AzurePrivatePeering" $circuit.Peerings[0].Name
Assert-AreEqual "AzurePrivatePeering" $circuit.Peerings[0].PeeringType
Assert-AreEqual "100" $circuit.Peerings[0].PeerASN
Assert-AreEqual "192.168.1.0/30" $circuit.Peerings[0].PrimaryPeerAddressPrefix
Assert-AreEqual "192.168.2.0/30" $circuit.Peerings[0].SecondaryPeerAddressPrefix
Assert-AreEqual "200" $circuit.Peerings[0].VlanId

# get peering
$p = $circuit | Get-AzureRmExpressRouteCircuitPeeringConfig -Name AzurePrivatePeering
Assert-AreEqual "AzurePrivatePeering" $p.Name
Assert-AreEqual "AzurePrivatePeering" $p.PeeringType
Assert-AreEqual "100" $p.PeerASN
Assert-AreEqual "192.168.1.0/30" $p.PrimaryPeerAddressPrefix
Assert-AreEqual "192.168.2.0/30" $p.SecondaryPeerAddressPrefix
Assert-AreEqual "200" $p.VlanId
Assert-Null $p.MicrosoftPeeringConfig

# List peering
$listPeering = $circuit | Get-AzureRmExpressRouteCircuitPeeringConfig
Assert-AreEqual 1 @($listPeering).Count

# add a new Peering
$circuit = Get-AzureRmExpressRouteCircuit -Name $circuitName -ResourceGroupName $rgname | Add-AzureRmExpressRouteCircuitPeeringConfig -Name MicrosoftPeering -PeeringType MicrosoftPeering -PeerASN 99 -PrimaryPeerAddressPrefix "192.168.1.0/30" -SecondaryPeerAddressPrefix "192.168.2.0/30" -VlanId 200 -MircosoftConfigAdvertisedPublicPrefixes @("11.2.3.4/30", "12.2.3.4/30") -MircosoftConfigCustomerAsn 1000 -MircosoftConfigRoutingRegistryName AFRINIC | Set-AzureRmExpressRouteCircuit

$p = $circuit | Get-AzureRmExpressRouteCircuitPeeringConfig -Name MicrosoftPeering
Assert-AreEqual "MicrosoftPeering" $p.Name
Assert-AreEqual "MicrosoftPeering" $p.PeeringType
Assert-AreEqual "99" $p.PeerASN
Assert-AreEqual "192.168.1.0/30" $p.PrimaryPeerAddressPrefix
Assert-AreEqual "192.168.2.0/30" $p.SecondaryPeerAddressPrefix
Assert-AreEqual "200" $p.VlanId
Assert-NotNull $p.MicrosoftPeeringConfig
Assert-AreEqual "1000" $p.MicrosoftPeeringConfig.CustomerASN
Assert-AreEqual "AFRINIC" $p.MicrosoftPeeringConfig.RoutingRegistryName
Assert-AreEqual 2 @($p.MicrosoftPeeringConfig.AdvertisedPublicPrefixes).Count
Assert-NotNull $p.MicrosoftPeeringConfig.AdvertisedPublicPrefixesState

$listPeering = $circuit | Get-AzureRmExpressRouteCircuitPeeringConfig
Assert-AreEqual 2 @($listPeering).Count

# Set a new peering
$circuit = Get-AzureRmExpressRouteCircuit -Name $circuitName -ResourceGroupName $rgname | Set-AzureRmExpressRouteCircuitPeeringConfig -Name MicrosoftPeering -PeeringType MicrosoftPeering -PeerASN 100 -PrimaryPeerAddressPrefix "192.168.1.0/30" -SecondaryPeerAddressPrefix "192.168.2.0/30" -VlanId 200 -MircosoftConfigAdvertisedPublicPrefixes @("11.2.3.4/30", "12.2.3.4/30") -MircosoftConfigCustomerAsn 1000 -MircosoftConfigRoutingRegistryName AFRINIC | Set-AzureRmExpressRouteCircuit
$p = $circuit | Get-AzureRmExpressRouteCircuitPeeringConfig -Name MicrosoftPeering
Assert-AreEqual "MicrosoftPeering" $p.Name
Assert-AreEqual "MicrosoftPeering" $p.PeeringType
Assert-AreEqual "100" $p.PeerASN
Assert-AreEqual "192.168.1.0/30" $p.PrimaryPeerAddressPrefix
Assert-AreEqual "192.168.2.0/30" $p.SecondaryPeerAddressPrefix
Assert-AreEqual "200" $p.VlanId
Assert-NotNull $p.MicrosoftPeeringConfig
Assert-AreEqual "1000" $p.MicrosoftPeeringConfig.CustomerASN
Assert-AreEqual "AFRINIC" $p.MicrosoftPeeringConfig.RoutingRegistryName
Assert-AreEqual 2 @($p.MicrosoftPeeringConfig.AdvertisedPublicPrefixes).Count
Assert-NotNull $p.MicrosoftPeeringConfig.AdvertisedPublicPrefixesState

# Delete Circuit
$delete = Remove-AzureRmExpressRouteCircuit -ResourceGroupName $rgname -name $circuitName -PassThru -Force
Assert-AreEqual true $delete

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

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 @@ -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="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.11-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Network" version="2.0.12-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Test.Framework" version="1.0.5715.36130-prerelease" targetFramework="net45" />
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.0.5715.36130-prerelease" targetFramework="net45" />
Expand Down
Loading