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 | |
Tomáš Pecka | b6c06e1 | 2021-04-20 20:09:44 +0200 | [diff] [blame] | 29 | typedef percent { |
| 30 | type uint8 { |
| 31 | range "0 .. 100"; |
| 32 | } |
| 33 | } |
| 34 | |
Tomáš Pecka | 9a02c3f | 2021-01-21 15:27:22 +0100 | [diff] [blame] | 35 | container firmware { |
| 36 | config false; |
| 37 | |
Tomáš Pecka | ad32af2 | 2021-01-27 17:39:57 +0100 | [diff] [blame] | 38 | 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áš Pecka | 9a02c3f | 2021-01-21 15:27:22 +0100 | [diff] [blame] | 73 | 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át | 4107b78 | 2021-02-18 05:40:01 +0100 | [diff] [blame] | 108 | nacm:default-deny-all; |
Tomáš Pecka | 9a02c3f | 2021-01-21 15:27:22 +0100 | [diff] [blame] | 109 | 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át | 59c19c1 | 2021-01-26 08:48:11 +0100 | [diff] [blame] | 119 | |
| 120 | typedef username-type { |
| 121 | type string { |
| 122 | pattern "[a-z][a-z0-9-]{0,30}"; |
| 123 | } |
| 124 | } |
| 125 | |
Václav Kubernát | ac257f3 | 2021-02-08 19:24:52 +0100 | [diff] [blame] | 126 | typedef password-type { |
| 127 | type string { |
| 128 | pattern "[^\\r\\n]*"; |
| 129 | } |
| 130 | } |
| 131 | |
Václav Kubernát | 59c19c1 | 2021-01-26 08:48:11 +0100 | [diff] [blame] | 132 | 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át | 4107b78 | 2021-02-18 05:40:01 +0100 | [diff] [blame] | 185 | nacm:default-deny-all; |
Václav Kubernát | 59c19c1 | 2021-01-26 08:48:11 +0100 | [diff] [blame] | 186 | 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át | ac257f3 | 2021-02-08 19:24:52 +0100 | [diff] [blame] | 190 | type password-type; |
Václav Kubernát | 59c19c1 | 2021-01-26 08:48:11 +0100 | [diff] [blame] | 191 | } |
| 192 | } |
| 193 | |
| 194 | output { |
| 195 | uses authentication-rpc-result; |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | action add-authorized-key { |
Václav Kubernát | 4107b78 | 2021-02-18 05:40:01 +0100 | [diff] [blame] | 200 | nacm:default-deny-all; |
Václav Kubernát | 59c19c1 | 2021-01-26 08:48:11 +0100 | [diff] [blame] | 201 | 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áš Pecka | d26a3ce | 2021-02-15 20:39:26 +0100 | [diff] [blame] | 214 | |
Tomáš Pecka | b6c06e1 | 2021-04-20 20:09:44 +0200 | [diff] [blame] | 215 | 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áš Pecka | 5be83e4 | 2021-04-21 17:26:40 +0200 | [diff] [blame] | 233 | |
| 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áš Pecka | b6c06e1 | 2021-04-20 20:09:44 +0200 | [diff] [blame] | 247 | } |
| 248 | |
Jan Kundrát | 9eea4ba | 2021-02-19 01:05:25 +0100 | [diff] [blame] | 249 | deviation /sys:system-shutdown { deviate not-supported; } |
Tomáš Pecka | 9a02c3f | 2021-01-21 15:27:22 +0100 | [diff] [blame] | 250 | } |