use of org.openkilda.floodlight.config.provider.FloodlightModuleConfigurationProvider in project open-kilda by telstra.
the class PingCommandTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
FloodlightModuleConfigurationProvider provider = FloodlightModuleConfigurationProvider.of(moduleContext, KildaCore.class);
KildaCoreConfig coreConfig = provider.getConfiguration(KildaCoreConfig.class);
expect(kildaCore.getConfig()).andStubReturn(coreConfig);
moduleContext.addService(KildaCore.class, kildaCore);
moduleContext.addService(IKafkaProducerService.class, producerService);
moduleContext.addService(PingService.class, pingService);
KafkaChannel topics = createMock(KafkaChannel.class);
expect(topics.getPingTopic()).andReturn(PING_KAFKA_TOPIC).anyTimes();
KafkaUtilityService kafkaUtility = createMock(KafkaUtilityService.class);
expect(kafkaUtility.getKafkaChannel()).andReturn(topics).anyTimes();
moduleContext.addService(KafkaUtilityService.class, kafkaUtility);
producerService.sendMessageAndTrack(anyString(), capture(kafkaMessageCatcher));
expectLastCall().andVoid().anyTimes();
}
use of org.openkilda.floodlight.config.provider.FloodlightModuleConfigurationProvider 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.config.provider.FloodlightModuleConfigurationProvider 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.config.provider.FloodlightModuleConfigurationProvider 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());
}
use of org.openkilda.floodlight.config.provider.FloodlightModuleConfigurationProvider 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;
}
}
Aggregations