Search in sources :

Example 1 with SimpleVirtualGroupStore

use of org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualGroupStore 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);
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) TestStorageService(org.onosproject.store.service.TestStorageService) VirtualProviderRegistryService(org.onosproject.incubator.net.virtual.provider.VirtualProviderRegistryService) CoreService(org.onosproject.core.CoreService) TestApplicationId(org.onosproject.TestApplicationId) DistributedVirtualNetworkStore(org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore) SimpleVirtualGroupStore(org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualGroupStore) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) VirtualNetworkStore(org.onosproject.incubator.net.virtual.VirtualNetworkStore) DistributedVirtualNetworkStore(org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore) VirtualProviderManager(org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager) VirtualNetworkGroupStore(org.onosproject.incubator.net.virtual.VirtualNetworkGroupStore) Before(org.junit.Before)

Example 2 with SimpleVirtualGroupStore

use of org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualGroupStore 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);
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) SimpleVirtualFlowRuleStore(org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualFlowRuleStore) SimpleVirtualFlowObjectiveStore(org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualFlowObjectiveStore) VirtualNetworkIntentStore(org.onosproject.incubator.net.virtual.VirtualNetworkIntentStore) SimpleVirtualPacketStore(org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualPacketStore) VirtualProviderRegistryService(org.onosproject.incubator.net.virtual.provider.VirtualProviderRegistryService) DefaultVirtualPacketProvider(org.onosproject.incubator.net.virtual.impl.provider.DefaultVirtualPacketProvider) DefaultVirtualGroupProvider(org.onosproject.incubator.net.virtual.impl.provider.DefaultVirtualGroupProvider) DefaultVirtualNetwork(org.onosproject.incubator.net.virtual.DefaultVirtualNetwork) VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) SimpleVirtualIntentStore(org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualIntentStore) ClusterService(org.onosproject.cluster.ClusterService) ClusterServiceAdapter(org.onosproject.cluster.ClusterServiceAdapter) SimpleVirtualGroupStore(org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualGroupStore) DefaultVirtualFlowRuleProvider(org.onosproject.incubator.net.virtual.impl.provider.DefaultVirtualFlowRuleProvider) VirtualProviderManager(org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager) VirtualNetworkPacketStore(org.onosproject.incubator.net.virtual.VirtualNetworkPacketStore) Test(org.junit.Test)

Aggregations

TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)2 VirtualProviderManager (org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager)2 VirtualProviderRegistryService (org.onosproject.incubator.net.virtual.provider.VirtualProviderRegistryService)2 SimpleVirtualGroupStore (org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualGroupStore)2 Before (org.junit.Before)1 Test (org.junit.Test)1 TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)1 TestApplicationId (org.onosproject.TestApplicationId)1 ClusterService (org.onosproject.cluster.ClusterService)1 ClusterServiceAdapter (org.onosproject.cluster.ClusterServiceAdapter)1 CoreService (org.onosproject.core.CoreService)1 DefaultVirtualNetwork (org.onosproject.incubator.net.virtual.DefaultVirtualNetwork)1 VirtualNetwork (org.onosproject.incubator.net.virtual.VirtualNetwork)1 VirtualNetworkGroupStore (org.onosproject.incubator.net.virtual.VirtualNetworkGroupStore)1 VirtualNetworkIntentStore (org.onosproject.incubator.net.virtual.VirtualNetworkIntentStore)1 VirtualNetworkPacketStore (org.onosproject.incubator.net.virtual.VirtualNetworkPacketStore)1 VirtualNetworkStore (org.onosproject.incubator.net.virtual.VirtualNetworkStore)1 DefaultVirtualFlowRuleProvider (org.onosproject.incubator.net.virtual.impl.provider.DefaultVirtualFlowRuleProvider)1 DefaultVirtualGroupProvider (org.onosproject.incubator.net.virtual.impl.provider.DefaultVirtualGroupProvider)1 DefaultVirtualPacketProvider (org.onosproject.incubator.net.virtual.impl.provider.DefaultVirtualPacketProvider)1