Search in sources :

Example 1 with KafkaChannel

use of org.openkilda.floodlight.KafkaChannel in project open-kilda by telstra.

the class KafkaMessageCollector method startUp.

@Override
public void startUp(FloodlightModuleContext moduleContext) {
    logger.info("Starting {}", this.getClass().getCanonicalName());
    FloodlightModuleConfigurationProvider provider = FloodlightModuleConfigurationProvider.of(moduleContext, this);
    KafkaMessageCollectorConfig consumerConfig = provider.getConfiguration(KafkaMessageCollectorConfig.class);
    KafkaChannel kafkaChannel = moduleContext.getServiceImpl(KafkaUtilityService.class).getKafkaChannel();
    logger.info("region: {}", kafkaChannel.getRegion());
    ConsumerLauncher launcher = new ConsumerLauncher(moduleContext, consumerConfig);
    launchTopics(consumerConfig, kafkaChannel, launcher);
}
Also used : FloodlightModuleConfigurationProvider(org.openkilda.floodlight.config.provider.FloodlightModuleConfigurationProvider) KafkaChannel(org.openkilda.floodlight.KafkaChannel) KafkaUtilityService(org.openkilda.floodlight.service.kafka.KafkaUtilityService)

Example 2 with KafkaChannel

use of org.openkilda.floodlight.KafkaChannel in project open-kilda by telstra.

the class PathVerificationService method startUp.

@Override
public void startUp(FloodlightModuleContext context) throws FloodlightModuleException {
    logger.info("Stating {}", PathVerificationService.class.getCanonicalName());
    KafkaChannel kafkaChannel = context.getServiceImpl(KafkaUtilityService.class).getKafkaChannel();
    logger.info("region: {}", kafkaChannel.getRegion());
    topoDiscoTopic = context.getServiceImpl(KafkaUtilityService.class).getKafkaChannel().getTopoDiscoTopic();
    islLatencyTopic = context.getServiceImpl(KafkaUtilityService.class).getKafkaChannel().getIslLatencyTopic();
    region = context.getServiceImpl(KafkaUtilityService.class).getKafkaChannel().getRegion();
    InputService inputService = context.getServiceImpl(InputService.class);
    inputService.addTranslator(OFType.PACKET_IN, this);
    context.getServiceImpl(PingService.class).setup(context);
    context.getServiceImpl(IRestApiService.class).addRestletRoutable(new PathVerificationServiceWebRoutable());
}
Also used : IRestApiService(net.floodlightcontroller.restserver.IRestApiService) InputService(org.openkilda.floodlight.service.of.InputService) PingService(org.openkilda.floodlight.service.ping.PingService) KafkaChannel(org.openkilda.floodlight.KafkaChannel) KafkaUtilityService(org.openkilda.floodlight.service.kafka.KafkaUtilityService) PathVerificationServiceWebRoutable(org.openkilda.floodlight.pathverification.web.PathVerificationServiceWebRoutable)

Example 3 with KafkaChannel

use of org.openkilda.floodlight.KafkaChannel in project open-kilda by telstra.

the class OfBatchExecutor method sendResponse.

private void sendResponse() {
    KafkaChannel kafkaChannel = kafkaUtilityService.getKafkaChannel();
    log.debug("Send response to {} (key={})", kafkaChannel.getSpeakerFlowHsTopic(), kafkaKey);
    kafkaProducerService.sendMessageAndTrack(kafkaChannel.getSpeakerFlowHsTopic(), kafkaKey, holder.getResult());
}
Also used : KafkaChannel(org.openkilda.floodlight.KafkaChannel)

Example 4 with KafkaChannel

use of org.openkilda.floodlight.KafkaChannel 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();
}
Also used : FloodlightModuleConfigurationProvider(org.openkilda.floodlight.config.provider.FloodlightModuleConfigurationProvider) KildaCoreConfig(org.openkilda.floodlight.KildaCoreConfig) KafkaChannel(org.openkilda.floodlight.KafkaChannel) KafkaUtilityService(org.openkilda.floodlight.service.kafka.KafkaUtilityService) Before(org.junit.Before)

Example 5 with KafkaChannel

use of org.openkilda.floodlight.KafkaChannel in project open-kilda by telstra.

the class SwitchTrackingServiceTest method setUp.

@Before
public void setUp() throws Exception {
    injectMocks(this);
    moduleContext.addService(ISwitchManager.class, switchManager);
    moduleContext.addService(FeatureDetectorService.class, featureDetector);
    moduleContext.addService(IKafkaProducerService.class, producerService);
    IOFSwitchService iofSwitchService = createMock(IOFSwitchService.class);
    iofSwitchService.addOFSwitchListener(eq(service));
    moduleContext.addService(IOFSwitchService.class, iofSwitchService);
    KafkaChannel topics = createMock(KafkaChannel.class);
    expect(topics.getTopoDiscoTopic()).andReturn(KAFKA_ISL_DISCOVERY_TOPIC);
    expect(topics.getRegion()).andReturn("1");
    KafkaUtilityService kafkaUtility = createMock(KafkaUtilityService.class);
    expect(kafkaUtility.getKafkaChannel()).andReturn(topics);
    moduleContext.addService(KafkaUtilityService.class, kafkaUtility);
    replay(kafkaUtility, topics, iofSwitchService);
    service.setup(moduleContext);
    verify(iofSwitchService);
    reset(kafkaUtility, topics, iofSwitchService);
}
Also used : IOFSwitchService(net.floodlightcontroller.core.internal.IOFSwitchService) KafkaChannel(org.openkilda.floodlight.KafkaChannel) KafkaUtilityService(org.openkilda.floodlight.service.kafka.KafkaUtilityService) Before(org.junit.Before)

Aggregations

KafkaChannel (org.openkilda.floodlight.KafkaChannel)9 KafkaUtilityService (org.openkilda.floodlight.service.kafka.KafkaUtilityService)8 Before (org.junit.Before)3 IOFSwitchService (net.floodlightcontroller.core.internal.IOFSwitchService)2 FloodlightModuleConfigurationProvider (org.openkilda.floodlight.config.provider.FloodlightModuleConfigurationProvider)2 IKafkaProducerService (org.openkilda.floodlight.service.kafka.IKafkaProducerService)2 InputService (org.openkilda.floodlight.service.of.InputService)2 IRestApiService (net.floodlightcontroller.restserver.IRestApiService)1 ZkStateTracker (org.openkilda.bluegreen.ZkStateTracker)1 KildaCore (org.openkilda.floodlight.KildaCore)1 KildaCoreConfig (org.openkilda.floodlight.KildaCoreConfig)1 PathVerificationServiceWebRoutable (org.openkilda.floodlight.pathverification.web.PathVerificationServiceWebRoutable)1 FeatureDetectorService (org.openkilda.floodlight.service.FeatureDetectorService)1 PingService (org.openkilda.floodlight.service.ping.PingService)1