Search in sources :

Example 1 with CommandContext

use of org.openkilda.wfm.CommandContext in project open-kilda by telstra.

the class ControllerToSpeakerProxyBoltTest method injectRegionUpdate.

private void injectRegionUpdate(RegionMappingUpdate update) {
    Tuple input = new TupleImpl(generalTopologyContext, new Values(update, new CommandContext()), SWITCH_MONITOR_BOLT, RegionTrackerBolt.STREAM_REGION_NOTIFICATION_ID);
    subject.execute(input);
    verify(outputCollector).ack(eq(input));
}
Also used : CommandContext(org.openkilda.wfm.CommandContext) Values(org.apache.storm.tuple.Values) TupleImpl(org.apache.storm.tuple.TupleImpl) Tuple(org.apache.storm.tuple.Tuple)

Example 2 with CommandContext

use of org.openkilda.wfm.CommandContext in project open-kilda by telstra.

the class ControllerToSpeakerProxyBoltTest method injectLifecycleEventUpdate.

private void injectLifecycleEventUpdate(Signal signal) {
    LifecycleEvent event = LifecycleEvent.builder().signal(signal).build();
    Tuple input = new TupleImpl(generalTopologyContext, new Values(event, new CommandContext()), ZOOKEEPER_SPOUT, STREAM_SPOUT_DEFAULT);
    subject.execute(input);
    verify(outputCollector).ack(eq(input));
}
Also used : CommandContext(org.openkilda.wfm.CommandContext) Values(org.apache.storm.tuple.Values) LifecycleEvent(org.openkilda.bluegreen.LifecycleEvent) TupleImpl(org.apache.storm.tuple.TupleImpl) Tuple(org.apache.storm.tuple.Tuple)

Example 3 with CommandContext

use of org.openkilda.wfm.CommandContext in project open-kilda by telstra.

the class SpeakerToNetworkProxyBoltTest method injectLifecycleEventUpdate.

private void injectLifecycleEventUpdate(Signal signal) {
    LifecycleEvent event = LifecycleEvent.builder().signal(signal).build();
    Tuple input = new TupleImpl(generalTopologyContext, new Values(event, new CommandContext()), ZOOKEEPER_SPOUT, STREAM_SPOUT_DEFAULT);
    subject.execute(input);
    verify(outputCollector).ack(eq(input));
}
Also used : CommandContext(org.openkilda.wfm.CommandContext) Values(org.apache.storm.tuple.Values) LifecycleEvent(org.openkilda.bluegreen.LifecycleEvent) TupleImpl(org.apache.storm.tuple.TupleImpl) Tuple(org.apache.storm.tuple.Tuple)

Example 4 with CommandContext

use of org.openkilda.wfm.CommandContext in project open-kilda by telstra.

the class FlowSwapEndpointsHubBolt method sendFlowUpdateRequest.

@Override
public void sendFlowUpdateRequest(FlowRequest flowRequest) {
    String childKey = KeyProvider.generateChainedKey(currentKey);
    CommandContext commandContext = getCommandContext();
    CommandMessage commandMessage = new CommandMessage(flowRequest, commandContext.getCreateTime(), childKey);
    emit(Stream.SWAP_ENDPOINTS_HUB_TO_ROUTER_BOLT.name(), getCurrentTuple(), new Values(childKey, commandMessage, new CommandContext(commandMessage)));
}
Also used : CommandContext(org.openkilda.wfm.CommandContext) Values(org.apache.storm.tuple.Values) CommandMessage(org.openkilda.messaging.command.CommandMessage)

Example 5 with CommandContext

use of org.openkilda.wfm.CommandContext in project open-kilda by telstra.

the class EmitUpdateRulesRequestsAction method buildCommands.

private Collection<FlowSegmentRequestFactory> buildCommands(FlowMirrorPointCreateFsm stateMachine, Flow flow) {
    final FlowCommandBuilder commandBuilder = commandBuilderFactory.getBuilder(flow.getEncapsulationType());
    PathId flowPathId = stateMachine.getFlowPathId();
    FlowPath path = flow.getPath(flowPathId).orElseThrow(() -> new FlowProcessingException(ErrorType.NOT_FOUND, format("Flow path %s not found", flowPathId)));
    PathId oppositePathId = flow.getOppositePathId(flowPathId).orElseThrow(() -> new FlowProcessingException(ErrorType.NOT_FOUND, format("Opposite flow path id for path %s not found", flowPathId)));
    FlowPath oppositePath = flow.getPath(oppositePathId).orElse(null);
    RequestedFlowMirrorPoint mirrorPoint = stateMachine.getRequestedFlowMirrorPoint();
    CommandContext context = stateMachine.getCommandContext();
    SpeakerRequestBuildContext speakerContext = buildBaseSpeakerContextForInstall(path.getSrcSwitchId(), path.getDestSwitchId());
    if (mirrorPoint.getMirrorPointSwitchId().equals(path.getSrcSwitchId())) {
        return new ArrayList<>(commandBuilder.buildIngressOnlyOneDirection(context, flow, path, oppositePath, speakerContext.getForward(), MirrorContext.builder().buildMirrorFactoryOnly(true).addNewGroup(stateMachine.isAddNewGroup()).build()));
    } else if (mirrorPoint.getMirrorPointSwitchId().equals(path.getDestSwitchId())) {
        return new ArrayList<>(commandBuilder.buildEgressOnlyOneDirection(context, flow, path, oppositePath, MirrorContext.builder().buildMirrorFactoryOnly(true).addNewGroup(stateMachine.isAddNewGroup()).build()));
    }
    return Collections.emptyList();
}
Also used : PathId(org.openkilda.model.PathId) RequestedFlowMirrorPoint(org.openkilda.wfm.topology.flowhs.model.RequestedFlowMirrorPoint) CommandContext(org.openkilda.wfm.CommandContext) FlowProcessingException(org.openkilda.wfm.topology.flowhs.exception.FlowProcessingException) ArrayList(java.util.ArrayList) FlowCommandBuilder(org.openkilda.wfm.topology.flowhs.service.FlowCommandBuilder) FlowPath(org.openkilda.model.FlowPath) SpeakerRequestBuildContext(org.openkilda.wfm.share.model.SpeakerRequestBuildContext)

Aggregations

CommandContext (org.openkilda.wfm.CommandContext)95 Test (org.junit.Test)28 Values (org.apache.storm.tuple.Values)27 FlowSegmentRequest (org.openkilda.floodlight.api.request.FlowSegmentRequest)15 Flow (org.openkilda.model.Flow)15 AbstractYFlowTest (org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)14 Tuple (org.apache.storm.tuple.Tuple)12 SwitchId (org.openkilda.model.SwitchId)11 YFlow (org.openkilda.model.YFlow)11 BaseSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest)9 SpeakerResponse (org.openkilda.floodlight.api.response.SpeakerResponse)9 YFlowRequest (org.openkilda.messaging.command.yflow.YFlowRequest)9 InfoMessage (org.openkilda.messaging.info.InfoMessage)9 TupleImpl (org.apache.storm.tuple.TupleImpl)8 FlowPath (org.openkilda.model.FlowPath)8 ArrayList (java.util.ArrayList)7 FlowRerouteRequest (org.openkilda.messaging.command.flow.FlowRerouteRequest)7 FlowProcessingException (org.openkilda.wfm.topology.flowhs.exception.FlowProcessingException)7 UnknownKeyException (org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException)7 List (java.util.List)6