use of org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualIntentStore 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);
}
use of org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualIntentStore in project onos by opennetworkinglab.
the class VirtualNetworkIntentManagerTest method setUp.
@Before
public void setUp() throws Exception {
virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
intentStore = new SimpleVirtualIntentStore();
coreService = new VirtualNetworkIntentManagerTest.TestCoreService();
MockIdGenerator.cleanBind();
TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService);
TestUtils.setField(virtualNetworkManagerStore, "storageService", new TestStorageService());
virtualNetworkManagerStore.activate();
manager = new VirtualNetworkManager();
manager.store = virtualNetworkManagerStore;
NetTestTools.injectEventDispatcher(manager, new TestEventDispatcher());
intentService.addListener(listener);
// Register a compiler and an installer both setup for success.
intentExtensionService = intentService;
intentExtensionService.registerCompiler(VirtualNetworkIntent.class, compiler);
created = new Semaphore(0, true);
withdrawn = new Semaphore(0, true);
purged = new Semaphore(0, true);
workPartitionService = new WorkPartitionServiceAdapter();
testDirectory = new TestServiceDirectory().add(VirtualNetworkStore.class, virtualNetworkManagerStore).add(IntentService.class, intentService).add(WorkPartitionService.class, workPartitionService);
TestUtils.setField(manager, "serviceDirectory", testDirectory);
manager.activate();
}
Aggregations