Search in sources :

Example 1 with FlowInstructions

use of org.openkilda.messaging.info.rule.FlowInstructions in project open-kilda by telstra.

the class OFFlowStatsConverter method buildFlowInstructions.

private static FlowInstructions buildFlowInstructions(final List<OFInstruction> instructions) {
    Map<OFInstructionType, OFInstruction> instructionMap = instructions.stream().collect(Collectors.toMap(OFInstruction::getType, instruction -> instruction));
    FlowApplyActions applyActions = Optional.ofNullable(instructionMap.get(OFInstructionType.APPLY_ACTIONS)).map(OFFlowStatsConverter::buildApplyActions).orElse(null);
    Long meter = Optional.ofNullable(instructionMap.get(OFInstructionType.METER)).map(instruction -> ((OFInstructionMeter) instruction).getMeterId()).orElse(null);
    return FlowInstructions.builder().applyActions(applyActions).goToMeter(meter).build();
}
Also used : OFFlowModFlags(org.projectfloodlight.openflow.protocol.OFFlowModFlags) OFFlowStatsEntry(org.projectfloodlight.openflow.protocol.OFFlowStatsEntry) OFActionType(org.projectfloodlight.openflow.protocol.OFActionType) Map(java.util.Map) Match(org.projectfloodlight.openflow.protocol.match.Match) OFActionMeter(org.projectfloodlight.openflow.protocol.action.OFActionMeter) OFInstruction(org.projectfloodlight.openflow.protocol.instruction.OFInstruction) FlowEntry(org.openkilda.messaging.info.rule.FlowEntry) OFActionOutput(org.projectfloodlight.openflow.protocol.action.OFActionOutput) OFOxm(org.projectfloodlight.openflow.protocol.oxm.OFOxm) OFInstructionApplyActions(org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions) Collectors(java.util.stream.Collectors) OFAction(org.projectfloodlight.openflow.protocol.action.OFAction) FlowApplyActions(org.openkilda.messaging.info.rule.FlowApplyActions) Objects(java.util.Objects) List(java.util.List) OFActionPushVlan(org.projectfloodlight.openflow.protocol.action.OFActionPushVlan) FlowSetFieldAction(org.openkilda.messaging.info.rule.FlowSetFieldAction) FlowInstructions(org.openkilda.messaging.info.rule.FlowInstructions) MatchField(org.projectfloodlight.openflow.protocol.match.MatchField) Optional(java.util.Optional) OFInstructionMeter(org.projectfloodlight.openflow.protocol.instruction.OFInstructionMeter) FlowMatchField(org.openkilda.messaging.info.rule.FlowMatchField) OFInstructionType(org.projectfloodlight.openflow.protocol.OFInstructionType) OFActionSetField(org.projectfloodlight.openflow.protocol.action.OFActionSetField) OFInstructionMeter(org.projectfloodlight.openflow.protocol.instruction.OFInstructionMeter) OFInstruction(org.projectfloodlight.openflow.protocol.instruction.OFInstruction) FlowApplyActions(org.openkilda.messaging.info.rule.FlowApplyActions) OFInstructionType(org.projectfloodlight.openflow.protocol.OFInstructionType)

Aggregations

List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 FlowApplyActions (org.openkilda.messaging.info.rule.FlowApplyActions)1 FlowEntry (org.openkilda.messaging.info.rule.FlowEntry)1 FlowInstructions (org.openkilda.messaging.info.rule.FlowInstructions)1 FlowMatchField (org.openkilda.messaging.info.rule.FlowMatchField)1 FlowSetFieldAction (org.openkilda.messaging.info.rule.FlowSetFieldAction)1 OFActionType (org.projectfloodlight.openflow.protocol.OFActionType)1 OFFlowModFlags (org.projectfloodlight.openflow.protocol.OFFlowModFlags)1 OFFlowStatsEntry (org.projectfloodlight.openflow.protocol.OFFlowStatsEntry)1 OFInstructionType (org.projectfloodlight.openflow.protocol.OFInstructionType)1 OFAction (org.projectfloodlight.openflow.protocol.action.OFAction)1 OFActionMeter (org.projectfloodlight.openflow.protocol.action.OFActionMeter)1 OFActionOutput (org.projectfloodlight.openflow.protocol.action.OFActionOutput)1 OFActionPushVlan (org.projectfloodlight.openflow.protocol.action.OFActionPushVlan)1 OFActionSetField (org.projectfloodlight.openflow.protocol.action.OFActionSetField)1 OFInstruction (org.projectfloodlight.openflow.protocol.instruction.OFInstruction)1