Tomáš Pecka | 9a02c3f | 2021-01-21 15:27:22 +0100 | [diff] [blame] | 1 | module czechlight-system { |
| 2 | yang-version 1.1; |
| 3 | namespace |
| 4 | "http://czechlight.cesnet.cz/yang/czechlight-system"; |
| 5 | |
| 6 | prefix "cla-sys"; |
| 7 | |
Tomáš Pecka | ad32af2 | 2021-01-27 17:39:57 +0100 | [diff] [blame] | 8 | import ietf-yang-types { |
| 9 | prefix yang; |
| 10 | } |
| 11 | |
Václav Kubernát | 4107b78 | 2021-02-18 05:40:01 +0100 | [diff] [blame] | 12 | import ietf-netconf-acm { |
| 13 | prefix nacm; |
| 14 | } |
| 15 | |
Jan Kundrát | 9eea4ba | 2021-02-19 01:05:25 +0100 | [diff] [blame] | 16 | import ietf-system { |
| 17 | prefix "sys"; |
| 18 | } |
| 19 | |
Tomáš Pecka | 9a02c3f | 2021-01-21 15:27:22 +0100 | [diff] [blame] | 20 | 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át | 7a30cf4 | 2022-07-12 22:24:09 +0200 | [diff] [blame^] | 29 | revision 2022-07-08 { |
| 30 | description "Extended firmware slot properties and actions"; |
| 31 | } |
| 32 | |
Tomáš Pecka | b6c06e1 | 2021-04-20 20:09:44 +0200 | [diff] [blame] | 33 | typedef percent { |
| 34 | type uint8 { |
| 35 | range "0 .. 100"; |
| 36 | } |
| 37 | } |
| 38 | |
Tomáš Pecka | 9a02c3f | 2021-01-21 15:27:22 +0100 | [diff] [blame] | 39 | container firmware { |
| 40 | config false; |
| 41 | |
Tomáš Pecka | ad32af2 | 2021-01-27 17:39:57 +0100 | [diff] [blame] | 42 | 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át | 58b39ae | 2022-07-08 18:54:10 +0200 | [diff] [blame] | 60 | leaf is-booted-now { |
| 61 | description "Is the system running from this slot?"; |
| 62 | type boolean; |
Tomáš Pecka | ad32af2 | 2021-01-27 17:39:57 +0100 | [diff] [blame] | 63 | } |
| 64 | |
Jan Kundrát | 58b39ae | 2022-07-08 18:54:10 +0200 | [diff] [blame] | 65 | 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áš Pecka | ad32af2 | 2021-01-27 17:39:57 +0100 | [diff] [blame] | 68 | } |
Jan Kundrát | e55b56b | 2022-07-13 12:51:44 +0200 | [diff] [blame] | 69 | |
| 70 | leaf will-boot-next { |
| 71 | description "Is this slot selected for booting after the next reboot?"; |
| 72 | type boolean; |
| 73 | } |
Jan Kundrát | 3795cab | 2022-07-13 18:08:19 +0200 | [diff] [blame] | 74 | |
| 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áš Pecka | ad32af2 | 2021-01-27 17:39:57 +0100 | [diff] [blame] | 82 | } |
| 83 | |
Tomáš Pecka | 9a02c3f | 2021-01-21 15:27:22 +0100 | [diff] [blame] | 84 | 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át | 4107b78 | 2021-02-18 05:40:01 +0100 | [diff] [blame] | 119 | nacm:default-deny-all; |
Jan Kundrát | 13b1359 | 2021-12-04 15:28:44 +0100 | [diff] [blame] | 120 | description "Download and install a new firmware image to the inactive FW slot"; |
Tomáš Pecka | 9a02c3f | 2021-01-21 15:27:22 +0100 | [diff] [blame] | 121 | 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át | 59c19c1 | 2021-01-26 08:48:11 +0100 | [diff] [blame] | 131 | |
| 132 | typedef username-type { |
| 133 | type string { |
| 134 | pattern "[a-z][a-z0-9-]{0,30}"; |
| 135 | } |
| 136 | } |
| 137 | |
Václav Kubernát | ac257f3 | 2021-02-08 19:24:52 +0100 | [diff] [blame] | 138 | typedef password-type { |
| 139 | type string { |
| 140 | pattern "[^\\r\\n]*"; |
| 141 | } |
| 142 | } |
| 143 | |
Václav Kubernát | 59c19c1 | 2021-01-26 08:48:11 +0100 | [diff] [blame] | 144 | 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át | 13b1359 | 2021-12-04 15:28:44 +0100 | [diff] [blame] | 166 | description "User management"; |
Václav Kubernát | 59c19c1 | 2021-01-26 08:48:11 +0100 | [diff] [blame] | 167 | list users { |
| 168 | config false; |
| 169 | key 'name'; |
Jan Kundrát | 13b1359 | 2021-12-04 15:28:44 +0100 | [diff] [blame] | 170 | description "All user accounts which are configured in the Linux system"; |
Václav Kubernát | 59c19c1 | 2021-01-26 08:48:11 +0100 | [diff] [blame] | 171 | |
| 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át | 13b1359 | 2021-12-04 15:28:44 +0100 | [diff] [blame] | 182 | description "List of SSH keys which are recognized for this user"; |
| 183 | |
Václav Kubernát | 59c19c1 | 2021-01-26 08:48:11 +0100 | [diff] [blame] | 184 | 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át | 7311fa9 | 2021-12-04 15:27:36 +0100 | [diff] [blame] | 194 | nacm:default-deny-all; |
Jan Kundrát | 13b1359 | 2021-12-04 15:28:44 +0100 | [diff] [blame] | 195 | description "Remove the selected SSH authentication key of the selected user"; |
Václav Kubernát | 59c19c1 | 2021-01-26 08:48:11 +0100 | [diff] [blame] | 196 | output { |
| 197 | uses authentication-rpc-result; |
| 198 | } |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | action change-password { |
Václav Kubernát | 4107b78 | 2021-02-18 05:40:01 +0100 | [diff] [blame] | 203 | nacm:default-deny-all; |
Václav Kubernát | 59c19c1 | 2021-01-26 08:48:11 +0100 | [diff] [blame] | 204 | 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át | ac257f3 | 2021-02-08 19:24:52 +0100 | [diff] [blame] | 208 | type password-type; |
Václav Kubernát | 59c19c1 | 2021-01-26 08:48:11 +0100 | [diff] [blame] | 209 | } |
| 210 | } |
| 211 | |
| 212 | output { |
| 213 | uses authentication-rpc-result; |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | action add-authorized-key { |
Václav Kubernát | 4107b78 | 2021-02-18 05:40:01 +0100 | [diff] [blame] | 218 | nacm:default-deny-all; |
Jan Kundrát | 13b1359 | 2021-12-04 15:28:44 +0100 | [diff] [blame] | 219 | description "Add a new SSH public key for authentication as the selected user"; |
Václav Kubernát | 59c19c1 | 2021-01-26 08:48:11 +0100 | [diff] [blame] | 220 | 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áš Pecka | d26a3ce | 2021-02-15 20:39:26 +0100 | [diff] [blame] | 233 | |
Tomáš Pecka | b6c06e1 | 2021-04-20 20:09:44 +0200 | [diff] [blame] | 234 | 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áš Pecka | 5be83e4 | 2021-04-21 17:26:40 +0200 | [diff] [blame] | 252 | |
| 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áš Pecka | b6c06e1 | 2021-04-20 20:09:44 +0200 | [diff] [blame] | 266 | } |
| 267 | |
Jan Kundrát | 9eea4ba | 2021-02-19 01:05:25 +0100 | [diff] [blame] | 268 | deviation /sys:system-shutdown { deviate not-supported; } |
Tomáš Pecka | 79344c8 | 2021-09-16 18:25:59 +0200 | [diff] [blame] | 269 | deviation /sys:system/sys:dns-resolver { deviate add { config false; } } |
Tomáš Pecka | 9a02c3f | 2021-01-21 15:27:22 +0100 | [diff] [blame] | 270 | } |