Search in sources :

Example 1 with ComponentContextAdapter

use of org.onlab.osgi.ComponentContextAdapter 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 ComponentContextAdapter

use of org.onlab.osgi.ComponentContextAdapter in project onos by opennetworkinglab.

the class NeighbourResolutionManagerTest method setUp.

@Before
public void setUp() throws Exception {
    neighbourManager = new NeighbourResolutionManager();
    packetService = createMock(PacketService.class);
    packetService.requestPackets(anyObject(TrafficSelector.class), anyObject(PacketPriority.class), anyObject(ApplicationId.class));
    expectLastCall().anyTimes();
    packetService.addProcessor(anyObject(PacketProcessor.class), anyInt());
    expectLastCall().andDelegateTo(new TestPacketService()).once();
    packetService.cancelPackets(anyObject(TrafficSelector.class), anyObject(PacketPriority.class), anyObject(ApplicationId.class));
    expectLastCall().anyTimes();
    replay(packetService);
    neighbourManager.packetService = packetService;
    CoreService coreService = createNiceMock(CoreService.class);
    replay(coreService);
    neighbourManager.coreService = coreService;
    neighbourManager.componentConfigService = new ComponentConfigAdapter();
    neighbourManager.activate(new ComponentContextAdapter());
}
Also used : PacketPriority(org.onosproject.net.packet.PacketPriority) ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) ComponentContextAdapter(org.onlab.osgi.ComponentContextAdapter) PacketProcessor(org.onosproject.net.packet.PacketProcessor) PacketService(org.onosproject.net.packet.PacketService) TrafficSelector(org.onosproject.net.flow.TrafficSelector) CoreService(org.onosproject.core.CoreService) TestApplicationId(org.onosproject.TestApplicationId) ApplicationId(org.onosproject.core.ApplicationId) Before(org.junit.Before)

Example 3 with ComponentContextAdapter

use of org.onlab.osgi.ComponentContextAdapter in project onos by opennetworkinglab.

the class OpticalPathProvisionerTest method setUp.

@Before
public void setUp() {
    this.deviceService = new TestDeviceService();
    deviceService.devMap.put(deviceIdOf(1), DEVICE1);
    deviceService.devMap.put(deviceIdOf(2), DEVICE2);
    deviceService.devMap.put(deviceIdOf(3), DEVICE3);
    deviceService.devMap.put(deviceIdOf(4), DEVICE4);
    deviceService.devMap.put(deviceIdOf(5), DEVICE5);
    deviceService.devMap.put(deviceIdOf(6), DEVICE6);
    deviceService.devMap.put(deviceIdOf(7), DEVICE7);
    deviceService.portMap.put(CP11, PORT11);
    deviceService.portMap.put(CP12, PORT12);
    deviceService.portMap.put(CP21, PORT21);
    deviceService.portMap.put(CP22, PORT22);
    deviceService.portMap.put(CP31, PORT31);
    deviceService.portMap.put(CP32, PORT32);
    deviceService.portMap.put(CP41, PORT41);
    deviceService.portMap.put(CP42, PORT42);
    deviceService.portMap.put(CP51, PORT51);
    deviceService.portMap.put(CP52, PORT52);
    deviceService.portMap.put(CP61, PORT61);
    deviceService.portMap.put(CP62, PORT62);
    deviceService.portMap.put(CP71, PORT71);
    deviceService.portMap.put(CP72, PORT72);
    this.linkService = new TestLinkService();
    linkService.links.addAll(Stream.of(LINK1, LINK2, LINK3, LINK4, LINK5, LINK6).collect(Collectors.toList()));
    this.topologyService = new TestTopologyService();
    this.intentService = new TestIntentService();
    this.mastershipService = new TestMastershipService();
    this.clusterService = new TestClusterService();
    mastershipService.setMastership(DEVICE1.id(), MastershipRole.MASTER);
    mastershipService.setMastership(DEVICE2.id(), MastershipRole.MASTER);
    mastershipService.setMastership(DEVICE3.id(), MastershipRole.MASTER);
    mastershipService.setMastership(DEVICE4.id(), MastershipRole.MASTER);
    mastershipService.setMastership(DEVICE5.id(), MastershipRole.MASTER);
    mastershipService.setMastership(DEVICE6.id(), MastershipRole.MASTER);
    mastershipService.setMastership(DEVICE7.id(), MastershipRole.MASTER);
    this.target = new OpticalPathProvisioner();
    target.coreService = new TestCoreService();
    target.intentService = this.intentService;
    target.topologyService = this.topologyService;
    target.linkService = this.linkService;
    target.mastershipService = this.mastershipService;
    target.clusterService = this.clusterService;
    target.storageService = new TestStorageService();
    target.deviceService = this.deviceService;
    target.networkConfigService = new TestNetworkConfigService();
    target.resourceService = new TestResourceService();
    injectEventDispatcher(target, new TestEventDispatcher());
    target.addListener(listener);
    target.activate(new ComponentContextAdapter());
    // To overwrite opticalView-ed deviceService
    target.deviceService = this.deviceService;
    idGenerator = new IdGenerator() {

        int counter = 1;

        @Override
        public long getNewId() {
            return counter++;
        }
    };
    Intent.unbindIdGenerator(idGenerator);
    Intent.bindIdGenerator(idGenerator);
}
Also used : ComponentContextAdapter(org.onlab.osgi.ComponentContextAdapter) IdGenerator(org.onosproject.core.IdGenerator) ConnectPoint(org.onosproject.net.ConnectPoint) Before(org.junit.Before)

Example 4 with ComponentContextAdapter

use of org.onlab.osgi.ComponentContextAdapter in project onos by opennetworkinglab.

the class VirtualNetworkPacketManagerWithDistStoreTest method setUpDistPacketStore.

private void setUpDistPacketStore() throws TestUtils.TestUtilsException {
    distStore = new DistributedVirtualPacketStore();
    TestUtils.setField(distStore, "cfgService", new ComponentConfigAdapter());
    TestUtils.setField(distStore, "storageService", storageService);
    TestUtils.setField(distStore, "clusterService", clusterService);
    TestUtils.setField(distStore, "communicationService", new TestClusterCommunicationService());
    TestUtils.setField(distStore, "mastershipService", new TestMastershipService());
    distStore.activate(new ComponentContextAdapter());
    // super.setUp() will cause Distributed store to be used.
    packetStore = distStore;
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) ComponentContextAdapter(org.onlab.osgi.ComponentContextAdapter) DistributedVirtualPacketStore(org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualPacketStore)

Aggregations

ComponentContextAdapter (org.onlab.osgi.ComponentContextAdapter)4 Before (org.junit.Before)3 ComponentConfigAdapter (org.onosproject.cfg.ComponentConfigAdapter)2 TestApplicationId (org.onosproject.TestApplicationId)1 ApplicationService (org.onosproject.app.ApplicationService)1 ApplicationId (org.onosproject.core.ApplicationId)1 CoreService (org.onosproject.core.CoreService)1 IdGenerator (org.onosproject.core.IdGenerator)1 DistributedVirtualPacketStore (org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualPacketStore)1 ConnectPoint (org.onosproject.net.ConnectPoint)1 NetworkConfigListener (org.onosproject.net.config.NetworkConfigListener)1 DeviceListener (org.onosproject.net.device.DeviceListener)1 TrafficSelector (org.onosproject.net.flow.TrafficSelector)1 FlowObjectiveService (org.onosproject.net.flowobjective.FlowObjectiveService)1 HostService (org.onosproject.net.host.HostService)1 InterfaceListener (org.onosproject.net.intf.InterfaceListener)1 PacketPriority (org.onosproject.net.packet.PacketPriority)1 PacketProcessor (org.onosproject.net.packet.PacketProcessor)1 PacketService (org.onosproject.net.packet.PacketService)1