Class PlanExecutor
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 Summary
Modifier and TypeMethodDescriptionstatic DeploymentOutcomeexecute(DeploymentPlan plan, ExecutionInputs inputs, ExecutionOptions options) Executes a plan from scratch: no live-state read, a fresh in-memory checkpoint.static DeploymentOutcomereconcile(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, whenoptions.isApplyUpdates(), patches the patchable fields of resources that differ.static RollbackReportrollback(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.
-
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. Usereconcile(DeploymentPlan, ExecutionInputs, ExecutionOptions, CheckpointStore)to make a run idempotent and resumable.- Parameters:
plan- a valid plan with a Fabric client boundinputs- the customer inputs;nullmeans noneoptions- execution options;nullmeans 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, whenoptions.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 boundinputs- the customer inputs;nullmeans noneoptions- execution options;nullmeans defaultsstore- where checkpoints are kept;nullmeans 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 fromcreated- the outcome's resources, in creation orderoptions- timeouts, poll interval and clock;nullmeans defaults- Returns:
- what was removed and what was left
-