Search in sources :

Example 1 with KafkaUtilityService

use of org.openkilda.floodlight.service.kafka.KafkaUtilityService 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 2 with KafkaUtilityService

use of org.openkilda.floodlight.service.kafka.KafkaUtilityService 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)

Example 3 with KafkaUtilityService

use of org.openkilda.floodlight.service.kafka.KafkaUtilityService in project open-kilda by telstra.

the class SpeakerCommandProcessor method handleResult.

private void handleResult(SpeakerCommandRemoteReport report, String kafkaKey) {
    KafkaUtilityService kafkaUtil = moduleContext.getServiceImpl(KafkaUtilityService.class);
    IKafkaProducerService kafkaProducer = moduleContext.getServiceImpl(IKafkaProducerService.class);
    report.reply(kafkaUtil.getKafkaChannel(), kafkaProducer, kafkaKey);
}
Also used : IKafkaProducerService(org.openkilda.floodlight.service.kafka.IKafkaProducerService) KafkaUtilityService(org.openkilda.floodlight.service.kafka.KafkaUtilityService)

Example 4 with KafkaUtilityService

use of org.openkilda.floodlight.service.kafka.KafkaUtilityService in project open-kilda by telstra.

the class NetworkDiscoveryEmitterTest method setUp.

@Before
public void setUp() throws Exception {
    injectMocks(this);
    moduleContext.addService(IKafkaProducerService.class, kafkaProducerService);
    moduleContext.addService(IPathVerificationService.class, pathVerificationService);
    KafkaChannel kafkaChannel = mock(KafkaChannel.class);
    expect(kafkaChannel.getTopoDiscoTopic()).andStubReturn(CONFIRMATION_TOPIC);
    expect(kafkaChannel.getRegion()).andStubReturn(REGION);
    KafkaUtilityService kafkaUtility = mock(KafkaUtilityService.class);
    expect(kafkaUtility.getKafkaChannel()).andStubReturn(kafkaChannel);
    moduleContext.addService(KafkaUtilityService.class, kafkaUtility);
}
Also used : KafkaChannel(org.openkilda.floodlight.KafkaChannel) KafkaUtilityService(org.openkilda.floodlight.service.kafka.KafkaUtilityService) Before(org.junit.Before)

Aggregations

KafkaUtilityService (org.openkilda.floodlight.service.kafka.KafkaUtilityService)4 Before (org.junit.Before)3 KafkaChannel (org.openkilda.floodlight.KafkaChannel)3 IOFSwitchService (net.floodlightcontroller.core.internal.IOFSwitchService)1 KildaCoreConfig (org.openkilda.floodlight.KildaCoreConfig)1 FloodlightModuleConfigurationProvider (org.openkilda.floodlight.config.provider.FloodlightModuleConfigurationProvider)1 IKafkaProducerService (org.openkilda.floodlight.service.kafka.IKafkaProducerService)1