Skip to content

Commit 4ffd95b

Browse files
ureriduSam Kowalski
andauthored
Add Asn param to Cortex Virtual hub and Vpn Gateway (#19498)
* added custom asn functionality to virtual hub and vpn gateway create and update cmds * bgpsettings.asn * updated changelog * removed wrong param in test * removed wrong param in test * Added test session record * updated help modules * retrigger checks Co-authored-by: Sam Kowalski <[email protected]>
1 parent e900084 commit 4ffd95b

File tree

12 files changed

+7325
-54
lines changed

12 files changed

+7325
-54
lines changed

src/Network/Network.Test/ScenarioTests/CortexTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,13 @@ public void TestVpnSiteLinkConnectionGetIkeSa()
130130
{
131131
TestRunner.RunTestScript("Test-VpnSiteLinkConnectionGetIkeSa");
132132
}
133+
134+
[Fact]
135+
[Trait(Category.AcceptanceType, Category.CheckIn)]
136+
[Trait(Category.Owner, NrpTeamAlias.brooklynft)]
137+
public void TestVirtualHubAndVpnGatewayWithCustomAsn()
138+
{
139+
TestRunner.RunTestScript("Test-VirtualHubAndVpnGatewayWithCustomAsn");
140+
}
133141
}
134142
}

src/Network/Network.Test/ScenarioTests/CortexTests.ps1

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,3 +1803,78 @@ function Test-VpnSiteLinkConnectionGetIkeSa
18031803
Clean-ResourceGroup $rgname
18041804
}
18051805
}
1806+
1807+
<#
1808+
.SYNOPSIS
1809+
Create a virtual hub and vpn gateway with custom asn and update them
1810+
#>
1811+
function Test-VirtualHubAndVpnGatewayWithCustomAsn
1812+
{
1813+
# Setup
1814+
$rgName = Get-ResourceName
1815+
$rglocation = Get-ProviderLocation ResourceManagement "West Central US"
1816+
$virtualWanName = Get-ResourceName
1817+
$virtualHubName = Get-ResourceName
1818+
$vpnGatewayName = Get-ResourceName
1819+
1820+
try
1821+
{
1822+
# Create the resource group
1823+
$resourceGroup = New-AzResourceGroup -Name $rgName -Location $rglocation
1824+
1825+
# Create the Virtual Wan
1826+
$createdVirtualWan = New-AzVirtualWan -ResourceGroupName $rgName -Name $virtualWanName -Location $rglocation -AllowVnetToVnetTraffic -AllowBranchToBranchTraffic
1827+
$virtualWan = Get-AzVirtualWan -ResourceGroupName $rgName -Name $virtualWanName
1828+
Assert-AreEqual $rgName $virtualWan.ResourceGroupName
1829+
Assert-AreEqual $virtualWanName $virtualWan.Name
1830+
Assert-AreEqual $true $virtualWan.AllowVnetToVnetTraffic
1831+
Assert-AreEqual $true $virtualWan.AllowBranchToBranchTraffic
1832+
1833+
# Create the Virtual Hub
1834+
$createdVirtualHub = New-AzVirtualHub -ResourceGroupName $rgName -Name $virtualHubName -Location $rglocation -VirtualWan $virtualWan -AddressPrefix "192.168.1.0/24" -VirtualRouterAsn 65000
1835+
$virtualHub = Get-AzVirtualHub -ResourceGroupName $rgName -Name $virtualHubName
1836+
Assert-AreEqual $rgName $virtualHub.ResourceGroupName
1837+
Assert-AreEqual $virtualHubName $virtualHub.Name
1838+
Assert-AreEqual "192.168.1.0/24" $virtualHub.AddressPrefix
1839+
Assert-AreEqual 65000 $virtualHub.VirtualRouterAsn
1840+
1841+
# Create the VpnGateway
1842+
$createdVpnGateway = New-AzVpnGateway -ResourceGroupName $rgName -Name $vpnGatewayName -VirtualHub $virtualHub -VpnGatewayScaleUnit 3 -Asn 65100
1843+
$vpnGateway = Get-AzVpnGateway -ResourceGroupName $rgName -Name $vpnGatewayName
1844+
Assert-AreEqual $rgName $vpnGateway.ResourceGroupName
1845+
Assert-AreEqual $vpnGatewayName $vpnGateway.Name
1846+
Assert-AreEqual 65100 $vpnGateway.BgpSettings.Asn
1847+
1848+
# Update Virtual Hub
1849+
$updatedVirtualHub = Update-AzVirtualHub -ResourceGroupName $rgName -Name $virtualHubName -VirtualRouterAsn 65001
1850+
$virtualHub = Get-AzVirtualHub -ResourceGroupName $rgName -Name $virtualHubName
1851+
Assert-AreEqual $rgName $virtualHub.ResourceGroupName
1852+
Assert-AreEqual $virtualHubName $virtualHub.Name
1853+
Assert-AreEqual 65001 $virtualHub.VirtualRouterAsn
1854+
1855+
# Update the VpnGateway
1856+
$updatedVpnGateway = Update-AzVpnGateway -ResourceGroupName $rgName -Name $vpnGatewayName -Asn 65101
1857+
$vpnGateway = Get-AzVpnGateway -ResourceGroupName $rgName -Name $vpnGatewayName
1858+
Assert-AreEqual $rgName $vpnGateway.ResourceGroupName
1859+
Assert-AreEqual $vpnGatewayName $vpnGateway.Name
1860+
Assert-AreEqual 65101 $vpnGateway.BgpSettings.Asn
1861+
1862+
# Delete Vpn Gateway
1863+
$delete = Remove-AzVpnGateway -ResourceGroupName $rgName -Name $vpnGatewayName -Force -PassThru
1864+
Assert-AreEqual $True $delete
1865+
1866+
# Delete Virtual hub
1867+
$delete = Remove-AzVirtualHub -ResourceGroupName $rgname -Name $virtualHubName -Force -PassThru
1868+
Assert-AreEqual $True $delete
1869+
1870+
# Delete Virtual wan
1871+
$delete = Remove-AzVirtualWan -InputObject $virtualWan -Force -PassThru
1872+
Assert-AreEqual $True $delete
1873+
}
1874+
finally
1875+
{
1876+
Clean-ResourceGroup $rgname
1877+
}
1878+
}
1879+
1880+

0 commit comments

Comments
 (0)