Skip to content

Commit 0881e5d

Browse files
committed
Merge pull request Azure#1230 from Nilambari/release-1.0.0
Networking Hybrid team minor but important PS changes
2 parents aa07ccc + a44b3aa commit 0881e5d

File tree

22 files changed

+1798
-3925
lines changed

22 files changed

+1798
-3925
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6868
</Reference>
6969
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
70-
<SpecificVersion>False</SpecificVersion>
71-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.13-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
70+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.15-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
71+
<Private>True</Private>
7272
</Reference>
7373
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7474
<SpecificVersion>False</SpecificVersion>

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function Test-ExpressRouteCircuitCRUD
3131
$resourceGroup = New-AzureRmResourceGroup -Name $rgname -Location $rglocation
3232

3333
# Create the ExpressRouteCircuit
34-
$circuit = New-AzureRmExpressRouteCircuit -Name $circuitName -Location $location -ResourceGroupName $rgname -SkuTier Standard -SkuFamily MeteredData -ServiceProviderName "equinix" -PeeringLocation "Silicon Valley" -BandwidthInMbps 1000;
34+
$circuit = New-AzureRmExpressRouteCircuit -Name $circuitName -Location $location -ResourceGroupName $rgname -SkuTier Standard -SkuFamily MeteredData -BillingType MeteredData -ServiceProviderName "equinix" -PeeringLocation "Silicon Valley" -BandwidthInMbps 1000;
3535

3636
# get Circuit
3737
$getCircuit = Get-AzureRmExpressRouteCircuit -Name $circuitName -ResourceGroupName $rgname
@@ -61,7 +61,7 @@ function Test-ExpressRouteCircuitCRUD
6161
# set
6262
$getCircuit.ServiceProviderProperties.BandwidthInMbps = 500
6363

64-
$getCircuit = $getCircuit | Set-AzureRmExpressRouteCircuit
64+
$getCircuit = Set-AzureRmExpressRouteCircuit -ExpressRouteCircuit $getCircuit -BillingType UnlimitedData
6565
Assert-AreEqual $rgName $getCircuit.ResourceGroupName
6666
Assert-AreEqual $circuitName $getCircuit.Name
6767
Assert-NotNull $getCircuit.Location
@@ -108,7 +108,7 @@ function Test-ExpressRouteCircuitPeeringCRUD
108108

109109
# Create the ExpressRouteCircuit with peering
110110
$peering = New-AzureRmExpressRouteCircuitPeeringConfig -Name AzurePrivatePeering -PeeringType AzurePrivatePeering -PeerASN 100 -PrimaryPeerAddressPrefix "192.168.1.0/30" -SecondaryPeerAddressPrefix "192.168.2.0/30" -VlanId 200
111-
$circuit = New-AzureRmExpressRouteCircuit -Name $circuitName -Location $location -ResourceGroupName $rgname -SkuTier Standard -SkuFamily MeteredData -ServiceProviderName "equinix" -PeeringLocation "Silicon Valley" -BandwidthInMbps 1000 -Peering $peering
111+
$circuit = New-AzureRmExpressRouteCircuit -Name $circuitName -Location $location -ResourceGroupName $rgname -SkuTier Standard -SkuFamily MeteredData -BillingType UnlimitedData -ServiceProviderName "equinix" -PeeringLocation "Silicon Valley" -BandwidthInMbps 1000 -Peering $peering
112112

113113
#verification
114114
Assert-AreEqual $rgName $circuit.ResourceGroupName
@@ -146,7 +146,7 @@ function Test-ExpressRouteCircuitPeeringCRUD
146146
Assert-AreEqual 1 @($listPeering).Count
147147

148148
# add a new Peering
149-
$circuit = Get-AzureRmExpressRouteCircuit -Name $circuitName -ResourceGroupName $rgname | Add-AzureRmExpressRouteCircuitPeeringConfig -Name MicrosoftPeering -PeeringType MicrosoftPeering -PeerASN 99 -PrimaryPeerAddressPrefix "192.168.1.0/30" -SecondaryPeerAddressPrefix "192.168.2.0/30" -VlanId 200 -MircosoftConfigAdvertisedPublicPrefixes @("11.2.3.4/30", "12.2.3.4/30") -MircosoftConfigCustomerAsn 1000 -MircosoftConfigRoutingRegistryName AFRINIC | Set-AzureRmExpressRouteCircuit
149+
$circuit = Get-AzureRmExpressRouteCircuit -Name $circuitName -ResourceGroupName $rgname | Add-AzureRmExpressRouteCircuitPeeringConfig -Name MicrosoftPeering -PeeringType MicrosoftPeering -PeerASN 99 -PrimaryPeerAddressPrefix "192.168.1.0/30" -SecondaryPeerAddressPrefix "192.168.2.0/30" -VlanId 200 -MircosoftConfigAdvertisedPublicPrefixes @("11.2.3.4/30", "12.2.3.4/30") -MircosoftConfigCustomerAsn 1000 -MircosoftConfigRoutingRegistryName AFRINIC | Set-AzureRmExpressRouteCircuit -BillingType UnlimitedData
150150

151151
$p = $circuit | Get-AzureRmExpressRouteCircuitPeeringConfig -Name MicrosoftPeering
152152
Assert-AreEqual "MicrosoftPeering" $p.Name
@@ -165,7 +165,7 @@ function Test-ExpressRouteCircuitPeeringCRUD
165165
Assert-AreEqual 2 @($listPeering).Count
166166

167167
# Set a new peering
168-
$circuit = Get-AzureRmExpressRouteCircuit -Name $circuitName -ResourceGroupName $rgname | Set-AzureRmExpressRouteCircuitPeeringConfig -Name MicrosoftPeering -PeeringType MicrosoftPeering -PeerASN 100 -PrimaryPeerAddressPrefix "192.168.1.0/30" -SecondaryPeerAddressPrefix "192.168.2.0/30" -VlanId 200 -MircosoftConfigAdvertisedPublicPrefixes @("11.2.3.4/30", "12.2.3.4/30") -MircosoftConfigCustomerAsn 1000 -MircosoftConfigRoutingRegistryName AFRINIC | Set-AzureRmExpressRouteCircuit
168+
$circuit = Get-AzureRmExpressRouteCircuit -Name $circuitName -ResourceGroupName $rgname | Set-AzureRmExpressRouteCircuitPeeringConfig -Name MicrosoftPeering -PeeringType MicrosoftPeering -PeerASN 100 -PrimaryPeerAddressPrefix "192.168.1.0/30" -SecondaryPeerAddressPrefix "192.168.2.0/30" -VlanId 200 -MircosoftConfigAdvertisedPublicPrefixes @("11.2.3.4/30", "12.2.3.4/30") -MircosoftConfigCustomerAsn 1000 -MircosoftConfigRoutingRegistryName AFRINIC | Set-AzureRmExpressRouteCircuit -BillingType UnlimitedData
169169
$p = $circuit | Get-AzureRmExpressRouteCircuitPeeringConfig -Name MicrosoftPeering
170170
Assert-AreEqual "MicrosoftPeering" $p.Name
171171
Assert-AreEqual "MicrosoftPeering" $p.PeeringType

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

Lines changed: 244 additions & 359 deletions
Large diffs are not rendered by default.

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

Lines changed: 328 additions & 988 deletions
Large diffs are not rendered by default.

src/ResourceManager/Network/Commands.Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayTests/TestVirtualNetworkGatewayCRUD.json

Lines changed: 984 additions & 2533 deletions
Large diffs are not rendered by default.

src/ResourceManager/Network/Commands.Network.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
88
<package id="Microsoft.Azure.Graph.RBAC" version="1.7.0-preview" targetFramework="net45" />
99
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
10-
<package id="Microsoft.Azure.Management.Network" version="2.0.13-preview" targetFramework="net45" />
10+
<package id="Microsoft.Azure.Management.Network" version="2.0.15-preview" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
1212
<package id="Microsoft.Azure.Test.Framework" version="1.0.5774.40163-prerelease" targetFramework="net45" />
1313
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.0.5774.40163-prerelease" targetFramework="net45" />

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@
7777
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
7878
</Reference>
7979
<Reference Include="Microsoft.Azure.Management.Network, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
80-
<SpecificVersion>False</SpecificVersion>
81-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.13-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
80+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.2.0.15-preview\lib\net40\Microsoft.Azure.Management.Network.dll</HintPath>
81+
<Private>True</Private>
8282
</Reference>
8383
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
8484
<SpecificVersion>False</SpecificVersion>
@@ -297,6 +297,8 @@
297297
<Compile Include="VirtualNetworkGateway\NewAzureVirtualNetworkGatewayIpConfigCommand.cs" />
298298
<Compile Include="VirtualNetworkGateway\RemoveAzureVirtualNetworkGatewayCommand.cs" />
299299
<Compile Include="VirtualNetworkGateway\ResetAzureVirtualNetworkGatewayCommand.cs" />
300+
<Compile Include="VirtualNetworkGateway\SetAzureVirtualNetworkGatewayDefaultSiteCommand.cs" />
301+
<Compile Include="VirtualNetworkGateway\RemoveAzureVirtualNetworkGatewayDefaultSiteCommand.cs" />
300302
<Compile Include="LocalNetworkGateway\LocalNetworkGatewayBaseCmdlet.cs" />
301303
<Compile Include="LocalNetworkGateway\RemoveAzureLocalNetworkGatewayCommand.cs" />
302304
<Compile Include="LocalNetworkGateway\GetAzureLocalNetworkGatewayCommand.cs" />

src/ResourceManager/Network/Commands.Network/ExpressRouteCircuit/NewAzureExpressRouteCircuitCommand.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,20 @@ public class NewAzureExpressRouteCircuitCommand : ExpressRouteCircuitBaseCmdlet
8484
public int BandwidthInMbps { get; set; }
8585

8686
[Parameter(
87-
Mandatory = false,
87+
Mandatory = false,
8888
ValueFromPipelineByPropertyName = true)]
8989
[ValidateNotNullOrEmpty]
9090
public List<PSPeering> Peering { get; set; }
9191

92+
[Parameter(
93+
Mandatory = true,
94+
ValueFromPipelineByPropertyName = true)]
95+
[ValidateSet(
96+
MNM.ExpressRouteCircuitBillingType.MeteredData,
97+
MNM.ExpressRouteCircuitBillingType.UnlimitedData,
98+
IgnoreCase = true)]
99+
public string BillingType { get; set; }
100+
92101
[Parameter(
93102
Mandatory = false,
94103
ValueFromPipelineByPropertyName = true,
@@ -129,7 +138,7 @@ private PSExpressRouteCircuit CreateExpressRouteCircuit()
129138
circuit.Name = this.Name;
130139
circuit.ResourceGroupName = this.ResourceGroupName;
131140
circuit.Location = this.Location;
132-
141+
133142
// Construct sku
134143
if (!string.IsNullOrEmpty(this.SkuTier))
135144
{
@@ -150,6 +159,7 @@ private PSExpressRouteCircuit CreateExpressRouteCircuit()
150159

151160
circuit.Peerings = new List<PSPeering>();
152161
circuit.Peerings = this.Peering;
162+
circuit.BillingType = this.BillingType;
153163

154164
// Map to the sdk object
155165
var circuitModel = Mapper.Map<MNM.ExpressRouteCircuit>(circuit);
@@ -160,7 +170,7 @@ private PSExpressRouteCircuit CreateExpressRouteCircuit()
160170
this.ExpressRouteCircuitClient.CreateOrUpdate(this.ResourceGroupName, this.Name, circuitModel);
161171

162172
var getExpressRouteCircuit = this.GetExpressRouteCircuit(this.ResourceGroupName, this.Name);
163-
173+
getExpressRouteCircuit.BillingType = this.BillingType;
164174
return getExpressRouteCircuit;
165175
}
166176
}

src/ResourceManager/Network/Commands.Network/ExpressRouteCircuit/SetAzureExpressRouteCircuitCommand.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ public class SetAzureExpressRouteCircuitCommand : ExpressRouteCircuitBaseCmdlet
3131
HelpMessage = "The ExpressRouteCircuit")]
3232
public PSExpressRouteCircuit ExpressRouteCircuit { get; set; }
3333

34+
[Parameter(
35+
Mandatory = true,
36+
ValueFromPipelineByPropertyName = true)]
37+
[ValidateSet(
38+
MNM.ExpressRouteCircuitBillingType.MeteredData,
39+
MNM.ExpressRouteCircuitBillingType.UnlimitedData,
40+
IgnoreCase = true)]
41+
public string BillingType { get; set; }
42+
3443
protected override void ProcessRecord()
3544
{
3645
base.ProcessRecord();
@@ -39,7 +48,8 @@ protected override void ProcessRecord()
3948
{
4049
throw new ArgumentException(Microsoft.Azure.Commands.Network.Properties.Resources.ResourceNotFound);
4150
}
42-
51+
ExpressRouteCircuit.BillingType = BillingType;
52+
4353
// Map to the sdk object
4454
var circuitModel = Mapper.Map<MNM.ExpressRouteCircuit>(this.ExpressRouteCircuit);
4555
circuitModel.Type = Microsoft.Azure.Commands.Network.Properties.Resources.ExpressRouteCircuitType;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public class PSExpressRouteCircuit : PSTopLevelResource
3434

3535
public PSExpressRouteCircuitSku Sku { get; set; }
3636

37+
public string BillingType { get; set; }
38+
3739
public string ProvisioningState { get; set; }
3840

3941
[JsonIgnore]
@@ -47,7 +49,7 @@ public string ServiceProviderPropertiesText
4749
{
4850
get { return JsonConvert.SerializeObject(ServiceProviderProperties, Formatting.Indented); }
4951
}
50-
52+
5153
[JsonIgnore]
5254
public string PeeringsText
5355
{

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,21 @@ public class PSVirtualNetworkGateway : PSTopLevelResource
2727
public string VpnType { get; set; }
2828

2929
public bool EnableBgp { get; set; }
30-
30+
31+
public PSResourceId GatewayDefaultSite { get; set; }
32+
3133
public string ProvisioningState { get; set; }
3234

3335
[JsonIgnore]
3436
public string IpConfigurationsText
3537
{
3638
get { return JsonConvert.SerializeObject(IpConfigurations, Formatting.Indented); }
3739
}
40+
41+
[JsonIgnore]
42+
public string GatewayDefaultSiteText
43+
{
44+
get { return JsonConvert.SerializeObject(GatewayDefaultSite, Formatting.Indented); }
45+
}
3846
}
3947
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ public class PSVirtualNetworkGatewayConnection : PSTopLevelResource
3232

3333
public string SharedKey { get; set; }
3434

35+
public string ConnectionStatus { get; set; }
36+
37+
public ulong EgressBytesTransferred { get; set; }
38+
39+
public ulong IngressBytesTransferred { get; set; }
40+
3541
[JsonIgnore]
3642
public string VirtualNetworkGateway1Text
3743
{

src/ResourceManager/Network/Commands.Network/VirtualNetworkGateway/NewAzureVirtualNetworkGatewayCommand.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ public class NewAzureVirtualNetworkGatewayCommand : VirtualNetworkGatewayBaseCmd
8181
HelpMessage = "EnableBgp Flag")]
8282
public bool EnableBgp { get; set; }
8383

84+
[Parameter(
85+
Mandatory = false,
86+
ValueFromPipelineByPropertyName = true,
87+
ParameterSetName = "SetByResource",
88+
HelpMessage = "GatewayDefaultSite")]
89+
public PSLocalNetworkGateway GatewayDefaultSite { get; set; }
90+
8491
[Parameter(
8592
Mandatory = false,
8693
ValueFromPipelineByPropertyName = true,
@@ -132,6 +139,16 @@ private PSVirtualNetworkGateway CreateVirtualNetworkGateway()
132139
vnetGateway.VpnType = this.VpnType;
133140
vnetGateway.EnableBgp = this.EnableBgp;
134141

142+
if (this.GatewayDefaultSite != null)
143+
{
144+
vnetGateway.GatewayDefaultSite = new PSResourceId();
145+
vnetGateway.GatewayDefaultSite.Id = this.GatewayDefaultSite.Id;
146+
}
147+
else
148+
{
149+
vnetGateway.GatewayDefaultSite = null;
150+
}
151+
135152
// Map to the sdk object
136153
var vnetGatewayModel = Mapper.Map<MNM.VirtualNetworkGateway>(vnetGateway);
137154
vnetGatewayModel.Type = Microsoft.Azure.Commands.Network.Properties.Resources.VirtualNetworkGatewayType;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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 System;
16+
using System.Management.Automation;
17+
using AutoMapper;
18+
using Microsoft.Azure.Management.Network;
19+
using Microsoft.Azure.Commands.Network.Models;
20+
using Microsoft.Azure.Commands.Resources.Models;
21+
using MNM = Microsoft.Azure.Management.Network.Models;
22+
using System.Collections;
23+
using Microsoft.Azure.Commands.Tags.Model;
24+
using System.Collections.Generic;
25+
26+
namespace Microsoft.Azure.Commands.Network
27+
{
28+
[Cmdlet(VerbsCommon.Remove, "AzureVirtualNetworkGatewayDefaultSite"), OutputType(typeof(PSVirtualNetworkGateway))]
29+
public class RemoveAzureVirtualNetworkGatewayDefaultSiteCommand : VirtualNetworkGatewayBaseCmdlet
30+
{
31+
[Parameter(
32+
Mandatory = true,
33+
ValueFromPipeline = true,
34+
HelpMessage = "The VirtualNetworkGateway")]
35+
public PSVirtualNetworkGateway VirtualNetworkGateway { get; set; }
36+
37+
protected override void ProcessRecord()
38+
{
39+
base.ProcessRecord();
40+
41+
if (!this.IsVirtualNetworkGatewayPresent(this.VirtualNetworkGateway.ResourceGroupName, this.VirtualNetworkGateway.Name))
42+
{
43+
throw new ArgumentException(Microsoft.Azure.Commands.Network.Properties.Resources.ResourceNotFound);
44+
}
45+
46+
//this.VirtualNetworkGateway.GatewayDefaultSite = new PSResourceId();
47+
//this.VirtualNetworkGateway.GatewayDefaultSite.Id = string.Empty;
48+
this.VirtualNetworkGateway.GatewayDefaultSite = null;
49+
50+
// Map to the sdk object
51+
var virtualnetGatewayModel = Mapper.Map<MNM.VirtualNetworkGateway>(this.VirtualNetworkGateway);
52+
virtualnetGatewayModel.Type = Microsoft.Azure.Commands.Network.Properties.Resources.VirtualNetworkGatewayType;
53+
virtualnetGatewayModel.Tags = TagsConversionHelper.CreateTagDictionary(this.VirtualNetworkGateway.Tag, validate: true);
54+
55+
this.VirtualNetworkGatewayClient.CreateOrUpdate(this.VirtualNetworkGateway.ResourceGroupName, this.VirtualNetworkGateway.Name, virtualnetGatewayModel);
56+
57+
var getvirtualnetGateway = this.GetVirtualNetworkGateway(this.VirtualNetworkGateway.ResourceGroupName, this.VirtualNetworkGateway.Name);
58+
59+
WriteObject(getvirtualnetGateway);
60+
}
61+
}
62+
}
63+

0 commit comments

Comments
 (0)