Skip to content

Commit 4457562

Browse files
committed
Tests and bug fixes
1 parent fc4b953 commit 4457562

File tree

6 files changed

+1467
-7
lines changed

6 files changed

+1467
-7
lines changed

src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ public void TestVirtualNetworkSubnetCRUD()
5050
TestRunner.RunTestScript("Test-subnetCRUD");
5151
}
5252

53+
[Fact]
54+
[Trait(Category.AcceptanceType, Category.CheckIn)]
55+
[Trait(Category.Owner, NrpTeamAlias.sdnnrp)]
56+
public void TestVirtualNetworkBgpCommunitiesCRUD()
57+
{
58+
TestRunner.RunTestScript("Test-bgpCommunitiesCRUD");
59+
}
60+
5361
[Fact]
5462
[Trait(Category.AcceptanceType, Category.CheckIn)]
5563
[Trait(Category.Owner, NrpTeamAlias.sdnnrp)]

src/Network/Network.Test/ScenarioTests/VirtualNetworkTests.ps1

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,48 @@ function Test-subnetCRUD
201201
}
202202
}
203203

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+
204246
<#
205247
.SYNOPSIS
206248
Tests creating new virtualNetwork w/ delegated subnets.

0 commit comments

Comments
 (0)