@@ -23,7 +23,7 @@ function NewDirectConnectionV4V6($facilityId,$bandwidth)
23
23
Write-Debug " Created Hash $md5 "
24
24
$rand1 = Get-Random - Maximum 20 - Minimum 3
25
25
$rand2 = Get-Random - Maximum 200 - Minimum 1
26
- $sessionv4 = newIpV4Address $true $true 0 $rand1
26
+ $sessionv4 = newIpV4Address $true $true 0 $rand2
27
27
$sessionv6 = newIpV6Address $true $true 0 $rand2
28
28
Write-Debug " Created IPs $sessionv4 $SessionPrefixV6 "
29
29
$maxv4 = maxAdvertisedIpv4
@@ -32,6 +32,12 @@ function NewDirectConnectionV4V6($facilityId,$bandwidth)
32
32
33
33
$createdConnection = New-AzPeeringDirectConnectionObject - PeeringDbFacilityId $facilityId - SessionPrefixV4 $sessionv4 - SessionPrefixV6 $sessionv6 - MaxPrefixesAdvertisedIPv4 $maxv4 - MaxPrefixesAdvertisedIPv6 $maxv6 - BandwidthInMbps $bandwidth - MD5AuthenticationKey $md5
34
34
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
35
41
return $createdConnection
36
42
}
37
43
<#
@@ -63,7 +69,7 @@ function Test-NewDirectPeering
63
69
$sessionv4 = getPeeringVariable " sessionv4" $directConnection.BgpSession.SessionPrefixV4
64
70
$sessionv6 = getPeeringVariable " sessionv6" $directConnection.BgpSession.SessionPrefixV6
65
71
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
67
73
Write-Debug " Created New Peering: $createdPeering$Name "
68
74
Assert-NotNull $createdPeering
69
75
Assert-AreEqual $kind $createdPeering.Kind
@@ -86,15 +92,16 @@ function Test-NewDirectPeeringWithPipe
86
92
$loc = " Seattle"
87
93
$resourceGroup = " testCarrier" ;
88
94
Write-Debug $resourceGroup
89
- # Create Resource
90
- $resourceName = getAssetName " DirectPipeConnection" ;
91
- Write-Debug " Setting $resourceName "
92
- $peeringLocation = getPeeringLocation $kind $loc ;
95
+ # Create Asn
93
96
Write-Debug " Getting the Asn Information"
94
97
$randNum = getRandomNumber
95
98
Write-Debug " Random Number $randNum " ;
96
99
$peerAsn = makePeerAsn $randNum
97
100
$asn = $peerAsn
101
+ # Create Resource
102
+ $resourceName = getAssetName " DirectPipeConnection" ;
103
+ Write-Debug " Setting $resourceName "
104
+ $peeringLocation = getPeeringLocation $kind $loc ;
98
105
$facilityId = $peeringLocation [0 ].PeeringDBFacilityId
99
106
# create Connection
100
107
$bandwidth = getBandwidth
@@ -104,7 +111,7 @@ function Test-NewDirectPeeringWithPipe
104
111
$sessionv4 = getPeeringVariable " sessionv4" $directConnection.BgpSession.SessionPrefixV4
105
112
$sessionv6 = getPeeringVariable " sessionv6" $directConnection.BgpSession.SessionPrefixV6
106
113
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 )
108
115
Assert-NotNull $createdPeering
109
116
Assert-AreEqual " Direct" $createdPeering.Kind
110
117
Assert-AreEqual $resourceName $createdPeering.Name
@@ -126,28 +133,79 @@ function Test-NewDirectPeeringPipeTwoConnections
126
133
$loc = " Ashburn"
127
134
$resourceGroup = " testCarrier" ;
128
135
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
129
142
# Create Resource
130
143
$resourceName = getAssetName " DirectOneConnection" ;
131
144
Write-Debug " Setting $resourceName "
132
145
$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
133
185
Write-Debug " Getting the Asn Information"
134
186
$randNum = getRandomNumber
135
187
Write-Debug " Random Number $randNum " ;
136
188
$peerAsn = makePeerAsn $randNum
137
189
$asn = $peerAsn
190
+ # Create Resource
191
+ $resourceName = getAssetName " DirectOneConnection" ;
192
+ Write-Debug " Setting $resourceName "
193
+ $peeringLocation = getPeeringLocation $kind $loc ;
138
194
$facilityId = $peeringLocation [0 ].PeeringDBFacilityId
139
195
# create Connection
140
196
$bandwidth = getBandwidth
141
197
$bandwidth2 = getBandwidth
142
- $directConnection = NewDirectConnectionV4V6 $facilityId $bandwidth
143
198
$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 ."
148
199
$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
149
205
$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
151
209
Assert-NotNull $createdPeering
152
210
Assert-AreEqual $kind $createdPeering.Kind
153
211
Assert-AreEqual $resourceName $createdPeering.Name
@@ -157,5 +215,44 @@ function Test-NewDirectPeeringPipeTwoConnections
157
215
Assert-AreEqual $bandwidth $createdPeering.Connections [0 ].BandwidthInMbps
158
216
Assert-AreEqual $sessionv4 $createdPeering.Connections [0 ].BgpSession.SessionPrefixV4
159
217
Assert-AreEqual $sessionv6 $createdPeering.Connections [0 ].BgpSession.SessionPrefixV6
218
+ Assert-AreEqual " Premium_Direct_Free" $createdPeering.Sku.Name
160
219
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"
161
258
}
0 commit comments