Skip to content

Commit 1ca9335

Browse files
committed
* Added Peering Service events
* Removed UseForPeeringService at the Peering level * Updated to SDK 1.0.1-preview * Supports API Version 2019-09-01-preview
1 parent ffa5155 commit 1ca9335

File tree

80 files changed

+4510
-2532
lines changed

Some content is hidden

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

80 files changed

+4510
-2532
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="1.0.0-preview" />
14+
<PackageReference Include="Microsoft.Azure.Management.Peering" Version="1.0.1-preview" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

src/Peering/Peering.Test/ScenarioTests/ConvertLegacyTests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ GetLocationKindExchange
1818
function Test-ConvertLegacyKindExchangeAshburn {
1919
try {
2020
#must be hard coded asn because they have legacy items.
21-
$peerAsn = makePeerAsn 12129;
22-
$name = getPeeringVariable "Name" "AS12129_Ashburn_Exchange"
21+
$peerAsn = makePeerAsn 11164;
22+
$name = getPeeringVariable "Name" "AS11164_Ashburn_Exchange"
2323
$rg = getPeeringVariable "ResourceGroupName" "Building40"
2424
$legacy = Get-AzLegacyPeering -Kind Exchange -PeeringLocation Ashburn
2525
Assert-NotNull $peerAsn.Id
2626
Assert-NotNull $legacy
2727
Assert-True { $legacy.Count -ge 1 }
28-
$legacy | New-AzPeering -ResourceGroupName $rg -Name $name -PeerAsnResourceId $peerAsn.Id
28+
$peering = $legacy | New-AzPeering -ResourceGroupName $rg -Name $name -PeerAsnResourceId $peerAsn.Id -Tag @{ "tfs_813288" = "Approved" }
2929
$peering = Get-AzPeering -ResourceGroupName $rg -Name $name
3030
Assert-NotNull $peering
3131
}

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,25 @@ public void TestNewDirectPeeringPipeTwoConnections()
7171
{
7272
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-NewDirectPeeringPipeTwoConnections");
7373
}
74+
75+
/// <summary>
76+
/// The test new direct peering pipe two connections and sku premium direct free.
77+
/// </summary>
78+
[Fact]
79+
[Trait(Category.AcceptanceType, Category.CheckIn)]
80+
public void TestNewDirectPeeringPremiumDirectFree()
81+
{
82+
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-NewDirectPeeringPremiumDirectFree");
83+
}
84+
85+
/// <summary>
86+
/// The test new direct peering pipe two connections and sku premium direct unlimited.
87+
/// </summary>
88+
[Fact]
89+
[Trait(Category.AcceptanceType, Category.CheckIn)]
90+
public void TestNewDirectPeeringPremiumDirectUnlimited()
91+
{
92+
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-NewDirectPeeringPremiumDirectUnlimited");
93+
}
7494
}
7595
}

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

Lines changed: 110 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function NewDirectConnectionV4V6($facilityId,$bandwidth)
2323
Write-Debug "Created Hash $md5"
2424
$rand1 = Get-Random -Maximum 20 -Minimum 3
2525
$rand2 = Get-Random -Maximum 200 -Minimum 1
26-
$sessionv4 = newIpV4Address $true $true 0 $rand1
26+
$sessionv4 = newIpV4Address $true $true 0 $rand2
2727
$sessionv6 = newIpV6Address $true $true 0 $rand2
2828
Write-Debug "Created IPs $sessionv4 $SessionPrefixV6"
2929
$maxv4 = maxAdvertisedIpv4
@@ -32,6 +32,12 @@ function NewDirectConnectionV4V6($facilityId,$bandwidth)
3232

3333
$createdConnection = New-AzPeeringDirectConnectionObject -PeeringDbFacilityId $facilityId -SessionPrefixV4 $sessionv4 -SessionPrefixV6 $sessionv6 -MaxPrefixesAdvertisedIPv4 $maxv4 -MaxPrefixesAdvertisedIPv6 $maxv6 -BandwidthInMbps $bandwidth -MD5AuthenticationKey $md5
3434
Write-Debug "Created Connection $createdConnection"
35+
# Assert-NotNull $createdConnection
36+
# Assert-AreEqual $md5 $createdConnection.BgpSession.Md5AuthenticationKey
37+
# Assert-AreEqual $facilityId $createdConnection.PeeringDBFacilityId
38+
# Assert-AreEqual $bandwidth $createdConnection.BandwidthInMbps
39+
# Assert-AreEqual $sessionv4 $createdConnection.BgpSession.SessionPrefixV4
40+
# Assert-AreEqual $sessionv6 $createdConnection.BgpSession.SessionPrefixV6
3541
return $createdConnection
3642
}
3743
<#
@@ -63,7 +69,7 @@ function Test-NewDirectPeering
6369
$sessionv4 = getPeeringVariable "sessionv4" $directConnection.BgpSession.SessionPrefixV4
6470
$sessionv6 = getPeeringVariable "sessionv6" $directConnection.BgpSession.SessionPrefixV6
6571
Write-Debug "Creating New Peering: $resourceName."
66-
$createdPeering = New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeeringLocation $peeringLocation[0].PeeringLocation -PeerAsnResourceId $asn.Id -DirectConnection $directConnection -Tag $tags
72+
$createdPeering = New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeeringLocation $peeringLocation[0].PeeringLocation -Sku "Basic_Direct_Free" -PeerAsnResourceId $asn.Id -DirectConnection $directConnection -Tag $tags
6773
Write-Debug "Created New Peering: $createdPeering$Name"
6874
Assert-NotNull $createdPeering
6975
Assert-AreEqual $kind $createdPeering.Kind
@@ -86,15 +92,16 @@ function Test-NewDirectPeeringWithPipe
8692
$loc = "Seattle"
8793
$resourceGroup = "testCarrier";
8894
Write-Debug $resourceGroup
89-
#Create Resource
90-
$resourceName = getAssetName "DirectPipeConnection";
91-
Write-Debug "Setting $resourceName"
92-
$peeringLocation = getPeeringLocation $kind $loc;
95+
#Create Asn
9396
Write-Debug "Getting the Asn Information"
9497
$randNum = getRandomNumber
9598
Write-Debug "Random Number $randNum";
9699
$peerAsn = makePeerAsn $randNum
97100
$asn = $peerAsn
101+
#Create Resource
102+
$resourceName = getAssetName "DirectPipeConnection";
103+
Write-Debug "Setting $resourceName"
104+
$peeringLocation = getPeeringLocation $kind $loc;
98105
$facilityId = $peeringLocation[0].PeeringDBFacilityId
99106
#create Connection
100107
$bandwidth = getBandwidth
@@ -104,7 +111,7 @@ function Test-NewDirectPeeringWithPipe
104111
$sessionv4 = getPeeringVariable "sessionv4" $directConnection.BgpSession.SessionPrefixV4
105112
$sessionv6 = getPeeringVariable "sessionv6" $directConnection.BgpSession.SessionPrefixV6
106113
Write-Debug "Creating New Peering: $resourceName."
107-
$createdPeering = New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeeringLocation $peeringLocation[0].PeeringLocation -PeerAsnResourceId $asn.Id -Tag $tags -DirectConnection ($directConnection)
114+
$createdPeering = New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeeringLocation $peeringLocation[0].PeeringLocation -Sku "Basic_Direct_Free" -PeerAsnResourceId $asn.Id -Tag $tags -DirectConnection ($directConnection)
108115
Assert-NotNull $createdPeering
109116
Assert-AreEqual "Direct" $createdPeering.Kind
110117
Assert-AreEqual $resourceName $createdPeering.Name
@@ -126,28 +133,79 @@ function Test-NewDirectPeeringPipeTwoConnections
126133
$loc = "Ashburn"
127134
$resourceGroup = "testCarrier";
128135
Write-Debug $resourceGroup
136+
#Create Asn
137+
Write-Debug "Getting the Asn Information"
138+
$randNum = getRandomNumber
139+
Write-Debug "Random Number $randNum";
140+
$peerAsn = makePeerAsn $randNum
141+
$asn = $peerAsn
129142
#Create Resource
130143
$resourceName = getAssetName "DirectOneConnection";
131144
Write-Debug "Setting $resourceName"
132145
$peeringLocation = getPeeringLocation $kind $loc;
146+
$facilityId = $peeringLocation[0].PeeringDBFacilityId
147+
#create Connection
148+
$bandwidth = getBandwidth
149+
$bandwidth2 = getBandwidth
150+
$tags = @{"tfs_$randNum" = "value1"; "tag2" = "value2"}
151+
Write-Debug "Creating New Peering: $resourceName."
152+
$connection1 = NewDirectConnectionV4V6 $facilityId $bandwidth
153+
# variables to save for playback
154+
$sessionv4 = getPeeringVariable "sessionv4" $connection1.BgpSession.SessionPrefixV4
155+
$sessionv6 = getPeeringVariable "sessionv6" $connection1.BgpSession.SessionPrefixV6
156+
$md5 = $connection1.BgpSession.Md5AuthenticationKey
157+
#connection2
158+
$connection2 = NewDirectConnectionV4V6 $facilityId $bandwidth2
159+
#create peering
160+
$createdPeering = New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeeringLocation $peeringLocation[0].PeeringLocation -Sku "Basic_Direct_Free" -PeerAsnResourceId $asn.Id -Tag $tags -DirectConnection $connection1, $connection2
161+
Assert-NotNull $createdPeering
162+
Assert-AreEqual $kind $createdPeering.Kind
163+
Assert-AreEqual $resourceName $createdPeering.Name
164+
Assert-AreEqual $peeringLocation[0].PeeringLocation $createdPeering.PeeringLocation
165+
Assert-AreEqual $md5 $createdPeering.Connections[0].BgpSession.Md5AuthenticationKey
166+
Assert-AreEqual $facilityId $createdPeering.Connections[0].PeeringDBFacilityId
167+
Assert-AreEqual $bandwidth $createdPeering.Connections[0].BandwidthInMbps
168+
Assert-AreEqual $sessionv4 $createdPeering.Connections[0].BgpSession.SessionPrefixV4
169+
Assert-AreEqual $sessionv6 $createdPeering.Connections[0].BgpSession.SessionPrefixV6
170+
Assert-NotNull $createdPeering.Connections[1].BgpSession
171+
}
172+
173+
<#
174+
.SYNOPSIS
175+
Tests new Direct Peering Pipe Two Connections
176+
#>
177+
function Test-NewDirectPeeringPremiumDirectFree
178+
{
179+
#Hard Coded locations becuase of limitations in locations
180+
$kind = isDirect $true;
181+
$loc = "Ashburn"
182+
$resourceGroup = "testCarrier";
183+
Write-Debug $resourceGroup
184+
#Create Asn
133185
Write-Debug "Getting the Asn Information"
134186
$randNum = getRandomNumber
135187
Write-Debug "Random Number $randNum";
136188
$peerAsn = makePeerAsn $randNum
137189
$asn = $peerAsn
190+
#Create Resource
191+
$resourceName = getAssetName "DirectOneConnection";
192+
Write-Debug "Setting $resourceName"
193+
$peeringLocation = getPeeringLocation $kind $loc;
138194
$facilityId = $peeringLocation[0].PeeringDBFacilityId
139195
#create Connection
140196
$bandwidth = getBandwidth
141197
$bandwidth2 = getBandwidth
142-
$directConnection = NewDirectConnectionV4V6 $facilityId $bandwidth
143198
$tags = @{"tfs_$randNum" = "value1"; "tag2" = "value2"}
144-
$md5 = $directConnection.BgpSession.Md5AuthenticationKey
145-
$sessionv4 = getPeeringVariable "sessionv4" $directConnection.BgpSession.SessionPrefixV4
146-
$sessionv6 = getPeeringVariable "sessionv6" $directConnection.BgpSession.SessionPrefixV6
147-
Write-Debug "Creating New Peering: $resourceName."
148199
$connection1 = NewDirectConnectionV4V6 $facilityId $bandwidth
200+
# variables to save for playback
201+
$sessionv4 = getPeeringVariable "sessionv4" $connection1.BgpSession.SessionPrefixV4
202+
$sessionv6 = getPeeringVariable "sessionv6" $connection1.BgpSession.SessionPrefixV6
203+
$md5 = $connection1.BgpSession.Md5AuthenticationKey
204+
#connection2
149205
$connection2 = NewDirectConnectionV4V6 $facilityId $bandwidth2
150-
$createdPeering = New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeeringLocation $peeringLocation[0].PeeringLocation -PeerAsnResourceId $asn.Id -Tag $tags -DirectConnection $connection1, $connection2
206+
#create peering
207+
$connection2.UseForPeeringService = $true
208+
$createdPeering = New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeeringLocation $peeringLocation[0].PeeringLocation -Sku "Basic_Direct_Free" -PeerAsnResourceId $asn.Id -Tag $tags -DirectConnection $connection1, $connection2
151209
Assert-NotNull $createdPeering
152210
Assert-AreEqual $kind $createdPeering.Kind
153211
Assert-AreEqual $resourceName $createdPeering.Name
@@ -157,5 +215,44 @@ function Test-NewDirectPeeringPipeTwoConnections
157215
Assert-AreEqual $bandwidth $createdPeering.Connections[0].BandwidthInMbps
158216
Assert-AreEqual $sessionv4 $createdPeering.Connections[0].BgpSession.SessionPrefixV4
159217
Assert-AreEqual $sessionv6 $createdPeering.Connections[0].BgpSession.SessionPrefixV6
218+
Assert-AreEqual "Premium_Direct_Free" $createdPeering.Sku.Name
160219
Assert-NotNull $createdPeering.Connections[1].BgpSession
220+
}
221+
222+
<#
223+
.SYNOPSIS
224+
Tests new Direct Peering Pipe Two Connections
225+
#>
226+
function Test-NewDirectPeeringPremiumDirectUnlimited
227+
{
228+
#Hard Coded locations becuase of limitations in locations
229+
$kind = isDirect $true;
230+
$loc = "Ashburn"
231+
$resourceGroup = "testCarrier";
232+
Write-Debug $resourceGroup
233+
#Create Asn
234+
Write-Debug "Getting the Asn Information"
235+
$randNum = getRandomNumber
236+
Write-Debug "Random Number $randNum";
237+
$peerAsn = makePeerAsn $randNum
238+
$asn = $peerAsn
239+
#Create Resource
240+
$resourceName = getAssetName "DirectOneConnection";
241+
Write-Debug "Setting $resourceName"
242+
$peeringLocation = getPeeringLocation $kind $loc;
243+
$facilityId = $peeringLocation[0].PeeringDBFacilityId
244+
#create Connection
245+
$bandwidth = getBandwidth
246+
$bandwidth2 = getBandwidth
247+
$tags = @{"tfs_$randNum" = "value1"; "tag2" = "value2"}
248+
$connection1 = NewDirectConnectionV4V6 $facilityId $bandwidth
249+
# variables to save for playback
250+
$sessionv4 = getPeeringVariable "sessionv4" $connection1.BgpSession.SessionPrefixV4
251+
$sessionv6 = getPeeringVariable "sessionv6" $connection1.BgpSession.SessionPrefixV6
252+
$md5 = $connection1.BgpSession.Md5AuthenticationKey
253+
#connection2
254+
$connection2 = NewDirectConnectionV4V6 $facilityId $bandwidth2
255+
#create peering
256+
$connection2.UseForPeeringService = $true
257+
Assert-ThrowsContains { $createdPeering = New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeeringLocation $peeringLocation[0].PeeringLocation -Sku "Premium_Direct_Unlimited" -PeerAsnResourceId $asn.Id -Tag $tags -DirectConnection $connection1, $connection2 } "Peering SKU is invalid for Direct"
161258
}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ function Test-NewExchangePeering()
4545
Assert-NotNull $createdPeering
4646
Assert-NotNull $createdPeering.Connections.ConnectionIdentifier
4747
}
48-
catch{
49-
Write-Debug $error
50-
}
5148
finally{
5249
$isRemoved = Remove-AzPeerAsn -Name $peerAsn.Name -Force -PassThru;
5350
Assert-True {$isRemoved}

src/Peering/Peering.Test/ScenarioTests/PeeringServiceTests.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ GetPeeringServiceProviders
4343
function Test-GetPeeringServiceByResourceGroup {
4444
#Hard Coded locations becuase of limitations in locations
4545
$name = getAssetName "myPeeringService";
46-
$loc = "Washington"
47-
$provider = "TestPeer1"
46+
$loc = "Florida"
47+
$provider = "AS56845-Global1191"
4848
$resourceGroup = "Building40"
4949
$peeringService = New-AzPeeringService -ResourceGroupName $resourceGroup -Name $name -PeeringLocation $loc -PeeringServiceProvider $provider
5050
Assert-NotNull $peeringService
@@ -65,8 +65,8 @@ GetPeeringServiceLocations
6565
function Test-GetPeeringServiceByResourceId {
6666
#Hard Coded locations becuase of limitations in locations
6767
$name = getAssetName "myPeeringService";
68-
$loc = "Washington"
69-
$provider = "TestPeer1"
68+
$loc = "Florida"
69+
$provider = "AS56845-Global1191"
7070
$resourceGroup = "Building40"
7171
$peeringService = New-AzPeeringService -ResourceGroupName $resourceGroup -Name $name -PeeringLocation $loc -PeeringServiceProvider $provider
7272
Assert-NotNull $peeringService
@@ -96,8 +96,8 @@ GetPeeringServiceLocations
9696
function Test-NewPeeringService {
9797
#Hard Coded locations becuase of limitations in locations
9898
$name = getAssetName "myPeeringService";
99-
$loc = "Washington"
100-
$provider = "TestPeer1"
99+
$loc = "Florida"
100+
$provider = "AS56845-Global1191"
101101
$resourceGroup = "Building40"
102102
$peeringService = New-AzPeeringService -ResourceGroupName $resourceGroup -Name $name -PeeringLocation $loc -PeeringServiceProvider $provider
103103
Assert-NotNull $peeringService
@@ -114,8 +114,8 @@ function Test-NewPeeringServicePrefix {
114114
#Hard Coded locations becuase of limitations in locations
115115
$name = getAssetName "myPeeringService";
116116
$prefixName = getAssetName "myPrefix";
117-
$loc = "Washington"
118-
$provider = "TestPeer1"
117+
$loc = "Florida"
118+
$provider = "AS56845-Global1191"
119119
$resourceGroup = "Building40"
120120
$prefix = newIpV4Address $true $true 0 4
121121
$peeringService = New-AzPeeringService -ResourceGroupName $resourceGroup -Name $name -PeeringLocation $loc -PeeringServiceProvider $provider

src/Peering/Peering.Test/ScenarioTests/ScenarioExchangePeeringTests.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,19 @@ function Test-ConvertLegacyToExchange
5858

5959
#Hard Coded locations becuase of limitations in locations
6060
$kind = isDirect $false;
61-
$loc = "Seattle"
61+
$loc = "ashburn"
6262
$resourceGroup = "testCarrier"
6363
#asn has to be hard coded because its unique and finite amoungst locations
64-
$asnId = 11164
64+
$asnId = 57976
6565
$resourceName = getAssetName "LegacyConvertExchange"
6666
$asnPeerName = getAssetName "PeerName"
6767
$asn = makePeerAsn $asnId
6868
Assert-NotNull $asn
6969
Assert-AreEqual "Approved" $asn.ValidationState
7070
$legacy = Get-AzLegacyPeering -Kind $kind -PeeringLocation $loc
71+
$tags = @{"tfs_$asnId" = "Active"; "tag2" = "value2"}
7172
Assert-NotNull $legacy
72-
$legacy | New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeerAsnResourceId $asn.Id
73+
$legacy | New-AzPeering -Name $resourceName -ResourceGroupName $resourceGroup -PeerAsnResourceId $asn.Id -Tag $tags
7374
$newPeering = Get-AzPeering -ResourceGroupName testCarrier -Name $resourceName
7475
Assert-NotNull $newPeering
7576
}
@@ -142,5 +143,5 @@ function Test-UpdateExchangeMd5OnNameAndResourceGroup
142143
$peering.Tags = $tags;
143144
$peering.Connections[0] = $peering.Connections[0] | Set-AzPeeringExchangeConnectionObject -MD5AuthenticationKey $hash
144145
$peering.Connections[1] = $peering.Connections[1] | Set-AzPeeringExchangeConnectionObject -MD5AuthenticationKey $hash
145-
Assert-ThrowsContains {$peering | Update-AzPeering } "OperationNotSupported"
146+
Assert-ThrowsContains {$peering = $peering | Update-AzPeering} "not yet supported"
146147
}

src/Peering/Peering.Test/ScenarioTests/SetPeeringTests.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,6 @@ public SetPeeringTests(Xunit.Abstractions.ITestOutputHelper output)
4141

4242
}
4343

44-
/// <summary>
45-
/// The test get and set use for peering service.
46-
/// </summary>
47-
[Fact]
48-
[Trait(Category.AcceptanceType, Category.CheckIn)]
49-
public void TestGetAndSetUseForPeeringService()
50-
{
51-
TestController.NewInstance.RunPowerShellTest(this.logger, "Test-GetAndSetUseForPeeringService");
52-
}
53-
5444
/// <summary>
5545
/// The test set new bandwidth.
5646
/// </summary>

0 commit comments

Comments
 (0)