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