Search in sources :

Example 1 with NetworkConfigListener

use of org.onosproject.net.config.NetworkConfigListener in project onos by opennetworkinglab.

the class ControlPlaneRedirectManagerTest method setUp.

@Before
public void setUp() {
    networkConfigListener = createMock(NetworkConfigListener.class);
    deviceService = new TestDeviceService();
    deviceListener = createMock(DeviceListener.class);
    interfaceListener = createMock(InterfaceListener.class);
    deviceService.addListener(deviceListener);
    setUpInterfaceService();
    interfaceService = new InternalInterfaceService();
    interfaceService.addListener(interfaceListener);
    networkConfigService = new TestNetworkConfigService();
    networkConfigService.addListener(networkConfigListener);
    flowObjectiveService = createMock(FlowObjectiveService.class);
    applicationService = createNiceMock(ApplicationService.class);
    replay(applicationService);
    setUpFlowObjectiveService();
    controlPlaneRedirectManager.coreService = coreService;
    controlPlaneRedirectManager.flowObjectiveService = flowObjectiveService;
    controlPlaneRedirectManager.networkConfigService = networkConfigService;
    controlPlaneRedirectManager.interfaceService = interfaceService;
    controlPlaneRedirectManager.deviceService = deviceService;
    controlPlaneRedirectManager.hostService = createNiceMock(HostService.class);
    controlPlaneRedirectManager.mastershipService = mastershipService;
    controlPlaneRedirectManager.applicationService = applicationService;
    controlPlaneRedirectManager.activate(new ComponentContextAdapter());
    verify(flowObjectiveService);
}
Also used : HostService(org.onosproject.net.host.HostService) DeviceListener(org.onosproject.net.device.DeviceListener) ComponentContextAdapter(org.onlab.osgi.ComponentContextAdapter) FlowObjectiveService(org.onosproject.net.flowobjective.FlowObjectiveService) NetworkConfigListener(org.onosproject.net.config.NetworkConfigListener) InterfaceListener(org.onosproject.net.intf.InterfaceListener) ApplicationService(org.onosproject.app.ApplicationService) Before(org.junit.Before)

Example 2 with NetworkConfigListener

use of org.onosproject.net.config.NetworkConfigListener in project onos by opennetworkinglab.

the class TestCodecService method setup.

@Before
public void setup() throws IOException {
    storageService = new TestStorageService();
    mastershipService = createNiceMock(MastershipService.class);
    coreService = createNiceMock(CoreService.class);
    hostService = createNiceMock(HostService.class);
    deviceService = createNiceMock(DeviceService.class);
    expect(deviceService.getDevices()).andReturn(ImmutableList.of()).anyTimes();
    networkConfigRegistry = createNiceMock(NetworkConfigRegistry.class);
    networkConfigService = createNiceMock(NetworkConfigService.class);
    manager = new SimpleIntManager();
    manager.coreService = coreService;
    manager.deviceService = deviceService;
    manager.storageService = storageService;
    manager.mastershipService = mastershipService;
    manager.hostService = hostService;
    manager.netcfgService = networkConfigService;
    manager.netcfgRegistry = networkConfigRegistry;
    manager.eventExecutor = MoreExecutors.newDirectExecutorService();
    manager.codecService = codecService;
    expect(coreService.registerApplication(APP_NAME)).andReturn(APP_ID).anyTimes();
    networkConfigRegistry.registerConfigFactory(anyObject());
    expectLastCall().once();
    Capture<NetworkConfigListener> capture = newCapture();
    networkConfigService.addListener(EasyMock.capture(capture));
    expectLastCall().once();
    IntReportConfig config = getIntReportConfig("/report-config.json");
    expect(networkConfigService.getConfig(APP_ID, IntReportConfig.class)).andReturn(config).anyTimes();
    replay(mastershipService, deviceService, coreService, hostService, networkConfigRegistry, networkConfigService);
    manager.activate();
    networkConfigListener = capture.getValue();
}
Also used : HostService(org.onosproject.net.host.HostService) NetworkConfigRegistry(org.onosproject.net.config.NetworkConfigRegistry) NetworkConfigService(org.onosproject.net.config.NetworkConfigService) TestStorageService(org.onosproject.store.service.TestStorageService) DeviceService(org.onosproject.net.device.DeviceService) CoreService(org.onosproject.core.CoreService) MastershipService(org.onosproject.mastership.MastershipService) IntReportConfig(org.onosproject.net.behaviour.inbandtelemetry.IntReportConfig) NetworkConfigListener(org.onosproject.net.config.NetworkConfigListener) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)2 NetworkConfigListener (org.onosproject.net.config.NetworkConfigListener)2 HostService (org.onosproject.net.host.HostService)2 ComponentContextAdapter (org.onlab.osgi.ComponentContextAdapter)1 ApplicationService (org.onosproject.app.ApplicationService)1 CoreService (org.onosproject.core.CoreService)1 MastershipService (org.onosproject.mastership.MastershipService)1 IntReportConfig (org.onosproject.net.behaviour.inbandtelemetry.IntReportConfig)1 NetworkConfigRegistry (org.onosproject.net.config.NetworkConfigRegistry)1 NetworkConfigService (org.onosproject.net.config.NetworkConfigService)1 DeviceListener (org.onosproject.net.device.DeviceListener)1 DeviceService (org.onosproject.net.device.DeviceService)1 FlowObjectiveService (org.onosproject.net.flowobjective.FlowObjectiveService)1 InterfaceListener (org.onosproject.net.intf.InterfaceListener)1 TestStorageService (org.onosproject.store.service.TestStorageService)1