Skip to content

Parameters & Interpolation

Workflows use JMESPath expressions enclosed in double curly braces ({{ ... }}) to make steps dynamic. Parameters can reference the execution context, workflow parameters, and results from previous steps.

Workflow Parameters

Define what inputs your workflow accepts using parameterSchema (standard JSON Schema):

parameterSchema:
  type: object
  properties:
    subnet:
      type: string
      description: "Subnet to scan (CIDR notation)"
    community:
      type: string
      description: "SNMP community string"
  required:
    - subnet

When executing the workflow, pass parameter values:

{
  "workflow": "wf.example.neops.io/device_discovery:1.0.0",
  "executeOnParameters": {},
  "parameters": { "subnet": "10.0.1.0/24", "community": "public" }
}

Access them in steps via {{ parameters.<name> }}:

  - type: functionBlock
    label: get_version
    functionBlock: "fb.examples.neops.io/show_version:1.0.0"
    runOn: device

Interpolation Sources

Every {{ expression }} is evaluated as a JMESPath query against the execution context. The context contains:

Path Description Example
parameters.* User-provided execution parameters {{ parameters.timeout }}
context.device.* Current device data {{ context.device.hostname }}
context.device.facts.* Device facts from CMS {{ context.device.facts.version }}
context.device.platform.* Platform info {{ context.device.platform.shortName }}
context.interface.* Current interface data {{ context.interface.name }}
context.device_group.* Current group data {{ context.device_group.name }}
<step_label>.result.* Result from a previous step {{ ping.result.data.reachable }}
<step_label>.result.success Whether a step succeeded {{ ping.result.success }}

Accessing Previous Step Results

Each step's result is stored under its label. If a step labeled check_reachability returns { "data": { "reachable": true, "latency": 5 } }:

parameters:
  is_reachable: "{{ check_reachability.result.data.reachable }}"
  latency_ms: "{{ check_reachability.result.data.latency }}"

JMESPath Functions

JMESPath supports built-in functions for filtering, transforming, and testing data:

condition:
  type: jmes
  # Check if any interface is in DOWN state
  jmes: "{{ length(context.interfaces[?state == 'DOWN']) > `0` }}"

Common functions: length(), contains(), starts_with(), type(), keys(), values(), sort(), join(). See the JMESPath specification for the full list.

Raw Parameters

Use rawParameters when you need literal strings that contain {{ }} (e.g., Jinja templates):

parameters:
  hostname: "{{ context.device.hostname }}"     # interpolated at runtime
rawParameters:
  jinja_template: "hostname {{ hostname }}"      # literal, not interpolated

rawParameters are merged with parameters. If a key exists in both, rawParameters takes precedence.

This is essential when your function block receives a Jinja template or JMESPath expression as a parameter value -- you want the curly braces passed through as-is, not evaluated by the engine.


See also: