How do I add a workflow?
Workflow creation options
You have several options for adding workflows to NSP.
-
Create a workflow. This procedure provides general steps. See the Network Automation tutorial on the Network Developer Portal for detailed information.
-
Install a workflow using Artifacts; see How do I install an artifact bundle?.
Note: if an installed workflow appears with a red signature icon, there is a problem with the workflow. Try downloading and installing again. Contact Nokia if the problem persists.
-
Clone a workflow and edit the clone as needed.
Note: Here are some things to know when setting up workflows.
-
A workflow must pass validation before it can be saved in NSP. If you import a workflow that is not valid or clone a workflow and make changes that don’t pass validation, you must update it to fix the errors before you can add it to the workflow list.
-
Workflows are imported in the DRAFT state. The state must be changed to PUBLISHED before the workflow is available to all users.
Sample workflow
When you create a workflow, sample YAML is populated as shown below, providing a basic structure for a workflow. You can use the sample as a guide or delete it and enter or copy and paste your own YAML code.
version: '2.0'
changeWorkflowName:
description: this is a sample workflow
type: direct
tags:
- sample workflow
input:
- var1 : ''
output:
keyword: <% $.timeNow %>
tasks:
task1:
action: std.js
input:
script: |
function myFunction(){
var a = new Date();
var b = a.getTime();
var c = 1000;
var d = b - c;
return String(d);
}
return myFunction();
publish:
timeNow: <% task().result %>
on-success:
- task2
task2:
action: std.javascript
input:
script: |
function myFunction(){
var a = new Date();
var b = a.getTime();
var c = 1000;
var d = b - c;
return String(d);
}
return myFunction();
publish:
timeNow: <% task().result %>