Skip to content

Commit 7f036ca

Browse files
authored
Merge pull request #9712 from rileymckenna/feature/updateApiVersion
Feature/update api version
2 parents ce45b8c + f5ae2a2 commit 7f036ca

File tree

102 files changed

+5446
-2378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+5446
-2378
lines changed

src/Peering/Peering.Test/Peering.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Azure.Management.Peering" Version="0.9.0-preview" />
14+
<PackageReference Include="Microsoft.Azure.Management.Peering" Version="0.10.0-preview" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

src/Peering/Peering.Test/ScenarioTests/CreateNewDirectConnectionTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
namespace Microsoft.Azure.Commands.Peering.Test.ScenarioTests
1616
{
1717
using Microsoft.Azure.ServiceManagement.Common.Models;
18+
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
1819
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1920

2021
using Xunit;
@@ -38,8 +39,8 @@ public class CreateNewDirectConnectionTests
3839
/// </param>
3940
public CreateNewDirectConnectionTests(ITestOutputHelper output)
4041
{
41-
this.logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
42-
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(this.logger);
42+
this.logger = new XunitTracingInterceptor(output);
43+
XunitTracingInterceptor.AddToContext(this.logger);
4344
}
4445

4546
/// <summary>

src/Peering/Peering.Test/ScenarioTests/CreateNewDirectConnectionTests.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ function Test-NewDirectConnectionHighBandwidth
142142
#Set up the wrong BandwidthInMbps
143143
$bandwidth = getBandwidth
144144
#Anything over 100000 will fail.
145+
$bandwidth = [int]$bandwidth * 10
145146
Write-Debug "Creating Connection at $facilityId"
146147
$md5 = getHash
147148
$md5 = $md5.ToString()

src/Peering/Peering.Test/ScenarioTests/CreateNewDirectPeeringTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
namespace Microsoft.Azure.Commands.Peering.Test.ScenarioTests
1616
{
17+
using System;
1718
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1819

1920
using Xunit;

src/Peering/Peering.Test/ScenarioTests/CreateNewDirectPeeringTests.ps1

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,16 @@ function Test-NewDirectPeering
4949
$resourceName = getAssetName "DirectOneConnection";
5050
Write-Debug "Setting $resourceName"
5151
$peeringLocation = getPeeringLocation $kind $loc;
52-
$asn = Get-AzPeerAsn | Where-Object {$_.Name -match "Global"} | Select-Object -First 1
52+
Write-Debug "Getting the Asn Information"
53+
$randNum = getRandomNumber
54+
Write-Debug "Random Number $randNum";
55+
$peerAsn = makePeerAsn $randNum
56+
$asn = $peerAsn
5357
$facilityId = $peeringLocation[0].PeeringDBFacilityId
5458
#create Connection
5559
$bandwidth = getBandwidth
5660
$directConnection = NewDirectConnectionV4V6 $facilityId $bandwidth
57-
$tags = @{"tag1" = "value1"; "tag2" = "value2"}
61+
$tags = @{"tfs_$randNum" = "value1"; "tag2" = "value2"}
5862
$md5 = $directConnection.BgpSession.Md5AuthenticationKey
5963
$sessionv4 = getPeeringVariable "sessionv4" $directConnection.BgpSession.SessionPrefixV4
6064
$sessionv6 = getPeeringVariable "sessionv6" $directConnection.BgpSession.SessionPrefixV6
@@ -86,12 +90,16 @@ function Test-NewDirectPeeringWithPipe
8690
$resourceName = getAssetName "DirectPipeConnection";
8791
Write-Debug "Setting $resourceName"
8892
$peeringLocation = getPeeringLocation $kind $loc;
89-
$asn = Get-AzPeerAsn | Where-Object {$_.Name -match "Global"} | Select-Object -First 1
93+
Write-Debug "Getting the Asn Information"
94+
$randNum = getRandomNumber
95+
Write-Debug "Random Number $randNum";
96+
$peerAsn = makePeerAsn $randNum
97+
$asn = $peerAsn
9098
$facilityId = $peeringLocation[0].PeeringDBFacilityId
9199
#create Connection
92100
$bandwidth = getBandwidth
93101
$directConnection = NewDirectConnectionV4V6 $facilityId $bandwidth
94-
$tags = @{"tag1" = "value1"; "tag2" = "value2"}
102+
$tags = @{"tfs_$randNum" = "value1"; "tag2" = "value2"}
95103
$md5 = $directConnection.BgpSession.Md5AuthenticationKey
96104
$sessionv4 = getPeeringVariable "sessionv4" $directConnection.BgpSession.SessionPrefixV4
97105
$sessionv6 = getPeeringVariable "sessionv6" $directConnection.BgpSession.SessionPrefixV6
@@ -122,13 +130,17 @@ function Test-NewDirectPeeringPipeTwoConnections
122130
$resourceName = getAssetName "DirectOneConnection";
123131
Write-Debug "Setting $resourceName"
124132
$peeringLocation = getPeeringLocation $kind $loc;
125-
$asn = Get-AzPeerAsn | Where-Object {$_.Name -match "Global"} | Select-Object -First 1
133+
Write-Debug "Getting the Asn Information"
134+
$randNum = getRandomNumber
135+
Write-Debug "Random Number $randNum";
136+
$peerAsn = makePeerAsn $randNum
137+
$asn = $peerAsn
126138
$facilityId = $peeringLocation[0].PeeringDBFacilityId
127139
#create Connection
128140
$bandwidth = getBandwidth
129141
$bandwidth2 = getBandwidth
130142
$directConnection = NewDirectConnectionV4V6 $facilityId $bandwidth
131-
$tags = @{"tag1" = "value1"; "tag2" = "value2"}
143+
$tags = @{"tfs_$randNum" = "value1"; "tag2" = "value2"}
132144
$md5 = $directConnection.BgpSession.Md5AuthenticationKey
133145
$sessionv4 = getPeeringVariable "sessionv4" $directConnection.BgpSession.SessionPrefixV4
134146
$sessionv6 = getPeeringVariable "sessionv6" $directConnection.BgpSession.SessionPrefixV6

src/Peering/Peering.Test/ScenarioTests/CreateNewExchangePeeringTests.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,5 @@ public void TestNewExchangePeeringPipe()
5959
{
6060
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-NewExchangePeeringPipe");
6161
}
62-
63-
/// <summary>
64-
/// The test new exchange peering pipe two connections.
65-
/// </summary>
66-
[Fact]
67-
[Trait(Category.AcceptanceType, Category.CheckIn)]
68-
public void TestNewExchangePeeringPipeTwoConnections()
69-
{
70-
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-NewExchangePeeringPipeTwoConnections");
71-
}
7262
}
7363
}

src/Peering/Peering.Test/ScenarioTests/CreateNewExchangePeeringTests.ps1

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -33,34 +33,7 @@ function NewExchangeConnectionV4V6($facilityId, $v4, $v6)
3333
$createdConnection = New-AzPeeringExchangeConnectionObject -PeeringDbFacilityId $facilityId -MaxPrefixesAdvertisedIPv4 $maxv4 -PeerSessionIPv4Address $sessionv4 -PeerSessionIPv6Address $sessionv6 -MaxPrefixesAdvertisedIPv6 $maxv6 -MD5AuthenticationKey $md5
3434
return $createdConnection
3535
}
36-
<#
37-
.SYNOPSIS
38-
Helper Function NewExchangeConnectionV4V6
39-
#>
40-
function Test-NewExchangePeeringPipeTwoConnections
41-
{
42-
#Hard Coded locations becuase of limitations in locations
43-
$resourceName = getAssetName "NewExchangePeeringPipeTwoConnections"
44-
$resourceGroup = "testCarrier"
45-
$peeringLocation = "Seattle"
46-
$kind = IsDirect $false
47-
Write-Debug "Getting the Facility Information"
48-
$facility = Get-AzPeeringLocation -PeeringLocation $peeringLocation -Kind $kind
49-
$microsoftIpAddressV4 = $facility[1].MicrosoftIPv4Address
50-
$microsoftIpAddressV6 = $facility[1].MicrosoftIPv6Address
51-
$facilityId = $facility[1].PeeringDBFacilityId
52-
$peeringLocation = $facility[1].PeeringLocation
53-
Write-Debug "Getting the Asn Information"
54-
$peerAsn = Get-AzPeerAsn | Where-Object {$_.Name -match "Global"} | Select-Object -First 1
55-
$asn = $peerAsn.Id
56-
Write-Debug "Creating Connections"
57-
$connection1 = NewExchangeConnectionV4V6 $facilityId $microsoftIpAddressV4 $microsoftIpAddressV6
58-
$connection2 = NewExchangeConnectionV4V6 $facilityId $microsoftIpAddressV4 $microsoftIpAddressV6
59-
Write-Debug "Created $connection1 $connection1"
60-
$tags = @{"tag1" = "value1"; "tag2" = "value2"}
61-
$createdPeering = New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeeringLocation $peeringLocation -PeerAsnResourceId $asn -ExchangeConnection $connection1,$connection2 -Tag $tags
62-
Assert-NotNull $createdPeering
63-
}
36+
6437
<#
6538
.SYNOPSIS
6639
Tests new Exchange Peering
@@ -73,22 +46,35 @@ function Test-NewExchangePeering()
7346
$peeringLocation = "Berlin"
7447
$kind = IsDirect $false
7548
Write-Debug "Getting the Facility Information"
49+
try {
7650
$facility = Get-AzPeeringLocation -PeeringLocation $peeringLocation -Kind $kind
7751
$microsoftIpAddressV4 = $facility[0].MicrosoftIPv4Address.Split(',') | Select-Object -First 1
7852
$microsoftIpAddressV6 = $facility[0].MicrosoftIPv6Address.Split(',') | Select-Object -First 1
7953
$facilityId = $facility[0].PeeringDBFacilityId
8054
$peeringLocation = $facility[0].PeeringLocation
8155
Write-Debug "Getting the Asn Information"
82-
$peerAsn = Get-AzPeerAsn | Where-Object {$_.Name -match "Global"} | Select-Object -First 1
56+
$randNum = getRandomNumber
57+
Write-Debug "Random Number $randNum";
58+
$peerAsn = makePeerAsn $randNum
8359
$asn = $peerAsn.Id
8460
Write-Debug "Creating Connections"
8561
$connection1 = NewExchangeConnectionV4V6 $facilityId $microsoftIpAddressV4 $microsoftIpAddressV6
8662
$connection2 = NewExchangeConnectionV4V6 $facilityId $microsoftIpAddressV4 $microsoftIpAddressV6
8763
Write-Debug "Created $connection1 $connection1"
88-
$tags = @{"tag1" = "value1"; "tag2" = "value2"}
64+
$tags = @{"tfs_$randNum" = "Active"; "tag2" = "value2"}
65+
Write-Debug "Tags: $tags";
8966
Write-Debug "Creating Resource $resourceName"
9067
$createdPeering = New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeeringLocation $peeringLocation -PeerAsnResourceId $asn -ExchangeConnection $connection1,$connection2 -Tag $tags
9168
Assert-NotNull $createdPeering
69+
Assert-NotNull $createdPeering.Connections.ConnectionIdentifier
70+
}
71+
catch{
72+
Write-Debug $error
73+
}
74+
finally{
75+
$isRemoved = Remove-AzPeerAsn -Name $peerAsn.Name -Force -PassThru;
76+
Assert-True {$isRemoved}
77+
}
9278
}
9379
<#
9480
.SYNOPSIS
@@ -101,19 +87,29 @@ function Test-NewExchangePeeringPipe
10187
$resourceGroup = "testCarrier"
10288
$peeringLocation = "Amsterdam"
10389
$kind = IsDirect $false
90+
try{
10491
Write-Debug "Getting the Facility Information"
10592
$facility = Get-AzPeeringLocation -PeeringLocation $peeringLocation -Kind $kind
10693
$microsoftIpAddressV4 = $facility[0].MicrosoftIPv4Address
10794
$microsoftIpAddressV6 = $facility[0].MicrosoftIPv6Address
10895
$facilityId = $facility[0].PeeringDBFacilityId
10996
$peeringLocation = $facility[0].PeeringLocation
11097
Write-Debug "Getting the Asn Information"
111-
$peerAsn = Get-AzPeerAsn | Where-Object {$_.Name -match "Global"} | Select-Object -First 1
98+
$randNum = getRandomNumber
99+
Write-Debug "Random Number $randNum";
100+
$peerAsn = makePeerAsn $randNum
112101
$asn = $peerAsn.Id
113102
Write-Debug "Creating Connections"
114103
$connection1 = NewExchangeConnectionV4V6 $facilityId $microsoftIpAddressV4 $microsoftIpAddressV6
115-
$tags = @{"tag1" = "value1"; "tag2" = "value2"}
104+
$tags = @{"tfs_$randNum" = "Active"; "tag2" = "value2"}
116105
Write-Debug "Creating Resource $resourceName"
117106
$createdPeering = New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeeringLocation $peeringLocation -PeerAsnResourceId $asn -Tag $tags -ExchangeConnection $connection1
118107
Assert-NotNull $createdPeering
108+
Assert-NotNull $createdPeering.Connections.ConnectionIdentifier
109+
}
110+
catch{}
111+
finally{
112+
$isRemoved = Remove-AzPeerAsn -Name $peerAsn.Name -Force -PassThru
113+
Assert-True {$isRemoved}
114+
}
119115
}

src/Peering/Peering.Test/ScenarioTests/GetLegacyTests.ps1

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@ GetLocationKindExchange
1717
#>
1818
function Test-GetLegacyKindExchangeAshburn
1919
{
20+
try{
21+
#must be hard coded asn because they have legacy items.
22+
$peerAsn = makePeerAsn 15224;
2023
$legacy = Get-AzLegacyPeering -Kind Exchange -PeeringLocation Ashburn
2124
Assert-NotNull $legacy
2225
Assert-True {$legacy.Count -ge 1}
26+
}finally {
27+
$isRemoved = Remove-AzPeerAsn -Name $peerAsn.Name -Force -PassThru
28+
Assert-True {$isRemoved}
29+
}
2330
}
2431

2532
<#
@@ -28,22 +35,16 @@ GetLocationKindDirect
2835
#>
2936
function Test-GetLegacyKindDirectAmsterdam
3037
{
31-
$peerAsn = makePeerAsn 3257
38+
try{
39+
#must be hard coded asn because they have legacy items.
40+
$peerAsn = makePeerAsn 20940
3241
$legacy = Get-AzLegacyPeering -Kind Direct -PeeringLocation Amsterdam
3342
Assert-NotNull $legacy
3443
Assert-True {$legacy.Count -ge 1}
44+
}
45+
finally {
46+
$isRemoved = Remove-AzPeerAsn -Name $peerAsn.Name -Force -PassThru
47+
Assert-True {$isRemoved}
48+
}
3549
}
3650

37-
function makePeerAsn($asn)
38-
{
39-
#asn has to be hard coded because its unique and finite amoungst locations
40-
$asnId = $asn
41-
$asnPeerName = getAssetName "Global"
42-
$asnPeer = getAssetName
43-
[string[]]$emails = "noc@$asnPeer.com","noc@$asnPeerName.com"
44-
$phone = getAssetName
45-
New-AzPeerAsn -Name $asnPeerName -PeerName $asnPeer -PeerAsn $asnId -Email $emails -Phone $phone
46-
$created = Get-AzPeerAsn -Name $asnPeerName
47-
Assert-NotNull $created
48-
return $created
49-
}

src/Peering/Peering.Test/ScenarioTests/GetLocationTests.ps1

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ function Test-GetLocationKindExchangeSeattle
3939
{
4040
$location = Get-AzPeeringLocation -Kind Exchange -PeeringLocation seattle
4141
Assert-NotNull $location
42-
Assert-AreEqual 4 $location.Count
43-
Assert-AreEqual 11 $location[0].PeeringDBFacilityId
44-
Assert-AreEqual 13 $location[1].PeeringDBFacilityId
45-
Assert-AreEqual 1174 $location[2].PeeringDBFacilityId
46-
Assert-AreEqual 82 $location[3].PeeringDBFacilityId
42+
Assert-AreEqual 5 $location.Count
4743
}
4844
<#
4945
.SYNOPSIS
@@ -53,6 +49,5 @@ function Test-GetLocationKindDirectSeattle
5349
{
5450
$location = Get-AzPeeringLocation -Kind Direct -PeeringLocation seattle
5551
Assert-NotNull $location
56-
Assert-AreEqual 1 $location.Count
57-
Assert-AreEqual 71 $location[0].PeeringDBFacilityId
52+
Assert-AreEqual 2 $location.Count
5853
}

src/Peering/Peering.Test/ScenarioTests/PeeringAsnTests.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ function makePeerAsn($asn)
9494
[string[]]$emails = "noc@$asnPeer.com","noc@$asnPeerName.com"
9595
$phone = getAssetName
9696
$created = New-AzPeerAsn -Name $asnPeerName -PeerName $asnPeer -PeerAsn $asnId -Email $emails -Phone $phone
97+
$created.ValidationState = "Approved";
98+
$created = $created | Set-AzPeerAsn
9799
return $created
98100
}
99101

src/Peering/Peering.Test/ScenarioTests/PeeringCommon.ps1

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,43 @@ function maxAdvertisedIpv6
7575
function getHash
7676
{
7777
$hash = getPeeringVariable "Hash" $ipGenerator.BuildHash()
78+
Write-Debug "The hash $hash";
7879
return "$hash"
7980
}
8081

8182
function getBandwidth
8283
{
8384
$bandwidth = getPeeringVariable "bandwidth" $ipGenerator.GetBandwidth()
85+
Write-Debug "The bandwidth $bandwidth";
8486
return $bandwidth
8587
}
8688

89+
function getRandomNumber {
90+
$num = Get-Random -Maximum 65010 -Minimum 1
91+
Write-Debug "The random $num";
92+
return $num
93+
}
94+
95+
function makePeerAsn($asn)
96+
{
97+
$asnId = $asn
98+
$asnPeerName = getAssetName "$asn-Global"
99+
Write-Debug "PeerName $asnPeerName"
100+
$asnPeer = getAssetName "AS$asn-Global"
101+
Write-Debug "PeerName $asnPeer"
102+
[string[]]$emails = "noc@$asnPeer.com","noc@$asnPeerName.com"
103+
$phone = getAssetName "2342432433"
104+
Write-Debug "Email: $emails; Phone $phone"
105+
$created = New-AzPeerAsn -Name $asnPeerName -PeerName $asnPeer -PeerAsn $asnId -Email $emails -Phone $phone
106+
Write-Debug "PeerName $asnPeerName"
107+
$created.ValidationState = "Approved";
108+
Write-Debug "ValidationState: $created"
109+
Write-Debug "Sleep 2 seconds..."
110+
Wait-Seconds 2
111+
$created = $created | Set-AzPeerAsn
112+
return $created
113+
}
114+
87115
function getPeeringVariable
88116
{
89117
param([string]$variableName, $value)

src/Peering/Peering.Test/ScenarioTests/ScenarioExchangePeeringTests.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,6 @@ public void TestConvertLegacyToExchange()
5757
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-ConvertLegacyToExchange");
5858
}
5959

60-
/// <summary>
61-
/// The test update exchange i pv 4 on resource id.
62-
/// </summary>
63-
[Fact]
64-
[Trait(Category.AcceptanceType, Category.CheckIn)]
65-
public void TestUpdateExchangeIPv4OnResourceId()
66-
{
67-
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-UpdateExchangeIPv4OnResourceId");
68-
}
69-
70-
/// <summary>
71-
/// The test update exchange i pv 4 on input object.
72-
/// </summary>
73-
[Fact]
74-
[Trait(Category.AcceptanceType, Category.CheckIn)]
75-
public void TestUpdateExchangeIPv4OnInputObject()
76-
{
77-
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-UpdateExchangeIPv4OnInputObject");
78-
}
79-
8060
/// <summary>
8161
/// The test update exchange md 5 on name and resource group.
8262
/// </summary>

0 commit comments

Comments
 (0)