use of org.onosproject.event.EventDeliveryService in project onos by opennetworkinglab.
the class VirtualNetworkMeterManagerTest method setUp.
@Before
public void setUp() throws Exception {
virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
CoreService coreService = new TestCoreService();
TestStorageService storageService = new TestStorageService();
TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService);
TestUtils.setField(virtualNetworkManagerStore, "storageService", storageService);
virtualNetworkManagerStore.activate();
meterStore = new SimpleVirtualMeterStore();
providerRegistryService = new VirtualProviderManager();
providerRegistryService.registerProvider(provider);
manager = new VirtualNetworkManager();
manager.store = virtualNetworkManagerStore;
TestUtils.setField(manager, "coreService", coreService);
eventDeliveryService = new TestEventDispatcher();
NetTestTools.injectEventDispatcher(manager, eventDeliveryService);
// eventDeliveryService.addSink(VirtualEvent.class, listenerRegistryManager);
appId = new TestApplicationId("MeterManagerTest");
testDirectory = new TestServiceDirectory().add(VirtualNetworkStore.class, virtualNetworkManagerStore).add(CoreService.class, coreService).add(VirtualProviderRegistryService.class, providerRegistryService).add(EventDeliveryService.class, eventDeliveryService).add(StorageService.class, storageService).add(VirtualNetworkMeterStore.class, meterStore);
TestUtils.setField(manager, "serviceDirectory", testDirectory);
manager.activate();
vnet1 = setupVirtualNetworkTopology(manager, TID1);
vnet2 = setupVirtualNetworkTopology(manager, TID2);
meterManager1 = new VirtualNetworkMeterManager(manager, vnet1.id());
meterManager2 = new VirtualNetworkMeterManager(manager, vnet2.id());
providerService1 = (VirtualMeterProviderService) providerRegistryService.getProviderService(vnet1.id(), VirtualMeterProvider.class);
providerService2 = (VirtualMeterProviderService) providerRegistryService.getProviderService(vnet2.id(), VirtualMeterProvider.class);
assertTrue("provider should be registered", providerRegistryService.getProviders().contains(provider.id()));
setupMeterTestVariables();
}
use of org.onosproject.event.EventDeliveryService in project onos by opennetworkinglab.
the class VirtualNetworkPacketManagerTest method setUp.
@Before
public void setUp() throws TestUtils.TestUtilsException {
virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService);
TestUtils.setField(virtualNetworkManagerStore, "storageService", storageService);
virtualNetworkManagerStore.activate();
manager = new VirtualNetworkManager();
manager.store = virtualNetworkManagerStore;
manager.coreService = coreService;
NetTestTools.injectEventDispatcher(manager, new TestEventDispatcher());
flowObjectiveStore = new SimpleVirtualFlowObjectiveStore();
TestUtils.setField(flowObjectiveStore, "storageService", storageService);
flowObjectiveStore.activate();
flowRuleStore = new SimpleVirtualFlowRuleStore();
flowRuleStore.activate();
providerRegistryService = new VirtualProviderManager();
providerRegistryService.registerProvider(provider);
providerRegistryService.registerProvider(flowRuleProvider);
testDirectory = new TestServiceDirectory().add(VirtualNetworkStore.class, virtualNetworkManagerStore).add(CoreService.class, coreService).add(VirtualProviderRegistryService.class, providerRegistryService).add(EventDeliveryService.class, eventDeliveryService).add(ClusterService.class, new ClusterServiceAdapter()).add(VirtualNetworkFlowRuleStore.class, flowRuleStore).add(VirtualNetworkFlowObjectiveStore.class, flowObjectiveStore).add(VirtualNetworkPacketStore.class, packetStore);
TestUtils.setField(manager, "serviceDirectory", testDirectory);
eventDeliveryService = new TestEventDispatcher();
NetTestTools.injectEventDispatcher(manager, eventDeliveryService);
manager.activate();
vnet1 = VirtualNetworkTestUtil.setupVirtualNetworkTopology(manager, TID1);
vnet2 = VirtualNetworkTestUtil.setupVirtualNetworkTopology(manager, TID2);
packetManager1 = new VirtualNetworkPacketManager(manager, vnet1.id());
packetManager2 = new VirtualNetworkPacketManager(manager, vnet2.id());
}
Aggregations