Search in sources :

Example 11 with OfCommand

use of org.openkilda.floodlight.api.request.rulemanager.OfCommand in project open-kilda by telstra.

the class UpdateYFlowRulesAction method buildYFlowDeleteRequest.

protected DeleteSpeakerCommandsRequest buildYFlowDeleteRequest(SwitchId switchId, PathId pathId, CommandContext context) {
    List<OfCommand> ofCommands = buildYFlowOfCommands(switchId, pathId);
    UUID commandId = commandIdGenerator.generate();
    MessageContext messageContext = new MessageContext(commandId.toString(), context.getCorrelationId());
    return new DeleteSpeakerCommandsRequest(messageContext, switchId, commandId, ofCommands);
}
Also used : OfCommand(org.openkilda.floodlight.api.request.rulemanager.OfCommand) MessageContext(org.openkilda.messaging.MessageContext) UUID(java.util.UUID) DeleteSpeakerCommandsRequest(org.openkilda.floodlight.api.request.rulemanager.DeleteSpeakerCommandsRequest)

Example 12 with OfCommand

use of org.openkilda.floodlight.api.request.rulemanager.OfCommand in project open-kilda by telstra.

the class UpdateYFlowRulesAction method buildYFlowOfCommands.

private List<OfCommand> buildYFlowOfCommands(SwitchId switchId, PathId pathId) {
    DataAdapter dataAdapter = PersistenceDataAdapter.builder().persistenceManager(persistenceManager).switchIds(singleton(switchId)).pathIds(singleton(pathId)).build();
    List<SpeakerData> speakerData = ruleManager.buildRulesForSwitch(switchId, dataAdapter);
    return speakerData.stream().filter(data -> data instanceof FlowSpeakerData).map(data -> new FlowCommand((FlowSpeakerData) data)).collect(toList());
}
Also used : FlowProcessingWithHistorySupportAction(org.openkilda.wfm.topology.flowhs.fsm.common.actions.FlowProcessingWithHistorySupportAction) DeleteSpeakerCommandsRequest(org.openkilda.floodlight.api.request.rulemanager.DeleteSpeakerCommandsRequest) Collections.singleton(java.util.Collections.singleton) InstallSpeakerCommandsRequest(org.openkilda.floodlight.api.request.rulemanager.InstallSpeakerCommandsRequest) Flow(org.openkilda.model.Flow) YFlow(org.openkilda.model.YFlow) PersistenceManager(org.openkilda.persistence.PersistenceManager) PathId(org.openkilda.model.PathId) FlowPathSwapContext(org.openkilda.wfm.topology.flowhs.fsm.pathswap.FlowPathSwapContext) FlowCommand(org.openkilda.floodlight.api.request.rulemanager.FlowCommand) FlowPathSwapFsm(org.openkilda.wfm.topology.flowhs.fsm.pathswap.FlowPathSwapFsm) State(org.openkilda.wfm.topology.flowhs.fsm.pathswap.FlowPathSwapFsm.State) ErrorType(org.openkilda.messaging.error.ErrorType) DataAdapter(org.openkilda.rulemanager.DataAdapter) MessageContext(org.openkilda.messaging.MessageContext) PersistenceDataAdapter(org.openkilda.rulemanager.adapter.PersistenceDataAdapter) CommandContext(org.openkilda.wfm.CommandContext) Event(org.openkilda.wfm.topology.flowhs.fsm.pathswap.FlowPathSwapFsm.Event) SpeakerData(org.openkilda.rulemanager.SpeakerData) UUID(java.util.UUID) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) String.format(java.lang.String.format) OfCommand(org.openkilda.floodlight.api.request.rulemanager.OfCommand) RuleManager(org.openkilda.rulemanager.RuleManager) YFlowRepository(org.openkilda.persistence.repositories.YFlowRepository) Collectors.toList(java.util.stream.Collectors.toList) FlowProcessingException(org.openkilda.wfm.topology.flowhs.exception.FlowProcessingException) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) Stream(java.util.stream.Stream) SwitchId(org.openkilda.model.SwitchId) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) FlowCommand(org.openkilda.floodlight.api.request.rulemanager.FlowCommand) DataAdapter(org.openkilda.rulemanager.DataAdapter) PersistenceDataAdapter(org.openkilda.rulemanager.adapter.PersistenceDataAdapter) SpeakerData(org.openkilda.rulemanager.SpeakerData) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData)

Aggregations

OfCommand (org.openkilda.floodlight.api.request.rulemanager.OfCommand)12 UUID (java.util.UUID)10 String.format (java.lang.String.format)8 List (java.util.List)8 Slf4j (lombok.extern.slf4j.Slf4j)8 FlowCommand (org.openkilda.floodlight.api.request.rulemanager.FlowCommand)8 Optional (java.util.Optional)7 Set (java.util.Set)7 Collectors (java.util.stream.Collectors)7 GroupCommand (org.openkilda.floodlight.api.request.rulemanager.GroupCommand)7 MeterCommand (org.openkilda.floodlight.api.request.rulemanager.MeterCommand)7 SpeakerCommandResponse (org.openkilda.floodlight.api.response.rulemanager.SpeakerCommandResponse)7 HistoryRecordingAction (org.openkilda.wfm.topology.flowhs.fsm.common.actions.HistoryRecordingAction)7 DeleteSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.DeleteSpeakerCommandsRequest)6 InstallSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.InstallSpeakerCommandsRequest)5 MessageContext (org.openkilda.messaging.MessageContext)3 SwitchId (org.openkilda.model.SwitchId)3 IOFSwitch (net.floodlightcontroller.core.IOFSwitch)2 YFlowRerouteContext (org.openkilda.wfm.topology.flowhs.fsm.yflow.reroute.YFlowRerouteContext)2 YFlowRerouteFsm (org.openkilda.wfm.topology.flowhs.fsm.yflow.reroute.YFlowRerouteFsm)2