Search in sources :

Example 41 with WorkItem

use of org.batfish.common.WorkItem in project batfish by batfish.

the class Client method runAnalysis.

private boolean runAnalysis(@Nullable FileWriter outWriter, List<String> options, List<String> parameters, boolean delta, boolean differential) {
    Command command = differential ? Command.RUN_ANALYSIS_DIFFERENTIAL : delta ? Command.RUN_ANALYSIS_DELTA : Command.RUN_ANALYSIS;
    if (!isValidArgument(options, parameters, 0, 1, 1, command)) {
        return false;
    }
    if (!isSetContainer(true) || !isSetTestrig()) {
        return false;
    }
    String analysisName = parameters.get(0);
    // answer the question
    WorkItem wItemAs = WorkItemBuilder.getWorkItemRunAnalysis(analysisName, _currContainerName, _currTestrig, _currEnv, _currDeltaTestrig, _currDeltaEnv, delta, differential);
    return execute(wItemAs, outWriter);
}
Also used : WorkItem(org.batfish.common.WorkItem)

Example 42 with WorkItem

use of org.batfish.common.WorkItem in project batfish by batfish.

the class WorkItemBuilder method getWorkItemAnswerQuestion.

public static WorkItem getWorkItemAnswerQuestion(String questionName, String containerName, String testrigName, String envName, String deltaTestrig, String deltaEnvName, boolean isDifferential, boolean isDelta) {
    WorkItem wItem = new WorkItem(containerName, testrigName);
    wItem.addRequestParam(BfConsts.COMMAND_ANSWER, "");
    wItem.addRequestParam(BfConsts.ARG_QUESTION_NAME, questionName);
    wItem.addRequestParam(BfConsts.ARG_ENVIRONMENT_NAME, envName);
    if (isDifferential) {
        wItem.addRequestParam(BfConsts.ARG_DIFFERENTIAL, "");
    }
    if (deltaEnvName != null) {
        wItem.addRequestParam(BfConsts.ARG_DELTA_ENVIRONMENT_NAME, deltaEnvName);
    }
    if (deltaTestrig != null) {
        wItem.addRequestParam(BfConsts.ARG_DELTA_TESTRIG, deltaTestrig);
    }
    if (isDelta) {
        wItem.addRequestParam(BfConsts.ARG_DIFF_ACTIVE, "");
    }
    return wItem;
}
Also used : WorkItem(org.batfish.common.WorkItem)

Example 43 with WorkItem

use of org.batfish.common.WorkItem in project batfish by batfish.

the class WorkItemBuilder method getWorkItemRunAnalysis.

public static WorkItem getWorkItemRunAnalysis(String analysisName, String containerName, String testrigName, String envName, String deltaTestrig, String deltaEnvName, boolean delta, boolean differential) {
    WorkItem wItem = new WorkItem(containerName, testrigName);
    wItem.addRequestParam(BfConsts.COMMAND_ANALYZE, "");
    wItem.addRequestParam(BfConsts.ARG_ANALYSIS_NAME, analysisName);
    wItem.addRequestParam(BfConsts.ARG_TESTRIG, testrigName);
    wItem.addRequestParam(BfConsts.ARG_ENVIRONMENT_NAME, envName);
    if (differential || delta) {
        wItem.addRequestParam(BfConsts.ARG_DELTA_TESTRIG, deltaTestrig);
        wItem.addRequestParam(BfConsts.ARG_DELTA_ENVIRONMENT_NAME, deltaEnvName);
    }
    if (delta) {
        wItem.addRequestParam(BfConsts.ARG_DIFF_ACTIVE, "");
    }
    if (differential) {
        wItem.addRequestParam(BfConsts.ARG_DIFFERENTIAL, "");
    }
    return wItem;
}
Also used : WorkItem(org.batfish.common.WorkItem)

Example 44 with WorkItem

use of org.batfish.common.WorkItem in project batfish by batfish.

the class WorkItemBuilder method getWorkItemParse.

public static WorkItem getWorkItemParse(String containerName, String testrigName) {
    WorkItem wItem = new WorkItem(containerName, testrigName);
    wItem.addRequestParam(BfConsts.COMMAND_PARSE_VENDOR_INDEPENDENT, "");
    wItem.addRequestParam(BfConsts.COMMAND_PARSE_VENDOR_SPECIFIC, "");
    wItem.addRequestParam(BfConsts.COMMAND_INIT_INFO, "");
    wItem.addRequestParam(BfConsts.ARG_UNIMPLEMENTED_SUPPRESS, "");
    return wItem;
}
Also used : WorkItem(org.batfish.common.WorkItem)

Aggregations

WorkItem (org.batfish.common.WorkItem)44 Test (org.junit.Test)15 BatfishException (org.batfish.common.BatfishException)14 IOException (java.io.IOException)6 EnvironmentMetadata (org.batfish.datamodel.EnvironmentMetadata)5 JSONObject (org.codehaus.jettison.json.JSONObject)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 FileNotFoundException (java.io.FileNotFoundException)3 Path (java.nio.file.Path)3 AccessControlException (java.security.AccessControlException)3 POST (javax.ws.rs.POST)3 Path (javax.ws.rs.Path)3 Produces (javax.ws.rs.Produces)3 FileExistsException (org.apache.commons.io.FileExistsException)3 JSONException (org.codehaus.jettison.json.JSONException)3 LinkedList (java.util.LinkedList)2 Task (org.batfish.common.Task)2 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ArrayList (java.util.ArrayList)1