Search in sources :

Example 1 with FlowInstructions

use of org.openkilda.testing.service.floodlight.model.FlowInstructions in project open-kilda by telstra.

the class DefaultFlowsChecker method isValidDefaultFlow.

private static boolean isValidDefaultFlow(String flowId, FlowEntry flow, SwitchId switchId, Scenario scenario) {
    boolean valid = true;
    if (Objects.isNull(flow)) {
        scenario.write(String.format("Switch %s doesn't contain %s flow", switchId, flowId));
        return false;
    }
    FlowInstructions instructions = flow.getInstructions();
    FlowApplyActions flowActions = instructions.getApplyActions();
    if (!isValidSetFieldProperty(flowActions.getField(), switchId)) {
        scenario.write(String.format("Switch %s has incorrect set field action for flow %s", switchId, flow.getCookie()));
        valid = false;
    }
    String flowOutput = flowActions.getFlowOutput();
    if (!CONTROLLER_OUTPUT.equals(flowOutput)) {
        scenario.write(String.format("Switch %s has incorrect output action name for flow %s", switchId, flow.getCookie()));
        valid = false;
    }
    FlowMatchField flowMatch = flow.getMatch();
    if (BROADCAST_FLOW.equals(flow.getCookie())) {
        if (!VERIFICATION_DST.equals(flowMatch.getEthDst())) {
            scenario.write(String.format("Switch %s has incorrect verification broadcast packets destination", switchId));
            valid = false;
        }
    } else if (NON_BROADCAST_FLOW.equals(flow.getCookie())) {
        if (!switchId.toMacAddress().equals(flowMatch.getEthDst())) {
            scenario.write(String.format("Switch %s contains incorrect eth_dst: %s", switchId, flowMatch.getEthDst()));
            valid = false;
        }
    }
    return valid;
}
Also used : FlowInstructions(org.openkilda.testing.service.floodlight.model.FlowInstructions) FlowMatchField(org.openkilda.testing.service.floodlight.model.FlowMatchField) FlowApplyActions(org.openkilda.testing.service.floodlight.model.FlowApplyActions)

Example 2 with FlowInstructions

use of org.openkilda.testing.service.floodlight.model.FlowInstructions in project open-kilda by telstra.

the class DefaultFlowsChecker method isValidDropRule.

private static boolean isValidDropRule(FlowEntry flow, SwitchId switchId, Scenario scenario) {
    boolean valid = true;
    if (Objects.isNull(flow)) {
        scenario.write(String.format("Switch %s doesn't contain %s flow", switchId, DROP_FLOW));
        return false;
    }
    if (flow.getPriority() != 1) {
        scenario.write(String.format("Switch %s has incorrect priority for flow %s", switchId, flow.getCookie()));
        valid = false;
    }
    FlowInstructions instructions = flow.getInstructions();
    if (Objects.nonNull(instructions.getApplyActions())) {
        scenario.write(String.format("Switch %s has incorrect instructions for flow %s", switchId, flow.getCookie()));
        valid = false;
    }
    return valid;
}
Also used : FlowInstructions(org.openkilda.testing.service.floodlight.model.FlowInstructions)

Aggregations

FlowInstructions (org.openkilda.testing.service.floodlight.model.FlowInstructions)2 FlowApplyActions (org.openkilda.testing.service.floodlight.model.FlowApplyActions)1 FlowMatchField (org.openkilda.testing.service.floodlight.model.FlowMatchField)1