Search in sources :

Example 1 with WorkplaceStore

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

the class WorkplaceStoreCommand method printAllWorkplace.

/**
 * Prints all workplaces.
 */
private void printAllWorkplace() {
    WorkplaceStore workplaceStore = get(WorkplaceStore.class);
    for (Workplace workplace : workplaceStore.getWorkplaces()) {
        print(getWorkplaceString(workplace));
        printWorkplaceContexts(workplaceStore, workplace.name());
    }
}
Also used : WorkplaceStore(org.onosproject.workflow.api.WorkplaceStore) Workplace(org.onosproject.workflow.api.Workplace)

Example 2 with WorkplaceStore

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

the class WorkflowStatusCommand method invoke.

private void invoke() {
    try {
        WorkflowStore workflowStore = get(WorkflowStore.class);
        WorkplaceStore workplaceStore = get(WorkplaceStore.class);
        System.out.printf("%-25s %-45s %-10s%n", "DEVICEIP", " WORKFLOW NAME", "WORKFLOW STATE");
        for (WorkflowContext context : workplaceStore.getContexts()) {
            for (Workflow workflow : workflowStore.getAll()) {
                if (context.workflowId().equals(workflow.id())) {
                    JsonDataModelTree tree = (JsonDataModelTree) context.data();
                    JsonNode mgmtIp = tree.nodeAt("/mgmtIp");
                    System.out.printf("%-25s %-45s %-10s%n", mgmtIp, context.name(), context.state().toString());
                }
            }
        }
    } catch (WorkflowException e) {
        e.printStackTrace();
    }
}
Also used : WorkflowStore(org.onosproject.workflow.api.WorkflowStore) WorkplaceStore(org.onosproject.workflow.api.WorkplaceStore) WorkflowContext(org.onosproject.workflow.api.WorkflowContext) WorkflowException(org.onosproject.workflow.api.WorkflowException) JsonDataModelTree(org.onosproject.workflow.api.JsonDataModelTree) Workflow(org.onosproject.workflow.api.Workflow) JsonNode(com.fasterxml.jackson.databind.JsonNode)

Example 3 with WorkplaceStore

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

the class WorkFlowCommand method eval.

/**
 * Evaluates workflow context.
 * @param workflowContextName workflow context name
 */
private void eval(String workflowContextName) {
    WorkplaceStore storService = get(WorkplaceStore.class);
    WorkflowExecutionService execService = get(WorkflowExecutionService.class);
    WorkflowContext context = storService.getContext(workflowContextName);
    if (context == null) {
        error("failed to find workflow context {}", workflowContextName);
        return;
    }
    execService.eval(workflowContextName);
}
Also used : WorkplaceStore(org.onosproject.workflow.api.WorkplaceStore) WorkflowExecutionService(org.onosproject.workflow.api.WorkflowExecutionService) WorkflowContext(org.onosproject.workflow.api.WorkflowContext)

Example 4 with WorkplaceStore

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

the class WorkplaceStoreCommand method printWorkplace.

/**
 * Prints workplace.
 * @param name workplace name
 */
private void printWorkplace(String name) {
    WorkplaceStore workplaceStore = get(WorkplaceStore.class);
    Workplace workplace = workplaceStore.getWorkplace(name);
    if (Objects.isNull(workplace)) {
        print("Not existing workplace " + name);
        return;
    }
    print(getWorkplaceString(workplace));
    printWorkplaceContexts(workplaceStore, workplace.name());
}
Also used : WorkplaceStore(org.onosproject.workflow.api.WorkplaceStore) Workplace(org.onosproject.workflow.api.Workplace)

Aggregations

WorkplaceStore (org.onosproject.workflow.api.WorkplaceStore)4 WorkflowContext (org.onosproject.workflow.api.WorkflowContext)2 Workplace (org.onosproject.workflow.api.Workplace)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 JsonDataModelTree (org.onosproject.workflow.api.JsonDataModelTree)1 Workflow (org.onosproject.workflow.api.Workflow)1 WorkflowException (org.onosproject.workflow.api.WorkflowException)1 WorkflowExecutionService (org.onosproject.workflow.api.WorkflowExecutionService)1 WorkflowStore (org.onosproject.workflow.api.WorkflowStore)1