Search in sources :

Example 41 with TestServiceDirectory

use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.

the class VirtualNetworkLinkManagerTest method setUp.

@Before
public void setUp() throws Exception {
    virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
    coreService = new VirtualNetworkLinkManagerTest.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();
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) DistributedVirtualNetworkStore(org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore) TestStorageService(org.onosproject.store.service.TestStorageService) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) Before(org.junit.Before)

Example 42 with TestServiceDirectory

use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.

the class VirtualNetworkManagerTest method setUp.

@Before
public void setUp() throws Exception {
    virtualNetworkManagerStore = new DistributedVirtualNetworkStore();
    MockIdGenerator.cleanBind();
    coreService = new TestCoreService();
    TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService);
    TestUtils.setField(virtualNetworkManagerStore, "storageService", new TestStorageService());
    virtualNetworkManagerStore.activate();
    manager = new VirtualNetworkManager();
    manager.store = virtualNetworkManagerStore;
    manager.addListener(listener);
    manager.coreService = coreService;
    NetTestTools.injectEventDispatcher(manager, new TestEventDispatcher());
    testDirectory = new TestServiceDirectory();
    TestUtils.setField(manager, "serviceDirectory", testDirectory);
    manager.activate();
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) DistributedVirtualNetworkStore(org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore) TestStorageService(org.onosproject.store.service.TestStorageService) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) Before(org.junit.Before)

Example 43 with TestServiceDirectory

use of org.onlab.osgi.TestServiceDirectory in project onos by opennetworkinglab.

the class VirtualNetworkMastershipManagerTest 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;
    TestUtils.setField(manager, "coreService", coreService);
    eventDeliveryService = new TestEventDispatcher();
    NetTestTools.injectEventDispatcher(manager, eventDeliveryService);
    SimpleVirtualMastershipStore store = new SimpleVirtualMastershipStore();
    TestUtils.setField(store, "coreService", coreService);
    store.activate();
    testClusterService = new TestClusterService();
    ServiceDirectory testDirectory = new TestServiceDirectory().add(VirtualNetworkStore.class, virtualNetworkManagerStore).add(CoreService.class, coreService).add(EventDeliveryService.class, eventDeliveryService).add(ClusterService.class, testClusterService).add(VirtualNetworkMastershipStore.class, store);
    TestUtils.setField(manager, "serviceDirectory", testDirectory);
    manager.activate();
    createVnets();
    mastershipMgr1 = new VirtualNetworkMastershipManager(manager, vnet1.id());
    mastershipMgr2 = new VirtualNetworkMastershipManager(manager, vnet2.id());
    service = mastershipMgr1;
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) SimpleVirtualMastershipStore(org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualMastershipStore) DistributedVirtualNetworkStore(org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore) ClusterService(org.onosproject.cluster.ClusterService) TestStorageService(org.onosproject.store.service.TestStorageService) ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) CoreService(org.onosproject.core.CoreService) Before(org.junit.Before)

Example 44 with TestServiceDirectory

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

Example 45 with TestServiceDirectory

use of org.onlab.osgi.TestServiceDirectory 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());
}
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) EventDeliveryService(org.onosproject.event.EventDeliveryService) CoreService(org.onosproject.core.CoreService) VirtualNetworkFlowRuleStore(org.onosproject.incubator.net.virtual.VirtualNetworkFlowRuleStore) DistributedVirtualNetworkStore(org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore) ClusterServiceAdapter(org.onosproject.cluster.ClusterServiceAdapter) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) VirtualProviderManager(org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager) VirtualNetworkPacketStore(org.onosproject.incubator.net.virtual.VirtualNetworkPacketStore) Before(org.junit.Before)

Aggregations

TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)71 Before (org.junit.Before)66 ServiceDirectory (org.onlab.osgi.ServiceDirectory)53 CodecManager (org.onosproject.codec.impl.CodecManager)37 DistributedVirtualNetworkStore (org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore)14 TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)13 TestStorageService (org.onosproject.store.service.TestStorageService)12 CoreService (org.onosproject.core.CoreService)10 BeforeClass (org.junit.BeforeClass)5 CfmCodecContext (org.onosproject.cfm.CfmCodecContext)5 CodecService (org.onosproject.codec.CodecService)5 VirtualProviderManager (org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager)5 BaseConfig (org.onosproject.net.config.BaseConfig)5 DeviceService (org.onosproject.net.device.DeviceService)5 TestApplicationId (org.onosproject.TestApplicationId)4 CfmMdService (org.onosproject.incubator.net.l2monitoring.cfm.service.CfmMdService)3 VirtualNetworkStore (org.onosproject.incubator.net.virtual.VirtualNetworkStore)3 VirtualProviderRegistryService (org.onosproject.incubator.net.virtual.provider.VirtualProviderRegistryService)3 SimpleVirtualFlowRuleStore (org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualFlowRuleStore)3 Semaphore (java.util.concurrent.Semaphore)2