use of org.openkilda.messaging.MessageContext in project open-kilda by telstra.
the class TransitFlowSegmentRemoveCommandTest method makeCommand.
@Override
protected TransitFlowSegmentRemoveCommand makeCommand(FlowTransitEncapsulation encapsulation) {
MessageContext messageContext = new MessageContext();
UUID commandId = UUID.randomUUID();
FlowSegmentMetadata metadata = new FlowSegmentMetadata("transit-flow-segment-remove-flow-id", new Cookie(6), false);
int ingressIslPort = 3;
int egressIslPort = 5;
return new TransitFlowSegmentRemoveCommand(messageContext, mapSwitchId(dpIdNext), commandId, metadata, ingressIslPort, encapsulation, egressIslPort, null);
}
use of org.openkilda.messaging.MessageContext in project open-kilda by telstra.
the class IngressServer42FlowInstallCommandTest method createCommand.
private IngressServer42FlowInstallCommand createCommand(int outerVlan, int innerVlan, FlowTransitEncapsulation encapsulation, boolean multiTable) throws Exception {
FlowSegmentMetadata metadata = new FlowSegmentMetadata(FLOW_ID, COOKIE, multiTable);
IngressServer42FlowInstallCommand command = new IngressServer42FlowInstallCommand(new MessageContext(), UUID.randomUUID(), metadata, INGRESS_SWITCH_ID, CUSTOMER_PORT, outerVlan, innerVlan, EGRESS_SWITCH_ID, ISL_PORT, encapsulation, SERVER_42_PORT, SERVER_42_MAC_ADDRESS);
FloodlightModuleContext context = new FloodlightModuleContext();
IOFSwitchService switchServiceMock = mock(IOFSwitchService.class);
expect(switchServiceMock.getActiveSwitch(anyObject())).andReturn(getOfSwitch()).anyTimes();
context.addService(IOFSwitchService.class, switchServiceMock);
FeatureDetectorService featureDetectorServiceMock = mock(FeatureDetectorService.class);
expect(featureDetectorServiceMock.detectSwitch(anyObject())).andReturn(FEATURES).anyTimes();
context.addService(FeatureDetectorService.class, featureDetectorServiceMock);
Properties properties = new Properties();
properties.setProperty(SERVER_42_UPD_PORT_OFFSET_PROPERTY, Integer.toString(SERVER_42_UPD_PORT_OFFSET));
PropertiesBasedConfigurationProvider provider = new PropertiesBasedConfigurationProvider(properties);
KildaCore kildaCoreMock = mock(KildaCore.class);
expect(kildaCoreMock.getConfig()).andReturn(provider.getConfiguration(KildaCoreConfig.class)).anyTimes();
context.addService(KildaCore.class, kildaCoreMock);
replay(switchServiceMock, featureDetectorServiceMock, kildaCoreMock);
command.setup(context);
return command;
}
use of org.openkilda.messaging.MessageContext in project open-kilda by telstra.
the class EgressFlowSegmentCommandJsonTest method makeRequest.
@Override
protected EgressFlowSegmentRequest makeRequest() {
SwitchId swId = new SwitchId(1);
EgressFlowSegmentRequestFactory factory = new EgressFlowSegmentRequestFactory(new MessageContext(), new FlowSegmentMetadata("egress-flow-segment-install-request", new Cookie(2), false), new FlowEndpoint(swId, 3, 4), new FlowEndpoint(new SwitchId(swId.toLong() + 1), 6, 7), 9, new FlowTransitEncapsulation(10, FlowEncapsulationType.TRANSIT_VLAN), MirrorConfig.builder().build());
return makeRequest(factory);
}
use of org.openkilda.messaging.MessageContext in project open-kilda by telstra.
the class IngressFlowLoopSegmentInstallCommandTest method createCommand.
private IngressFlowLoopSegmentInstallCommand createCommand(int outerVlan, int innerVlan, boolean multiTable) throws Exception {
FlowSegmentMetadata metadata = new FlowSegmentMetadata(FLOW_ID, COOKIE, multiTable);
FlowEndpoint endpoint = FlowEndpoint.builder().switchId(SWITCH_ID_1).portNumber(PORT_1).outerVlanId(outerVlan).innerVlanId(innerVlan).build();
IngressFlowLoopSegmentInstallCommand command = new IngressFlowLoopSegmentInstallCommand(new MessageContext(), UUID.randomUUID(), metadata, endpoint);
FloodlightModuleContext context = new FloodlightModuleContext();
IOFSwitchService switchServiceMock = mock(IOFSwitchService.class);
expect(switchServiceMock.getActiveSwitch(anyObject())).andReturn(getOfSwitch()).anyTimes();
context.addService(IOFSwitchService.class, switchServiceMock);
FeatureDetectorService featureDetectorServiceMock = mock(FeatureDetectorService.class);
expect(featureDetectorServiceMock.detectSwitch(anyObject())).andReturn(FEATURES).anyTimes();
context.addService(FeatureDetectorService.class, featureDetectorServiceMock);
PropertiesBasedConfigurationProvider provider = new PropertiesBasedConfigurationProvider(new Properties());
KildaCore kildaCoreMock = mock(KildaCore.class);
expect(kildaCoreMock.getConfig()).andReturn(provider.getConfiguration(KildaCoreConfig.class)).anyTimes();
context.addService(KildaCore.class, kildaCoreMock);
replay(switchServiceMock, featureDetectorServiceMock, kildaCoreMock);
command.setup(context);
return command;
}
use of org.openkilda.messaging.MessageContext in project open-kilda by telstra.
the class OneSwitchFlowCommandJsonTest method makeRequest.
@Override
protected OneSwitchFlowRequest makeRequest() {
SwitchId swId = new SwitchId(1);
OneSwitchFlowRequestFactory factory = new OneSwitchFlowRequestFactory(new MessageContext(), new FlowSegmentMetadata("single-switch-flow-install-request", new Cookie(2), false), new FlowEndpoint(swId, 3, 4), new MeterConfig(new MeterId(6), 7000), new FlowEndpoint(swId, 8, 9), RulesContext.builder().build(), MirrorConfig.builder().build());
return makeRequest(factory);
}
Aggregations