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
@@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

namespace Microsoft.Azure.Management.Network.Models
{

/// <summary>
/// Defines values for DisablePeeringRoute.
/// </summary>


public static class DisablePeeringRoute
{
public const string None = "None";
public const string All = "All";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ public RouteTable()
/// means disable.
/// </param>

/// <param name="disablePeeringRoute">Whether to disable the routes learned by peering on the route table.
/// 'None' means peering routes are enabled, 'All' means all peering routes are disabled.
/// Possible values include: 'None', 'All'
/// </param>

/// <param name="resourceGuid">The resource GUID property of the route table.
/// </param>
public RouteTable(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary<string, string> tags = default(System.Collections.Generic.IDictionary<string, string>), string etag = default(string), string provisioningState = default(string), System.Collections.Generic.IList<Route> routes = default(System.Collections.Generic.IList<Route>), System.Collections.Generic.IList<Subnet> subnets = default(System.Collections.Generic.IList<Subnet>), bool? disableBgpRoutePropagation = default(bool?), string resourceGuid = default(string))
public RouteTable(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary<string, string> tags = default(System.Collections.Generic.IDictionary<string, string>), string etag = default(string), string provisioningState = default(string), System.Collections.Generic.IList<Route> routes = default(System.Collections.Generic.IList<Route>), System.Collections.Generic.IList<Subnet> subnets = default(System.Collections.Generic.IList<Subnet>), bool? disableBgpRoutePropagation = default(bool?), string disablePeeringRoute = default(string), string resourceGuid = default(string))

: base(id, name, type, location, tags)
{
Expand All @@ -68,6 +73,7 @@ public RouteTable()
this.Routes = routes;
this.Subnets = subnets;
this.DisableBgpRoutePropagation = disableBgpRoutePropagation;
this.DisablePeeringRoute = disablePeeringRoute;
this.ResourceGuid = resourceGuid;
CustomInit();
}
Expand Down Expand Up @@ -110,6 +116,14 @@ public RouteTable()
[Newtonsoft.Json.JsonProperty(PropertyName = "properties.disableBgpRoutePropagation")]
public bool? DisableBgpRoutePropagation {get; set; }

/// <summary>
/// Gets or sets whether to disable the routes learned by peering on the route
/// table. 'None' means peering routes are enabled, 'All' means all peering
/// routes are disabled. Possible values include: 'None', 'All'
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "properties.disablePeeringRoute")]
public string DisablePeeringRoute {get; set; }

/// <summary>
/// Gets the resource GUID property of the route table.
/// </summary>
Expand Down
8 changes: 8 additions & 0 deletions src/Network/Network.Test/ScenarioTests/RouteTableTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,13 @@ public void TestRouteWithDisableBgpRoutePropagation()
{
TestRunner.RunTestScript("Test-RouteTableWithDisableBgpRoutePropagation");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.Owner, NrpTeamAlias.nsgdev)]
public void TestRouteWithDisablePeeringRoute()
{
TestRunner.RunTestScript("Test-RouteTableWithDisablePeeringRoute");
}
}
}
59 changes: 59 additions & 0 deletions src/Network/Network.Test/ScenarioTests/RouteTableTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -442,4 +442,63 @@ function Test-RouteTableWithDisableBgpRoutePropagation
# Cleanup
Clean-ResourceGroup $rgname
}
}

<#
.SYNOPSIS
Tests RouteTableWithDisablePeeringRoute.
#>
function Test-RouteTableWithDisablePeeringRoute
{
# Setup
$rgname = Get-ResourceGroupName
$routeTableName = Get-ResourceName
$rglocation = Get-ProviderLocation ResourceManagement
$resourceTypeParent = "Microsoft.Network/routeTables"
$location = Get-ProviderLocation $resourceTypeParent

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

# Create RouteTable with DisablePeeringRoute set to "All"
$rt = New-AzRouteTable -name $routeTableName -DisablePeeringRoute "All" -ResourceGroupName $rgname -Location $location

# Get RouteTable
$getRT = Get-AzRouteTable -name $routeTableName -ResourceGroupName $rgName

#verification
Assert-AreEqual $rgName $getRT.ResourceGroupName
Assert-AreEqual $routeTableName $getRT.Name
Assert-AreEqual "All" $getRT.DisablePeeringRoute
Assert-NotNull $getRT.Etag
Assert-AreEqual 0 @($getRT.Routes).Count

# list
$list = Get-AzRouteTable -ResourceGroupName $rgname
Assert-AreEqual 1 @($list).Count
Assert-AreEqual $list[0].ResourceGroupName $getRT.ResourceGroupName
Assert-AreEqual $list[0].Name $getRT.Name
Assert-AreEqual $list[0].DisablePeeringRoute $getRT.DisablePeeringRoute
Assert-AreEqual $list[0].Etag $getRT.Etag
Assert-AreEqual @($list[0].Routes).Count @($getRT.Routes).Count

# Update to "None"
$getRT.DisablePeeringRoute = "None"
$updatedRT = Set-AzRouteTable -RouteTable $getRT
Assert-AreEqual "None" $updatedRT.DisablePeeringRoute

# Delete RouteTable
$delete = Remove-AzRouteTable -ResourceGroupName $rgname -name $routeTableName -PassThru -Force
Assert-AreEqual true $delete

$list = Get-AzRouteTable -ResourceGroupName $rgname
Assert-AreEqual 0 @($list).Count
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/Network/Network/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
--->

## Upcoming Release
* Added DisablePeeringRoute support for Route Table
- Added `-DisablePeeringRoute` parameter to `New-AzRouteTable` cmdlet
- Supported values are `None` and `All`

## Version 7.25.1
* Onboarded `Microsoft.DataReplication/replicationVaults` to Private Link Common Cmdlets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ public partial class NewAzureRmRouteTable : NetworkBaseCmdlet
HelpMessage = "Gets or sets whether to disable the routes learned by BGP on that route table. True means disable.")]
public SwitchParameter DisableBgpRoutePropagation { get; set; }

[Parameter(
Mandatory = false,
HelpMessage = "Whether to disable the routes learned by peering on the route table. 'None' means that peering routes will be present. 'All' means that all peering routes will be dropped.")]
[ValidateSet("None", "All", IgnoreCase = true)]
public string DisablePeeringRoute { get; set; }

[Parameter(
Mandatory = true,
HelpMessage = "The location.",
Expand Down Expand Up @@ -100,6 +106,7 @@ public override void Execute()
var vRouteTable = new PSRouteTable
{
DisableBgpRoutePropagation = this.DisableBgpRoutePropagation,
DisablePeeringRoute = this.DisablePeeringRoute,
Location = this.Location,
Routes = this.Route?.ToList(),
};
Expand Down
3 changes: 3 additions & 0 deletions src/Network/Network/Models/PSRouteTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public class PSRouteTable : PSTopLevelResource
[Ps1Xml(Target = ViewControl.Table)]
public bool DisableBgpRoutePropagation { get; set; }

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

[JsonIgnore]
public string RoutesText
{
Expand Down
18 changes: 17 additions & 1 deletion src/Network/Network/help/New-AzRouteTable.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Creates a route table.
## SYNTAX

```
New-AzRouteTable -ResourceGroupName <String> -Name <String> [-DisableBgpRoutePropagation] -Location <String>
New-AzRouteTable -ResourceGroupName <String> -Name <String> [-DisableBgpRoutePropagation] [-DisablePeeringRoute <String>] -Location <String>
[-Tag <Hashtable>] [-Route <PSRoute[]>] [-Force] [-AsJob] [-DefaultProfile <IAzureContextContainer>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```
Expand Down Expand Up @@ -107,6 +107,22 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -DisablePeeringRoute
Specifies whether to disable peering routes. Valid values are None and All.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:
Accepted values: None, All

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -Force
Indicates that this cmdlet creates a route table even if a route table that has the same name already exists.

Expand Down
Loading