Class TopologyDiagram

java.lang.Object
com.eqixiac.equinix.design.export.TopologyDiagram

public class TopologyDiagram extends Object
Renders deployment topologies as Mermaid graph text. Mermaid renders natively on GitHub, GitLab, and many docs platforms, so the output is a portable, version-controllable diagram.

For a DeploymentPlan, each metro becomes a subgraph containing its Cloud Router(s); provider connections are drawn as edges from a router to an external provider node, and backbone links as edges between routers in different metros. For an OptimizationResult, metros are nodes annotated with their rank and score, optionally grouping the workloads placed in each metro.

Beta. A native multicloud link on the plan (DeploymentPlan.multicloudLinksOrEmpty()) is drawn as a dashed bidirectional edge (<-.->) between the two cloud nodes, never through a Cloud Router. Its label is native multicloud (outside Fabric) followed by a second line with the bandwidth in Mbps (the covering size, or the requested bandwidth when none covers it), the environment status and the role. Each end attaches to the provider node already drawn for a connection to the same cloud and region; when the plan has none (a REPLACEMENT link whose connections were omitted, or a link matched on a different region) a cloud node labeled with the provider name and region is added. An UNAVAILABLE entry is not drawn: no link can be created for it. A plan without links produces the same diagram as before links existed.

Node and edge labels are HTML-escaped (&, <, > and double quotes), so metro, router, provider, region and workload names containing markup-significant characters render literally instead of being interpreted by Mermaid's HTML label parser.

This class is stateless and thread-safe.

  • Constructor Details

    • TopologyDiagram

      public TopologyDiagram()
  • Method Details

    • toMermaid

      public String toMermaid(DeploymentPlan plan)
      Renders the deployment plan as a Mermaid graph LR diagram.
      Parameters:
      plan - the deployment plan to diagram; must not be null
      Returns:
      Mermaid source describing metros, Cloud Routers, provider connections and backbone links
      Throws:
      IllegalArgumentException - if plan is null
    • toMermaid

      public String toMermaid(OptimizationResult result)
      Renders an optimization result as a Mermaid graph TD diagram: each recommended metro is a node annotated with its rank and composite score, and any workloads placed in that metro (from the deployment topology) are shown as child nodes connected to their metro.
      Parameters:
      result - the optimization result to diagram; must not be null
      Returns:
      Mermaid source describing recommended metros and workload placements
      Throws:
      IllegalArgumentException - if result is null