Search in sources :

Example 1 with FlowEntry

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

the class DefaultFlowsChecker method validateDefaultRules.

/**
 * Validates whether all default rules are correctly installed on a switch.
 */
public static boolean validateDefaultRules(SwitchEntry sw, FlowEntriesMap map, Scenario scenario) {
    FlowEntry flow = map.get(BROADCAST_FLOW);
    boolean result = isValidDefaultFlow(BROADCAST_FLOW, flow, sw.getSwitchId(), scenario);
    if (!VERSION_12.equals(sw.getOfVersion())) {
        result = result & isValidDefaultFlow(NON_BROADCAST_FLOW, map.get(NON_BROADCAST_FLOW), sw.getSwitchId(), scenario);
        result = result & isValidDropRule(map.get(DROP_FLOW), sw.getSwitchId(), scenario);
    }
    return result;
}
Also used : FlowEntry(org.openkilda.testing.service.floodlight.model.FlowEntry)

Example 2 with FlowEntry

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

the class StubServiceFactory method buildFlowEntries.

private FlowEntriesMap buildFlowEntries(SwitchId switchId, String switchVersion) {
    FlowEntriesMap result = new FlowEntriesMap();
    // broadcast verification flow (for all OF versions)
    FlowEntry flowEntry = buildFlowEntry("flow-0x8000000000000002", FlowMatchField.builder().ethDst("08:ed:02:ef:ff:ff").build(), FlowInstructions.builder().applyActions(FlowApplyActions.builder().flowOutput("controller").field(switchId.toMacAddress() + "->eth_dst").build()).build());
    result.put(flowEntry.getCookie(), flowEntry);
    // define drop flow
    FlowEntry dropFlow = FlowEntry.builder().instructions(FlowInstructions.builder().none("drop").build()).priority(1).cookie("flow-0x8000000000000001").build();
    result.put(dropFlow.getCookie(), dropFlow);
    if ("OF_13".equals(switchVersion)) {
        // non-broadcast flow for versions 13 and later
        FlowEntry flowFor13Version = buildFlowEntry("flow-0x8000000000000003", FlowMatchField.builder().ethDst(switchId.toMacAddress()).build(), FlowInstructions.builder().applyActions(FlowApplyActions.builder().flowOutput("controller").field(switchId.toMacAddress() + "->eth_dst").build()).build());
        result.put(flowFor13Version.getCookie(), flowFor13Version);
    }
    return result;
}
Also used : FlowEntry(org.openkilda.testing.service.floodlight.model.FlowEntry) FlowEntriesMap(org.openkilda.testing.service.floodlight.model.FlowEntriesMap)

Aggregations

FlowEntry (org.openkilda.testing.service.floodlight.model.FlowEntry)2 FlowEntriesMap (org.openkilda.testing.service.floodlight.model.FlowEntriesMap)1