Search in sources :

Example 1 with SwitchFlowFactory

use of org.openkilda.floodlight.switchmanager.factory.SwitchFlowFactory 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);
}
Also used : IOFSwitch(net.floodlightcontroller.core.IOFSwitch) PathVerificationServiceConfig(org.openkilda.floodlight.pathverification.PathVerificationServiceConfig) IOFSwitchService(net.floodlightcontroller.core.internal.IOFSwitchService) FeatureDetectorService(org.openkilda.floodlight.service.FeatureDetectorService) IFloodlightProviderService(net.floodlightcontroller.core.IFloodlightProviderService) KildaCore(org.openkilda.floodlight.KildaCore) FloodlightModuleConfigurationProvider(org.openkilda.floodlight.config.provider.FloodlightModuleConfigurationProvider) IRestApiService(net.floodlightcontroller.restserver.IRestApiService) PathVerificationService(org.openkilda.floodlight.pathverification.PathVerificationService) IPathVerificationService(org.openkilda.floodlight.pathverification.IPathVerificationService) JdkProxyStaticConfigurationFactory(com.sabre.oss.conf4j.factory.jdkproxy.JdkProxyStaticConfigurationFactory) MapConfigurationSource(com.sabre.oss.conf4j.source.MapConfigurationSource) KildaCoreConfig(org.openkilda.floodlight.KildaCoreConfig) SwitchDescription(net.floodlightcontroller.core.SwitchDescription) SwitchFlowFactory(org.openkilda.floodlight.switchmanager.factory.SwitchFlowFactory) Before(org.junit.Before)

Example 2 with SwitchFlowFactory

use of org.openkilda.floodlight.switchmanager.factory.SwitchFlowFactory in project open-kilda by telstra.

the class SwitchManager method init.

/**
 * {@inheritDoc}
 */
@Override
public void init(FloodlightModuleContext context) throws FloodlightModuleException {
    ofSwitchService = context.getServiceImpl(IOFSwitchService.class);
    producerService = context.getServiceImpl(IKafkaProducerService.class);
    switchTracking = context.getServiceImpl(SwitchTrackingService.class);
    featureDetectorService = context.getServiceImpl(FeatureDetectorService.class);
    FloodlightModuleConfigurationProvider provider = FloodlightModuleConfigurationProvider.of(context, this);
    config = provider.getConfiguration(SwitchManagerConfig.class);
    switchFlowFactory = context.getServiceImpl(SwitchFlowFactory.class);
    String connectModeProperty = config.getConnectMode();
    try {
        connectMode = ConnectModeRequest.Mode.valueOf(connectModeProperty);
    } catch (Exception e) {
        logger.error("CONFIG EXCEPTION: connect-mode could not be set to {}, defaulting to AUTO", connectModeProperty);
        connectMode = ConnectModeRequest.Mode.AUTO;
    }
}
Also used : FloodlightModuleConfigurationProvider(org.openkilda.floodlight.config.provider.FloodlightModuleConfigurationProvider) IOFSwitchService(net.floodlightcontroller.core.internal.IOFSwitchService) IKafkaProducerService(org.openkilda.floodlight.service.kafka.IKafkaProducerService) FeatureDetectorService(org.openkilda.floodlight.service.FeatureDetectorService) SwitchFlowFactory(org.openkilda.floodlight.switchmanager.factory.SwitchFlowFactory) InvalidMeterIdException(org.openkilda.floodlight.error.InvalidMeterIdException) ExecutionException(java.util.concurrent.ExecutionException) TimeoutException(java.util.concurrent.TimeoutException) SwitchOperationException(org.openkilda.floodlight.error.SwitchOperationException) UnsupportedSwitchOperationException(org.openkilda.floodlight.error.UnsupportedSwitchOperationException) SwitchNotFoundException(org.openkilda.floodlight.error.SwitchNotFoundException) FloodlightModuleException(net.floodlightcontroller.core.module.FloodlightModuleException) OfInstallException(org.openkilda.floodlight.error.OfInstallException)

Example 3 with SwitchFlowFactory

use of org.openkilda.floodlight.switchmanager.factory.SwitchFlowFactory in project open-kilda by telstra.

the class SwitchManagerOF12Test method setUp.

@Before
public void setUp() throws FloodlightModuleException {
    EasyMock.reset(switchService);
    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();
    SwitchFlowFactory switchFlowFactory = EasyMock.createMock(SwitchFlowFactory.class);
    expect(switchFlowFactory.getDropLoopFlowGenerator()).andReturn(DropLoopFlowGenerator.builder().build()).anyTimes();
    replay(pathVerificationService, switchFlowFactory);
    context.addService(IPathVerificationService.class, pathVerificationService);
    context.addService(SwitchFlowFactory.class, switchFlowFactory);
    switchManager = new SwitchManager();
    switchManager.init(context);
}
Also used : PathVerificationService(org.openkilda.floodlight.pathverification.PathVerificationService) IPathVerificationService(org.openkilda.floodlight.pathverification.IPathVerificationService) PathVerificationServiceConfig(org.openkilda.floodlight.pathverification.PathVerificationServiceConfig) SwitchFlowFactory(org.openkilda.floodlight.switchmanager.factory.SwitchFlowFactory) Before(org.junit.Before)

Aggregations

SwitchFlowFactory (org.openkilda.floodlight.switchmanager.factory.SwitchFlowFactory)3 IOFSwitchService (net.floodlightcontroller.core.internal.IOFSwitchService)2 Before (org.junit.Before)2 FloodlightModuleConfigurationProvider (org.openkilda.floodlight.config.provider.FloodlightModuleConfigurationProvider)2 IPathVerificationService (org.openkilda.floodlight.pathverification.IPathVerificationService)2 PathVerificationService (org.openkilda.floodlight.pathverification.PathVerificationService)2 PathVerificationServiceConfig (org.openkilda.floodlight.pathverification.PathVerificationServiceConfig)2 FeatureDetectorService (org.openkilda.floodlight.service.FeatureDetectorService)2 JdkProxyStaticConfigurationFactory (com.sabre.oss.conf4j.factory.jdkproxy.JdkProxyStaticConfigurationFactory)1 MapConfigurationSource (com.sabre.oss.conf4j.source.MapConfigurationSource)1 ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 IFloodlightProviderService (net.floodlightcontroller.core.IFloodlightProviderService)1 IOFSwitch (net.floodlightcontroller.core.IOFSwitch)1 SwitchDescription (net.floodlightcontroller.core.SwitchDescription)1 FloodlightModuleException (net.floodlightcontroller.core.module.FloodlightModuleException)1 IRestApiService (net.floodlightcontroller.restserver.IRestApiService)1 KildaCore (org.openkilda.floodlight.KildaCore)1 KildaCoreConfig (org.openkilda.floodlight.KildaCoreConfig)1 InvalidMeterIdException (org.openkilda.floodlight.error.InvalidMeterIdException)1