Workflow with the if condition.

{
  "id":"using-variables-and-conditions",
  "name": "Example for showcasing Conditions",
  "description":"Sample Workflow to show use of Conditions - If Conditions",
  "version":"1.0",
  "startStep":"step1",
  "variables": [
    {"name":"vnfId", "type": "string"},
    {"name":"CONDITION_VARIABLE", "type": "string"}
  ],
  "input": [
    {"name": "USER", "description": "Username", "type": "string"},
    {"name": "PWD", "description": "Password", "type": "password"},
    {"name": "HOSTNAME", "description": "Hostname", "type": "string"},
    {"name": "SCRIPT_ARG", "description": "Script Argument", "type": "string"}
  ],
  "output": [
    {"name":"FINAL_OUTPUT", "description": "Final Output", "type": "string"}
  ],
  "steps":[
    {
      "stepId":"step1",
      "workflow":"RUN_SSH_COMMAND_IN_GUEST",
      "namespace": "nfv",
      "type":"decision",
      "description": "Step 1 - Make Decision",
      "inBinding":[
        {"name": "username", "type": "string", "exportName": "USER"},
        {"name": "password", "type": "password", "exportName": "PWD"},
        {"name": "port", "type": "number", "default": "22"},
        {"name": "cmd", "type": "string", "default": "/opt/script-1.sh {{SCRIPT_ARG}}"},
        {"name": "encoding", "type": "string", "default": " "},
        {"name": "hostNameOrIP", "type": "string", "exportName": "HOSTNAME"},
        {"name": "passwordAuthentication", "type": "boolean", "default": "true"}
      ],
      "outBinding": [
        {"name": "result", "type": "string", "exportName": "CONDITION_VARIABLE"}
      ],
      "condition": [
        {
          "name": "CONDITION_VARIABLE",
          "type": "string",
          "comparator": "equals",
          "value": "PASS",
          "nextStep": "step2"
        },
        {
          "name": "CONDITION_VARIABLE",
          "type": "string",
          "comparator": "contains",
          "value": "WARN",
          "nextStep": "step3"
        },
        {
          "name": "CONDITION_VARIABLE",
          "type": "string",
          "comparator": "equals",
          "value": "ERROR",
          "nextStep": "END"
        }
      ]
    },
    {
      "stepId":"step2",
      "workflow":"RUN_SSH_COMMAND_IN_GUEST",
      "namespace": "nfv",
      "type":"task",
      "description": "Step 2 - Run if step 1 output is PASS",
      "inBinding":[
        {"name": "username", "type": "string", "exportName": "USER"},
        {"name": "password", "type": "password", "exportName": "PWD"},
        {"name": "port", "type": "number", "default": "22"},
        {"name": "cmd", "type": "string", "default": "/opt/scriptPass.sh"},
        {"name": "encoding", "type": "string", "default": " "},
        {"name": "hostNameOrIP", "type": "string", "exportName": "HOSTNAME"},
        {"name": "passwordAuthentication", "type": "boolean", "default": "true"}
      ],
      "outBinding": [
        {"name": "result", "type": "string", "exportName": "FINAL_OUTPUT"}
      ],
      "nextStep":"END"
    },
    {
      "stepId":"step3",
      "workflow":"RUN_SSH_COMMAND_IN_GUEST",
      "namespace": "nfv",
      "type":"task",
      "description": "Step 3 - Run if step 1 output is WARN",
      "inBinding":[
        {"name": "username", "type": "string", "exportName": "USER"},
        {"name": "password", "type": "password", "exportName": "PWD"},
        {"name": "port", "type": "number", "default": "22"},
        {"name": "cmd", "type": "string", "default": "/opt/scriptWarn.sh"},
        {"name": "encoding", "type": "string", "default": " "},
        {"name": "hostNameOrIP", "type": "string", "exportName": "HOSTNAME"},
        {"name": "passwordAuthentication", "type": "boolean", "default": "true"}
      ],
      "outBinding": [
        {"name": "result", "type": "string", "exportName": "FINAL_OUTPUT"}
      ],
      "nextStep":"END"
    }
  ]
}