Skip to content

New property of the express route resources #4195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 29, 2017
Merged
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 @@ -269,6 +269,9 @@
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.ApplicationGatewayTests\TestAvailableWafRuleSets.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.ExpressRouteCircuitTests\TestExpressRouteBgpServiceCommunitiesGet.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.NetworkWatcherAPITests\TestFlowLog.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void TestExpressRouteCircuitPrivatePublicPeeringCRUD()
NetworkResourcesController.NewInstance.RunPsTest("Test-ExpressRouteCircuitPrivatePublicPeeringCRUD");
}

[Fact(Skip = "Skip until necessary fixes done")]
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestExpressRouteCircuitMicrosoftPeeringCRUD()
{
Expand All @@ -53,5 +53,12 @@ public void TestExpressRouteCircuitAuthorizationCRUD()
{
NetworkResourcesController.NewInstance.RunPsTest("Test-ExpressRouteCircuitAuthorizationCRUD");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestExpressRouteBgpServiceCommunitiesGet()
{
NetworkResourcesController.NewInstance.RunPsTest("Test-ExpressRouteBGPServiceCommunities");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@
# limitations under the License.
# ----------------------------------------------------------------------------------

<#
.SYNOPSIS
Tests ExpressRouteCircuitCRUD.
#>
function Test-ExpressRouteBGPServiceCommunities
{
$communities = Get-AzureRmBgpServiceCommunity

Assert-NotNull $communities
Assert-NotNull $communities[0].BgpCommunities
Assert-AreEqual true $communities[0].BgpCommunities[0].IsAuthorizedToUse
}
<#
.SYNOPSIS
Tests ExpressRouteCircuitCRUD.
Expand Down Expand Up @@ -256,7 +268,7 @@ function Test-ExpressRouteCircuitMicrosoftPeeringCRUD
# Create the resource group
$resourceGroup = New-AzureRmResourceGroup -Name $rgname -Location $rglocation
# Create the ExpressRouteCircuit with peering
$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
$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
$circuit = New-AzureRmExpressRouteCircuit -Name $circuitName -Location $location -ResourceGroupName $rgname -SkuTier Premium -SkuFamily MeteredData -ServiceProviderName "equinix" -PeeringLocation "Silicon Valley" -BandwidthInMbps 1000 -Peering $peering

#verification
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public override void Execute()
peering.MicrosoftPeeringConfig.AdvertisedPublicPrefixes = this.MicrosoftConfigAdvertisedPublicPrefixes;
peering.MicrosoftPeeringConfig.CustomerASN = this.MicrosoftConfigCustomerAsn;
peering.MicrosoftPeeringConfig.RoutingRegistryName = this.MicrosoftConfigRoutingRegistryName;
peering.MicrosoftPeeringConfig.LegacyMode = Convert.ToInt32(this.LegacyMode);
}

if (!string.IsNullOrEmpty(this.RouteFilterId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
namespace Microsoft.Azure.Commands.Network
{
using System.Collections.Generic;
using System.ComponentModel;

using Microsoft.Azure.Commands.Network.Models;
using System.Management.Automation;
using MNM = Microsoft.Azure.Management.Network.Models;
Expand Down Expand Up @@ -104,5 +106,11 @@ public class AzureExpressRouteCircuitPeeringConfigBase : NetworkBaseCmdlet
HelpMessage = "RouteFilter")]
[ValidateNotNullOrEmpty]
public PSRouteFilter RouteFilter { get; set; }

[Parameter(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dihan0604 please add tests for this new parameter.

Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The legacy mode of the Peering")]
public bool LegacyMode { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ public override void Execute()
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace Microsoft.Azure.Commands.Network
{
using System;
using System.Linq;

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

if (!string.IsNullOrEmpty(this.RouteFilterId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public override void Execute()
peering.MicrosoftPeeringConfig.AdvertisedPublicPrefixes = this.MicrosoftConfigAdvertisedPublicPrefixes;
peering.MicrosoftPeeringConfig.CustomerASN = this.MicrosoftConfigCustomerAsn;
peering.MicrosoftPeeringConfig.RoutingRegistryName = this.MicrosoftConfigRoutingRegistryName;
peering.MicrosoftPeeringConfig.LegacyMode = Convert.ToInt32(this.LegacyMode);
}

if (!string.IsNullOrEmpty(this.RouteFilterId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2160,6 +2160,14 @@
<Label>CommunityPrefixes</Label>
<PropertyName>CommunityPrefixesText</PropertyName>
</ListItem>
<ListItem>
<Label>IsAuthorizedToUse</Label>
<PropertyName>IsAuthorizedToUseText</PropertyName>
</ListItem>
<ListItem>
<Label>ServiceGroup</Label>
<PropertyName>ServiceGroupText</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public class PSBgpCommunity

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

public bool IsAuthorizedToUse { get; set; }

public string ServiceGroup { get; set; }

[JsonIgnore]
public string CommunityPrefixesText
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ public class PSPeeringConfig
{
public List<string> AdvertisedPublicPrefixes { get; set; }

[JsonProperty(Order = 1)]
public List<string> AdvertisedCommunities { get; set; }

[JsonProperty(Order = 1)]
public string AdvertisedPublicPrefixesState { get; set; }

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

[JsonProperty(Order = 1)]
public int LegacyMode { get; set; }

[JsonProperty(Order = 1)]
public string RoutingRegistryName { get; set; }

Expand All @@ -36,5 +42,11 @@ public string AdvertisedPublicPrefixesSText
{
get { return JsonConvert.SerializeObject(AdvertisedPublicPrefixes, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
}

[JsonIgnore]
public string AdvertisedCommunitiesSText
{
get { return JsonConvert.SerializeObject(AdvertisedCommunities, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
}
}
}