Move ClusterAdminRpcService to its own bundle
[controller.git] / opendaylight / md-sal / sal-cluster-admin / src / main / yang / cluster-admin.yang
1 module cluster-admin {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:cluster:admin";
4     prefix "cluster-admin";
5
6     description
7         "This module contains YANG RPC definitions for administering a cluster.";
8
9     revision "2015-10-13" {
10         description "Initial revision.";
11     }
12
13     typedef data-store-type {
14         type enumeration {
15             enum config {
16                 value 1;
17             }
18             enum operational {
19                 value 2;
20             }
21         }
22     }
23
24     grouping shard-operation-result {
25         leaf shard-name {
26             type string;
27         }
28
29         leaf data-store-type {
30             type data-store-type;
31         }
32
33         leaf succeeded {
34             type boolean;
35         }
36
37         leaf error-message {
38             type string;
39         }
40     }
41
42     grouping shard-result-output {
43         list shard-result {
44             key "shard-name data-store-type";
45             uses shard-operation-result;
46
47             description "The list of results, one per shard";
48         }
49     }
50     
51     rpc add-shard-replica {
52         input {
53             leaf shard-name {
54                 mandatory true;
55                 type string;
56                 description "The name of the shard for which to create a replica.";
57             }
58
59             leaf data-store-type {
60                 mandatory true;
61                 type data-store-type;
62                 description "The type of the data store to which the replica belongs";
63             }
64         }
65
66         description "Adds a replica of a shard to this node and joins it to an existing cluster. The shard must
67             already have a module configuration defined for it and there must already be a shard existing on
68             another node with a leader. This RPC first contacts peer member seed nodes searching for a shard.
69             When found, an AddServer message is sent to the shard leader and applied as described in the Raft
70             paper.";
71     }
72
73     rpc remove-shard-replica {
74         input {
75             leaf shard-name {
76                 mandatory true;
77                 type string;
78                 description "The name of the shard for which to remove the replica.";
79             }
80
81             leaf member-name {
82                 mandatory true;
83                 type string;
84                 description "The cluster member from which the shard replica should be removed";
85             }
86
87             leaf data-store-type {
88                 mandatory true;
89                 type data-store-type;
90                 description "The type of the data store to which the replica belongs";
91             }
92         }
93
94         description "Removes an existing replica of a shard from this node via the RemoveServer mechanism as
95             described in the Raft paper.";
96     }
97
98     rpc add-replicas-for-all-shards {
99         output {
100             uses shard-result-output;
101         }
102
103         description "Adds replicas on this node for all currently defined shards. This is equivalent to issuing
104             an add-shard-replica RPC for all shards.";
105     }
106
107     rpc remove-all-shard-replicas {
108         input {
109             leaf member-name {
110                 mandatory true;
111                 type string;
112                 description "The cluster member from which the shard replicas should be removed";
113             }
114         }
115         
116         output {
117             uses shard-result-output;
118         }
119         
120         description "Removes replicas for all shards on this node. This is equivalent to issuing
121             a remove-shard-replica for all shards and essentially removes this node from a cluster.";
122     }
123
124     rpc convert-members-to-nonvoting-for-all-shards {
125         input {
126             leaf-list member-names {
127                 type string;
128                 description "The names of the cluster members to convert.";
129             }
130         }
131         
132         description "Converts the given cluster members to non-voting for all shards. The members will no 
133             longer participate in leader elections and consensus but will be replicated. This is useful for
134             having a set of members serve as a backup cluster in case the primary voting cluster suffers
135             catastrophic failure. This RPC can be issued to any cluster member and will be forwarded
136             to the leader.";
137     }
138
139     rpc convert-members-to-voting-for-all-shards {
140         input {
141             leaf-list member-names {
142                 type string;
143                 description "The names of the cluster members to convert.";
144             }
145         }
146
147         description "Converts the given cluster members to voting for all shards. The members will 
148             participate in leader elections and consensus.";
149     }
150
151     rpc backup-datastore {
152         input {
153             leaf file-path {
154               type string;
155               description "The path and name of the file in which to store the backup.";
156             }
157         }
158
159         description "Creates a backup file of the datastore state";
160     }
161 }