Skip to content

Commit 6527d55

Browse files
committed
Fixed commandlet issues, test script & re-recorded failing tests.
1 parent 62150c7 commit 6527d55

File tree

7 files changed

+1576
-3898
lines changed

7 files changed

+1576
-3898
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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 -BillingType MeteredData UnlimitedData -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/ExpressRouteCircuit/NewAzureExpressRouteCircuitCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ private PSExpressRouteCircuit CreateExpressRouteCircuit()
170170
this.ExpressRouteCircuitClient.CreateOrUpdate(this.ResourceGroupName, this.Name, circuitModel);
171171

172172
var getExpressRouteCircuit = this.GetExpressRouteCircuit(this.ResourceGroupName, this.Name);
173-
173+
getExpressRouteCircuit.BillingType = this.BillingType;
174174
return getExpressRouteCircuit;
175175
}
176176
}

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/VirtualNetworkGateway/NewAzureVirtualNetworkGatewayCommand.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,6 @@ 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 = "SetByResourceId",
88-
HelpMessage = "GatewayDefaultSiteId")]
89-
public string GatewayDefaultSiteId { get; set; }
90-
9184
[Parameter(
9285
Mandatory = false,
9386
ValueFromPipelineByPropertyName = true,
@@ -148,13 +141,12 @@ private PSVirtualNetworkGateway CreateVirtualNetworkGateway()
148141

149142
if (this.GatewayDefaultSite != null)
150143
{
151-
this.GatewayDefaultSiteId = this.GatewayDefaultSite.Id;
144+
vnetGateway.GatewayDefaultSite = new PSResourceId();
145+
vnetGateway.GatewayDefaultSite.Id = this.GatewayDefaultSite.Id;
152146
}
153-
154-
if (!string.IsNullOrEmpty(this.GatewayDefaultSiteId))
147+
else
155148
{
156-
vnetGateway.GatewayDefaultSite = new PSResourceId();
157-
vnetGateway.GatewayDefaultSite.Id = this.GatewayDefaultSiteId;
149+
vnetGateway.GatewayDefaultSite = null;
158150
}
159151

160152
// Map to the sdk object

0 commit comments

Comments
 (0)