@Test public void shouldCreateNonIngressCommandsWithTransitSwitch() { Switch srcSwitch = Switch.builder().switchId(SWITCH_1).build(); Switch destSwitch = Switch.builder().switchId(SWITCH_3).build(); Flow flow = buildFlow(srcSwitch, 1, 101, destSwitch, 2, 102, 0); setSegmentsWithTransitSwitches( Objects.requireNonNull(flow.getForwardPath()), Objects.requireNonNull(flow.getReversePath())); List<FlowSegmentRequestFactory> commands = target.buildAllExceptIngress(COMMAND_CONTEXT, flow); assertEquals(4, commands.size()); verifyForwardTransitRequest(flow, SWITCH_2, commands.get(0).makeInstallRequest(commandIdGenerator.generate())); verifyForwardEgressRequest(flow, commands.get(1).makeInstallRequest(commandIdGenerator.generate())); verifyReverseTransitRequest(flow, SWITCH_2, commands.get(2).makeInstallRequest(commandIdGenerator.generate())); verifyReverseEgressRequest(flow, commands.get(3).makeInstallRequest(commandIdGenerator.generate())); }
@Override public List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow) { return buildAllExceptIngress(context, flow, flow.getForwardPath(), flow.getReversePath()); }
SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow) { return buildAllExceptIngress(context, flow, flow.getForwardPath(), flow.getReversePath()); } }
SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow) { return buildAllExceptIngress(context, flow, flow.getForwardPath(), flow.getReversePath()); } SpeakerFlowSegmentRequestBuilder(FlowResourcesManager resourcesManager); }
SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow) { return buildAllExceptIngress(context, flow, flow.getForwardPath(), flow.getReversePath()); } SpeakerFlowSegmentRequestBuilder(FlowResourcesManager resourcesManager); @Override List<FlowSegmentRequestFactory> buildAll(CommandContext context, Flow flow, FlowPath path,
                                                    SpeakerRequestBuildContext speakerRequestBuildContext); @Override List<FlowSegmentRequestFactory> buildAll(CommandContext context, Flow flow, FlowPath forwardPath,
                                                    FlowPath reversePath,
                                                    SpeakerRequestBuildContext speakerRequestBuildContext); @Override List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow); @Override List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, Flow flow, FlowPath path); @Override List<FlowSegmentRequestFactory> buildAllExceptIngress(
            CommandContext context, Flow flow, FlowPath path, FlowPath oppositePath); @Override List<FlowSegmentRequestFactory> buildIngressOnly(
            CommandContext context, @NonNull Flow flow, SpeakerRequestBuildContext speakerRequestBuildContext); @Override List<FlowSegmentRequestFactory> buildIngressOnly(
            CommandContext context, Flow flow, FlowPath path, FlowPath oppositePath,
            SpeakerRequestBuildContext speakerRequestBuildContext); @Override List<FlowSegmentRequestFactory> buildIngressOnlyOneDirection(
            CommandContext context, Flow flow, FlowPath path, FlowPath oppositePath,
            PathContext pathContext); @Override List<FlowSegmentRequestFactory> buildEgressOnly(
            CommandContext context, Flow flow, FlowPath path, FlowPath oppositePath); @Override List<FlowSegmentRequestFactory> buildEgressOnlyOneDirection(
            CommandContext context, Flow flow, FlowPath path, FlowPath oppositePath); }
SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow) { return buildAllExceptIngress(context, flow, flow.getForwardPath(), flow.getReversePath()); } SpeakerFlowSegmentRequestBuilder(FlowResourcesManager resourcesManager); @Override List<FlowSegmentRequestFactory> buildAll(CommandContext context, Flow flow, FlowPath path,
                                                    SpeakerRequestBuildContext speakerRequestBuildContext); @Override List<FlowSegmentRequestFactory> buildAll(CommandContext context, Flow flow, FlowPath forwardPath,
                                                    FlowPath reversePath,
                                                    SpeakerRequestBuildContext speakerRequestBuildContext); @Override List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow); @Override List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, Flow flow, FlowPath path); @Override List<FlowSegmentRequestFactory> buildAllExceptIngress(
            CommandContext context, Flow flow, FlowPath path, FlowPath oppositePath); @Override List<FlowSegmentRequestFactory> buildIngressOnly(
            CommandContext context, @NonNull Flow flow, SpeakerRequestBuildContext speakerRequestBuildContext); @Override List<FlowSegmentRequestFactory> buildIngressOnly(
            CommandContext context, Flow flow, FlowPath path, FlowPath oppositePath,
            SpeakerRequestBuildContext speakerRequestBuildContext); @Override List<FlowSegmentRequestFactory> buildIngressOnlyOneDirection(
            CommandContext context, Flow flow, FlowPath path, FlowPath oppositePath,
            PathContext pathContext); @Override List<FlowSegmentRequestFactory> buildEgressOnly(
            CommandContext context, Flow flow, FlowPath path, FlowPath oppositePath); @Override List<FlowSegmentRequestFactory> buildEgressOnlyOneDirection(
            CommandContext context, Flow flow, FlowPath path, FlowPath oppositePath);  }