@@ -201,6 +201,48 @@ function Test-subnetCRUD
201
201
}
202
202
}
203
203
204
+ <#
205
+ . SYNOPSIS
206
+ Tests creating, updating & deleting a virtualNetwork with BGP Communities.
207
+ . DESCRIPTION
208
+ SmokeTest
209
+ #>
210
+ function Test-bgpCommunitiesCRUD
211
+ {
212
+ # Setup
213
+ $rgname = Get-ResourceGroupName
214
+ $vnetName = Get-ResourceName
215
+ $rglocation = Get-ProviderLocation ResourceManagement
216
+ $resourceTypeParent = " Microsoft.Network/virtualNetworks"
217
+ $location = Get-ProviderLocation $resourceTypeParent
218
+
219
+ try
220
+ {
221
+ # Create the resource group
222
+ $resourceGroup = New-AzResourceGroup - Name $rgname - Location $rglocation - Tags @ { testtag = " testval" }
223
+
224
+ # Create q virtual network with a BGP community
225
+ New-AzVirtualNetwork - Name $vnetName - ResourceGroupName $rgname - Location $location - AddressPrefix 10.0 .0.0 / 16 - BgpCommunity 12076 :61234
226
+
227
+ # Get the virtual network and verify that the community is set to the expected value
228
+ $vnet = Get-AzVirtualNetwork - Name $vnetName - ResourceGroupName $rgname
229
+ Assert-AreEqual " 12076:61234" $vnet.BgpCommunities.VirtualNetworkCommunity
230
+
231
+ # Update the virtual network with a different BGP community
232
+ $vnet.BgpCommunities.VirtualNetworkCommunity = " 12076:64321"
233
+ $vnet | Set-AzVirtualNetwork
234
+
235
+ # Get the virtual network and verify that the community is set to the new value
236
+ $vnet = Get-AzVirtualNetwork - Name $vnetName - ResourceGroupName $rgname
237
+ Assert-AreEqual " 12076:64321" $vnet.BgpCommunities.VirtualNetworkCommunity
238
+ }
239
+ finally
240
+ {
241
+ # Cleanup
242
+ Clean - ResourceGroup $rgname
243
+ }
244
+ }
245
+
204
246
<#
205
247
. SYNOPSIS
206
248
Tests creating new virtualNetwork w/ delegated subnets.
0 commit comments