Further warnings mitigation
[netconf.git] / keystore / keystore-legacy / src / main / yang / netconf-keystore.yang
1 module netconf-keystore {
2     namespace "urn:opendaylight:netconf:keystore";
3     prefix "keystore";
4
5     revision "2017-10-17" {
6         description "Initial revision of the Netconf SBP keystore.";
7     }
8
9     description "Store used for key based Credentials for Netconf SBP. Before a connector with key based authentication
10                  is created it needs to have a record for the key pair it uses. All the records here need to be
11                  encrypted as they contain sensitive data. Therefore NEVER do direct writes and only use the provided
12                  RPCs for adding/removing key entries.";
13
14     grouping keystore-entry {
15         list key-credential {
16             key key-id;
17
18             leaf key-id {
19                 type string;
20             }
21
22             leaf private-key {
23                 description "Base64 encoded private key that should be used for authentication with a netconf device.
24                              Do not include a public key as that is calculated from the private key.
25                              DO NOT write this directly into the data store, use the provided RPCs as these will
26                              encrypt the key before the entry is written into the data store.";
27                 type string;
28             }
29
30             leaf passphrase {
31                 description "If the provided key is encrypted by a passphrase this needs to be included. Leave empty
32                              if the key does not have a passphrase.
33                              DO NOT write write this directly into the data store, use the provided RPCs as these will
34                              encrypt the passphrase before the entry is written into the data store.";
35                 type string;
36             }
37         }
38     }
39
40     grouping private-keys {
41         list private-key {
42             key name;
43             description "A private key.";
44             leaf name {
45                 type string;
46             }
47             leaf data {
48                 description "Base64 encoded private key.";
49                 type string;
50             }
51             leaf-list certificate-chain {
52                 description "A certificate chain for this public key. Each certificate is an X.509 v3 certificate
53                              structure as specified by RFC5280, encoded using the Base64 format.";
54                 type string;
55                 ordered-by user;
56             }
57         }
58     }
59
60     grouping trusted-certificates {
61         list trusted-certificate {
62             key name;
63             description "A list of trusted certificate. These certificates can be used by a server to authenticate
64                          clients, or by clients to authenticate servers.";
65             leaf name {
66                 type string;
67             }
68             leaf certificate {
69                 description "An X.509 v3 certificate structure as specified by RFC5280, encoded using
70                              the Base64 format.";
71                 type string;
72             }
73         }
74     }
75
76     container keystore {
77         uses keystore-entry;
78         uses private-keys;
79         uses trusted-certificates;
80     }
81
82     rpc add-keystore-entry {
83         description "Use this rpc to add a single or multiple new keys into the keystore. The private key and passphrase
84                      will both be encrypted before they are written into the data store.";
85         input {
86             uses keystore-entry;
87         }
88     }
89
90     rpc remove-keystore-entry {
91         description "Use this rpc to remove a single or multiple keys from the data store.";
92         input {
93             leaf-list key-id {
94                 type string;
95             }
96         }
97     }
98
99     rpc add-private-key {
100         description "Add a list of private keys into the keystore.";
101         input {
102             uses private-keys;
103         }
104     }
105
106     rpc remove-private-key {
107         description "Remove a list of private keys from the data store.";
108         input {
109             leaf-list name {
110                 type string;
111             }
112         }
113     }
114
115     rpc add-trusted-certificate {
116         description "Add a list of trusted certificates into the keystore.";
117         input {
118             uses trusted-certificates;
119         }
120     }
121
122     rpc remove-trusted-certificate {
123         description "Remove a list of trusted certificates from the data store.";
124         input {
125             leaf-list name {
126                 type string;
127             }
128         }
129     }
130 }