use of org.openkilda.testing.service.floodlight.model.FlowMatchField 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;
}
Aggregations