use of org.openkilda.floodlight.service.FeatureDetectorService 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.floodlight.service.FeatureDetectorService 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.floodlight.service.FeatureDetectorService in project open-kilda by telstra.
the class SwitchManagerTest method setUp.
@Before
public void setUp() throws FloodlightModuleException {
JdkProxyStaticConfigurationFactory factory = new JdkProxyStaticConfigurationFactory();
config = factory.createConfiguration(SwitchManagerConfig.class, new MapConfigurationSource(emptyMap()));
ofSwitchService = createMock(IOFSwitchService.class);
restApiService = createMock(IRestApiService.class);
featureDetectorService = createMock(FeatureDetectorService.class);
switchFlowFactory = new SwitchFlowFactory();
iofSwitch = createMock(IOFSwitch.class);
switchDescription = createMock(SwitchDescription.class);
dpid = DatapathId.of(SWITCH_ID.toLong());
PathVerificationServiceConfig config = EasyMock.createMock(PathVerificationServiceConfig.class);
expect(config.getVerificationBcastPacketDst()).andReturn("00:26:E1:FF:FF:FF").anyTimes();
replay(config);
PathVerificationService pathVerificationService = EasyMock.createMock(PathVerificationService.class);
expect(pathVerificationService.getConfig()).andReturn(config).anyTimes();
replay(pathVerificationService);
KildaCore kildaCore = EasyMock.createMock(KildaCore.class);
FloodlightModuleConfigurationProvider provider = FloodlightModuleConfigurationProvider.of(context, KildaCore.class);
KildaCoreConfig coreConfig = provider.getConfiguration(KildaCoreConfig.class);
expect(kildaCore.getConfig()).andStubReturn(coreConfig);
EasyMock.replay(kildaCore);
context.addService(KildaCore.class, kildaCore);
SwitchTrackingService switchTracking = createMock(SwitchTrackingService.class);
switchTracking.setup(context);
replay(switchTracking);
context.addService(SwitchTrackingService.class, switchTracking);
IFloodlightProviderService floodlightProvider = createMock(IFloodlightProviderService.class);
floodlightProvider.addOFMessageListener(EasyMock.eq(OFType.ERROR), EasyMock.anyObject(SwitchManager.class));
replay(floodlightProvider);
context.addService(IFloodlightProviderService.class, floodlightProvider);
context.addService(IRestApiService.class, restApiService);
context.addService(IOFSwitchService.class, ofSwitchService);
context.addService(FeatureDetectorService.class, featureDetectorService);
context.addService(SwitchFlowFactory.class, switchFlowFactory);
context.addService(IPathVerificationService.class, pathVerificationService);
switchManager = new SwitchManager();
context.addService(ISwitchManager.class, switchManager);
switchManager.init(context);
switchManager.startUp(context);
}
use of org.openkilda.floodlight.service.FeatureDetectorService in project open-kilda by telstra.
the class MeterCommand method setup.
@Override
protected void setup(FloodlightModuleContext moduleContext) throws Exception {
super.setup(moduleContext);
FloodlightModuleConfigurationProvider provider = FloodlightModuleConfigurationProvider.of(moduleContext, SwitchManager.class);
switchManagerConfig = provider.getConfiguration(SwitchManagerConfig.class);
FeatureDetectorService featuresDetector = moduleContext.getServiceImpl(FeatureDetectorService.class);
switchFeatures = featuresDetector.detectSwitch(getSw());
}
use of org.openkilda.floodlight.service.FeatureDetectorService in project open-kilda by telstra.
the class GroupCommand method setup.
@Override
protected void setup(FloodlightModuleContext moduleContext) throws Exception {
super.setup(moduleContext);
FloodlightModuleConfigurationProvider provider = FloodlightModuleConfigurationProvider.of(moduleContext, SwitchManager.class);
switchManagerConfig = provider.getConfiguration(SwitchManagerConfig.class);
FeatureDetectorService featuresDetector = moduleContext.getServiceImpl(FeatureDetectorService.class);
switchFeatures = featuresDetector.detectSwitch(getSw());
}
Aggregations