Move ClusterAdminRpcService to its own bundle
[controller.git] / opendaylight / md-sal / sal-cluster-admin / src / main / yang / cluster-admin.yang
diff --git a/opendaylight/md-sal/sal-cluster-admin/src/main/yang/cluster-admin.yang b/opendaylight/md-sal/sal-cluster-admin/src/main/yang/cluster-admin.yang
new file mode 100644 (file)
index 0000000..2d81db7
--- /dev/null
@@ -0,0 +1,161 @@
+module cluster-admin {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:cluster:admin";
+    prefix "cluster-admin";
+
+    description
+        "This module contains YANG RPC definitions for administering a cluster.";
+
+    revision "2015-10-13" {
+        description "Initial revision.";
+    }
+
+    typedef data-store-type {
+        type enumeration {
+            enum config {
+                value 1;
+            }
+            enum operational {
+                value 2;
+            }
+        }
+    }
+
+    grouping shard-operation-result {
+        leaf shard-name {
+            type string;
+        }
+
+        leaf data-store-type {
+            type data-store-type;
+        }
+
+        leaf succeeded {
+            type boolean;
+        }
+
+        leaf error-message {
+            type string;
+        }
+    }
+
+    grouping shard-result-output {
+        list shard-result {
+            key "shard-name data-store-type";
+            uses shard-operation-result;
+
+            description "The list of results, one per shard";
+        }
+    }
+    
+    rpc add-shard-replica {
+        input {
+            leaf shard-name {
+                mandatory true;
+                type string;
+                description "The name of the shard for which to create a replica.";
+            }
+
+            leaf data-store-type {
+                mandatory true;
+                type data-store-type;
+                description "The type of the data store to which the replica belongs";
+            }
+        }
+
+        description "Adds a replica of a shard to this node and joins it to an existing cluster. The shard must
+            already have a module configuration defined for it and there must already be a shard existing on
+            another node with a leader. This RPC first contacts peer member seed nodes searching for a shard.
+            When found, an AddServer message is sent to the shard leader and applied as described in the Raft
+            paper.";
+    }
+
+    rpc remove-shard-replica {
+        input {
+            leaf shard-name {
+                mandatory true;
+                type string;
+                description "The name of the shard for which to remove the replica.";
+            }
+
+            leaf member-name {
+                mandatory true;
+                type string;
+                description "The cluster member from which the shard replica should be removed";
+            }
+
+            leaf data-store-type {
+                mandatory true;
+                type data-store-type;
+                description "The type of the data store to which the replica belongs";
+            }
+        }
+
+        description "Removes an existing replica of a shard from this node via the RemoveServer mechanism as
+            described in the Raft paper.";
+    }
+
+    rpc add-replicas-for-all-shards {
+        output {
+            uses shard-result-output;
+        }
+
+        description "Adds replicas on this node for all currently defined shards. This is equivalent to issuing
+            an add-shard-replica RPC for all shards.";
+    }
+
+    rpc remove-all-shard-replicas {
+        input {
+            leaf member-name {
+                mandatory true;
+                type string;
+                description "The cluster member from which the shard replicas should be removed";
+            }
+        }
+        
+        output {
+            uses shard-result-output;
+        }
+        
+        description "Removes replicas for all shards on this node. This is equivalent to issuing
+            a remove-shard-replica for all shards and essentially removes this node from a cluster.";
+    }
+
+    rpc convert-members-to-nonvoting-for-all-shards {
+        input {
+            leaf-list member-names {
+                type string;
+                description "The names of the cluster members to convert.";
+            }
+        }
+        
+        description "Converts the given cluster members to non-voting for all shards. The members will no 
+            longer participate in leader elections and consensus but will be replicated. This is useful for
+            having a set of members serve as a backup cluster in case the primary voting cluster suffers
+            catastrophic failure. This RPC can be issued to any cluster member and will be forwarded
+            to the leader.";
+    }
+
+    rpc convert-members-to-voting-for-all-shards {
+        input {
+            leaf-list member-names {
+                type string;
+                description "The names of the cluster members to convert.";
+            }
+        }
+
+        description "Converts the given cluster members to voting for all shards. The members will 
+            participate in leader elections and consensus.";
+    }
+
+    rpc backup-datastore {
+        input {
+            leaf file-path {
+              type string;
+              description "The path and name of the file in which to store the backup.";
+            }
+        }
+
+        description "Creates a backup file of the datastore state";
+    }
+}
\ No newline at end of file