blob: 25d70209ef54a58448aa17c0085fd3c7901f0dfe [file] [log] [blame]
Tomáš Pecka9a02c3f2021-01-21 15:27:22 +01001module czechlight-system {
2 yang-version 1.1;
3 namespace
4 "http://czechlight.cesnet.cz/yang/czechlight-system";
5
6 prefix "cla-sys";
7
Tomáš Peckaad32af22021-01-27 17:39:57 +01008 import ietf-yang-types {
9 prefix yang;
10 }
11
Václav Kubernát4107b782021-02-18 05:40:01 +010012 import ietf-netconf-acm {
13 prefix nacm;
14 }
15
Jan Kundrát9eea4ba2021-02-19 01:05:25 +010016 import ietf-system {
17 prefix "sys";
18 }
19
Tomáš Pecka9a02c3f2021-01-21 15:27:22 +010020 organization "CESNET";
21 contact "photonic@cesnet.cz";
22 description
23 "YANG model for system administration in Czechlight devices.";
24
25 revision 2021-01-13 {
26 description "Initial release";
27 }
28
Tomáš Peckab6c06e12021-04-20 20:09:44 +020029 typedef percent {
30 type uint8 {
31 range "0 .. 100";
32 }
33 }
34
Tomáš Pecka9a02c3f2021-01-21 15:27:22 +010035 container firmware {
36 config false;
37
Tomáš Peckaad32af22021-01-27 17:39:57 +010038 list firmware-slot {
39 key name;
40
41 leaf name {
42 description "Identifier of the slot.";
43 type string;
44 }
45
46 leaf version {
47 description "Firmware version installed in the slot.";
48 type string;
49 }
50
51 leaf installed {
52 description "Datetime of the last installation performed in this slot.";
53 type yang:date-and-time;
54 }
55
56 leaf state {
57 description "Current state of the slot.";
58 type enumeration {
59 enum inactive;
60 enum booted;
61 }
62 }
63
64 leaf boot-status {
65 description "Boot status.";
66 type enumeration {
67 enum good;
68 enum bad;
69 }
70 }
71 }
72
Tomáš Pecka9a02c3f2021-01-21 15:27:22 +010073 container installation {
74 leaf status {
75 description "Informs about the status of the current (or last) installation.";
76
77 type enumeration {
78 enum none;
79 enum in-progress;
80 enum succeeded;
81 enum failed;
82 }
83 }
84
85 leaf message {
86 description "The last message from the installation process. This MAY contain the last error message.";
87 type string;
88 }
89
90 notification update {
91 description "Notifies clients about installation progress.";
92
93 leaf message {
94 description "Progress status.";
95 type string;
96 }
97
98 leaf progress {
99 description "Progress of the installation in percents.";
100
101 type int8 {
102 range "0 .. 100";
103 }
104 }
105 }
106
107 action install {
Václav Kubernát4107b782021-02-18 05:40:01 +0100108 nacm:default-deny-all;
Tomáš Pecka9a02c3f2021-01-21 15:27:22 +0100109 input {
110 leaf url {
111 description "URL or path to the new firmware.";
112 type string;
113 mandatory true;
114 }
115 }
116 }
117 }
118 }
Václav Kubernát59c19c12021-01-26 08:48:11 +0100119
120 typedef username-type {
121 type string {
122 pattern "[a-z][a-z0-9-]{0,30}";
123 }
124 }
125
Václav Kubernátac257f32021-02-08 19:24:52 +0100126 typedef password-type {
127 type string {
128 pattern "[^\\r\\n]*";
129 }
130 }
131
Václav Kubernát59c19c12021-01-26 08:48:11 +0100132 grouping authentication-rpc-result {
133 leaf result {
134 mandatory true;
135 type enumeration {
136 enum success;
137 enum failure;
138 }
139 }
140
141 leaf message {
142 description "Can be used to supply and error message.";
143 type string;
144 }
145 }
146
147 typedef authorized-key-format {
148 description "Pubkey in the authorized_keys format for sshd.";
149 type string;
150 }
151
152
153 container authentication {
154 list users {
155 config false;
156 key 'name';
157
158 leaf name {
159 type username-type;
160 }
161
162 leaf password-last-change {
163 type string;
164 }
165
166 list authorized-keys {
167 key 'index';
168 leaf index {
169 type int32;
170 }
171
172 leaf public-key {
173 mandatory true;
174 type authorized-key-format;
175 }
176
177 action remove {
178 output {
179 uses authentication-rpc-result;
180 }
181 }
182 }
183
184 action change-password {
Václav Kubernát4107b782021-02-18 05:40:01 +0100185 nacm:default-deny-all;
Václav Kubernát59c19c12021-01-26 08:48:11 +0100186 input {
187 leaf password-cleartext {
188 mandatory true;
189 description "This is supposed to be a plaintext password. Make sure it's not logged anywhere.";
Václav Kubernátac257f32021-02-08 19:24:52 +0100190 type password-type;
Václav Kubernát59c19c12021-01-26 08:48:11 +0100191 }
192 }
193
194 output {
195 uses authentication-rpc-result;
196 }
197 }
198
199 action add-authorized-key {
Václav Kubernát4107b782021-02-18 05:40:01 +0100200 nacm:default-deny-all;
Václav Kubernát59c19c12021-01-26 08:48:11 +0100201 input {
202 leaf key {
203 mandatory true;
204 type authorized-key-format;
205 }
206 }
207
208 output {
209 uses authentication-rpc-result;
210 }
211 }
212 }
213 }
Tomáš Peckad26a3ce2021-02-15 20:39:26 +0100214
Tomáš Peckab6c06e12021-04-20 20:09:44 +0200215 container leds {
216 config false;
217 description "Current status of LEDs.";
218
219 list led {
220 key 'name';
221
222 leaf name {
223 type string;
224 description "Name of the LED";
225 }
226
227 leaf brightness {
228 mandatory true;
229 description "Current brightness of the LED in percents of the maximal possible brightness of the LED.";
230 type percent;
231 }
232 }
Tomáš Pecka5be83e42021-04-21 17:26:40 +0200233
234 action uid {
235 input {
236 leaf state {
237 mandatory true;
238 description "Change state of the UID led (turn off, on, or keep blinking).";
239 type enumeration {
240 enum off;
241 enum on;
242 enum blinking;
243 }
244 }
245 }
246 }
Tomáš Peckab6c06e12021-04-20 20:09:44 +0200247 }
248
Jan Kundrát9eea4ba2021-02-19 01:05:25 +0100249 deviation /sys:system-shutdown { deviate not-supported; }
Tomáš Pecka9a02c3f2021-01-21 15:27:22 +0100250}