public override void ExecuteCmdlet()
        {
            if(string.IsNullOrEmpty(AccessType))
            {
                AzureDedicatedCircuitStats stats = new AzureDedicatedCircuitStats
                                                       {
                                                           PrimaryBytesIn = (ulong)0,
                                                           PrimaryBytesOut = (ulong)0,
                                                           SecondaryBytesIn = (ulong)0,
                                                           SecondaryBytesOut = (ulong)0
                                                       };
                stats = compute(stats, ServiceKey, BgpPeeringAccessType.Private);
                stats = compute(stats, ServiceKey, BgpPeeringAccessType.Public);
                stats = compute(stats, ServiceKey, BgpPeeringAccessType.Microsoft);

                WriteObject(stats);

            }
            BgpPeeringAccessType type;
            if (BgpPeeringAccessType.TryParse(AccessType, true, out type))
            {
                var stats = ExpressRouteClient.GetAzureDedicatedCircuitStatsInfo(ServiceKey, type);
                WriteObject(stats);
            }
        }
 private AzureDedicatedCircuitStats compute(AzureDedicatedCircuitStats stats, Guid key, BgpPeeringAccessType type)
 {
     var tempstats = ExpressRouteClient.GetAzureDedicatedCircuitStatsInfo(key,type);
     stats.PrimaryBytesIn += tempstats.PrimaryBytesIn;
     stats.PrimaryBytesOut += tempstats.PrimaryBytesOut;
     stats.SecondaryBytesIn += tempstats.SecondaryBytesIn;
     stats.SecondaryBytesOut += tempstats.SecondaryBytesOut;
     return stats;
 }
 private AzureDedicatedCircuitStats compute(AzureDedicatedCircuitStats stats, Guid key, BgpPeeringAccessType type)
 {
     try
     {
         AzureBgpPeering peering = ExpressRouteClient.GetAzureBGPPeering(ServiceKey, type);
         if (peering != null)
         {
             var tempstats = ExpressRouteClient.GetAzureDedicatedCircuitStatsInfo(key, type);
             stats.PrimaryBytesIn += tempstats.PrimaryBytesIn;
             stats.PrimaryBytesOut += tempstats.PrimaryBytesOut;
             stats.SecondaryBytesIn += tempstats.SecondaryBytesIn;
             stats.SecondaryBytesOut += tempstats.SecondaryBytesOut;
         }
         return stats;
     }
     catch
     {
         // The cirucit might not have corresponding peering
         return stats;
     }
 }