Skip to content

Commit 5ef1209

Browse files
committed
Add RoutingConfiguration support for RouteServerPeer and VirtualNetworkGatewayConnection
- Added RoutingConfiguration, VirtualHubVnetConnection, and VirtualHubVnetConnectionId parameters to Add-AzRouteServerPeer and Update-AzRouteServerPeer - Added RoutingConfiguration parameter to New-AzVirtualNetworkGatewayConnection and Set-AzVirtualNetworkGatewayConnection - Updated PSBgpConnection, PSRouteServerPeer, PSRouteServer, PSVirtualNetworkGatewayConnection models - Added scenario tests for RouteServerPeer and VirtualNetworkGatewayConnection with RoutingConfiguration - Updated help documentation for all affected cmdlets
1 parent 38a6cf3 commit 5ef1209

17 files changed

Lines changed: 482 additions & 8 deletions

src/Network/Network.Test/ScenarioTests/RouteServerTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,13 @@ public void TestRouteServerPeerRoutes()
3434
{
3535
TestRunner.RunTestScript(string.Format("Test-RouteServerPeerRoutes"));
3636
}
37+
38+
[Fact]
39+
[Trait(Category.AcceptanceType, Category.CheckIn)]
40+
[Trait(Category.Owner, NrpTeamAlias.virtualwan)]
41+
public void TestRouteServerPeerWithRoutingConfiguration()
42+
{
43+
TestRunner.RunTestScript(string.Format("Test-RouteServerPeerWithRoutingConfiguration"));
44+
}
3745
}
3846
}

src/Network/Network.Test/ScenarioTests/RouteServerTests.ps1

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,92 @@ function Test-RouteServerPeerRoutes
205205
# Cleanup
206206
Clean-ResourceGroup $rgname
207207
}
208+
}
209+
210+
<#
211+
.SYNOPSIS
212+
Test route server peer with routing configuration and hub virtual network connection
213+
#>
214+
function Test-RouteServerPeerWithRoutingConfiguration
215+
{
216+
# Setup
217+
$rgname = Get-ResourceGroupName
218+
$vnetName = Get-ResourceName
219+
$rglocation = Get-ProviderLocation ResourceManagement "centraluseuap"
220+
$routeServerName = Get-ResourceName
221+
$subnetName = "RouteServerSubnet"
222+
$peerName = Get-ResourceName
223+
$publicIpAddressName = Get-ResourceName
224+
$routeMapName = Get-ResourceName
225+
226+
try
227+
{
228+
# Create resource group
229+
$resourceGroup = New-AzResourceGroup -Name $rgname -Location $rglocation -Tags @{ testtag = "testval" }
230+
231+
# Create virtual network with RouteServerSubnet
232+
$subnet = New-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.0.0/24
233+
$vnet = New-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $rglocation -AddressPrefix 10.0.0.0/16 -Subnet $subnet
234+
$vnet = Get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname
235+
$hostedSubnet = Get-AzVirtualNetworkSubnetConfig -Name $subnetName -VirtualNetwork $vnet
236+
237+
# Create the public ip address for route server
238+
$publicIp = New-AzPublicIpAddress -Name $publicIpAddressName -ResourceGroupName $rgname -AllocationMethod Static -Location $rglocation -Sku Standard -Tier Regional
239+
$publicIp = Get-AzPublicIpAddress -Name $publicIpAddressName -ResourceGroupName $rgname
240+
241+
# Create route server
242+
$routeServer = New-AzRouteServer -ResourceGroupName $rgname -Location $rglocation -RouteServerName $routeServerName -HostedSubnet $hostedSubnet.Id -PublicIpAddress $publicIp
243+
$routeServer = Get-AzRouteServer -ResourceGroupName $rgname -RouteServerName $routeServerName
244+
Assert-AreEqual $routeServerName $routeServer.Name
245+
246+
# Get the route server hub and wait for provisioning
247+
$virtualHubName = $routeServerName
248+
$virtualHub = Get-AzVirtualHub -ResourceGroupName $rgname -Name $virtualHubName
249+
while ($virtualHub.RoutingState -eq "Provisioning")
250+
{
251+
Start-TestSleep -Seconds 180
252+
$virtualHub = Get-AzVirtualHub -ResourceGroupName $rgname -Name $virtualHubName
253+
}
254+
Assert-AreEqual $virtualHub.RoutingState "Provisioned"
255+
256+
# Create a route map on the route server hub
257+
$routeMapMatchCriterion1 = New-AzRouteMapRuleCriterion -MatchCondition "Contains" -RoutePrefix @("10.0.0.0/16")
258+
$routeMapActionParameter1 = New-AzRouteMapRuleActionParameter -AsPath @("12345")
259+
$routeMapAction1 = New-AzRouteMapRuleAction -Type "Add" -Parameter @($routeMapActionParameter1)
260+
$routeMapRule1 = New-AzRouteMapRule -Name "rule1" -MatchCriteria @($routeMapMatchCriterion1) -RouteMapRuleAction @($routeMapAction1) -NextStepIfMatched "Continue"
261+
262+
New-AzRouteMap -ResourceGroupName $rgname -VirtualHubName $virtualHubName -Name $routeMapName -RouteMapRule @($routeMapRule1)
263+
$routeMap = Get-AzRouteMap -ResourceGroupName $rgname -VirtualHubName $virtualHubName -Name $routeMapName
264+
Assert-AreEqual $routeMapName $routeMap.Name
265+
Assert-AreEqual 1 $routeMap.Rules.Count
266+
267+
# Create routing configuration with inbound and outbound route maps
268+
$routingConfig = New-AzRoutingConfiguration -InboundRouteMap $routeMap.Id -OutboundRouteMap $routeMap.Id
269+
270+
# Create route server peer with routing configuration
271+
$result = Add-AzRouteServerPeer -ResourceGroupName $rgname -RouteServerName $routeServerName -PeerName $peerName -PeerIp "10.0.0.5" -PeerAsn "65010" -RoutingConfiguration $routingConfig
272+
$peer = Get-AzRouteServerPeer -ResourceGroupName $rgname -RouteServerName $routeServerName -PeerName $peerName
273+
Assert-AreEqual $peerName $peer.PeerName
274+
Assert-AreEqual "10.0.0.5" $peer.PeerIp
275+
Assert-AreEqual "65010" $peer.PeerAsn
276+
Assert-NotNull $peer.RoutingConfiguration
277+
Assert-AreEqual $peer.RoutingConfiguration.InboundRouteMap.Id $routeMap.Id
278+
Assert-AreEqual $peer.RoutingConfiguration.OutboundRouteMap.Id $routeMap.Id
279+
280+
# Delete route server peer
281+
$deleteResult = Remove-AzRouteServerPeer -ResourceGroupName $rgname -RouteServerName $routeServerName -PeerName $peerName -Force
282+
Assert-AreEqual 0 @($deleteResult.Peerings).Count
283+
284+
# Delete route map
285+
Remove-AzRouteMap -ResourceGroupName $rgname -VirtualHubName $virtualHubName -Name $routeMapName -Force
286+
287+
# Delete route server
288+
$deleteRouteServer = Remove-AzRouteServer -ResourceGroupName $rgname -RouteServerName $routeServerName -PassThru -Force
289+
Assert-AreEqual true $deleteRouteServer
290+
}
291+
finally
292+
{
293+
# Cleanup
294+
Clean-ResourceGroup $rgname
295+
}
208296
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,13 @@ public void TestVirtualNetworkGatewayConnectionWithCertificateAuth()
121121
{
122122
TestRunner.RunTestScript("Test-VirtualNetworkGatewayConnectionWithCertificateAuth");
123123
}
124+
125+
[Fact]
126+
[Trait(Category.AcceptanceType, Category.CheckIn)]
127+
[Trait(Category.Owner, NrpTeamAlias.brooklynft_subset4)]
128+
public void TestVirtualNetworkGatewayConnectionWithRoutingConfiguration()
129+
{
130+
TestRunner.RunTestScript("Test-VirtualNetworkGatewayConnectionWithRoutingConfiguration");
131+
}
124132
}
125133
}

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

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,4 +1093,124 @@ function Test-VirtualNetworkGatewayConnectionWithCertificateAuth
10931093
# Cleanup
10941094
Clean-ResourceGroup $rgname
10951095
}
1096+
}
1097+
1098+
<#
1099+
.SYNOPSIS
1100+
VirtualNetworkGatewayConnectionWithRoutingConfiguration
1101+
#>
1102+
function Test-VirtualNetworkGatewayConnectionWithRoutingConfiguration
1103+
{
1104+
# Setup
1105+
$rgname = Get-ResourceGroupName
1106+
$rname = Get-ResourceName
1107+
$domainNameLabel = Get-ResourceName
1108+
$vnetName = Get-ResourceName
1109+
$localnetName = Get-ResourceName
1110+
$vnetConnectionName = Get-ResourceName
1111+
$publicIpName = Get-ResourceName
1112+
$vnetGatewayConfigName = Get-ResourceName
1113+
$rglocation = Get-ProviderLocation ResourceManagement "centraluseuap"
1114+
$resourceTypeParent = "Microsoft.Network/connections"
1115+
$location = Get-ProviderLocation $resourceTypeParent "centraluseuap"
1116+
$routeServerName = Get-ResourceName
1117+
$routeServerPublicIpName = Get-ResourceName
1118+
$routeMapName = Get-ResourceName
1119+
1120+
try
1121+
{
1122+
# Create the resource group
1123+
$resourceGroup = New-AzResourceGroup -Name $rgname -Location $rglocation -Tags @{ testtag = "testval" }
1124+
1125+
# Create VNet with both RouteServerSubnet and GatewaySubnet
1126+
$rsSubnet = New-AzVirtualNetworkSubnetConfig -Name "RouteServerSubnet" -AddressPrefix 10.0.1.0/24
1127+
$gwSubnet = New-AzVirtualNetworkSubnetConfig -Name "GatewaySubnet" -AddressPrefix 10.0.0.0/24
1128+
$vnet = New-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $rglocation -AddressPrefix 10.0.0.0/16 -Subnet $rsSubnet,$gwSubnet
1129+
$vnet = Get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname
1130+
$hostedSubnet = Get-AzVirtualNetworkSubnetConfig -Name "RouteServerSubnet" -VirtualNetwork $vnet
1131+
$subnet = Get-AzVirtualNetworkSubnetConfig -Name "GatewaySubnet" -VirtualNetwork $vnet
1132+
1133+
# Create the public ip address for route server
1134+
$rsPublicIp = New-AzPublicIpAddress -Name $routeServerPublicIpName -ResourceGroupName $rgname -AllocationMethod Static -Location $rglocation -Sku Standard -Tier Regional
1135+
$rsPublicIp = Get-AzPublicIpAddress -Name $routeServerPublicIpName -ResourceGroupName $rgname
1136+
1137+
# Create route server (this creates a VirtualHub resource internally)
1138+
$routeServer = New-AzRouteServer -ResourceGroupName $rgname -Location $rglocation -RouteServerName $routeServerName -HostedSubnet $hostedSubnet.Id -PublicIpAddress $rsPublicIp
1139+
$routeServer = Get-AzRouteServer -ResourceGroupName $rgname -RouteServerName $routeServerName
1140+
Assert-AreEqual $routeServerName $routeServer.Name
1141+
1142+
# Get the route server hub using Get-AzVirtualHub
1143+
$virtualHubName = $routeServerName
1144+
$virtualHub = Get-AzVirtualHub -ResourceGroupName $rgname -Name $virtualHubName
1145+
Assert-NotNull $virtualHub
1146+
1147+
# Wait for Virtual Hub Routing State to become Provisioned
1148+
while ($virtualHub.RoutingState -eq "Provisioning")
1149+
{
1150+
Start-TestSleep -Seconds 180
1151+
$virtualHub = Get-AzVirtualHub -ResourceGroupName $rgname -Name $virtualHubName
1152+
}
1153+
Assert-AreEqual $virtualHub.RoutingState "Provisioned"
1154+
1155+
# Create a route map on the route server hub
1156+
$routeMapMatchCriterion1 = New-AzRouteMapRuleCriterion -MatchCondition "Contains" -RoutePrefix @("10.0.0.0/16")
1157+
$routeMapActionParameter1 = New-AzRouteMapRuleActionParameter -AsPath @("12345")
1158+
$routeMapAction1 = New-AzRouteMapRuleAction -Type "Add" -Parameter @($routeMapActionParameter1)
1159+
$routeMapRule1 = New-AzRouteMapRule -Name "rule1" -MatchCriteria @($routeMapMatchCriterion1) -RouteMapRuleAction @($routeMapAction1) -NextStepIfMatched "Continue"
1160+
1161+
New-AzRouteMap -ResourceGroupName $rgname -VirtualHubName $virtualHubName -Name $routeMapName -RouteMapRule @($routeMapRule1)
1162+
$routeMap = Get-AzRouteMap -ResourceGroupName $rgname -VirtualHubName $virtualHubName -Name $routeMapName
1163+
Assert-AreEqual $routeMapName $routeMap.Name
1164+
Assert-AreEqual 1 $routeMap.Rules.Count
1165+
1166+
# Create routing configuration with inbound and outbound route maps
1167+
$routingConfig = New-AzRoutingConfiguration -InboundRouteMap $routeMap.Id -OutboundRouteMap $routeMap.Id
1168+
1169+
# Create the publicip for VPN Gateway
1170+
$publicip = New-AzPublicIpAddress -ResourceGroupName $rgname -name $publicIpName -location $rglocation -AllocationMethod Dynamic -DomainNameLabel $domainNameLabel
1171+
1172+
# Create VirtualNetworkGateway using GatewaySubnet from same VNet
1173+
$vnetIpConfig = New-AzVirtualNetworkGatewayIpConfig -Name $vnetGatewayConfigName -PublicIpAddress $publicip -Subnet $subnet
1174+
$actual = New-AzVirtualNetworkGateway -ResourceGroupName $rgname -name $rname -location $rglocation -IpConfigurations $vnetIpConfig -GatewayType Vpn -VpnType RouteBased -EnableBgp $false -GatewaySku VpnGw2
1175+
$vnetGateway = Get-AzVirtualNetworkGateway -ResourceGroupName $rgname -name $rname
1176+
1177+
# Create LocalNetworkGateway
1178+
$actual = New-AzLocalNetworkGateway -ResourceGroupName $rgname -name $localnetName -location $rglocation -AddressPrefix 192.168.0.0/16 -GatewayIpAddress 192.168.3.10
1179+
$localnetGateway = Get-AzLocalNetworkGateway -ResourceGroupName $rgname -name $localnetName
1180+
1181+
# Create VirtualNetworkGatewayConnection with RoutingConfiguration
1182+
$actual = New-AzVirtualNetworkGatewayConnection -ResourceGroupName $rgname -name $vnetConnectionName -location $rglocation -VirtualNetworkGateway1 $vnetGateway -LocalNetworkGateway2 $localnetGateway -ConnectionType IPsec -RoutingWeight 3 -SharedKey abc -RoutingConfiguration $routingConfig
1183+
$expected = Get-AzVirtualNetworkGatewayConnection -ResourceGroupName $rgname -name $vnetConnectionName
1184+
Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
1185+
Assert-AreEqual $expected.Name $actual.Name
1186+
Assert-AreEqual "IPsec" $expected.ConnectionType
1187+
Assert-NotNull $expected.RoutingConfiguration
1188+
Assert-AreEqual $expected.RoutingConfiguration.InboundRouteMap.Id $routeMap.Id
1189+
Assert-AreEqual $expected.RoutingConfiguration.OutboundRouteMap.Id $routeMap.Id
1190+
1191+
# Update VirtualNetworkGatewayConnection RoutingConfiguration
1192+
$routingConfig2 = New-AzRoutingConfiguration -InboundRouteMap $routeMap.Id -OutboundRouteMap $routeMap.Id
1193+
$expected.Location = $rglocation
1194+
$expected.VirtualNetworkGateway1.Location = $rglocation
1195+
$expected.LocalNetworkGateway2.Location = $rglocation
1196+
$actual = Set-AzVirtualNetworkGatewayConnection -VirtualNetworkGatewayConnection $expected -RoutingConfiguration $routingConfig2 -Force
1197+
$expected = Get-AzVirtualNetworkGatewayConnection -ResourceGroupName $rgname -name $vnetConnectionName
1198+
Assert-NotNull $expected.RoutingConfiguration
1199+
Assert-AreEqual $expected.RoutingConfiguration.InboundRouteMap.Id $routeMap.Id
1200+
Assert-AreEqual $expected.RoutingConfiguration.OutboundRouteMap.Id $routeMap.Id
1201+
1202+
# Delete VirtualNetworkGatewayConnection
1203+
Remove-AzVirtualNetworkGatewayConnection -ResourceGroupName $rgname -name $vnetConnectionName -Force
1204+
1205+
# Delete Route Map
1206+
Remove-AzRouteMap -ResourceGroupName $rgname -VirtualHubName $virtualHubName -Name $routeMapName -Force
1207+
1208+
# Delete Route Server
1209+
Remove-AzRouteServer -ResourceGroupName $rgname -RouteServerName $routeServerName -Force
1210+
}
1211+
finally
1212+
{
1213+
# Cleanup
1214+
Clean-ResourceGroup $rgname
1215+
}
10961216
}

src/Network/Network/ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
--->
2020

2121
## Upcoming Release
22+
* Added `RoutingConfiguration`, `VirtualHubVnetConnection`, and `VirtualHubVnetConnectionId` parameters to `Add-AzRouteServerPeer` and `Update-AzRouteServerPeer`
23+
- Allows configuring inbound/outbound route maps for Route Server BGP peer connections
24+
- Allows specifying a hub virtual network connection for the peer (by object or resource id)
25+
* Added `RoutingConfiguration` parameter to `New-AzVirtualNetworkGatewayConnection` and `Set-AzVirtualNetworkGatewayConnection`
26+
- Allows configuring routing configuration (inbound/outbound route maps) for Virtual Network Gateway connections
2227
* Added new cmdlets for DDoS Custom Policy management
2328
- `New-AzDdosCustomPolicy`: Create a new DDoS custom policy with detection rules
2429
- `New-AzDdosCustomPolicy` requires at least one detection rule at creation time

src/Network/Network/Generated/Models/PSBgpConnection.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace Microsoft.Azure.Commands.Network.Models
1717
{
1818

1919
using Microsoft.WindowsAzure.Commands.Common.Attributes;
20+
using Newtonsoft.Json;
2021

2122
public partial class PSBgpConnection : PSChildResource
2223
{
@@ -31,5 +32,13 @@ public partial class PSBgpConnection : PSChildResource
3132

3233
[Ps1Xml(Target = ViewControl.Table)]
3334
public string ProvisioningState { get; set; }
35+
36+
public PSRoutingConfiguration RoutingConfiguration { get; set; }
37+
38+
[JsonIgnore]
39+
public string RoutingConfigurationText
40+
{
41+
get { return JsonConvert.SerializeObject(RoutingConfiguration, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
42+
}
3443
}
3544
}

src/Network/Network/Generated/Models/PSRouteServer.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ public PSRouteServer(PSVirtualHub virtualHub)
4747
Name = connection.Name,
4848
PeerIp = connection.PeerIp,
4949
PeerAsn = connection.PeerAsn,
50-
ProvisioningState = connection.ProvisioningState
50+
ProvisioningState = connection.ProvisioningState,
51+
RoutingConfiguration = connection.RoutingConfiguration,
52+
HubVirtualNetworkConnection = connection.HubVirtualNetworkConnection
5153
};
5254
this.Peerings.Add(peering);
5355
}

src/Network/Network/Generated/Models/PSRouteServerPeer.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.WindowsAzure.Commands.Common.Attributes;
2+
using Newtonsoft.Json;
23

34
namespace Microsoft.Azure.Commands.Network.Models
45
{
@@ -8,7 +9,19 @@ public partial class PSRouteServerPeer : PSChildResource
89
public uint PeerAsn { get; set; }
910
[Ps1Xml(Target = ViewControl.Table)]
1011
public string PeerIp { get; set; }
12+
13+
[Ps1Xml(Label = "HubVirtualNetworkConnection id", Target = ViewControl.Table, ScriptBlock = "$_.HubVirtualNetworkConnection.Id")]
14+
public PSResourceId HubVirtualNetworkConnection { get; set; }
15+
1116
[Ps1Xml(Target = ViewControl.Table)]
1217
public string ProvisioningState { get; set; }
18+
19+
public PSRoutingConfiguration RoutingConfiguration { get; set; }
20+
21+
[JsonIgnore]
22+
public string RoutingConfigurationText
23+
{
24+
get { return JsonConvert.SerializeObject(RoutingConfiguration, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
25+
}
1326
}
1427
}

src/Network/Network/Models/PSVirtualNetworkGatewayConnection.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ public class PSVirtualNetworkGatewayConnection : PSTopLevelResource
9494
[Ps1Xml(Label = "GatewayCustomBgpIpAddresses", Target = ViewControl.Table)]
9595
public List<PSGatewayCustomBgpIpConfiguration> GatewayCustomBgpIpAddresses { get; set; }
9696

97+
public PSRoutingConfiguration RoutingConfiguration { get; set; }
98+
99+
[JsonIgnore]
100+
public string RoutingConfigurationText
101+
{
102+
get { return JsonConvert.SerializeObject(RoutingConfiguration, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
103+
}
104+
97105
[JsonIgnore]
98106
public string VirtualNetworkGateway1Text
99107
{

src/Network/Network/RouteServerPeer/AddAzureRMRouteServerPeerCommand.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,24 @@ public partial class AddAzureRmRouteServerPeer : RouteServerBaseCmdlet
7272
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
7373
public SwitchParameter AsJob { get; set; }
7474

75+
[Parameter(
76+
Mandatory = false,
77+
HelpMessage = "The routing configuration for this RouteServerPeer.")]
78+
public PSRoutingConfiguration RoutingConfiguration { get; set; }
79+
80+
[Parameter(
81+
Mandatory = false,
82+
HelpMessage = "The VirtualHubVnetConnection resource.")]
83+
[ValidateNotNull]
84+
public PSHubVirtualNetworkConnection VirtualHubVnetConnection { get; set; }
85+
86+
[Parameter(
87+
Mandatory = false,
88+
ValueFromPipelineByPropertyName = true,
89+
HelpMessage = "The VirtualHubVnetConnection resource id.")]
90+
[ValidateNotNullOrEmpty]
91+
public string VirtualHubVnetConnectionId { get; set; }
92+
7593
public override void Execute()
7694
{
7795
base.Execute();
@@ -114,6 +132,20 @@ public override void Execute()
114132

115133
var bgpConnectionModel = NetworkResourceManagerProfile.Mapper.Map<MNM.BgpConnection>(peer);
116134

135+
if (this.RoutingConfiguration != null)
136+
{
137+
bgpConnectionModel.RoutingConfiguration = NetworkResourceManagerProfile.Mapper.Map<MNM.RoutingConfiguration>(RoutingConfiguration);
138+
}
139+
140+
if (this.VirtualHubVnetConnection != null)
141+
{
142+
bgpConnectionModel.HubVirtualNetworkConnection = new MNM.SubResource(this.VirtualHubVnetConnection.Id);
143+
}
144+
else if (!string.IsNullOrEmpty(this.VirtualHubVnetConnectionId))
145+
{
146+
bgpConnectionModel.HubVirtualNetworkConnection = new MNM.SubResource(this.VirtualHubVnetConnectionId);
147+
}
148+
117149
this.NetworkClient.NetworkManagementClient.VirtualHubBgpConnection.CreateOrUpdate(this.ResourceGroupName, this.RouteServerName, this.PeerName, bgpConnectionModel);
118150
var virtualHub = this.NetworkClient.NetworkManagementClient.VirtualHubs.Get(this.ResourceGroupName, this.RouteServerName);
119151
var virtualHubModel = NetworkResourceManagerProfile.Mapper.Map<PSVirtualHub>(virtualHub);

0 commit comments

Comments
 (0)