Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Network/Network.Test/ScenarioTests/CortexTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,13 @@ public void TestBgpSettingsUpdateVpnGateway()
{
TestRunner.RunTestScript("Test-BgpUpdateVpnGateway");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.Owner, NrpTeamAlias.pgtm)]
public void TestCortexVirtualHubCRUD()
{
TestRunner.RunTestScript("Test-CortexVirtualHubCRUD");
}
}
}
47 changes: 46 additions & 1 deletion src/Network/Network.Test/ScenarioTests/CortexTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function Test-CortexCRUD
Assert-AreEqual $virtualHubName $virtualHub.Name
$routes = $virtualHub.RouteTable.Routes
Assert-AreEqual 2 @($routes).Count

# Create the VpnSite
$vpnSiteAddressSpaces = New-Object string[] 1
$vpnSiteAddressSpaces[0] = "192.168.2.0/24"
Expand Down Expand Up @@ -849,4 +849,49 @@ function Test-CortexExpressRouteCRUD

Clean-ResourceGroup $rgname
}
}

function Test-CortexVirtualHubCRUD
{
# Setup
$rgName = Get-ResourceName
$rglocation = Get-ProviderLocation ResourceManagement "West Central US"

$virtualWanName = Get-ResourceName
$virtualHubName = Get-ResourceName

try
{
# Create the resource group
$resourceGroup = New-AzResourceGroup -Name $rgName -Location $rglocation

# Create the Virtual Wan
$createdVirtualWan = New-AzVirtualWan -ResourceGroupName $rgName -Name $virtualWanName -Location $rglocation -AllowVnetToVnetTraffic -AllowBranchToBranchTraffic
$virtualWan = Get-AzVirtualWan -ResourceGroupName $rgName -Name $virtualWanName
Assert-AreEqual $rgName $virtualWan.ResourceGroupName
Assert-AreEqual $virtualWanName $virtualWan.Name
Assert-AreEqual $true $virtualWan.AllowVnetToVnetTraffic
Assert-AreEqual $true $virtualWan.AllowBranchToBranchTraffic

# Create the Virtual Hub
$createdVirtualHub = New-AzVirtualHub -ResourceGroupName $rgName -Name $virtualHubName -Location $rglocation -AddressPrefix "10.0.0.0/16" -VirtualWan $virtualWan
$virtualHub = Get-AzVirtualHub -ResourceGroupName $rgName -Name $virtualHubName
Assert-AreEqual $rgName $virtualHub.ResourceGroupName
Assert-AreEqual $virtualHubName $virtualHub.Name
Assert-AreEqual "10.0.0.0/16" $virtualHub.AddressPrefix

# Reset-AzHubRouter
Reset-AzHubRouter -ResourceGroupName $rgName -Name $virtualHubName

# Delete the resources
$delete = Remove-AzVirtualHub -ResourceGroupName $rgName -Name $virtualHubName -Force -PassThru
Assert-AreEqual $True $delete

$delete = Remove-AzVirtualWan -ResourceGroupName $rgName -Name $virtualWanName -Force -PassThru
Assert-AreEqual $True $delete
}
finally
{
Clean-ResourceGroup $rgname
}
}
Loading