Skip to content

Commit ca93419

Browse files
authored
[Express Route] IPv6 Global Reach Add/Set-AzExpressRouteCircuitConnection cmdlet changes. (#11501)
* Updated ChangeLog.md * Added Set-Cmdlet * Added Set/Add AzExpressRouteConnection Cmdlets * Updated with review comments. * ReNamed the new parameter from PeerAddressType to AddressPrefixType. * Added Set/Add AzExpressRouteConnection Cmdlets * Updated with review comments. * Fixed Ipv6CircuitConnectionParameter * Added help files for Express Route Circuit Connection Config * Minor fixes * Fixed indentation in Add-AzExpressRouteCircuitConnectionConfig.cs and updated help text in documentation. * Addressed Review comments. * Updated the help message * Updated the help text. * a. Added test cases b. Incorporated review comments. * Added Resources.Designer.cs for Add/SetAzureExpressRouteCircuitConnectionConfigCommand * Minor updates to ChangeLog.md * Fixed indentation * Fixed online help/Set-AzExpressRouteCircuitConnectionConfig .md * Fixed test case * Fixing online help/Set-AzExpressRouteCircuitConnectionConfig .md * removed online version from the file
1 parent ef6da90 commit ca93419

18 files changed

+7844
-272
lines changed

src/Network/Network.Test/ScenarioTests/ExpressRouteCircuitTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,22 @@ public void TestExpressRouteCircuitConnectionCRUD()
9090
TestRunner.RunTestScript("Test-ExpressRouteCircuitConnectionCRUD");
9191
}
9292

93+
[Fact]
94+
[Trait(Category.AcceptanceType, Category.CheckIn)]
95+
[Trait(Category.Owner, NrpTeamAlias.pgtm)]
96+
public void TestExpressRouteCircuitConnectionIPv6CRUD()
97+
{
98+
TestRunner.RunTestScript("Test-ExpressRouteCircuitConnectionIPv6CRUD");
99+
}
100+
101+
[Fact]
102+
[Trait(Category.AcceptanceType, Category.CheckIn)]
103+
[Trait(Category.Owner, NrpTeamAlias.pgtm)]
104+
public void TestExpressRouteCircuitConnectionIPv6PrecreatedCRUD()
105+
{
106+
TestRunner.RunTestScript("Test-ExpressRouteCircuitConnectionIPv6PrecreatedCRUD");
107+
}
108+
93109
[Fact]
94110
[Trait(Category.AcceptanceType, Category.CheckIn)]
95111
[Trait(Category.Owner, NrpTeamAlias.pgtm)]

src/Network/Network.Test/ScenarioTests/ExpressRouteCircuitTests.ps1

Lines changed: 698 additions & 252 deletions
Large diffs are not rendered by default.

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.ExpressRouteCircuitTests/TestExpressRouteCircuitConnectionIPv6CRUD.json

Lines changed: 4183 additions & 0 deletions
Large diffs are not rendered by default.

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.ExpressRouteCircuitTests/TestExpressRouteCircuitConnectionIPv6PrecreatedCRUD.json

Lines changed: 2435 additions & 0 deletions
Large diffs are not rendered by default.

src/Network/Network/Az.Network.psd1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ CmdletsToExport = 'Add-AzApplicationGatewayAuthenticationCertificate',
369369
'Remove-AzDdosProtectionPlan',
370370
'New-AzNetworkWatcherProtocolConfiguration',
371371
'Add-AzExpressRouteCircuitConnectionConfig',
372+
'Set-AzExpressRouteCircuitConnectionConfig',
372373
'Get-AzExpressRouteCircuitConnectionConfig',
373374
'Remove-AzExpressRouteCircuitConnectionConfig',
374375
'New-AzServiceEndpointPolicy', 'Remove-AzServiceEndpointPolicy',

src/Network/Network/ChangeLog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020

2121
## Upcoming Release
2222

23+
* Add Support for IPv6 address family in ExpressRouteCircuitConnectionConfig (Global Reach)
24+
- Added Cmdlet
25+
- Set-AzExpressRouteCircuitConnectionConfig
26+
- allows setting of all the existing properties including the IPv6CircuitConnectionProperties
27+
-Updated Cmdlet
28+
- Add-AzExpressRouteCircuitConnectionConfig
29+
- Added another optional parameter AddressPrefixType to specify the address family of address prefix
30+
2331
## Version 2.4.0
2432
* Updated cmdlets to allow cross-tenant VirtualHubVnetConnections
2533
- `New-AzVirtualHubVnetConnection`

src/Network/Network/Common/NetworkResourceManagerProfile.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,7 @@ private static void Initialize()
769769
cfg.CreateMap<CNM.PSPeering, MNM.ExpressRouteCircuitPeering>();
770770
cfg.CreateMap<CNM.PSExpressRouteCircuitAuthorization, MNM.ExpressRouteCircuitAuthorization>();
771771
cfg.CreateMap<CNM.PSExpressRouteCircuitConnection, MNM.ExpressRouteCircuitConnection>();
772+
cfg.CreateMap<CNM.PSExpressRouteCircuitConnectionIPv6ConnectionConfig, MNM.Ipv6CircuitConnectionConfig>();
772773

773774
// MNM to CNM
774775
cfg.CreateMap<MNM.ExpressRouteCircuit, CNM.PSExpressRouteCircuit>();
@@ -781,6 +782,7 @@ private static void Initialize()
781782
cfg.CreateMap<CNM.PSExpressRouteCircuitRoutesTable, MNM.ExpressRouteCircuitRoutesTable>();
782783
cfg.CreateMap<CNM.PSExpressRouteCircuitRoutesTableSummary, MNM.ExpressRouteCircuitRoutesTableSummary>();
783784
cfg.CreateMap<MNM.ExpressRouteCircuitConnection, CNM.PSExpressRouteCircuitConnection>();
785+
cfg.CreateMap<MNM.Ipv6CircuitConnectionConfig, CNM.PSExpressRouteCircuitConnectionIPv6ConnectionConfig>();
784786

785787
// ExpressRouteCircuitPeering
786788
// CNM to MNM
@@ -796,10 +798,10 @@ private static void Initialize()
796798
// Express Route Circuit Connection
797799
// CNM to MNM
798800
cfg.CreateMap<CNM.PSExpressRouteCircuitConnection, MNM.ExpressRouteCircuitConnection>();
799-
801+
800802
// MNM to CNM
801803
cfg.CreateMap<MNM.ExpressRouteCircuitConnection, CNM.PSExpressRouteCircuitConnection>();
802-
804+
803805
// Peer Express Route Circuit Connection
804806
// CNM to MNM
805807
cfg.CreateMap<CNM.PSPeerExpressRouteCircuitConnection, MNM.PeerExpressRouteCircuitConnection>();

src/Network/Network/ExpressRouteCircuit/Peering/Connection/AddAzureExpressRouteCircuitConnectionConfigCommand.cs

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,29 @@ public override void Execute()
4343
{
4444
base.Execute();
4545

46-
var circuitconnection = new PSExpressRouteCircuitConnection();
47-
48-
circuitconnection.Name = this.Name;
49-
circuitconnection.AddressPrefix = this.AddressPrefix;
50-
5146
var peering =
5247
this.ExpressRouteCircuit.Peerings.SingleOrDefault(
5348
resource =>
5449
string.Equals(resource.Name, "AzurePrivatePeering", System.StringComparison.CurrentCultureIgnoreCase));
5550

5651
if (peering == null)
5752
{
58-
throw new ArgumentException("Private Peering needs to be configured on the Express Route Circuit");
53+
throw new ArgumentException(Properties.Resources.ExpressRoutePrivatePeeringNotFound);
54+
}
55+
56+
var circuitconnection = peering.Connections.SingleOrDefault(
57+
resource =>
58+
string.Equals(resource.Name, Name, System.StringComparison.CurrentCultureIgnoreCase));
59+
60+
if (circuitconnection != null)
61+
{
62+
throw new ArgumentException(string.Format(Properties.Resources.ExpressRouteCircuitConnectionAlreadyAdded, Name));
5963
}
6064

65+
circuitconnection = new PSExpressRouteCircuitConnection();
66+
67+
circuitconnection.Name = this.Name;
68+
6169
circuitconnection.ExpressRouteCircuitPeering = new PSResourceId();
6270
circuitconnection.ExpressRouteCircuitPeering.Id = peering.Id;
6371

@@ -69,6 +77,19 @@ public override void Execute()
6977
circuitconnection.AuthorizationKey = this.AuthorizationKey;
7078
}
7179

80+
if (this.AddressPrefixType == IPv6)
81+
{
82+
// Create new PSExpressRouteIPv6AddressPrefix()
83+
var expressRouteIPv6AddressPrefix = new PSExpressRouteCircuitConnectionIPv6ConnectionConfig();
84+
expressRouteIPv6AddressPrefix.AddressPrefix = AddressPrefix;
85+
circuitconnection.IPv6CircuitConnectionConfig = expressRouteIPv6AddressPrefix;
86+
}
87+
else
88+
{
89+
// For IPv4
90+
circuitconnection.AddressPrefix = this.AddressPrefix;
91+
}
92+
7293
peering.Connections.Add(circuitconnection);
7394

7495
WriteObject(this.ExpressRouteCircuit);

src/Network/Network/ExpressRouteCircuit/Peering/Connection/AzureExpressRouteCircuitConnectionConfigBase.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ public class AzureExpressRouteCircuitConnectionConfigBase : NetworkBaseCmdlet
4646
[ValidateNotNullOrEmpty]
4747
public string AddressPrefix { get; set; }
4848

49+
[Parameter(
50+
Mandatory = false,
51+
HelpMessage = "Specify address family of the configured AddressPrefix. Valid values [IPv4|IPv6]")]
52+
[ValidateSet(
53+
IPv4,
54+
IPv6,
55+
IgnoreCase = true)]
56+
public string AddressPrefixType { get; set; }
57+
4958
[Parameter(
5059
Mandatory = false,
5160
HelpMessage = "Authorization Key to peer to circuit in another subscription")]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.Network.Models;
16+
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
17+
using System;
18+
using System.Linq;
19+
using System.Management.Automation;
20+
21+
namespace Microsoft.Azure.Commands.Network {
22+
[CmdletOutputBreakingChange(typeof(PSExpressRouteCircuit), DeprecatedOutputProperties = new[] { "AllowGlobalReach" })]
23+
[Cmdlet("Set", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ExpressRouteCircuitConnectionConfig", DefaultParameterSetName = "SetByResource", SupportsShouldProcess = true), OutputType(typeof(PSExpressRouteCircuit))]
24+
public class SetAzureExpressRouteCircuitConnectionConfigCommand : AzureExpressRouteCircuitConnectionConfigBase
25+
{
26+
[Parameter(
27+
Position = 0,
28+
Mandatory = true,
29+
HelpMessage = "The name of the Circuit Connection")]
30+
[ValidateNotNullOrEmpty]
31+
public override string Name { get; set; }
32+
33+
[Parameter(
34+
Position = 1,
35+
Mandatory = true,
36+
ValueFromPipeline = true,
37+
HelpMessage = "Express Route Circuit Peering initiating connection")]
38+
[ValidateNotNullOrEmpty]
39+
public PSExpressRouteCircuit ExpressRouteCircuit { get; set; }
40+
41+
public override void Execute()
42+
{
43+
base.Execute();
44+
45+
var peering = this.ExpressRouteCircuit.Peerings.SingleOrDefault(
46+
resource =>
47+
string.Equals(resource.Name, "AzurePrivatePeering", System.StringComparison.CurrentCultureIgnoreCase));
48+
49+
if (peering == null)
50+
{
51+
throw new ArgumentException(Properties.Resources.ExpressRoutePrivatePeeringNotFound);
52+
}
53+
54+
var circuitconnection = peering.Connections.SingleOrDefault(
55+
resource =>
56+
string.Equals(resource.Name, Name, StringComparison.CurrentCultureIgnoreCase));
57+
58+
if (null == circuitconnection)
59+
{
60+
throw new ArgumentException(string.Format(Properties.Resources.ExpressRouteCircuitConnectionNotFound, Name));
61+
}
62+
63+
circuitconnection.Name = this.Name;
64+
65+
if (null != peering.Id)
66+
{
67+
circuitconnection.ExpressRouteCircuitPeering.Id = peering.Id;
68+
}
69+
70+
if (null != this.PeerExpressRouteCircuitPeering)
71+
{
72+
circuitconnection.PeerExpressRouteCircuitPeering.Id = this.PeerExpressRouteCircuitPeering;
73+
}
74+
75+
if (!string.IsNullOrWhiteSpace(this.AuthorizationKey))
76+
{
77+
circuitconnection.AuthorizationKey = this.AuthorizationKey;
78+
}
79+
80+
if (this.AddressPrefix != null)
81+
{
82+
if (this.AddressPrefixType == IPv6)
83+
{
84+
if (circuitconnection.IPv6CircuitConnectionConfig != null)
85+
{
86+
circuitconnection.IPv6CircuitConnectionConfig.AddressPrefix = this.AddressPrefix;
87+
}
88+
else
89+
{
90+
var ipv6AddressPrefix = new PSExpressRouteCircuitConnectionIPv6ConnectionConfig();
91+
ipv6AddressPrefix.AddressPrefix = this.AddressPrefix;
92+
circuitconnection.IPv6CircuitConnectionConfig = ipv6AddressPrefix;
93+
}
94+
}
95+
else
96+
{
97+
circuitconnection.AddressPrefix = this.AddressPrefix;
98+
}
99+
}
100+
101+
WriteObject(this.ExpressRouteCircuit);
102+
} // end of Execute()
103+
}
104+
}

src/Network/Network/Generated/Models/PSExpressRouteCircuitConnection.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public partial class PSExpressRouteCircuitConnection : PSChildResource
4848
[JsonProperty(Order = 1)]
4949
public PSResourceId PeerExpressRouteCircuitPeering { get; set; }
5050

51+
[JsonProperty(Order = 1)]
52+
public PSExpressRouteCircuitConnectionIPv6ConnectionConfig IPv6CircuitConnectionConfig { get; set; }
53+
5154
[JsonIgnore]
5255
public string ExpressRouteCircuitPeeringText
5356
{
@@ -59,5 +62,11 @@ public string PeerExpressRouteCircuitPeeringText
5962
{
6063
get { return JsonConvert.SerializeObject(PeerExpressRouteCircuitPeering, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
6164
}
65+
66+
[JsonIgnore]
67+
public string IPv6CircuitConnectionConfigText
68+
{
69+
get { return JsonConvert.SerializeObject(IPv6CircuitConnectionConfig, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
70+
}
6271
}
6372
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// Copyright (c) Microsoft. All rights reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
namespace Microsoft.Azure.Commands.Network.Models
17+
{
18+
using Microsoft.Azure.Management.Network.Models;
19+
20+
using Newtonsoft.Json;
21+
using WindowsAzure.Commands.Common.Attributes;
22+
23+
public class PSExpressRouteCircuitConnectionIPv6ConnectionConfig
24+
{
25+
[JsonProperty(Order = 1)]
26+
[Ps1Xml(Target = ViewControl.Table)]
27+
public string AddressPrefix { get; set; }
28+
29+
[JsonProperty(Order = 1)]
30+
[Ps1Xml(Target = ViewControl.Table)]
31+
public string CircuitConnectionStatus { get; set; }
32+
33+
}
34+
}

src/Network/Network/Network.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<PsModuleName>Network</PsModuleName>
@@ -8,7 +8,8 @@
88

99
<PropertyGroup>
1010
<RootNamespace>$(LegacyAssemblyPrefix)$(PsModuleName)</RootNamespace>
11-
<TargetFramework>netstandard2.0</TargetFramework>
11+
<ApplicationIcon />
12+
<Win32Resource />
1213
</PropertyGroup>
1314

1415
<ItemGroup>

src/Network/Network/Network.format.ps1xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3732,6 +3732,32 @@
37323732
<Label>FirewallPolicy</Label>
37333733
<PropertyName>FirewallPolicy</PropertyName>
37343734
</ListItem>
3735+
<ListItem>
3736+
<Label>IPv6CircuitConnectionConfig</Label>
3737+
<PropertyName>IPv6CircuitConnectionConfigText</PropertyName>
3738+
</ListItem>
3739+
</ListItems>
3740+
</ListEntry>
3741+
</ListEntries>
3742+
</ListControl>
3743+
</View>
3744+
<View>
3745+
<Name>Microsoft.Azure.Commands.Network.Models.PSExpressRouteCircuitConnectionIPv6Prefix</Name>
3746+
<ViewSelectedBy>
3747+
<TypeName>Microsoft.Azure.Commands.Network.Models.PSExpressRouteCircuitConnectionIPv6Prefix</TypeName>
3748+
</ViewSelectedBy>
3749+
<ListControl>
3750+
<ListEntries>
3751+
<ListEntry>
3752+
<ListItems>
3753+
<ListItem>
3754+
<Label>AddressPrefix</Label>
3755+
<PropertyName>AddressPrefix</PropertyName>
3756+
</ListItem>
3757+
<ListItem>
3758+
<Label>CircuitConnectionStatus</Label>
3759+
<PropertyName>CircuitConnectionStatus</PropertyName>
3760+
</ListItem>
37353761
</ListItems>
37363762
</ListEntry>
37373763
</ListEntries>

0 commit comments

Comments
 (0)