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);
}
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());
}
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);
}
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;
}
Aggregations