Skip to content

Commit 30ac17a

Browse files
committed
address comments
1 parent 7294233 commit 30ac17a

File tree

3 files changed

+41
-59
lines changed

3 files changed

+41
-59
lines changed

src/ResourceManager/Network/Commands.Network/ExpressRouteCircuit/Stats/GetAzureExpressRouteCircuitARPTableCommand.cs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ namespace Microsoft.Azure.Commands.Network
2727
{
2828
public enum DevicePathEnum
2929
{
30-
primary,
31-
secondary
30+
Primary,
31+
Secondary
3232
}
3333

3434
[Cmdlet(VerbsCommon.Get, "AzureRmExpressRouteCircuitARPTable"),OutputType(typeof(PSExpressRouteCircuitArpTable))]
@@ -69,25 +69,21 @@ public class GetAzureExpressRouteCircuitARPTableCommand : NetworkBaseCmdlet
6969
[Parameter(
7070
Mandatory = true,
7171
HelpMessage = "The DevicePath, can be either Primary or Secondary")]
72-
[ValidateNotNullOrEmpty]
73-
public string DevicePath { get; set; }
72+
[ValidateNotNullOrEmpty]
73+
public DevicePathEnum DevicePath { get; set; }
7474

7575
public override void ExecuteCmdlet()
7676
{
7777
base.ExecuteCmdlet();
78-
DevicePathEnum path;
79-
if (Enum.TryParse(DevicePath, true, out path))
80-
{
81-
var arpTables = this.NetworkClient.NetworkManagementClient.ExpressRouteCircuits.ListArpTable
82-
(ResourceGroupName, ExpressRouteCircuitName, PeeringType, DevicePath).Value.Cast<object>().ToList();
83-
var psARPs = new List<PSExpressRouteCircuitArpTable>();
84-
foreach (var arpTable in arpTables)
85-
{
86-
var psARP = Mapper.Map<PSExpressRouteCircuitArpTable>(arpTable);
87-
psARPs.Add(psARP);
88-
}
89-
WriteObject(psARPs, true);
90-
}
78+
var arpTables = this.NetworkClient.NetworkManagementClient.ExpressRouteCircuits.ListArpTable
79+
(ResourceGroupName, ExpressRouteCircuitName, PeeringType, DevicePath.ToString()).Value.Cast<object>().ToList();
80+
var psARPs = new List<PSExpressRouteCircuitArpTable>();
81+
foreach (var arpTable in arpTables)
82+
{
83+
var psARP = Mapper.Map<PSExpressRouteCircuitArpTable>(arpTable);
84+
psARPs.Add(psARP);
85+
}
86+
WriteObject(psARPs, true);
9187
}
9288
}
9389

src/ResourceManager/Network/Commands.Network/ExpressRouteCircuit/Stats/GetAzureExpressRouteCircuitRouteTableCommand.cs

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@
2424
using System.Linq;
2525

2626
namespace Microsoft.Azure.Commands.Network
27-
{
28-
29-
30-
31-
27+
{
3228
[Cmdlet(VerbsCommon.Get, "AzureRmExpressRouteCircuitRouteTable"),OutputType(typeof(PSExpressRouteCircuitRoutesTable))]
3329
public class GetAzureRmExpressRouteCircuitRouteTable : NetworkBaseCmdlet
3430
{
@@ -62,30 +58,26 @@ public class GetAzureRmExpressRouteCircuitRouteTable : NetworkBaseCmdlet
6258
MNM.ExpressRouteCircuitPeeringType.AzurePublicPeering,
6359
MNM.ExpressRouteCircuitPeeringType.MicrosoftPeering,
6460
IgnoreCase = true)]
65-
public string PeeringType { get; set; }
66-
67-
[Parameter(
68-
Mandatory = true,
69-
HelpMessage = "The DevicePath, can be either Primary or Secondary")]
70-
[ValidateNotNullOrEmpty]
71-
public string DevicePath { get; set; }
61+
public string PeeringType { get; set; }
62+
63+
[Parameter(
64+
Mandatory = true,
65+
HelpMessage = "The DevicePath, can be either Primary or Secondary")]
66+
[ValidateNotNullOrEmpty]
67+
public DevicePathEnum DevicePath { get; set; }
7268

7369
public override void ExecuteCmdlet()
7470
{
75-
base.ExecuteCmdlet();
76-
DevicePathEnum path;
77-
if (Enum.TryParse(DevicePath, true, out path))
78-
{
79-
var routeTables = this.NetworkClient.NetworkManagementClient.ExpressRouteCircuits.ListRoutesTable
80-
(ResourceGroupName, ExpressRouteCircuitName, PeeringType, DevicePath).Value.Cast<object>().ToList();
81-
var psRoutes = new List<PSExpressRouteCircuitRoutesTable>();
82-
foreach (var routeTable in routeTables)
83-
{
84-
var psRoute = Mapper.Map<PSExpressRouteCircuitRoutesTable>(routeTable);
85-
psRoutes.Add(psRoute);
86-
}
87-
WriteObject(psRoutes, true);
88-
}
71+
base.ExecuteCmdlet();
72+
var routeTables = this.NetworkClient.NetworkManagementClient.ExpressRouteCircuits.ListRoutesTable
73+
(ResourceGroupName, ExpressRouteCircuitName, PeeringType, DevicePath.ToString()).Value.Cast<object>().ToList();
74+
var psRoutes = new List<PSExpressRouteCircuitRoutesTable>();
75+
foreach (var routeTable in routeTables)
76+
{
77+
var psRoute = Mapper.Map<PSExpressRouteCircuitRoutesTable>(routeTable);
78+
psRoutes.Add(psRoute);
79+
}
80+
WriteObject(psRoutes, true);
8981
}
9082
}
9183

src/ResourceManager/Network/Commands.Network/ExpressRouteCircuit/Stats/GetAzureExpressRouteCircuitRouteTableSummaryCommand.cs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
namespace Microsoft.Azure.Commands.Network
2727
{
28-
29-
3028
[Cmdlet(VerbsCommon.Get, "AzureRmExpressRouteCircuitRouteTableSummary"), OutputType(typeof(PSExpressRouteCircuitRoutesTableSummary))]
3129
public class GetAzureRmExpressRouteCircuitRouteTableSummaryCommand : NetworkBaseCmdlet
3230
{
@@ -63,27 +61,23 @@ public class GetAzureRmExpressRouteCircuitRouteTableSummaryCommand : NetworkBase
6361
public string PeeringType { get; set; }
6462

6563
[Parameter(
66-
Mandatory = true,
67-
HelpMessage = "The DevicePath, can be either Primary or Secondary")]
64+
Mandatory = true,
65+
HelpMessage = "The DevicePath, can be either Primary or Secondary")]
6866
[ValidateNotNullOrEmpty]
69-
public string DevicePath { get; set; }
67+
public DevicePathEnum DevicePath { get; set; }
7068

7169
public override void ExecuteCmdlet()
7270
{
7371
base.ExecuteCmdlet();
74-
DevicePathEnum path;
75-
if (Enum.TryParse(DevicePath, true, out path))
72+
var arpTables = this.NetworkClient.NetworkManagementClient.ExpressRouteCircuits.ListRoutesTableSummary
73+
(ResourceGroupName, ExpressRouteCircuitName, PeeringType, DevicePath.ToString()).Value.Cast<object>().ToList();
74+
var psARPs = new List<PSExpressRouteCircuitRoutesTableSummary>();
75+
foreach (var arpTable in arpTables)
7676
{
77-
var arpTables = this.NetworkClient.NetworkManagementClient.ExpressRouteCircuits.ListRoutesTableSummary
78-
(ResourceGroupName, ExpressRouteCircuitName, PeeringType, DevicePath).Value.Cast<object>().ToList();
79-
var psARPs = new List<PSExpressRouteCircuitRoutesTableSummary>();
80-
foreach (var arpTable in arpTables)
81-
{
82-
var psARP = Mapper.Map<PSExpressRouteCircuitRoutesTableSummary>(arpTable);
83-
psARPs.Add(psARP);
84-
}
85-
WriteObject(psARPs, true);
77+
var psARP = Mapper.Map<PSExpressRouteCircuitRoutesTableSummary>(arpTable);
78+
psARPs.Add(psARP);
8679
}
80+
WriteObject(psARPs, true);
8781
}
8882
}
8983

0 commit comments

Comments
 (0)