blob: 1a80c35132098cace302ecc1c40f3ca9fdb3a4dc [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
Tomáš Pecka9a02c3f2021-01-21 15:27:22 +010016 organization "CESNET";
17 contact "photonic@cesnet.cz";
18 description
19 "YANG model for system administration in Czechlight devices.";
20
21 revision 2021-01-13 {
22 description "Initial release";
23 }
24
25 container firmware {
26 config false;
27
Tomáš Peckaad32af22021-01-27 17:39:57 +010028 list firmware-slot {
29 key name;
30
31 leaf name {
32 description "Identifier of the slot.";
33 type string;
34 }
35
36 leaf version {
37 description "Firmware version installed in the slot.";
38 type string;
39 }
40
41 leaf installed {
42 description "Datetime of the last installation performed in this slot.";
43 type yang:date-and-time;
44 }
45
46 leaf state {
47 description "Current state of the slot.";
48 type enumeration {
49 enum inactive;
50 enum booted;
51 }
52 }
53
54 leaf boot-status {
55 description "Boot status.";
56 type enumeration {
57 enum good;
58 enum bad;
59 }
60 }
61 }
62
Tomáš Pecka9a02c3f2021-01-21 15:27:22 +010063 container installation {
64 leaf status {
65 description "Informs about the status of the current (or last) installation.";
66
67 type enumeration {
68 enum none;
69 enum in-progress;
70 enum succeeded;
71 enum failed;
72 }
73 }
74
75 leaf message {
76 description "The last message from the installation process. This MAY contain the last error message.";
77 type string;
78 }
79
80 notification update {
81 description "Notifies clients about installation progress.";
82
83 leaf message {
84 description "Progress status.";
85 type string;
86 }
87
88 leaf progress {
89 description "Progress of the installation in percents.";
90
91 type int8 {
92 range "0 .. 100";
93 }
94 }
95 }
96
97 action install {
Václav Kubernát4107b782021-02-18 05:40:01 +010098 nacm:default-deny-all;
Tomáš Pecka9a02c3f2021-01-21 15:27:22 +010099 input {
100 leaf url {
101 description "URL or path to the new firmware.";
102 type string;
103 mandatory true;
104 }
105 }
106 }
107 }
108 }
Václav Kubernát59c19c12021-01-26 08:48:11 +0100109
110 typedef username-type {
111 type string {
112 pattern "[a-z][a-z0-9-]{0,30}";
113 }
114 }
115
Václav Kubernátac257f32021-02-08 19:24:52 +0100116 typedef password-type {
117 type string {
118 pattern "[^\\r\\n]*";
119 }
120 }
121
Václav Kubernát59c19c12021-01-26 08:48:11 +0100122 grouping authentication-rpc-result {
123 leaf result {
124 mandatory true;
125 type enumeration {
126 enum success;
127 enum failure;
128 }
129 }
130
131 leaf message {
132 description "Can be used to supply and error message.";
133 type string;
134 }
135 }
136
137 typedef authorized-key-format {
138 description "Pubkey in the authorized_keys format for sshd.";
139 type string;
140 }
141
142
143 container authentication {
144 list users {
145 config false;
146 key 'name';
147
148 leaf name {
149 type username-type;
150 }
151
152 leaf password-last-change {
153 type string;
154 }
155
156 list authorized-keys {
157 key 'index';
158 leaf index {
159 type int32;
160 }
161
162 leaf public-key {
163 mandatory true;
164 type authorized-key-format;
165 }
166
167 action remove {
168 output {
169 uses authentication-rpc-result;
170 }
171 }
172 }
173
174 action change-password {
Václav Kubernát4107b782021-02-18 05:40:01 +0100175 nacm:default-deny-all;
Václav Kubernát59c19c12021-01-26 08:48:11 +0100176 input {
177 leaf password-cleartext {
178 mandatory true;
179 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 +0100180 type password-type;
Václav Kubernát59c19c12021-01-26 08:48:11 +0100181 }
182 }
183
184 output {
185 uses authentication-rpc-result;
186 }
187 }
188
189 action add-authorized-key {
Václav Kubernát4107b782021-02-18 05:40:01 +0100190 nacm:default-deny-all;
Václav Kubernát59c19c12021-01-26 08:48:11 +0100191 input {
192 leaf key {
193 mandatory true;
194 type authorized-key-format;
195 }
196 }
197
198 output {
199 uses authentication-rpc-result;
200 }
201 }
202 }
203 }
Tomáš Peckad26a3ce2021-02-15 20:39:26 +0100204
205 container networking {
206 container standalone-eth1 {
207 presence "Presence of this container should make eth1 network interface standalone (not in any bridge).";
208 }
209 }
Tomáš Pecka9a02c3f2021-01-21 15:27:22 +0100210}