Working with Subflows

A subflow is a sequence of runbook nodes that executes a discrete runbook activity and that can be saved as an independent reusable component. Subflows enable you to implement a common runbook operation once and reuse it in multiple runbooks where it's useful. You can also use the same subflow multiple times in a single runbook.

Create a Subflow

To create a new subflow:

  1. Navigate to the Subflows Page:

    1. Click the Waffle Icon.

    2. Click AI Ops > Automations.

    3. In the Management page, click the Hamburger Icon, then click Subflows.

  2. Click New. This action opens the Subflow Editor, which is similar to the Runbook Editor.

The Subflow Editor does not include Trigger nodes, Impact Statement nodes, or Visualization nodes in the Node palette, as these are not used in subflows.

Subflows cannot be created while editing a runbook. If you anticipate using a subflow in a runbook, make sure that the subflow exists beforehand, so you can add its node to the runbook.

Every subflow must begin with a single Subflow Input node. When you create a new subflow, a Subflow Input node is added automatically to the canvas. You must add at least one Subflow Output node to complete the subflow definition.

Subflow Inputs

The Subflow Input node defines which data and variables the subflow receives from the parent runbook. Configure the Subflow Input node to specify:

  • Starting Entity: The object type (such as Application, Device, or Interface) which will be passed to the subflow from the runbook. This field is optional, but providing it gives the subflow the context it needs to execute.

  • Context Values Received From Caller: The names of subflow scope variables that will receive values from the parent runbook. Each variable must be defined separately in the Variable Definition Editor before it can be used here. When the subflow is placed in a runbook, these variables will be listed in the subflow node editor, and each will require a value to be supplied.

  • Context Values Sent Back To Caller: The names of subflow scope variables that will pass values back to the parent runbook. These variables must also be defined in the Variable Definition Editor. When the subflow is placed in a runbook, these variables will be listed in the subflow node editor's Output tab, where you can map them to variables in the runbook.

For more information about configuring the Subflow Input node, see Subflow Input.

Subflow Outputs

The Subflow Output node defines where the subflow's output is generated. You may have multiple Subflow Output nodes in a subflow, but they should be in branches that are mutually exclusive and of the same type. If your subflow has multiple execution branches, you may add a Subflow Output node to the end of each branch.

For more information about the Subflow Output node, see Subflow Output.

Using Subflows in Runbooks

To add a subflow to a runbook, select an existing subflow node from the Subflows category in the Node palette and drag it to the desired place on the Runbook canvas. The subflow must be connected between nodes in the runbook flow. The Subflow Input node connects to a node that precedes the subflow, and the Subflow Output node connects to a node that follows the subflow.

If the subflow definition is not valid for the nodes that you try to attach to, Riverbed IQ Ops will notify you that the subflow cannot be connected.

After adding a subflow to a runbook, configure it by selecting the subflow node and editing its properties:

  • Input tab: Supply values for the subflow input variables that were defined in the Subflow Input node's "Context Values Received From Caller" section. You can set these to specific values or map them from runtime or incident variables in the runbook.

  • Output tab: Map the subflow output variables (defined in the Subflow Input node's "Context Values Sent Back To Caller" section) to runtime or incident variables in the runbook. This makes the subflow's output data available for use in subsequent nodes in the runbook.

A runbook can contain multiple subflows. You can use multiple instances of the same subflow in a single runbook, or you can use multiple different subflows. Each subflow instance is configured independently, allowing you to pass different input values and map outputs to different runbook variables.

In addition, you can add user defined subflows to a runbook or built-in subflows such as skills for Riverbed IQ Ops or part of an integration such as Aternity.

Subflow Variables

Subflow variables are variables that have a subflow scope. These variables are persistent within a subflow execution. While subflow variables themselves are not directly accessible from the parent runbook, their values can be passed between the subflow and its parent runbook through the Input and Output tab mappings configured in the subflow node.

To create subflow variables, open the Variable Definition Editor in the Subflow Editor and click Add Subflow Variable, then choose the variable type from the pop-up menu.

Subflow variables are named with the "subflow." prefix automatically whenever they are displayed or used outside the Variable Definition Editor. For example, a variable named "appNameIn" in the Subflow scope will be referenced as "subflow.appNameIn" when used in node configurations or templates.

Subflow variables serve multiple purposes:

  • Input variables: Variables listed in the Subflow Input node's "Context Values Received From Caller" section receive values from the parent runbook when the subflow is called.

  • Output variables: Variables listed in the Subflow Input node's "Context Values Sent Back To Caller" section pass values back to the parent runbook when the subflow completes execution.

  • Temporary variables: Subflow variables can also be used inside the subflow as temporary variables to store intermediate values during subflow execution.

Subflow variables are not visible outside of the subflow. They exist only within the subflow's execution scope and cannot be accessed from the parent runbook or other subflows.

If multiple instances of the same subflow are used in a runbook, each instance maintains its own independent set of subflow variables. The variables in one instance are completely separate from the variables in another instance, even if they share the same subflow definition.

For more information about variable scopes, see Variable Scopes.

Subflow Constraints

  • A subflow cannot contain another subflow. Subflows can only be used within runbooks, not within other subflows.

  • Subflows cannot be created while editing a runbook. You must create subflows beforehand on the Subflows page before you can add them to a runbook.