Skip to content

Commit 1dbc428

Browse files
committed
add new property for bgp
1 parent 5fe65c9 commit 1dbc428

File tree

6 files changed

+46
-10
lines changed

6 files changed

+46
-10
lines changed

src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/GetAzureBGPPeering.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,20 @@ public class GetAzureBGPPeeringCommand : ExpressRouteBaseCmdlet
3333

3434
public override void ExecuteCmdlet()
3535
{
36-
var route = ExpressRouteClient.GetAzureBGPPeering(ServiceKey, AccessType);
37-
WriteObject(route);
36+
var peer = ExpressRouteClient.GetAzureBGPPeering(ServiceKey, AccessType);
37+
38+
if (AccessType != BgpPeeringAccessType.Microsoft)
39+
{
40+
peer.LegacyMode = 1;
41+
}
42+
43+
WriteObject(peer);
3844
}
3945
}
46+
47+
private enum LegacyMode
48+
{
49+
False = 0,
50+
True = 1
51+
}
4052
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Microsoft.WindowsAzure.Commands.ExpressRoute.BgpPeerings
8+
{
9+
public enum LegacyMode
10+
{
11+
False = 0,
12+
True = 1
13+
}
14+
}

src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/NewAzureBGPPeering.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ public class NewAzureBGPPeeringCommand : ExpressRouteBaseCmdlet
3636
HelpMessage = "Peer Asn")]
3737
public UInt32 PeerAsn { get; set; }
3838

39+
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Legacy Mode")]
40+
public LegacyMode LegacyMode { get; set; }
41+
3942
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Primary Peer Subnet")]
4043
[ValidateNotNullOrEmpty]
4144
public string PrimaryPeerSubnet { get; set; }
@@ -61,8 +64,14 @@ public class NewAzureBGPPeeringCommand : ExpressRouteBaseCmdlet
6164
public override void ExecuteCmdlet()
6265
{
6366
var route = ExpressRouteClient.NewAzureBGPPeering(ServiceKey, AdvertisedPublicPrefixes, CustomerAsn, PeerAsn,
64-
PrimaryPeerSubnet, RoutingRegistryName, SecondaryPeerSubnet, VlanId, AccessType, SharedKey);
67+
PrimaryPeerSubnet, RoutingRegistryName, SecondaryPeerSubnet, VlanId, AccessType, SharedKey, Convert.ToUInt32(LegacyMode));
6568
WriteObject(route);
6669
}
6770
}
71+
72+
public enum LegacyMode
73+
{
74+
False = 0,
75+
True = 1
76+
}
6877
}

src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@
8888
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
8989
</Reference>
9090
<Reference Include="Microsoft.WindowsAzure.Management.ExpressRoute">
91-
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.ExpressRoute.0.20.0-preview\lib\net40\Microsoft.WindowsAzure.Management.ExpressRoute.dll</HintPath>
91+
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.ExpressRoute.0.21.0-preview\lib\net40\Microsoft.WindowsAzure.Management.ExpressRoute.dll</HintPath>
9292
<Private>True</Private>
9393
</Reference>
94-
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
94+
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
9595
<SpecificVersion>False</SpecificVersion>
9696
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
9797
</Reference>
@@ -194,4 +194,4 @@
194194
</ItemGroup>
195195
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
196196
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
197-
</Project>
197+
</Project>

src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,20 @@ public AzureBgpPeering GetAzureBGPPeering(Guid serviceKey, BgpPeeringAccessType
7979
return Client.BorderGatewayProtocolPeerings.Get(serviceKey.ToString(), accessType).BgpPeering;
8080
}
8181

82-
public AzureBgpPeering NewAzureBGPPeering(Guid serviceKey, string advertisedPublicPrefixes, UInt32 customerAsn, UInt32 peerAsn, string primaryPeerSubnet,
83-
string routingRegistryName, string secondaryPeerSubnet, UInt32 vlanId, BgpPeeringAccessType accessType, string sharedKey = null)
82+
public AzureBgpPeering NewAzureBGPPeering(Guid serviceKey, string advertisedPublicPrefixes, UInt32 customerAsn, UInt32 peerAsn,string primaryPeerSubnet,
83+
string routingRegistryName, string secondaryPeerSubnet, UInt32 vlanId, BgpPeeringAccessType accessType, string sharedKey = null, UInt32 legacyMode = 0)
8484
{
8585
var result = Client.BorderGatewayProtocolPeerings.New(serviceKey.ToString(), accessType, new BorderGatewayProtocolPeeringNewParameters()
8686
{
8787
AdvertisedPublicPrefixes = advertisedPublicPrefixes,
8888
CustomerAutonomousSystemNumber = customerAsn,
89+
LegacyMode = legacyMode,
8990
PeerAutonomousSystemNumber = peerAsn,
9091
PrimaryPeerSubnet = primaryPeerSubnet,
9192
RoutingRegistryName = routingRegistryName,
9293
SecondaryPeerSubnet = secondaryPeerSubnet,
9394
SharedKey = sharedKey,
94-
VirtualLanId = vlanId
95+
VirtualLanId = vlanId,
9596
});
9697

9798
if (result.HttpStatusCode.Equals(HttpStatusCode.OK))

src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
<package id="Microsoft.Rest.ClientRuntime" version="2.3.5" targetFramework="net45" />
1313
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.2.9-preview" targetFramework="net45" />
1414
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
15-
<package id="Microsoft.WindowsAzure.Management.ExpressRoute" version="0.20.0-preview" targetFramework="net45" />
15+
<package id="Microsoft.WindowsAzure.Management.ExpressRoute" version="0.21.0-preview" targetFramework="net45" />
1616
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
1717
</packages>

0 commit comments

Comments
 (0)