Search in sources :

Example 1 with AddShardReplicaInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddShardReplicaInputBuilder in project controller by opendaylight.

the class ClusterAdminRpcServiceTest method testAddShardReplicaFailures.

@Test
public void testAddShardReplicaFailures() throws Exception {
    String name = "testAddShardReplicaFailures";
    MemberNode memberNode = MemberNode.builder(memberNodes).akkaConfig("Member1").testName(name).moduleShardsConfig("module-shards-cars-member-1.conf").build();
    ClusterAdminRpcService service = new ClusterAdminRpcService(memberNode.configDataStore(), memberNode.operDataStore(), null);
    RpcResult<Void> rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder().setDataStoreType(DataStoreType.Config).build()).get(10, TimeUnit.SECONDS);
    verifyFailedRpcResult(rpcResult);
    rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder().setShardName("cars").build()).get(10, TimeUnit.SECONDS);
    verifyFailedRpcResult(rpcResult);
    rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder().setShardName("people").setDataStoreType(DataStoreType.Config).build()).get(10, TimeUnit.SECONDS);
    verifyFailedRpcResult(rpcResult);
}
Also used : MemberNode(org.opendaylight.controller.cluster.datastore.MemberNode) AddShardReplicaInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddShardReplicaInputBuilder) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Example 2 with AddShardReplicaInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddShardReplicaInputBuilder in project controller by opendaylight.

the class ClusterAdminRpcServiceTest method doAddShardReplica.

private static void doAddShardReplica(MemberNode memberNode, String shardName, String... peerMemberNames) throws Exception {
    memberNode.waitForMembersUp(peerMemberNames);
    ClusterAdminRpcService service = new ClusterAdminRpcService(memberNode.configDataStore(), memberNode.operDataStore(), null);
    RpcResult<Void> rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder().setShardName(shardName).setDataStoreType(DataStoreType.Config).build()).get(10, TimeUnit.SECONDS);
    verifySuccessfulRpcResult(rpcResult);
    verifyRaftPeersPresent(memberNode.configDataStore(), shardName, peerMemberNames);
    Optional<ActorRef> optional = memberNode.operDataStore().getActorContext().findLocalShard(shardName);
    assertFalse("Oper shard present", optional.isPresent());
    rpcResult = service.addShardReplica(new AddShardReplicaInputBuilder().setShardName(shardName).setDataStoreType(DataStoreType.Operational).build()).get(10, TimeUnit.SECONDS);
    verifySuccessfulRpcResult(rpcResult);
    verifyRaftPeersPresent(memberNode.operDataStore(), shardName, peerMemberNames);
}
Also used : AddShardReplicaInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddShardReplicaInputBuilder) ActorRef(akka.actor.ActorRef)

Aggregations

AddShardReplicaInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.AddShardReplicaInputBuilder)2 ActorRef (akka.actor.ActorRef)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 Test (org.junit.Test)1 MemberNode (org.opendaylight.controller.cluster.datastore.MemberNode)1