Class PlanExecutor

java.lang.Object
com.eqixiac.equinix.design.plan.PlanExecutor

public final class PlanExecutor extends Object
Executes and reconciles deployment plans. Every path that creates Fabric resources goes through this class, so one failure policy and one checkpoint discipline apply to all of them.

Order and pre-flight

Steps run in PlanSteps order: Cloud Routers, provider connections (PRIMARY before SECONDARY), backbone links, routing protocols (DIRECT before BGP). Before anything is created, every connection that will be created must have its cloud authorization key (from the plan or the ExecutionInputs); otherwise nothing is sent. Each connection is dry-run with its complete body (real A-side uuid, customer key, VLAN, marker) immediately before its real create: a rejection (HTTP 4xx validation) is a step failure; an infeasibility (401/403/429/5xx/transport, classified by PlanValidator.classifyLiveFailure(Throwable)) is recorded as a recoverable warning and the create proceeds.

Failure policy

A step fails when its create (or pre-flight) is rejected, when the resource lands in a terminal failure state, when it does not reach PROVISIONED within provisionTimeout, or when it cannot be attempted at all (a hand-built router with no package code). Every kind of step follows ExecutionOptions.getFailurePolicy(): FailurePolicy.ABORT_AND_ROLLBACK (default) stops and removes what this run created via PlanRollback; FailurePolicy.CONTINUE_ON_ERROR records the failure, skips the steps that depend on it (each reported SKIPPED with the reason) and carries on.

Checkpoints and resume

After every step the deployment's Checkpoint is saved to the CheckpointStore. A create is recorded the moment the API accepts it, before the state wait, so a run that dies while waiting resumes by waiting again instead of creating a duplicate. reconcile(DeploymentPlan, ExecutionInputs, ExecutionOptions, CheckpointStore) also reads live state first: a resource whose create was accepted but never recorded (the process died between the response and the checkpoint write) is found by its marker or name and adopted. Re-running a completed plan creates nothing.

  • Method Details

    • execute

      public static DeploymentOutcome execute(DeploymentPlan plan, ExecutionInputs inputs, ExecutionOptions options)
      Executes a plan from scratch: no live-state read, a fresh in-memory checkpoint. Use reconcile(DeploymentPlan, ExecutionInputs, ExecutionOptions, CheckpointStore) to make a run idempotent and resumable.
      Parameters:
      plan - a valid plan with a Fabric client bound
      inputs - the customer inputs; null means none
      options - execution options; null means defaults
      Returns:
      the outcome
      Throws:
      IllegalStateException - when the plan is invalid or has no Fabric client
    • reconcile

      public static DeploymentOutcome reconcile(DeploymentPlan plan, ExecutionInputs inputs, ExecutionOptions options, CheckpointStore store)
      Brings live state to the plan: reads live state, diffs it against the plan and the deployment's checkpoint, adopts what exists, creates only what is missing (in dependency order, checkpointing after every step) and, when options.isApplyUpdates(), patches the patchable fields of resources that differ. A re-run of a completed plan creates nothing.
      Parameters:
      plan - a valid plan with a Fabric client bound
      inputs - the customer inputs; null means none
      options - execution options; null means defaults
      store - where checkpoints are kept; null means a fresh in-memory store
      Returns:
      the outcome, including the step-by-step results
      Throws:
      IllegalStateException - when the plan is invalid or has no Fabric client
    • rollback

      public static RollbackReport rollback(DeploymentPlan plan, List<ProvisionedResource> created, ExecutionOptions options)
      Rolls back the resources an earlier outcome created, using the plan to learn which connections attach to which Cloud Router.
      Parameters:
      plan - the plan the outcome came from
      created - the outcome's resources, in creation order
      options - timeouts, poll interval and clock; null means defaults
      Returns:
      what was removed and what was left