Search in sources :

Example 6 with TestServiceDirectory

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

the class K8sPortWebResourceTest method setUpTest.

/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
    final CodecManager codecService = new CodecManager();
    codecService.activate();
    codecService.registerCodec(K8sPort.class, new K8sPortCodec());
    ServiceDirectory testDirectory = new TestServiceDirectory().add(K8sNetworkAdminService.class, mockAdminService).add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
}
Also used : ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) CodecManager(org.onosproject.codec.impl.CodecManager) K8sNetworkAdminService(org.onosproject.k8snetworking.api.K8sNetworkAdminService) K8sPortCodec(org.onosproject.k8snetworking.codec.K8sPortCodec) Before(org.junit.Before)

Example 7 with TestServiceDirectory

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

the class ControlMetricsResourceTest method setUpTest.

/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
    final CodecManager codecService = new CodecManager();
    codecService.activate();
    codecService.registerCodec(ControlLoadSnapshot.class, new ControlLoadSnapshotCodec());
    ServiceDirectory testDirectory = new TestServiceDirectory().add(ControlPlaneMonitorService.class, mockControlPlaneMonitorService).add(ClusterService.class, mockClusterService).add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
    nodeId = new NodeId("1");
    mockControlLoad = new MockControlLoad();
    ControllerNode mockControllerNode = new MockControllerNode(nodeId);
    expect(mockClusterService.getLocalNode()).andReturn(mockControllerNode).anyTimes();
    replay(mockClusterService);
}
Also used : ClusterService(org.onosproject.cluster.ClusterService) ControlLoadSnapshotCodec(org.onosproject.cpman.codec.ControlLoadSnapshotCodec) ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) NodeId(org.onosproject.cluster.NodeId) ControllerNode(org.onosproject.cluster.ControllerNode) CodecManager(org.onosproject.codec.impl.CodecManager) Before(org.junit.Before)

Example 8 with TestServiceDirectory

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

the class OpenstackVtapNetworkWebResourceTest method setUpTest.

/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
    final CodecManager codecService = new CodecManager();
    codecService.activate();
    codecService.registerCodec(OpenstackVtapNetwork.class, new OpenstackVtapNetworkCodec());
    ServiceDirectory testDirectory = new TestServiceDirectory().add(OpenstackVtapService.class, mockVtapService).add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
    vtapNetwork = DefaultOpenstackVtapNetwork.builder().mode(OpenstackVtapNetwork.Mode.VXLAN).networkId(1).serverIp(IpAddress.valueOf("10.10.10.1")).build();
}
Also used : OpenstackVtapService(org.onosproject.openstackvtap.api.OpenstackVtapService) OpenstackVtapNetworkCodec(org.onosproject.openstackvtap.codec.OpenstackVtapNetworkCodec) ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) CodecManager(org.onosproject.codec.impl.CodecManager) Before(org.junit.Before)

Example 9 with TestServiceDirectory

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

the class KubevirtMm5WebResourceTest method setUpTest.

/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
    final CodecManager codecService = new CodecManager();
    codecService.activate();
    codecService.registerCodec(KubevirtNetwork.class, new KubevirtNetworkCodec());
    codecService.registerCodec(KubevirtHostRoute.class, new KubevirtHostRouteCodec());
    codecService.registerCodec(KubevirtIpPool.class, new KubevirtIpPoolCodec());
    ServiceDirectory testDirectory = new TestServiceDirectory().add(KubevirtNodeService.class, mockNodeService).add(KubevirtNetworkService.class, mockNetworkService).add(KubevirtRouterService.class, mockRouterService).add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
}
Also used : KubevirtNodeService(org.onosproject.kubevirtnode.api.KubevirtNodeService) KubevirtNetworkCodec(org.onosproject.kubevirtnetworking.codec.KubevirtNetworkCodec) ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) CodecManager(org.onosproject.codec.impl.CodecManager) KubevirtRouterService(org.onosproject.kubevirtnetworking.api.KubevirtRouterService) KubevirtIpPoolCodec(org.onosproject.kubevirtnetworking.codec.KubevirtIpPoolCodec) KubevirtHostRouteCodec(org.onosproject.kubevirtnetworking.codec.KubevirtHostRouteCodec) Before(org.junit.Before)

Example 10 with TestServiceDirectory

use of org.onlab.osgi.TestServiceDirectory 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)

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