Class EquinixIXMapping

java.lang.Object
com.eqixiac.equinix.design.peering.model.EquinixIXMapping

public class EquinixIXMapping extends Object
Bridges PeeringDB Equinix IX and facility IDs to Equinix Fabric MetroId values entirely from live data - no hardcoded city table.

Equinix names every IBX (facility) with its metro as a prefix - LA3/LA4 are in Los Angeles, SV5 in Silicon Valley, DC11 in Ashburn. So a facility is resolved by reading the IBX code out of its PeeringDB name and looking it up in the live IBX→metro map supplied at construction (built from fabric.metros().getIbxs()); an exact IBX hit wins, and the metro prefix is a fallback (accepted only when it names a metro present in the live map, so a brand-new metro resolves while a stray token does not). Each resolved facility also seeds a city→metro map, through which IXes - which carry only a city - resolve. This means even city aliases (a "San Jose" exchange co-located with the Silicon Valley SV facilities) map correctly, with no static table and without depending on coordinates.

Because the bridge is keyed by MetroId (not the MetroCode enum), a metro that is live in Fabric but not yet in the enum still resolves and stays distinct.

Call mapFacilities(Map) before mapIxes(Map) (the IX bridge depends on the facility pass).

Author:
ianjones
See Also:
  • Constructor Details

    • EquinixIXMapping

      public EquinixIXMapping(Map<String,MetroId> ibxToMetro)
      Parameters:
      ibxToMetro - live IBX-code → metro map (upper-cased keys), typically built from fabric.metros() and each metro's getIbxs(). A null map yields an empty bridge.
    • EquinixIXMapping

      public EquinixIXMapping(Map<String,MetroId> ibxToMetro, Collection<MetroId> liveMetros)
      Parameters:
      ibxToMetro - live IBX-code → metro map, may be empty
      liveMetros - every metro the live fabric.metros() catalogue returned. These gate the IBX-prefix fallback (DC1 → DC). The live /fabric/v4/metros response carries no per-metro IBX list (checked 2026-11-11), so without this set no PeeringDB facility could resolve.
  • Method Details

    • mapFacilities

      public void mapFacilities(Map<Integer, PeeringDbFacility> equinixFacs)
      Binds each Equinix facility to its metro by reading the IBX code out of the facility name, and seeds the city→metro map used by mapIxes(Map). Call this before mapIxes(Map).
      Parameters:
      equinixFacs - the Equinix facility map from PeeringDB (fac ID → facility metadata)
    • mapIxes

      public void mapIxes(Map<Integer, PeeringDbIx> equinixIxes)
      Binds each Equinix IX to a metro via the facility-derived city→metro map (IXes carry only a city, not an IBX code). Call mapFacilities(Map) first.
      Parameters:
      equinixIxes - the Equinix IX map from PeeringDB (IX ID → IX metadata)
    • resolveFromName

      public MetroId resolveFromName(String name)
      Reads an Equinix IBX code out of a name (e.g. "Equinix LA4 - Los Angeles") and resolves it to a metro: an exact match against the live IBX→metro map wins; otherwise the IBX's metro-code prefix is tried, accepted only when that prefix names a metro present in the live map.
      Parameters:
      name - a PeeringDB facility name (or aka)
      Returns:
      the resolved metro, or null if the name carries no recognizable IBX code
    • metroForIx

      public MetroId metroForIx(int ixId)
      Parameters:
      ixId - the PeeringDB IX ID
      Returns:
      the mapped MetroId, or null if unmapped
    • metroForFacility

      public MetroId metroForFacility(int facId)
      Parameters:
      facId - the PeeringDB facility ID
      Returns:
      the mapped MetroId, or null if unmapped
    • ixIdsForMetro

      public List<Integer> ixIdsForMetro(MetroId metro)
      Parameters:
      metro - the Equinix metro
      Returns:
      the PeeringDB IX IDs in that metro, or an empty list
    • facIdsForMetro

      public List<Integer> facIdsForMetro(MetroId metro)
      Parameters:
      metro - the Equinix metro
      Returns:
      the PeeringDB facility IDs in that metro, or an empty list
    • metrosWithIx

      public Set<MetroId> metrosWithIx()
      Returns:
      the metros with at least one mapped IX (unmodifiable)
    • metrosWithFacilities

      public Set<MetroId> metrosWithFacilities()
      Returns:
      the metros with at least one mapped facility (unmodifiable)