blob: cfa001f177bceb41a359f1b7d3f81374deecf883 [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
Jan Kundrát7a30cf42022-07-12 22:24:09 +020029 revision 2022-07-08 {
30 description "Extended firmware slot properties and actions";
31 }
32
Tomáš Peckab6c06e12021-04-20 20:09:44 +020033 typedef percent {
34 type uint8 {
35 range "0 .. 100";
36 }
37 }
38
Tomáš Pecka9a02c3f2021-01-21 15:27:22 +010039 container firmware {
40 config false;
41
Tomáš Peckaad32af22021-01-27 17:39:57 +010042 list firmware-slot {
43 key name;
44
45 leaf name {
46 description "Identifier of the slot.";
47 type string;
48 }
49
50 leaf version {
51 description "Firmware version installed in the slot.";
52 type string;
53 }
54
55 leaf installed {
56 description "Datetime of the last installation performed in this slot.";
57 type yang:date-and-time;
58 }
59
Jan Kundrát58b39ae2022-07-08 18:54:10 +020060 leaf is-booted-now {
61 description "Is the system running from this slot?";
62 type boolean;
Tomáš Peckaad32af22021-01-27 17:39:57 +010063 }
64
Jan Kundrát58b39ae2022-07-08 18:54:10 +020065 leaf is-healthy {
66 description "Only healthy slots are considered for booting. Slots which failed during a boot are marked as non-healthy.";
67 type boolean;
Tomáš Peckaad32af22021-01-27 17:39:57 +010068 }
Jan Kundráte55b56b2022-07-13 12:51:44 +020069
70 leaf will-boot-next {
71 description "Is this slot selected for booting after the next reboot?";
72 type boolean;
73 }
Jan Kundrát3795cab2022-07-13 18:08:19 +020074
75 action set-active-after-reboot {
76 description "Schedule this slot for activation after the next reboot";
77 }
78
79 action set-unhealthy {
80 description "Mark this slot as having faulted during the last boot";
81 }
Tomáš Peckaad32af22021-01-27 17:39:57 +010082 }
83
Tomáš Pecka9a02c3f2021-01-21 15:27:22 +010084 container installation {
85 leaf status {
86 description "Informs about the status of the current (or last) installation.";
87
88 type enumeration {
89 enum none;
90 enum in-progress;
91 enum succeeded;
92 enum failed;
93 }
94 }
95
96 leaf message {
97 description "The last message from the installation process. This MAY contain the last error message.";
98 type string;
99 }
100
101 notification update {
102 description "Notifies clients about installation progress.";
103
104 leaf message {
105 description "Progress status.";
106 type string;
107 }
108
109 leaf progress {
110 description "Progress of the installation in percents.";
111
112 type int8 {
113 range "0 .. 100";
114 }
115 }
116 }
117
118 action install {
Václav Kubernát4107b782021-02-18 05:40:01 +0100119 nacm:default-deny-all;
Jan Kundrát13b13592021-12-04 15:28:44 +0100120 description "Download and install a new firmware image to the inactive FW slot";
Tomáš Pecka9a02c3f2021-01-21 15:27:22 +0100121 input {
122 leaf url {
123 description "URL or path to the new firmware.";
124 type string;
125 mandatory true;
126 }
127 }
128 }
129 }
130 }
Václav Kubernát59c19c12021-01-26 08:48:11 +0100131
132 typedef username-type {
133 type string {
134 pattern "[a-z][a-z0-9-]{0,30}";
135 }
136 }
137
Václav Kubernátac257f32021-02-08 19:24:52 +0100138 typedef password-type {
139 type string {
140 pattern "[^\\r\\n]*";
141 }
142 }
143
Václav Kubernát59c19c12021-01-26 08:48:11 +0100144 grouping authentication-rpc-result {
145 leaf result {
146 mandatory true;
147 type enumeration {
148 enum success;
149 enum failure;
150 }
151 }
152
153 leaf message {
154 description "Can be used to supply and error message.";
155 type string;
156 }
157 }
158
159 typedef authorized-key-format {
160 description "Pubkey in the authorized_keys format for sshd.";
161 type string;
162 }
163
164
165 container authentication {
Jan Kundrát13b13592021-12-04 15:28:44 +0100166 description "User management";
Václav Kubernát59c19c12021-01-26 08:48:11 +0100167 list users {
168 config false;
169 key 'name';
Jan Kundrát13b13592021-12-04 15:28:44 +0100170 description "All user accounts which are configured in the Linux system";
Václav Kubernát59c19c12021-01-26 08:48:11 +0100171
172 leaf name {
173 type username-type;
174 }
175
176 leaf password-last-change {
177 type string;
178 }
179
180 list authorized-keys {
181 key 'index';
Jan Kundrát13b13592021-12-04 15:28:44 +0100182 description "List of SSH keys which are recognized for this user";
183
Václav Kubernát59c19c12021-01-26 08:48:11 +0100184 leaf index {
185 type int32;
186 }
187
188 leaf public-key {
189 mandatory true;
190 type authorized-key-format;
191 }
192
193 action remove {
Jan Kundrát7311fa92021-12-04 15:27:36 +0100194 nacm:default-deny-all;
Jan Kundrát13b13592021-12-04 15:28:44 +0100195 description "Remove the selected SSH authentication key of the selected user";
Václav Kubernát59c19c12021-01-26 08:48:11 +0100196 output {
197 uses authentication-rpc-result;
198 }
199 }
200 }
201
202 action change-password {
Václav Kubernát4107b782021-02-18 05:40:01 +0100203 nacm:default-deny-all;
Václav Kubernát59c19c12021-01-26 08:48:11 +0100204 input {
205 leaf password-cleartext {
206 mandatory true;
207 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 +0100208 type password-type;
Václav Kubernát59c19c12021-01-26 08:48:11 +0100209 }
210 }
211
212 output {
213 uses authentication-rpc-result;
214 }
215 }
216
217 action add-authorized-key {
Václav Kubernát4107b782021-02-18 05:40:01 +0100218 nacm:default-deny-all;
Jan Kundrát13b13592021-12-04 15:28:44 +0100219 description "Add a new SSH public key for authentication as the selected user";
Václav Kubernát59c19c12021-01-26 08:48:11 +0100220 input {
221 leaf key {
222 mandatory true;
223 type authorized-key-format;
224 }
225 }
226
227 output {
228 uses authentication-rpc-result;
229 }
230 }
231 }
232 }
Tomáš Peckad26a3ce2021-02-15 20:39:26 +0100233
Tomáš Peckab6c06e12021-04-20 20:09:44 +0200234 container leds {
235 config false;
236 description "Current status of LEDs.";
237
238 list led {
239 key 'name';
240
241 leaf name {
242 type string;
243 description "Name of the LED";
244 }
245
246 leaf brightness {
247 mandatory true;
248 description "Current brightness of the LED in percents of the maximal possible brightness of the LED.";
249 type percent;
250 }
251 }
Tomáš Pecka5be83e42021-04-21 17:26:40 +0200252
253 action uid {
254 input {
255 leaf state {
256 mandatory true;
257 description "Change state of the UID led (turn off, on, or keep blinking).";
258 type enumeration {
259 enum off;
260 enum on;
261 enum blinking;
262 }
263 }
264 }
265 }
Tomáš Peckab6c06e12021-04-20 20:09:44 +0200266 }
267
Jan Kundrát9eea4ba2021-02-19 01:05:25 +0100268 deviation /sys:system-shutdown { deviate not-supported; }
Tomáš Pecka79344c82021-09-16 18:25:59 +0200269 deviation /sys:system/sys:dns-resolver { deviate add { config false; } }
Tomáš Pecka9a02c3f2021-01-21 15:27:22 +0100270}