Skip to content

Commit 4f97f10

Browse files
authored
Merge pull request #4195 from dihan0604/dev
New property of the express route resources
2 parents d34efd4 + 7fea484 commit 4f97f10

13 files changed

+33277
-434
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@
269269
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.ApplicationGatewayTests\TestAvailableWafRuleSets.json">
270270
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
271271
</None>
272+
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.ExpressRouteCircuitTests\TestExpressRouteBgpServiceCommunitiesGet.json">
273+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
274+
</None>
272275
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.NetworkWatcherAPITests\TestFlowLog.json">
273276
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
274277
</None>

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void TestExpressRouteCircuitPrivatePublicPeeringCRUD()
4040
NetworkResourcesController.NewInstance.RunPsTest("Test-ExpressRouteCircuitPrivatePublicPeeringCRUD");
4141
}
4242

43-
[Fact(Skip = "Skip until necessary fixes done")]
43+
[Fact]
4444
[Trait(Category.AcceptanceType, Category.CheckIn)]
4545
public void TestExpressRouteCircuitMicrosoftPeeringCRUD()
4646
{
@@ -53,5 +53,12 @@ public void TestExpressRouteCircuitAuthorizationCRUD()
5353
{
5454
NetworkResourcesController.NewInstance.RunPsTest("Test-ExpressRouteCircuitAuthorizationCRUD");
5555
}
56+
57+
[Fact]
58+
[Trait(Category.AcceptanceType, Category.CheckIn)]
59+
public void TestExpressRouteBgpServiceCommunitiesGet()
60+
{
61+
NetworkResourcesController.NewInstance.RunPsTest("Test-ExpressRouteBGPServiceCommunities");
62+
}
5663
}
5764
}

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@
1212
# limitations under the License.
1313
# ----------------------------------------------------------------------------------
1414

15+
<#
16+
.SYNOPSIS
17+
Tests ExpressRouteCircuitCRUD.
18+
#>
19+
function Test-ExpressRouteBGPServiceCommunities
20+
{
21+
$communities = Get-AzureRmBgpServiceCommunity
22+
23+
Assert-NotNull $communities
24+
Assert-NotNull $communities[0].BgpCommunities
25+
Assert-AreEqual true $communities[0].BgpCommunities[0].IsAuthorizedToUse
26+
}
1527
<#
1628
.SYNOPSIS
1729
Tests ExpressRouteCircuitCRUD.
@@ -256,7 +268,7 @@ function Test-ExpressRouteCircuitMicrosoftPeeringCRUD
256268
# Create the resource group
257269
$resourceGroup = New-AzureRmResourceGroup -Name $rgname -Location $rglocation
258270
# Create the ExpressRouteCircuit with peering
259-
$peering = New-AzureRmExpressRouteCircuitPeeringConfig -Name MicrosoftPeering -PeeringType MicrosoftPeering -PeerASN 33 -PrimaryPeerAddressPrefix "192.168.1.0/30" -SecondaryPeerAddressPrefix "192.168.2.0/30" -VlanId 223 -MicrosoftConfigAdvertisedPublicPrefixes @("11.2.3.4/30", "12.2.3.4/30") -MicrosoftConfigCustomerAsn 1000 -MicrosoftConfigRoutingRegistryName AFRINIC
271+
$peering = New-AzureRmExpressRouteCircuitPeeringConfig -Name MicrosoftPeering -PeeringType MicrosoftPeering -PeerASN 33 -PrimaryPeerAddressPrefix "192.168.1.0/30" -SecondaryPeerAddressPrefix "192.168.2.0/30" -VlanId 223 -MicrosoftConfigAdvertisedPublicPrefixes @("11.2.3.4/30", "12.2.3.4/30") -MicrosoftConfigCustomerAsn 1000 -MicrosoftConfigRoutingRegistryName AFRINIC -LegacyMode $true
260272
$circuit = New-AzureRmExpressRouteCircuit -Name $circuitName -Location $location -ResourceGroupName $rgname -SkuTier Premium -SkuFamily MeteredData -ServiceProviderName "equinix" -PeeringLocation "Silicon Valley" -BandwidthInMbps 1000 -Peering $peering
261273

262274
#verification

src/ResourceManager/Network/Commands.Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.ExpressRouteCircuitTests/TestExpressRouteBgpServiceCommunitiesGet.json

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

src/ResourceManager/Network/Commands.Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.ExpressRouteCircuitTests/TestExpressRouteCircuitMicrosoftPeeringCRUD.json

Lines changed: 33147 additions & 431 deletions
Large diffs are not rendered by default.

src/ResourceManager/Network/Commands.Network/ExpressRouteCircuit/Peering/AddAzureExpressRouteCircuitPeeringConfigCommand.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public override void Execute()
7676
peering.MicrosoftPeeringConfig.AdvertisedPublicPrefixes = this.MicrosoftConfigAdvertisedPublicPrefixes;
7777
peering.MicrosoftPeeringConfig.CustomerASN = this.MicrosoftConfigCustomerAsn;
7878
peering.MicrosoftPeeringConfig.RoutingRegistryName = this.MicrosoftConfigRoutingRegistryName;
79+
peering.MicrosoftPeeringConfig.LegacyMode = Convert.ToInt32(this.LegacyMode);
7980
}
8081

8182
if (!string.IsNullOrEmpty(this.RouteFilterId))

src/ResourceManager/Network/Commands.Network/ExpressRouteCircuit/Peering/AzureExpressRouteCircuitPeeringConfigBase.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
namespace Microsoft.Azure.Commands.Network
1616
{
1717
using System.Collections.Generic;
18+
using System.ComponentModel;
19+
1820
using Microsoft.Azure.Commands.Network.Models;
1921
using System.Management.Automation;
2022
using MNM = Microsoft.Azure.Management.Network.Models;
@@ -104,5 +106,11 @@ public class AzureExpressRouteCircuitPeeringConfigBase : NetworkBaseCmdlet
104106
HelpMessage = "RouteFilter")]
105107
[ValidateNotNullOrEmpty]
106108
public PSRouteFilter RouteFilter { get; set; }
109+
110+
[Parameter(
111+
Mandatory = false,
112+
ValueFromPipelineByPropertyName = true,
113+
HelpMessage = "The legacy mode of the Peering")]
114+
public bool LegacyMode { get; set; }
107115
}
108116
}

src/ResourceManager/Network/Commands.Network/ExpressRouteCircuit/Peering/GetAzureExpressRouteCircuitPeeringConfigCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ public override void Execute()
5151
}
5252
}
5353
}
54-
}
54+
}

src/ResourceManager/Network/Commands.Network/ExpressRouteCircuit/Peering/NewAzureExpressRouteCircuitPeeringConfigCommand.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
namespace Microsoft.Azure.Commands.Network
1919
{
20+
using System;
2021
using System.Linq;
2122

2223
[Cmdlet(VerbsCommon.New, "AzureRmExpressRouteCircuitPeeringConfig", DefaultParameterSetName = "SetByResource"), OutputType(typeof(PSPeering))]
@@ -61,6 +62,7 @@ public override void Execute()
6162
peering.MicrosoftPeeringConfig.AdvertisedPublicPrefixes = this.MicrosoftConfigAdvertisedPublicPrefixes;
6263
peering.MicrosoftPeeringConfig.CustomerASN = this.MicrosoftConfigCustomerAsn;
6364
peering.MicrosoftPeeringConfig.RoutingRegistryName = this.MicrosoftConfigRoutingRegistryName;
65+
peering.MicrosoftPeeringConfig.LegacyMode = Convert.ToInt32(this.LegacyMode);
6466
}
6567

6668
if (!string.IsNullOrEmpty(this.RouteFilterId))

src/ResourceManager/Network/Commands.Network/ExpressRouteCircuit/Peering/SetAzureExpressRouteCircuitPeeringConfigCommand.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public override void Execute()
7272
peering.MicrosoftPeeringConfig.AdvertisedPublicPrefixes = this.MicrosoftConfigAdvertisedPublicPrefixes;
7373
peering.MicrosoftPeeringConfig.CustomerASN = this.MicrosoftConfigCustomerAsn;
7474
peering.MicrosoftPeeringConfig.RoutingRegistryName = this.MicrosoftConfigRoutingRegistryName;
75+
peering.MicrosoftPeeringConfig.LegacyMode = Convert.ToInt32(this.LegacyMode);
7576
}
7677

7778
if (!string.IsNullOrEmpty(this.RouteFilterId))

src/ResourceManager/Network/Commands.Network/Microsoft.Azure.Commands.Network.format.ps1xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,6 +2160,14 @@
21602160
<Label>CommunityPrefixes</Label>
21612161
<PropertyName>CommunityPrefixesText</PropertyName>
21622162
</ListItem>
2163+
<ListItem>
2164+
<Label>IsAuthorizedToUse</Label>
2165+
<PropertyName>IsAuthorizedToUseText</PropertyName>
2166+
</ListItem>
2167+
<ListItem>
2168+
<Label>ServiceGroup</Label>
2169+
<PropertyName>ServiceGroupText</PropertyName>
2170+
</ListItem>
21632171
</ListItems>
21642172
</ListEntry>
21652173
</ListEntries>

src/ResourceManager/Network/Commands.Network/Models/PSBgpCommunity.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public class PSBgpCommunity
2828

2929
public List<string> CommunityPrefixes { get; set; }
3030

31+
public bool IsAuthorizedToUse { get; set; }
32+
33+
public string ServiceGroup { get; set; }
34+
3135
[JsonIgnore]
3236
public string CommunityPrefixesText
3337
{

src/ResourceManager/Network/Commands.Network/Models/PSPeeringConfig.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,18 @@ public class PSPeeringConfig
2222
{
2323
public List<string> AdvertisedPublicPrefixes { get; set; }
2424

25+
[JsonProperty(Order = 1)]
26+
public List<string> AdvertisedCommunities { get; set; }
27+
2528
[JsonProperty(Order = 1)]
2629
public string AdvertisedPublicPrefixesState { get; set; }
2730

2831
[JsonProperty(Order = 1)]
2932
public int CustomerASN { get; set; }
3033

34+
[JsonProperty(Order = 1)]
35+
public int LegacyMode { get; set; }
36+
3137
[JsonProperty(Order = 1)]
3238
public string RoutingRegistryName { get; set; }
3339

@@ -36,5 +42,11 @@ public string AdvertisedPublicPrefixesSText
3642
{
3743
get { return JsonConvert.SerializeObject(AdvertisedPublicPrefixes, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
3844
}
45+
46+
[JsonIgnore]
47+
public string AdvertisedCommunitiesSText
48+
{
49+
get { return JsonConvert.SerializeObject(AdvertisedCommunities, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
50+
}
3951
}
4052
}

0 commit comments

Comments
 (0)