/// <summary>
 /// Given a string representation of a node group for a specific network
 /// location
 /// </summary>
 /// <param name="loc">a path-like string representation of a network location</param>
 /// <returns>a node group string</returns>
 public virtual string GetNodeGroup(string loc)
 {
     netlock.ReadLock().Lock();
     try
     {
         loc = NetworkTopology.InnerNode.Normalize(loc);
         Node locNode = GetNode(loc);
         if (locNode is NetworkTopologyWithNodeGroup.InnerNodeWithNodeGroup)
         {
             NetworkTopologyWithNodeGroup.InnerNodeWithNodeGroup node = (NetworkTopologyWithNodeGroup.InnerNodeWithNodeGroup
                                                                         )locNode;
             if (node.IsNodeGroup())
             {
                 return(loc);
             }
             else
             {
                 if (node.IsRack())
                 {
                     // not sure the node group for a rack
                     return(null);
                 }
                 else
                 {
                     // may be a leaf node
                     return(GetNodeGroup(node.GetNetworkLocation()));
                 }
             }
         }
         else
         {
             // not in cluster map, don't handle it
             return(loc);
         }
     }
     finally
     {
         netlock.ReadLock().Unlock();
     }
 }
 public override string GetRack(string loc)
 {
     netlock.ReadLock().Lock();
     try
     {
         loc = NetworkTopology.InnerNode.Normalize(loc);
         Node locNode = GetNode(loc);
         if (locNode is NetworkTopologyWithNodeGroup.InnerNodeWithNodeGroup)
         {
             NetworkTopologyWithNodeGroup.InnerNodeWithNodeGroup node = (NetworkTopologyWithNodeGroup.InnerNodeWithNodeGroup
                                                                         )locNode;
             if (node.IsRack())
             {
                 return(loc);
             }
             else
             {
                 if (node.IsNodeGroup())
                 {
                     return(node.GetNetworkLocation());
                 }
                 else
                 {
                     // may be a data center
                     return(null);
                 }
             }
         }
         else
         {
             // not in cluster map, don't handle it
             return(loc);
         }
     }
     finally
     {
         netlock.ReadLock().Unlock();
     }
 }