Skip to content

Commit 896f005

Browse files
author
Hovsep
committed
Merge pull request Azure#1966 from lamchester/dev
Add parameters for BGP with VPN gateways
2 parents befdfac + 24e1762 commit 896f005

File tree

19 files changed

+8113
-9
lines changed

19 files changed

+8113
-9
lines changed

src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<Private>True</Private>
6969
</Reference>
7070
<Reference Include="Microsoft.Azure.Management.Network, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
71-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.3.2.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
71+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.3.3.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
7272
<Private>True</Private>
7373
</Reference>
7474
<Reference Include="Microsoft.Azure.Management.Storage, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/ResourceManager/Compute/Commands.Compute.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<package id="Microsoft.Azure.Graph.RBAC" version="1.9.0-preview" targetFramework="net45" />
88
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
99
<package id="Microsoft.Azure.Management.Compute" version="11.3.0-prerelease" targetFramework="net45" />
10-
<package id="Microsoft.Azure.Management.Network" version="3.2.0-preview" targetFramework="net45" />
10+
<package id="Microsoft.Azure.Management.Network" version="3.3.0-preview" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Management.Storage" version="3.0.0" targetFramework="net45" />
1212
<package id="Microsoft.Azure.Test.Framework" version="1.0.5896.19355-prerelease" targetFramework="net45" />
1313
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.6.0-preview" targetFramework="net45" />

src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
<Private>True</Private>
8282
</Reference>
8383
<Reference Include="Microsoft.Azure.Management.Network, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
84-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.3.2.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
84+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.3.3.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
8585
<Private>True</Private>
8686
</Reference>
8787
<Reference Include="Microsoft.Azure.Management.Storage">

src/ResourceManager/Compute/Commands.Compute/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
1212
<package id="Microsoft.Azure.Management.Compute" version="11.3.0-prerelease" targetFramework="net45" />
13-
<package id="Microsoft.Azure.Management.Network" version="3.2.0-preview" targetFramework="net45" />
13+
<package id="Microsoft.Azure.Management.Network" version="3.3.0-preview" targetFramework="net45" />
1414
<package id="Microsoft.Azure.Management.Storage" version="3.0.0" targetFramework="net45" />
1515
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
1616
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />

src/ResourceManager/Network/Commands.Network.Test/Commands.Network.Test.csproj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6565
</Reference>
6666
<Reference Include="Microsoft.Azure.Management.Network, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
67-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.3.2.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
67+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.3.3.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
6868
<Private>True</Private>
6969
</Reference>
7070
<Reference Include="Microsoft.Azure.ResourceManager">
@@ -227,7 +227,7 @@
227227
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.ExpressRouteCircuitTests\TestExpressRouteCircuitCRUD.json">
228228
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
229229
</None>
230-
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.ExpressRouteCircuitTests\TestExpressRouteCircuitMicrosoftPeeringCRUD.json" >
230+
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.ExpressRouteCircuitTests\TestExpressRouteCircuitMicrosoftPeeringCRUD.json">
231231
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
232232
</None>
233233
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.ExpressRouteCircuitTests\TestExpressRouteCircuitPrivatePublicPeeringCRUD.json">
@@ -320,6 +320,9 @@
320320
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayConnectionTests\TestVirtualNetworkeExpressRouteGatewayConnectionCRUD.json">
321321
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
322322
</None>
323+
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayConnectionTests\TestVirtualNetworkGatewayConnectionWithBgpCRUD.json">
324+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
325+
</None>
323326
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayTests\TestVirtualNetworkExpressRouteGatewayCRUD.json">
324327
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
325328
</None>

src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/VirtualNetworkGatewayConnectionTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,12 @@ public void TestVirtualNetworkeExpressRouteGatewayConnectionCRUD()
3939
{
4040
NetworkResourcesController.NewInstance.RunPsTest("Test-VirtualNetworkeExpressRouteGatewayConnectionCRUD");
4141
}
42+
43+
[Fact]
44+
[Trait(Category.AcceptanceType, Category.CheckIn)]
45+
public void TestVirtualNetworkGatewayConnectionWithBgpCRUD()
46+
{
47+
NetworkResourcesController.NewInstance.RunPsTest("Test-VirtualNetworkGatewayConnectionWithBgpCRUD");
48+
}
4249
}
4350
}

src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/VirtualNetworkGatewayConnectionTests.ps1

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,67 @@ function Test-VirtualNetworkeExpressRouteGatewayConnectionCRUD
6262
.SYNOPSIS
6363
Virtual network gateway connection tests
6464
#>
65+
function Test-VirtualNetworkGatewayConnectionWithBgpCRUD
66+
{
67+
# Setup
68+
$rgname = Get-ResourceGroupName
69+
$rname = Get-ResourceName
70+
$domainNameLabel = Get-ResourceName
71+
$vnetName = Get-ResourceName
72+
$localnetName = Get-ResourceName
73+
$vnetConnectionName = Get-ResourceName
74+
$publicIpName = Get-ResourceName
75+
$vnetGatewayConfigName = Get-ResourceName
76+
$rglocation = Get-ProviderLocation ResourceManagement
77+
$resourceTypeParent = "Microsoft.Network/connections"
78+
$location = Get-ProviderLocation $resourceTypeParent
79+
80+
try
81+
{
82+
# Create the resource group
83+
$resourceGroup = New-AzureRmResourceGroup -Name $rgname -Location $rglocation -Tags @{Name = "testtag"; Value = "testval"}
84+
85+
# Create the Virtual Network
86+
$subnet = New-AzureRmVirtualNetworkSubnetConfig -Name "GatewaySubnet" -AddressPrefix 10.0.0.0/24
87+
$vnet = New-AzureRmvirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $location -AddressPrefix 10.0.0.0/16 -Subnet $subnet
88+
$vnet = Get-AzureRmvirtualNetwork -Name $vnetName -ResourceGroupName $rgname
89+
$subnet = Get-AzureRmVirtualNetworkSubnetConfig -Name "GatewaySubnet" -VirtualNetwork $vnet
90+
91+
# Create the publicip
92+
$publicip = New-AzureRmPublicIpAddress -ResourceGroupName $rgname -name $publicIpName -location $location -AllocationMethod Dynamic -DomainNameLabel $domainNameLabel
93+
94+
# Create VirtualNetworkGateway
95+
$vnetIpConfig = New-AzureRmVirtualNetworkGatewayIpConfig -Name $vnetGatewayConfigName -PublicIpAddress $publicip -Subnet $subnet
96+
97+
# Also test overriding the gateway ASN
98+
$actual = New-AzureRmVirtualNetworkGateway -ResourceGroupName $rgname -name $rname -location $location -IpConfigurations $vnetIpConfig -GatewayType Vpn -VpnType RouteBased -GatewaySku Standard -Asn 55000
99+
$vnetGateway = Get-AzureRmVirtualNetworkGateway -ResourceGroupName $rgname -name $rname
100+
Assert-AreEqual $vnetGateway.BgpSettings.Asn $actual.BgpSettings.Asn
101+
102+
# Create LocalNetworkGateway
103+
$actual = New-AzureRmLocalNetworkGateway -ResourceGroupName $rgname -name $localnetName -location $location -AddressPrefix 192.168.0.0/16 -GatewayIpAddress 192.168.3.10 -Asn 1337 -BgpPeeringAddress "192.168.1.1" -PeerWeight 5
104+
$localnetGateway = Get-AzureRmLocalNetworkGateway -ResourceGroupName $rgname -name $localnetName
105+
Assert-AreEqual $localnetGateway.BgpSettings.Asn $actual.BgpSettings.Asn
106+
Assert-AreEqual $localnetGateway.BgpSettings.BgpPeeringAddress $actual.BgpSettings.BgpPeeringAddress
107+
Assert-AreEqual $localnetGateway.BgpSettings.PeerWeight $actual.BgpSettings.PeerWeight
108+
109+
# Create & Get VirtualNetworkGatewayConnection
110+
$actual = New-AzureRmVirtualNetworkGatewayConnection -ResourceGroupName $rgname -name $vnetConnectionName -location $location -VirtualNetworkGateway1 $vnetGateway -LocalNetworkGateway2 $localnetGateway -ConnectionType IPsec -RoutingWeight 3 -SharedKey abc -EnableBgp true
111+
$connection = Get-AzureRmVirtualNetworkGatewayConnection -ResourceGroupName $rgname -name $vnetConnectionName
112+
Assert-AreEqual $connection.EnableBgp $actual.EnableBgp
113+
114+
# Delete VirtualNetworkGatewayConnection
115+
$delete = Remove-AzureRmVirtualNetworkGatewayConnection -ResourceGroupName $actual.ResourceGroupName -name $vnetConnectionName -PassThru -Force
116+
Assert-AreEqual true $delete
117+
118+
}
119+
finally
120+
{
121+
# Cleanup
122+
Clean-ResourceGroup $rgname
123+
}
124+
}
125+
65126
function Test-VirtualNetworkGatewayConnectionCRUD
66127
{
67128
# Setup

0 commit comments

Comments
 (0)