Search in sources :

Example 11 with Workflow

use of org.onosproject.workflow.api.Workflow in project onos by opennetworkinglab.

the class WorkflowManager method invokeWorkflow.

@Override
public void invokeWorkflow(JsonNode worklowDescJson) throws WorkflowException {
    log.info("invokeWorkflow: {}", worklowDescJson);
    Workplace workplace = workplaceStore.getWorkplace(Workplace.SYSTEM_WORKPLACE);
    if (Objects.isNull(workplace)) {
        throw new WorkflowException("Invalid system workplace");
    }
    Workflow workflow = workflowStore.get(URI.create(worklowDescJson.get("id").asText()));
    if (Objects.isNull(workflow)) {
        throw new WorkflowException("Invalid Workflow");
    }
    checkWorkflowDataModelSchema(workflow, worklowDescJson);
    Workflow wfCreationWf = workflowStore.get(URI.create(WorkplaceWorkflow.WF_CREATE_WORKFLOW));
    if (Objects.isNull(wfCreationWf)) {
        throw new WorkflowException("Invalid workflow " + WorkplaceWorkflow.WF_CREATE_WORKFLOW);
    }
    WorkflowContext context = wfCreationWf.buildSystemContext(workplace, new JsonDataModelTree(worklowDescJson));
    workflowExecutionService.execInitWorklet(context);
}
Also used : WorkflowException(org.onosproject.workflow.api.WorkflowException) WorkflowContext(org.onosproject.workflow.api.WorkflowContext) JsonDataModelTree(org.onosproject.workflow.api.JsonDataModelTree) Workflow(org.onosproject.workflow.api.Workflow) Workplace(org.onosproject.workflow.api.Workplace) DefaultWorkplace(org.onosproject.workflow.api.DefaultWorkplace)

Aggregations

Workflow (org.onosproject.workflow.api.Workflow)11 WorkflowException (org.onosproject.workflow.api.WorkflowException)9 WorkflowContext (org.onosproject.workflow.api.WorkflowContext)6 Worklet (org.onosproject.workflow.api.Worklet)5 StorageException (org.onosproject.store.service.StorageException)4 ImmutableListWorkflow (org.onosproject.workflow.api.ImmutableListWorkflow)4 SystemWorkflowContext (org.onosproject.workflow.api.SystemWorkflowContext)4 URI (java.net.URI)3 WorkletDescription (org.onosproject.workflow.api.WorkletDescription)3 JsonDataModelTree (org.onosproject.workflow.api.JsonDataModelTree)2 ProgramCounter (org.onosproject.workflow.api.ProgramCounter)2 WorkflowStore (org.onosproject.workflow.api.WorkflowStore)2 WorkplaceStore (org.onosproject.workflow.api.WorkplaceStore)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 Executors.newSingleThreadScheduledExecutor (java.util.concurrent.Executors.newSingleThreadScheduledExecutor)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 Tools.groupedThreads (org.onlab.util.Tools.groupedThreads)1 DeviceService (org.onosproject.net.device.DeviceService)1 DefaultWorkletDescription (org.onosproject.workflow.api.DefaultWorkletDescription)1 DefaultWorkplace (org.onosproject.workflow.api.DefaultWorkplace)1