Search in sources :

Example 1 with TestApplicationId

use of org.onosproject.TestApplicationId in project onos by opennetworkinglab.

the class RouteConfigTest method setUp.

@Before
public void setUp() throws Exception {
    InputStream jsonStream = RouteConfigTest.class.getResourceAsStream("/route-config.json");
    ApplicationId subject = new TestApplicationId(KEY);
    ObjectMapper mapper = new ObjectMapper();
    JsonNode jsonNode = mapper.readTree(jsonStream);
    ConfigApplyDelegate delegate = new MockDelegate();
    config = new RouteConfig();
    config.init(subject, KEY, jsonNode, mapper, delegate);
}
Also used : InputStream(java.io.InputStream) TestApplicationId(org.onosproject.TestApplicationId) JsonNode(com.fasterxml.jackson.databind.JsonNode) TestApplicationId(org.onosproject.TestApplicationId) ApplicationId(org.onosproject.core.ApplicationId) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ConfigApplyDelegate(org.onosproject.net.config.ConfigApplyDelegate) Before(org.junit.Before)

Example 2 with TestApplicationId

use of org.onosproject.TestApplicationId 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 3 with TestApplicationId

use of org.onosproject.TestApplicationId 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());
}
Also used : SimpleVirtualFlowRuleStore(org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualFlowRuleStore) TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) SimpleVirtualFlowObjectiveStore(org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualFlowObjectiveStore) VirtualNetworkFlowObjectiveStore(org.onosproject.incubator.net.virtual.VirtualNetworkFlowObjectiveStore) 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) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) VirtualProviderManager(org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager) Before(org.junit.Before)

Example 4 with TestApplicationId

use of org.onosproject.TestApplicationId 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);
}
Also used : SimpleVirtualFlowRuleStore(org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualFlowRuleStore) 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) VirtualNetworkFlowRuleStore(org.onosproject.incubator.net.virtual.VirtualNetworkFlowRuleStore) DistributedVirtualNetworkStore(org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore) 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) Before(org.junit.Before)

Example 5 with TestApplicationId

use of org.onosproject.TestApplicationId 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)

Aggregations

TestApplicationId (org.onosproject.TestApplicationId)7 Before (org.junit.Before)5 TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)4 TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)4 CoreService (org.onosproject.core.CoreService)4 VirtualProviderManager (org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager)4 DistributedVirtualNetworkStore (org.onosproject.incubator.net.virtual.store.impl.DistributedVirtualNetworkStore)4 VirtualProviderRegistryService (org.onosproject.incubator.net.virtual.provider.VirtualProviderRegistryService)3 TestStorageService (org.onosproject.store.service.TestStorageService)3 EqualsTester (com.google.common.testing.EqualsTester)2 Test (org.junit.Test)2 VirtualNetworkStore (org.onosproject.incubator.net.virtual.VirtualNetworkStore)2 SimpleVirtualFlowRuleStore (org.onosproject.incubator.net.virtual.store.impl.SimpleVirtualFlowRuleStore)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 InputStream (java.io.InputStream)1 ApplicationId (org.onosproject.core.ApplicationId)1 EventDeliveryService (org.onosproject.event.EventDeliveryService)1 VirtualNetworkFlowObjectiveStore (org.onosproject.incubator.net.virtual.VirtualNetworkFlowObjectiveStore)1 VirtualNetworkFlowRuleStore (org.onosproject.incubator.net.virtual.VirtualNetworkFlowRuleStore)1