Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ public BgpConnection()
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "properties.connectionState")]
public string ConnectionState {get; private set; }

/// <summary>
/// Gets or sets the routing configuration indicating the associated and
/// propagated route tables for this connection.
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "properties.routingConfiguration")]
public RoutingConfiguration RoutingConfiguration {get; set; }
/// <summary>
/// Validate the object.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ public BgpConnectionProperties()
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "connectionState")]
public string ConnectionState {get; private set; }

/// <summary>
/// Gets or sets the routing configuration indicating the associated and
/// propagated route tables for this connection.
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "routingConfiguration")]
public RoutingConfiguration RoutingConfiguration {get; set; }
/// <summary>
/// Validate the object.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,13 @@ public VirtualNetworkGatewayConnection()
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "properties.authenticationType")]
public string AuthenticationType {get; set; }

/// <summary>
/// Gets or sets the routing configuration indicating the associated and
/// propagated route tables for this connection.
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "properties.routingConfiguration")]
public RoutingConfiguration RoutingConfiguration {get; set; }
/// <summary>
/// Validate the object.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,13 @@ public VirtualNetworkGatewayConnectionListEntity()
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "properties.enablePrivateLinkFastPath")]
public bool? EnablePrivateLinkFastPath {get; set; }

/// <summary>
/// Gets or sets the routing configuration indicating the associated and
/// propagated route tables for this connection.
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "properties.routingConfiguration")]
public RoutingConfiguration RoutingConfiguration {get; set; }
/// <summary>
/// Validate the object.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,13 @@ public VirtualNetworkGatewayConnectionListEntityPropertiesFormat()
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "enablePrivateLinkFastPath")]
public bool? EnablePrivateLinkFastPath {get; set; }

/// <summary>
/// Gets or sets the routing configuration indicating the associated and
/// propagated route tables for this connection.
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "routingConfiguration")]
public RoutingConfiguration RoutingConfiguration {get; set; }
/// <summary>
/// Validate the object.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@ public VirtualNetworkGatewayConnectionPropertiesFormat()
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "certificateAuthentication")]
public CertificateAuthentication CertificateAuthentication {get; set; }

/// <summary>
/// Gets or sets the routing configuration indicating the associated and
/// propagated route tables for this connection.
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "routingConfiguration")]
public RoutingConfiguration RoutingConfiguration {get; set; }
/// <summary>
/// Validate the object.
/// </summary>
Expand Down
8 changes: 8 additions & 0 deletions src/Network/Network.Test/ScenarioTests/RouteServerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,13 @@ public void TestRouteServerPeerRoutes()
{
TestRunner.RunTestScript(string.Format("Test-RouteServerPeerRoutes"));
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.Owner, NrpTeamAlias.virtualwan)]
public void TestRouteServerPeerWithRoutingConfiguration()
{
TestRunner.RunTestScript(string.Format("Test-RouteServerPeerWithRoutingConfiguration"));
}
}
}
92 changes: 92 additions & 0 deletions src/Network/Network.Test/ScenarioTests/RouteServerTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,96 @@ function Test-RouteServerPeerRoutes
# Cleanup
Clean-ResourceGroup $rgname
}
}

<#
.SYNOPSIS
Test route server peer with routing configuration and hub virtual network connection
#>
function Test-RouteServerPeerWithRoutingConfiguration
{
# Setup
$rgname = Get-ResourceGroupName
$vnetName = Get-ResourceName
$rglocation = Get-ProviderLocation ResourceManagement "centraluseuap"
$routeServerName = Get-ResourceName
$subnetName = "RouteServerSubnet"
$peerName = Get-ResourceName
$publicIpAddressName = Get-ResourceName
$routeMapName = Get-ResourceName

try
{
# Create resource group
$resourceGroup = New-AzResourceGroup -Name $rgname -Location $rglocation -Tags @{ testtag = "testval" }

# Create virtual network with RouteServerSubnet
$subnet = New-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.0.0/24
$vnet = New-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $rglocation -AddressPrefix 10.0.0.0/16 -Subnet $subnet
$vnet = Get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname
$hostedSubnet = Get-AzVirtualNetworkSubnetConfig -Name $subnetName -VirtualNetwork $vnet

# Create the public ip address for route server
$publicIp = New-AzPublicIpAddress -Name $publicIpAddressName -ResourceGroupName $rgname -AllocationMethod Static -Location $rglocation -Sku Standard -Tier Regional
$publicIp = Get-AzPublicIpAddress -Name $publicIpAddressName -ResourceGroupName $rgname

# Create route server
$routeServer = New-AzRouteServer -ResourceGroupName $rgname -Location $rglocation -RouteServerName $routeServerName -HostedSubnet $hostedSubnet.Id -PublicIpAddress $publicIp
$routeServer = Get-AzRouteServer -ResourceGroupName $rgname -RouteServerName $routeServerName
Assert-AreEqual $routeServerName $routeServer.Name

# Get the route server hub and wait for provisioning
$virtualHubName = $routeServerName
$virtualHub = Get-AzVirtualHub -ResourceGroupName $rgname -Name $virtualHubName
$routingStatePollIntervalSeconds = 180
$maxRoutingStatePollAttempts = 10
$routingStatePollAttempt = 0
while ($virtualHub.RoutingState -eq "Provisioning" -and $routingStatePollAttempt -lt $maxRoutingStatePollAttempts)
{
Start-TestSleep -Seconds $routingStatePollIntervalSeconds
$virtualHub = Get-AzVirtualHub -ResourceGroupName $rgname -Name $virtualHubName
$routingStatePollAttempt++
}
Assert-AreEqual "Provisioned" $virtualHub.RoutingState

# Create a route map on the route server hub
$routeMapMatchCriterion1 = New-AzRouteMapRuleCriterion -MatchCondition "Contains" -RoutePrefix @("10.0.0.0/16")
$routeMapActionParameter1 = New-AzRouteMapRuleActionParameter -AsPath @("12345")
$routeMapAction1 = New-AzRouteMapRuleAction -Type "Add" -Parameter @($routeMapActionParameter1)
$routeMapRule1 = New-AzRouteMapRule -Name "rule1" -MatchCriteria @($routeMapMatchCriterion1) -RouteMapRuleAction @($routeMapAction1) -NextStepIfMatched "Continue"

New-AzRouteMap -ResourceGroupName $rgname -VirtualHubName $virtualHubName -Name $routeMapName -RouteMapRule @($routeMapRule1)
$routeMap = Get-AzRouteMap -ResourceGroupName $rgname -VirtualHubName $virtualHubName -Name $routeMapName
Assert-AreEqual $routeMapName $routeMap.Name
Assert-AreEqual 1 $routeMap.Rules.Count

# Create routing configuration with inbound and outbound route maps
$routingConfig = New-AzRoutingConfiguration -InboundRouteMap $routeMap.Id -OutboundRouteMap $routeMap.Id

# Create route server peer with routing configuration
$result = Add-AzRouteServerPeer -ResourceGroupName $rgname -RouteServerName $routeServerName -PeerName $peerName -PeerIp "10.0.0.5" -PeerAsn "65010" -RoutingConfiguration $routingConfig
$peer = Get-AzRouteServerPeer -ResourceGroupName $rgname -RouteServerName $routeServerName -PeerName $peerName
Assert-AreEqual $peerName $peer.PeerName
Assert-AreEqual "10.0.0.5" $peer.PeerIp
Assert-AreEqual "65010" $peer.PeerAsn
Assert-NotNull $peer.RoutingConfiguration
Assert-AreEqual $peer.RoutingConfiguration.InboundRouteMap.Id $routeMap.Id
Assert-AreEqual $peer.RoutingConfiguration.OutboundRouteMap.Id $routeMap.Id

# Delete route server peer
$deleteResult = Remove-AzRouteServerPeer -ResourceGroupName $rgname -RouteServerName $routeServerName -PeerName $peerName -Force
Assert-AreEqual 0 @($deleteResult.Peerings).Count

# Delete route map
Remove-AzRouteMap -ResourceGroupName $rgname -VirtualHubName $virtualHubName -Name $routeMapName -Force

# Delete route server
$deleteRouteServer = Remove-AzRouteServer -ResourceGroupName $rgname -RouteServerName $routeServerName -PassThru -Force
Assert-AreEqual true $deleteRouteServer
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,13 @@ public void TestVirtualNetworkGatewayConnectionWithCertificateAuth()
{
TestRunner.RunTestScript("Test-VirtualNetworkGatewayConnectionWithCertificateAuth");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.Owner, NrpTeamAlias.brooklynft_subset4)]
public void TestVirtualNetworkGatewayConnectionWithRoutingConfiguration()
{
TestRunner.RunTestScript("Test-VirtualNetworkGatewayConnectionWithRoutingConfiguration");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1093,4 +1093,128 @@ function Test-VirtualNetworkGatewayConnectionWithCertificateAuth
# Cleanup
Clean-ResourceGroup $rgname
}
}

<#
.SYNOPSIS
VirtualNetworkGatewayConnectionWithRoutingConfiguration
#>
function Test-VirtualNetworkGatewayConnectionWithRoutingConfiguration
{
# Setup
$rgname = Get-ResourceGroupName
$rname = Get-ResourceName
$domainNameLabel = Get-ResourceName
$vnetName = Get-ResourceName
$localnetName = Get-ResourceName
$vnetConnectionName = Get-ResourceName
$publicIpName = Get-ResourceName
$vnetGatewayConfigName = Get-ResourceName
$rglocation = Get-ProviderLocation ResourceManagement "centraluseuap"
$resourceTypeParent = "Microsoft.Network/connections"
$location = Get-ProviderLocation $resourceTypeParent "centraluseuap"
$routeServerName = Get-ResourceName
$routeServerPublicIpName = Get-ResourceName
$routeMapName = Get-ResourceName

try
{
# Create the resource group
$resourceGroup = New-AzResourceGroup -Name $rgname -Location $rglocation -Tags @{ testtag = "testval" }

# Create VNet with both RouteServerSubnet and GatewaySubnet
$rsSubnet = New-AzVirtualNetworkSubnetConfig -Name "RouteServerSubnet" -AddressPrefix 10.0.1.0/24
$gwSubnet = New-AzVirtualNetworkSubnetConfig -Name "GatewaySubnet" -AddressPrefix 10.0.0.0/24
$vnet = New-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $rglocation -AddressPrefix 10.0.0.0/16 -Subnet $rsSubnet,$gwSubnet
$vnet = Get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname
$hostedSubnet = Get-AzVirtualNetworkSubnetConfig -Name "RouteServerSubnet" -VirtualNetwork $vnet
$subnet = Get-AzVirtualNetworkSubnetConfig -Name "GatewaySubnet" -VirtualNetwork $vnet

# Create the public ip address for route server
$rsPublicIp = New-AzPublicIpAddress -Name $routeServerPublicIpName -ResourceGroupName $rgname -AllocationMethod Static -Location $rglocation -Sku Standard -Tier Regional
$rsPublicIp = Get-AzPublicIpAddress -Name $routeServerPublicIpName -ResourceGroupName $rgname

# Create route server (this creates a VirtualHub resource internally)
$routeServer = New-AzRouteServer -ResourceGroupName $rgname -Location $rglocation -RouteServerName $routeServerName -HostedSubnet $hostedSubnet.Id -PublicIpAddress $rsPublicIp
$routeServer = Get-AzRouteServer -ResourceGroupName $rgname -RouteServerName $routeServerName
Assert-AreEqual $routeServerName $routeServer.Name

# Get the route server hub using Get-AzVirtualHub
$virtualHubName = $routeServerName
$virtualHub = Get-AzVirtualHub -ResourceGroupName $rgname -Name $virtualHubName
Assert-NotNull $virtualHub

# Wait for Virtual Hub Routing State to become Provisioned
$routingStatePollIntervalSeconds = 180
$maxRoutingStatePollAttempts = 10
$routingStatePollAttempt = 0
while ($virtualHub.RoutingState -eq "Provisioning" -and $routingStatePollAttempt -lt $maxRoutingStatePollAttempts)
{
Start-TestSleep -Seconds $routingStatePollIntervalSeconds
$virtualHub = Get-AzVirtualHub -ResourceGroupName $rgname -Name $virtualHubName
$routingStatePollAttempt++
}
Assert-AreEqual "Provisioned" $virtualHub.RoutingState

# Create a route map on the route server hub
$routeMapMatchCriterion1 = New-AzRouteMapRuleCriterion -MatchCondition "Contains" -RoutePrefix @("10.0.0.0/16")
$routeMapActionParameter1 = New-AzRouteMapRuleActionParameter -AsPath @("12345")
$routeMapAction1 = New-AzRouteMapRuleAction -Type "Add" -Parameter @($routeMapActionParameter1)
$routeMapRule1 = New-AzRouteMapRule -Name "rule1" -MatchCriteria @($routeMapMatchCriterion1) -RouteMapRuleAction @($routeMapAction1) -NextStepIfMatched "Continue"

New-AzRouteMap -ResourceGroupName $rgname -VirtualHubName $virtualHubName -Name $routeMapName -RouteMapRule @($routeMapRule1)
$routeMap = Get-AzRouteMap -ResourceGroupName $rgname -VirtualHubName $virtualHubName -Name $routeMapName
Assert-AreEqual $routeMapName $routeMap.Name
Assert-AreEqual 1 $routeMap.Rules.Count

# Create routing configuration with inbound and outbound route maps
$routingConfig = New-AzRoutingConfiguration -InboundRouteMap $routeMap.Id -OutboundRouteMap $routeMap.Id

# Create the publicip for VPN Gateway
$publicip = New-AzPublicIpAddress -ResourceGroupName $rgname -name $publicIpName -location $rglocation -AllocationMethod Dynamic -DomainNameLabel $domainNameLabel

# Create VirtualNetworkGateway using GatewaySubnet from same VNet
$vnetIpConfig = New-AzVirtualNetworkGatewayIpConfig -Name $vnetGatewayConfigName -PublicIpAddress $publicip -Subnet $subnet
$actual = New-AzVirtualNetworkGateway -ResourceGroupName $rgname -name $rname -location $rglocation -IpConfigurations $vnetIpConfig -GatewayType Vpn -VpnType RouteBased -EnableBgp $false -GatewaySku VpnGw2
$vnetGateway = Get-AzVirtualNetworkGateway -ResourceGroupName $rgname -name $rname

# Create LocalNetworkGateway
$actual = New-AzLocalNetworkGateway -ResourceGroupName $rgname -name $localnetName -location $rglocation -AddressPrefix 192.168.0.0/16 -GatewayIpAddress 192.168.3.10
$localnetGateway = Get-AzLocalNetworkGateway -ResourceGroupName $rgname -name $localnetName

# Create VirtualNetworkGatewayConnection with RoutingConfiguration
$actual = New-AzVirtualNetworkGatewayConnection -ResourceGroupName $rgname -name $vnetConnectionName -location $rglocation -VirtualNetworkGateway1 $vnetGateway -LocalNetworkGateway2 $localnetGateway -ConnectionType IPsec -RoutingWeight 3 -SharedKey abc -RoutingConfiguration $routingConfig
$expected = Get-AzVirtualNetworkGatewayConnection -ResourceGroupName $rgname -name $vnetConnectionName
Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
Assert-AreEqual $expected.Name $actual.Name
Assert-AreEqual "IPsec" $expected.ConnectionType
Assert-NotNull $expected.RoutingConfiguration
Assert-AreEqual $expected.RoutingConfiguration.InboundRouteMap.Id $routeMap.Id
Assert-AreEqual $expected.RoutingConfiguration.OutboundRouteMap.Id $routeMap.Id

# Update VirtualNetworkGatewayConnection RoutingConfiguration
$routingConfig2 = New-AzRoutingConfiguration -InboundRouteMap $routeMap.Id -OutboundRouteMap $routeMap.Id
$expected.Location = $rglocation
$expected.VirtualNetworkGateway1.Location = $rglocation
$expected.LocalNetworkGateway2.Location = $rglocation
$actual = Set-AzVirtualNetworkGatewayConnection -VirtualNetworkGatewayConnection $expected -RoutingConfiguration $routingConfig2 -Force
$expected = Get-AzVirtualNetworkGatewayConnection -ResourceGroupName $rgname -name $vnetConnectionName
Assert-NotNull $expected.RoutingConfiguration
Assert-AreEqual $expected.RoutingConfiguration.InboundRouteMap.Id $routeMap.Id
Assert-AreEqual $expected.RoutingConfiguration.OutboundRouteMap.Id $routeMap.Id

# Delete VirtualNetworkGatewayConnection
Remove-AzVirtualNetworkGatewayConnection -ResourceGroupName $rgname -name $vnetConnectionName -Force

# Delete Route Map
Remove-AzRouteMap -ResourceGroupName $rgname -VirtualHubName $virtualHubName -Name $routeMapName -Force

# Delete Route Server
Remove-AzRouteServer -ResourceGroupName $rgname -RouteServerName $routeServerName -Force
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}
5 changes: 5 additions & 0 deletions src/Network/Network/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
--->

## Upcoming Release
* Added `RoutingConfiguration`, `VirtualHubVnetConnection`, and `VirtualHubVnetConnectionId` parameters to `Add-AzRouteServerPeer` and `Update-AzRouteServerPeer`
- Allows configuring inbound/outbound route maps for Route Server BGP peer connections
- Allows specifying a hub virtual network connection for the peer (by object or resource id)
* Added `RoutingConfiguration` parameter to `New-AzVirtualNetworkGatewayConnection` and `Set-AzVirtualNetworkGatewayConnection`
- Allows configuring routing configuration (inbound/outbound route maps) for Virtual Network Gateway connections
* Removed validations to allow newly added AuxiliarySkus in New-AzNetworkInterface command without needing to add them in ValidateSet.
* Added new cmdlets for DDoS Custom Policy management
- `New-AzDdosCustomPolicy`: Create a new DDoS custom policy with detection rules
Expand Down
9 changes: 9 additions & 0 deletions src/Network/Network/Generated/Models/PSBgpConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace Microsoft.Azure.Commands.Network.Models
{

using Microsoft.WindowsAzure.Commands.Common.Attributes;
using Newtonsoft.Json;

public partial class PSBgpConnection : PSChildResource
{
Expand All @@ -31,5 +32,13 @@ public partial class PSBgpConnection : PSChildResource

[Ps1Xml(Target = ViewControl.Table)]
public string ProvisioningState { get; set; }

public PSRoutingConfiguration RoutingConfiguration { get; set; }

[JsonIgnore]
public string RoutingConfigurationText
{
get { return RoutingConfiguration == null ? string.Empty : JsonConvert.SerializeObject(RoutingConfiguration, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
}
}
}
Loading
Loading