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
3 changes: 2 additions & 1 deletion src/Peering/Peering.Test/Peering.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

<PropertyGroup>
<RootNamespace>$(LegacyAssemblyPrefix)$(PsModuleName)$(AzTestAssemblySuffix)</RootNamespace>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Peering" Version="2.0.1-preview" />
<PackageReference Include="Microsoft.Azure.Management.Peering" Version="2.1.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>

Expand Down
10 changes: 5 additions & 5 deletions src/Peering/Peering.Test/ScenarioTests/ConvertLegacyTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ GetLocationKindExchange
function Test-ConvertLegacyKindExchangeAshburn {
try {
#must be hard coded asn because they have legacy items.
$peerAsn = makePeerAsn 11164;
$name = getPeeringVariable "Name" "AS11164_Ashburn_Exchange"
$peerAsn = makePeerAsn 42;
$name = getPeeringVariable "Name" "AS42_Ashburn_Exchange"
$rg = getPeeringVariable "ResourceGroupName" "Building40"
$legacy = Get-AzLegacyPeering -Kind Exchange -PeeringLocation Ashburn
Assert-NotNull $peerAsn.Id
Expand All @@ -42,8 +42,8 @@ Convert Legacy Kind Exchange Amsterdam With New Connection
function Test-ConvertLegacyKindExchangeAmsterdamWithNewConnection {
try {
#must be hard coded asn because they have legacy items.
$peerAsn = makePeerAsn 15224
$name = getPeeringVariable "Name" "AS15224_Amsterdam_Exchange"
$peerAsn = makePeerAsn 42
$name = getPeeringVariable "Name" "AS42_Amsterdam_Exchange"
$rg = getPeeringVariable "ResourceGroupName" "Building40"
$legacy = Get-AzLegacyPeering -Kind Exchange -PeeringLocation Amsterdam
Assert-NotNull $legacy
Expand All @@ -54,7 +54,7 @@ function Test-ConvertLegacyKindExchangeAmsterdamWithNewConnection {
$facilityId = 26
$maxv4 = maxAdvertisedIpv4
$connection = New-AzPeeringExchangeConnectionObject -PeeringDbFacilityId $facilityId -MaxPrefixesAdvertisedIPv4 $maxv4 -PeerSessionIPv4Address $ipaddress
$peering = $legacy | New-AzPeering -ResourceGroupName $rg -Name $name -PeerAsnResourceId $peerAsn.Id -ExchangeConnection $connection -Tag @{ "tfs_813288" = "Approved" }
$peering = $legacy | New-AzPeering -ResourceGroupName $rg -Name $name -PeerAsnResourceId $peerAsn.Id
}
finally {
$isRemoved = Remove-AzPeerAsn -Name $peerAsn.Name -Force -PassThru
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ function Test-NewDirectPeeringPremiumDirectFree
#create peering
$connection2.UseForPeeringService = $true
Write-Output "New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeeringLocation $peeringLocation[0].PeeringLocation -MicrosoftNetwork AS8075 -Sku Premium_Direct_Free -PeerAsnResourceId $asn.Id -Tag $tags -DirectConnection $connection1, $connection2"
Assert-ThrowsContains {$createdPeering = New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeeringLocation $peeringLocation[0].PeeringLocation -MicrosoftNetwork AS8075 -Sku "Premium_Direct_Free" -PeerAsnResourceId $asn.Id -Tag $tags -DirectConnection $connection1, $connection2} "Internal"
$createdPeering = New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeeringLocation $peeringLocation[0].PeeringLocation -MicrosoftNetwork AS8075 -Sku "Premium_Direct_Free" -PeerAsnResourceId $asn.Id -Tag $tags -DirectConnection $connection1, $connection2
Assert-NotNull $createdPeering
}

<#
Expand Down
63 changes: 63 additions & 0 deletions src/Peering/Peering.Test/ScenarioTests/GetRxRoutes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// ----------------------------------------------------------------------------------
//
// 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.Azure.Commands.Peering.Test.ScenarioTests
{
using Microsoft.WindowsAzure.Commands.ScenarioTest;

using Xunit;

/// <summary>
/// The get legacy tests.
/// </summary>
public class GetRxRoutes
{
/// <summary>
/// The logger.
/// </summary>
private ServiceManagement.Common.Models.XunitTracingInterceptor logger;

/// <summary>
/// Initializes a new instance of the <see cref="GetRxRoutes"/> class.
/// </summary>
/// <param name="output">
/// The output.
/// </param>
public GetRxRoutes(Xunit.Abstractions.ITestOutputHelper output)
{
this.logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(this.logger);
}

/// <summary>
/// The test get legacy kind exchange amsterdam.
/// </summary>
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGetRxRoutes()
{
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-GetRxRoutes");
}

/// <summary>
/// The test get legacy kind direct amsterdam.
/// </summary>
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestListRxRoutesAsPath()
{
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-ListRxRoutesAsPath");
}
}
}
35 changes: 35 additions & 0 deletions src/Peering/Peering.Test/ScenarioTests/GetRxRoutes.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# ----------------------------------------------------------------------------------
#
# 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
GetLocationKindExchange
#>
function Test-GetRxRoutes {
$routes = Get-AzPeeringReceivedRoute -ResourceGroupName CenturyLink -Name Portland
Assert-NotNull $routes
Assert-True { $routes.Count -ge 1 }
}

<#
.SYNOPSIS
GetLocationKindDirect
#>
function Test-ListRxRoutesAsPath {
$peering = Get-AzPeering -ResourceGroupName CenturyLink -Name Portland
$id = $peering.id
Assert-NotNull $peering
$routes = Get-AzPeeringReceivedRoute -ResourceId $id -AsPath "3356"
Assert-NotNull $routes
Assert-True { $routes.Count -ge 1 }
}
3 changes: 2 additions & 1 deletion src/Peering/Peering.Test/ScenarioTests/RegisteredPrefix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ function Test-GetRegisteredPrefix {
$assetName = getAssetName "peering"
$resourceGroup = (Get-AzResource -ResourceId $peering.Id).ResourceGroupName
Assert-ThrowsContains { $peering | Get-AzPeeringRegisteredPrefix -Name $name } "NotFound"
Assert-ThrowsContains { Get-AzPeeringRegisteredPrefix -ResourceId $peering.Id } "peeringName"
$resourceId = $peering.Id+"/registerdPrefix/"+$name
Assert-ThrowsContains { Get-AzPeeringRegisteredPrefix -ResourceId $resourceId } "NotFound"
Assert-ThrowsContains {Get-AzPeeringRegisteredPrefix -ResourceGroupName $resourceGroup -PeeringName $assetName} "NotFound"
Assert-ThrowsContains { Get-AzPeeringRegisteredPrefix -ResourceGroupName $resourceGroup -PeeringName $assetName -Name $name } "NotFound"
Assert-ThrowsContains { Get-AzPeeringRegisteredPrefix -ResourceGroupName $resourceGroup -PeeringName $assetName -Name $name -ResourceId "asdfa" } "Parameter set cannot be resolved using the specified named parameters"
Expand Down
2 changes: 1 addition & 1 deletion src/Peering/Peering.Test/ScenarioTests/SetPeeringTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Test-SetNewIP {
$offset = getPeeringVariable "offSet" (Get-Random -Maximum 100 -Minimum 1 | % { $_ * 2 } )
$newIpAddress = getPeeringVariable "newIpAddress" (changeIp "$peerIpAddress/32" $false $offset $false )
$peer.Connections[0] = $peer.Connections[0] | Set-AzPeeringExchangeConnectionObject -PeerSessionIPv4Address $newIpAddress
Assert-ThrowsContains { $peer | Update-AzPeering } "BadArgument"
Assert-ThrowsContains { $peer | Update-AzPeering } "OperationNotSupported"
}
finally {
Clean-Peering $peering.Id
Expand Down
Loading