Search in sources :

Example 6 with ClusterServiceAdapter

use of org.onosproject.cluster.ClusterServiceAdapter in project onos by opennetworkinglab.

the class VplsOperationManagerTest method setup.

@Before
public void setup() {
    MockIdGenerator.cleanBind();
    vplsOperationManager = new VplsOperationManager();
    vplsOperationManager.coreService = new TestCoreService();
    vplsOperationManager.intentService = new TestIntentService();
    vplsOperationManager.leadershipService = new TestLeadershipService();
    vplsOperationManager.clusterService = new ClusterServiceAdapter();
    vplsOperationManager.hostService = new TestHostService();
    vplsOperationManager.vplsStore = new TestVplsStore();
    vplsOperationManager.isLeader = true;
    vplsOperationManager.activate();
}
Also used : ClusterServiceAdapter(org.onosproject.cluster.ClusterServiceAdapter) Before(org.junit.Before)

Example 7 with ClusterServiceAdapter

use of org.onosproject.cluster.ClusterServiceAdapter in project onos by opennetworkinglab.

the class MastershipProxyManagerTest method testProxyManager.

@Test
public void testProxyManager() throws Exception {
    TestClusterCommunicationServiceFactory clusterCommunicatorFactory = new TestClusterCommunicationServiceFactory();
    NodeId a = NodeId.nodeId("a");
    NodeId b = NodeId.nodeId("b");
    DeviceId deviceId = DeviceId.deviceId("a");
    Serializer serializer = Serializer.using(KryoNamespaces.BASIC);
    ProxyInterfaceImpl proxyInterface1 = new ProxyInterfaceImpl();
    MastershipProxyManager proxyManager1 = new MastershipProxyManager();
    proxyManager1.clusterService = new ClusterServiceAdapter() {

        @Override
        public ControllerNode getLocalNode() {
            return new DefaultControllerNode(a, IpAddress.valueOf(0));
        }
    };
    proxyManager1.clusterCommunicator = clusterCommunicatorFactory.newCommunicationService(a);
    proxyManager1.mastershipService = new MastershipServiceAdapter() {

        @Override
        public NodeId getMasterFor(DeviceId deviceId) {
            return b;
        }
    };
    proxyManager1.activate();
    proxyManager1.registerProxyService(ProxyInterface.class, proxyInterface1, serializer);
    ProxyInterfaceImpl proxyInterface2 = new ProxyInterfaceImpl();
    MastershipProxyManager proxyManager2 = new MastershipProxyManager();
    proxyManager2.clusterService = new ClusterServiceAdapter() {

        @Override
        public ControllerNode getLocalNode() {
            return new DefaultControllerNode(b, IpAddress.valueOf(0));
        }
    };
    proxyManager2.clusterCommunicator = clusterCommunicatorFactory.newCommunicationService(b);
    proxyManager2.mastershipService = new MastershipServiceAdapter() {

        @Override
        public NodeId getMasterFor(DeviceId deviceId) {
            return b;
        }
    };
    proxyManager2.activate();
    proxyManager2.registerProxyService(ProxyInterface.class, proxyInterface2, serializer);
    MastershipProxyFactory<ProxyInterface> proxyFactory1 = proxyManager1.getProxyFactory(ProxyInterface.class, serializer);
    assertEquals("Hello world!", proxyFactory1.getProxyFor(deviceId).sync("Hello world!"));
    assertEquals(1, proxyInterface2.syncCalls.get());
    assertEquals("Hello world!", proxyFactory1.getProxyFor(deviceId).async("Hello world!").join());
    assertEquals(1, proxyInterface2.asyncCalls.get());
    MastershipProxyFactory<ProxyInterface> proxyFactory2 = proxyManager2.getProxyFactory(ProxyInterface.class, serializer);
    assertEquals("Hello world!", proxyFactory2.getProxyFor(deviceId).sync("Hello world!"));
    assertEquals(2, proxyInterface2.syncCalls.get());
    assertEquals("Hello world!", proxyFactory2.getProxyFor(deviceId).async("Hello world!").join());
    assertEquals(2, proxyInterface2.asyncCalls.get());
    proxyManager1.deactivate();
    proxyManager2.deactivate();
}
Also used : DeviceId(org.onosproject.net.DeviceId) ControllerNode(org.onosproject.cluster.ControllerNode) DefaultControllerNode(org.onosproject.cluster.DefaultControllerNode) DefaultControllerNode(org.onosproject.cluster.DefaultControllerNode) MastershipServiceAdapter(org.onosproject.mastership.MastershipServiceAdapter) ClusterServiceAdapter(org.onosproject.cluster.ClusterServiceAdapter) NodeId(org.onosproject.cluster.NodeId) Serializer(org.onosproject.store.service.Serializer) Test(org.junit.Test)

Example 8 with ClusterServiceAdapter

use of org.onosproject.cluster.ClusterServiceAdapter in project onos by opennetworkinglab.

the class GossipIntentStoreTest method setUp.

@Override
@Before
public void setUp() {
    intentStore = new GossipIntentStore();
    intentStore.storageService = new TestStorageService();
    intentStore.partitionService = new WorkPartitionServiceAdapter();
    intentStore.clusterService = new ClusterServiceAdapter();
    super.setUp();
    builder1 = HostToHostIntent.builder().one(hid("12:34:56:78:91:ab/1")).two(hid("12:34:56:78:91:ac/1")).appId(APP_ID);
    intentStore.configService = new MockComponentConfigService();
    intentStore.activate(null);
}
Also used : WorkPartitionServiceAdapter(org.onosproject.net.intent.WorkPartitionServiceAdapter) TestStorageService(org.onosproject.store.service.TestStorageService) ClusterServiceAdapter(org.onosproject.cluster.ClusterServiceAdapter) Before(org.junit.Before)

Example 9 with ClusterServiceAdapter

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

Example 10 with ClusterServiceAdapter

use of org.onosproject.cluster.ClusterServiceAdapter in project onos by opennetworkinglab.

the class OpenstackNetworkManagerTest method setUp.

@Before
public void setUp() throws Exception {
    NETWORK.setId(NETWORK_ID);
    NETWORK_COPY.setId(NETWORK_ID);
    SUBNET.setId(SUBNET_ID);
    SUBNET_COPY.setId(SUBNET_ID);
    PORT.setId(PORT_ID);
    PORT_COPY.setId(PORT_ID);
    osNetworkStore = new DistributedOpenstackNetworkStore();
    TestUtils.setField(osNetworkStore, "coreService", new TestCoreService());
    TestUtils.setField(osNetworkStore, "storageService", new TestStorageService());
    TestUtils.setField(osNetworkStore, "preCommitPortService", new TestPreCommitPortService());
    TestUtils.setField(osNetworkStore, "eventExecutor", MoreExecutors.newDirectExecutorService());
    osNetworkStore.activate();
    target = new OpenstackNetworkManager();
    TestUtils.setField(target, "coreService", new TestCoreService());
    TestUtils.setField(target, "packetService", new PacketServiceAdapter());
    TestUtils.setField(target, "deviceService", new DeviceServiceAdapter());
    TestUtils.setField(target, "storageService", new TestStorageService());
    TestUtils.setField(target, "clusterService", new ClusterServiceAdapter());
    TestUtils.setField(target, "openstacknodeService", new TestOpenstackNodeManager());
    target.osNetworkStore = osNetworkStore;
    target.addListener(testListener);
    target.activate();
}
Also used : PacketServiceAdapter(org.onosproject.net.packet.PacketServiceAdapter) TestStorageService(org.onosproject.store.service.TestStorageService) ClusterServiceAdapter(org.onosproject.cluster.ClusterServiceAdapter) DeviceServiceAdapter(org.onosproject.net.device.DeviceServiceAdapter) Before(org.junit.Before)

Aggregations

ClusterServiceAdapter (org.onosproject.cluster.ClusterServiceAdapter)13 Before (org.junit.Before)10 TestStorageService (org.onosproject.store.service.TestStorageService)6 TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)4 Test (org.junit.Test)3 CoreServiceAdapter (org.onosproject.core.CoreServiceAdapter)3 ClusterCommunicationServiceAdapter (org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter)3 ControllerNode (org.onosproject.cluster.ControllerNode)2 DefaultControllerNode (org.onosproject.cluster.DefaultControllerNode)2 LeadershipServiceAdapter (org.onosproject.cluster.LeadershipServiceAdapter)2 NodeId (org.onosproject.cluster.NodeId)2 VirtualNetworkPacketStore (org.onosproject.incubator.net.virtual.VirtualNetworkPacketStore)2 VirtualProviderManager (org.onosproject.incubator.net.virtual.impl.provider.VirtualProviderManager)2 FlowObjectiveServiceAdapter (org.onosproject.net.flowobjective.FlowObjectiveServiceAdapter)2 Maps (com.google.common.collect.Maps)1 Sets (com.google.common.collect.Sets)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 List (java.util.List)1 Map (java.util.Map)1