use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.
the class VirtualNetworkGroupManagerTest method setUp.
@Before
public void setUp() throws Exception {
virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
CoreService coreService = new TestCoreService();
TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService);
TestUtils.setField(virtualNetworkManagerStore, "storageService", new TestStorageService());
virtualNetworkManagerStore.activate();
groupStore = new SimpleVirtualGroupStore();
providerRegistryService = new VirtualProviderManager();
providerRegistryService.registerProvider(provider);
manager = new VirtualNetworkManager();
manager.store = virtualNetworkManagerStore;
TestUtils.setField(manager, "coreService", coreService);
eventDeliveryService = new TestEventDispatcher();
injectEventDispatcher(manager, eventDeliveryService);
appId = new TestApplicationId("VirtualGroupManagerTest");
testDirectory = new TestServiceDirectory().add(VirtualNetworkStore.class, virtualNetworkManagerStore).add(CoreService.class, coreService).add(VirtualProviderRegistryService.class, providerRegistryService).add(EventDeliveryService.class, eventDeliveryService).add(VirtualNetworkGroupStore.class, groupStore);
TestUtils.setField(manager, "serviceDirectory", testDirectory);
manager.activate();
vnet1 = setupVirtualNetworkTopology(manager, TID1);
vnet2 = setupVirtualNetworkTopology(manager, TID2);
groupManager1 = new VirtualNetworkGroupManager(manager, vnet1.id());
groupManager2 = new VirtualNetworkGroupManager(manager, vnet2.id());
groupManager1.addListener(listener1);
groupManager2.addListener(listener2);
providerService1 = (VirtualGroupProviderService) providerRegistryService.getProviderService(vnet1.id(), VirtualGroupProvider.class);
providerService2 = (VirtualGroupProviderService) providerRegistryService.getProviderService(vnet2.id(), VirtualGroupProvider.class);
}
use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.
the class VirtualNetworkFlowObjectiveManagerTest method setUp.
@Before
public void setUp() throws Exception {
virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
CoreService coreService = new TestCoreService();
TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService);
TestUtils.setField(virtualNetworkManagerStore, "storageService", storageService);
virtualNetworkManagerStore.activate();
flowObjectiveStore = new SimpleVirtualFlowObjectiveStore();
TestUtils.setField(flowObjectiveStore, "storageService", storageService);
flowObjectiveStore.activate();
flowRuleStore = new SimpleVirtualFlowRuleStore();
flowRuleStore.activate();
manager = new VirtualNetworkManager();
manager.store = virtualNetworkManagerStore;
TestUtils.setField(manager, "coreService", coreService);
providerRegistryService = new VirtualProviderManager();
providerRegistryService.registerProvider(flowRuleProvider);
eventDeliveryService = new TestEventDispatcher();
NetTestTools.injectEventDispatcher(manager, eventDeliveryService);
appId = new TestApplicationId("FlowRuleManagerTest");
testDirectory = new TestServiceDirectory().add(VirtualNetworkStore.class, virtualNetworkManagerStore).add(CoreService.class, coreService).add(EventDeliveryService.class, eventDeliveryService).add(VirtualProviderRegistryService.class, providerRegistryService).add(VirtualNetworkFlowRuleStore.class, flowRuleStore).add(VirtualNetworkFlowObjectiveStore.class, flowObjectiveStore);
TestUtils.setField(manager, "serviceDirectory", testDirectory);
manager.activate();
vnet1 = setupVirtualNetworkTopology(manager, TID1);
vnet2 = setupVirtualNetworkTopology(manager, TID2);
service1 = new VirtualNetworkFlowObjectiveManager(manager, vnet1.id());
service2 = new VirtualNetworkFlowObjectiveManager(manager, vnet2.id());
}
use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.
the class VirtualNetworkFlowRuleManagerTest method setUp.
@Before
public void setUp() throws Exception {
virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
CoreService coreService = new TestCoreService();
TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService);
TestUtils.setField(virtualNetworkManagerStore, "storageService", new TestStorageService());
virtualNetworkManagerStore.activate();
flowRuleStore = new SimpleVirtualFlowRuleStore();
providerRegistryService = new VirtualProviderManager();
providerRegistryService.registerProvider(provider);
manager = new VirtualNetworkManager();
manager.store = virtualNetworkManagerStore;
TestUtils.setField(manager, "coreService", coreService);
eventDeliveryService = new TestEventDispatcher();
NetTestTools.injectEventDispatcher(manager, eventDeliveryService);
appId = new TestApplicationId("FlowRuleManagerTest");
testDirectory = new TestServiceDirectory().add(VirtualNetworkStore.class, virtualNetworkManagerStore).add(CoreService.class, coreService).add(VirtualProviderRegistryService.class, providerRegistryService).add(EventDeliveryService.class, eventDeliveryService).add(VirtualNetworkFlowRuleStore.class, flowRuleStore);
TestUtils.setField(manager, "serviceDirectory", testDirectory);
manager.activate();
vnet1 = setupVirtualNetworkTopology(manager, TID1);
vnet2 = setupVirtualNetworkTopology(manager, TID2);
vnetFlowRuleService1 = new VirtualNetworkFlowRuleManager(manager, vnet1.id());
vnetFlowRuleService2 = new VirtualNetworkFlowRuleManager(manager, vnet2.id());
vnetFlowRuleService1.addListener(listener1);
vnetFlowRuleService2.addListener(listener2);
vnetFlowRuleService1.operationsService = MoreExecutors.newDirectExecutorService();
vnetFlowRuleService2.operationsService = MoreExecutors.newDirectExecutorService();
vnetFlowRuleService1.deviceInstallers = MoreExecutors.newDirectExecutorService();
vnetFlowRuleService2.deviceInstallers = MoreExecutors.newDirectExecutorService();
providerService1 = (VirtualFlowRuleProviderService) providerRegistryService.getProviderService(vnet1.id(), VirtualFlowRuleProvider.class);
providerService2 = (VirtualFlowRuleProviderService) providerRegistryService.getProviderService(vnet2.id(), VirtualFlowRuleProvider.class);
}
use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.
the class VirtualNetworkHostManagerTest method setUp.
@Before
public void setUp() throws Exception {
virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
CoreService coreService = new TestCoreService();
TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService);
TestUtils.setField(virtualNetworkManagerStore, "storageService", new TestStorageService());
virtualNetworkManagerStore.activate();
manager = new VirtualNetworkManager();
manager.store = virtualNetworkManagerStore;
manager.coreService = coreService;
NetTestTools.injectEventDispatcher(manager, new TestEventDispatcher());
testDirectory = new TestServiceDirectory();
TestUtils.setField(manager, "serviceDirectory", testDirectory);
manager.activate();
}
use of org.onosproject.common.event.impl.TestEventDispatcher in project onos by opennetworkinglab.
the class VirtualNetworkManagerTest method testServiceGetReturnsSavedInstance.
/**
* Tests that the get() method returns saved service instances.
*/
@Test
public void testServiceGetReturnsSavedInstance() {
manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
validateServiceGetReturnsSavedInstance(virtualNetwork.id(), DeviceService.class);
validateServiceGetReturnsSavedInstance(virtualNetwork.id(), LinkService.class);
validateServiceGetReturnsSavedInstance(virtualNetwork.id(), TopologyService.class);
validateServiceGetReturnsSavedInstance(virtualNetwork.id(), HostService.class);
validateServiceGetReturnsSavedInstance(virtualNetwork.id(), PathService.class);
// extra setup needed for FlowRuleService, PacketService, GroupService, and IntentService
VirtualProviderManager virtualProviderManager = new VirtualProviderManager();
virtualProviderManager.registerProvider(new DefaultVirtualFlowRuleProvider());
virtualProviderManager.registerProvider(new DefaultVirtualPacketProvider());
virtualProviderManager.registerProvider(new DefaultVirtualGroupProvider());
testDirectory.add(CoreService.class, coreService).add(VirtualProviderRegistryService.class, virtualProviderManager).add(EventDeliveryService.class, new TestEventDispatcher()).add(ClusterService.class, new ClusterServiceAdapter()).add(VirtualNetworkFlowRuleStore.class, new SimpleVirtualFlowRuleStore()).add(VirtualNetworkPacketStore.class, new SimpleVirtualPacketStore()).add(VirtualNetworkGroupStore.class, new SimpleVirtualGroupStore()).add(VirtualNetworkIntentStore.class, new SimpleVirtualIntentStore()).add(VirtualNetworkFlowObjectiveStore.class, new SimpleVirtualFlowObjectiveStore());
validateServiceGetReturnsSavedInstance(virtualNetwork.id(), FlowRuleService.class);
validateServiceGetReturnsSavedInstance(virtualNetwork.id(), FlowObjectiveService.class);
validateServiceGetReturnsSavedInstance(virtualNetwork.id(), PacketService.class);
validateServiceGetReturnsSavedInstance(virtualNetwork.id(), GroupService.class);
validateServiceGetReturnsSavedInstance(virtualNetwork.id(), IntentService.class);
}
Aggregations