Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 1 | module example-schema { |
Václav Kubernát | a878960 | 2020-07-20 15:18:19 +0200 | [diff] [blame] | 2 | yang-version 1.1; |
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 3 | prefix aha; |
4 | namespace "http://example.com"; | ||||
5 | |||||
Václav Kubernát | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 6 | import other-module { |
7 | prefix other; | ||||
8 | } | ||||
9 | |||||
Václav Kubernát | da8e4b9 | 2020-02-04 11:56:30 +0100 | [diff] [blame] | 10 | container inventory { |
11 | container stuff { | ||||
12 | presence true; | ||||
13 | } | ||||
14 | } | ||||
15 | |||||
Václav Kubernát | 134d78f | 2019-09-03 16:42:29 +0200 | [diff] [blame] | 16 | leaf leafUInt8 { |
17 | type uint8; | ||||
18 | } | ||||
19 | |||||
20 | leaf leafUInt16 { | ||||
21 | type uint16; | ||||
22 | } | ||||
23 | |||||
24 | leaf leafUInt32 { | ||||
25 | type uint32; | ||||
26 | } | ||||
27 | |||||
28 | leaf leafUInt64 { | ||||
29 | type uint64; | ||||
30 | } | ||||
31 | |||||
32 | leaf leafInt8 { | ||||
33 | type int8; | ||||
34 | } | ||||
35 | |||||
36 | leaf leafInt16 { | ||||
37 | type int16; | ||||
38 | } | ||||
39 | |||||
40 | leaf leafInt32 { | ||||
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 41 | type int32; |
42 | } | ||||
43 | |||||
Václav Kubernát | 134d78f | 2019-09-03 16:42:29 +0200 | [diff] [blame] | 44 | leaf leafInt64 { |
45 | type int64; | ||||
46 | } | ||||
47 | |||||
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 48 | leaf leafString { |
49 | type string; | ||||
50 | } | ||||
51 | |||||
52 | leaf leafEnum { | ||||
53 | type enumeration { | ||||
54 | enum lol; | ||||
55 | enum data; | ||||
56 | enum coze; | ||||
57 | } | ||||
58 | } | ||||
59 | |||||
60 | leaf leafDecimal { | ||||
Václav Kubernát | 9cfcd87 | 2020-02-18 12:34:02 +0100 | [diff] [blame] | 61 | units "nm"; |
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 62 | type decimal64 { |
63 | fraction-digits 9; | ||||
64 | } | ||||
65 | } | ||||
66 | |||||
67 | container pContainer { | ||||
68 | presence true; | ||||
69 | } | ||||
70 | |||||
Václav Kubernát | 45f4a82 | 2019-05-29 21:10:50 +0200 | [diff] [blame] | 71 | list person { |
72 | key 'name'; | ||||
73 | leaf name { | ||||
74 | type string; | ||||
75 | } | ||||
76 | } | ||||
77 | |||||
Václav Kubernát | 3efb5ca | 2019-10-09 20:07:40 +0200 | [diff] [blame] | 78 | leaf bossPerson { |
79 | type leafref { | ||||
80 | path '../aha:person/name'; | ||||
81 | } | ||||
82 | } | ||||
83 | |||||
Václav Kubernát | 2984f44 | 2020-02-20 17:43:35 +0100 | [diff] [blame] | 84 | leaf unionIntString { |
85 | type union { | ||||
86 | type int32; | ||||
87 | type string; | ||||
88 | } | ||||
89 | } | ||||
90 | |||||
Václav Kubernát | 7d82da7 | 2019-04-11 15:16:38 +0200 | [diff] [blame] | 91 | grouping upAndDown { |
92 | leaf up { | ||||
93 | type boolean; | ||||
94 | } | ||||
95 | leaf down { | ||||
96 | type boolean; | ||||
97 | } | ||||
98 | } | ||||
99 | |||||
100 | uses upAndDown; | ||||
101 | |||||
102 | container lol { | ||||
103 | uses upAndDown; | ||||
104 | } | ||||
Jan Kundrát | 6ee8479 | 2020-01-24 01:43:36 +0100 | [diff] [blame] | 105 | |
106 | grouping targets_def { | ||||
107 | list targets { | ||||
108 | key 'city'; | ||||
109 | leaf city { | ||||
110 | type string; | ||||
111 | } | ||||
112 | } | ||||
113 | } | ||||
114 | |||||
Václav Kubernát | e7248b2 | 2020-06-26 15:38:59 +0200 | [diff] [blame] | 115 | rpc fire { |
116 | input { | ||||
117 | leaf whom { | ||||
118 | type leafref { | ||||
119 | path '/aha:person/name'; | ||||
120 | } | ||||
121 | } | ||||
122 | } | ||||
123 | } | ||||
124 | |||||
Jan Kundrát | 6ee8479 | 2020-01-24 01:43:36 +0100 | [diff] [blame] | 125 | rpc launch-nukes { |
126 | input { | ||||
127 | container payload { | ||||
128 | leaf kilotons { | ||||
129 | type uint64; | ||||
130 | mandatory true; | ||||
131 | units "kilotons"; | ||||
132 | } | ||||
133 | } | ||||
134 | leaf description { | ||||
135 | type string; | ||||
136 | } | ||||
137 | container cities { | ||||
138 | presence true; | ||||
139 | uses targets_def; | ||||
140 | } | ||||
141 | } | ||||
142 | output { | ||||
143 | leaf blast-radius { | ||||
144 | type uint32; | ||||
145 | units "m"; | ||||
146 | } | ||||
147 | leaf actual-yield { | ||||
148 | type uint64; | ||||
149 | units "kilotons"; | ||||
150 | } | ||||
151 | container damaged-places { | ||||
152 | presence true; | ||||
153 | uses targets_def; | ||||
154 | } | ||||
155 | } | ||||
156 | } | ||||
157 | |||||
158 | rpc noop {} | ||||
Václav Kubernát | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 159 | |
160 | list selectedNumbers { | ||||
161 | key 'value'; | ||||
162 | leaf value { | ||||
163 | type int8; | ||||
164 | } | ||||
165 | } | ||||
166 | |||||
167 | list animalWithColor { | ||||
168 | key 'name color'; | ||||
169 | leaf name { | ||||
170 | type string; | ||||
171 | } | ||||
172 | leaf color { | ||||
173 | type string; | ||||
174 | } | ||||
175 | } | ||||
176 | |||||
177 | list ports { | ||||
178 | key 'name'; | ||||
179 | leaf name { | ||||
180 | type enumeration { | ||||
181 | enum A; | ||||
182 | enum B; | ||||
183 | enum C; | ||||
184 | enum D; | ||||
185 | enum E; | ||||
186 | } | ||||
187 | } | ||||
Václav Kubernát | a878960 | 2020-07-20 15:18:19 +0200 | [diff] [blame] | 188 | |
189 | action shutdown { | ||||
190 | output { | ||||
191 | leaf success { | ||||
192 | mandatory true; | ||||
193 | type boolean; | ||||
194 | } | ||||
195 | } | ||||
196 | } | ||||
Václav Kubernát | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 197 | } |
198 | |||||
199 | list org { | ||||
200 | key 'department'; | ||||
201 | leaf department { | ||||
202 | type string; | ||||
203 | } | ||||
204 | |||||
205 | list people { | ||||
206 | key 'name'; | ||||
207 | leaf name { | ||||
208 | type string; | ||||
209 | } | ||||
210 | |||||
211 | list computers { | ||||
212 | key 'type'; | ||||
213 | leaf type { | ||||
214 | type enumeration { | ||||
215 | enum PC; | ||||
216 | enum laptop; | ||||
217 | enum server; | ||||
218 | } | ||||
219 | } | ||||
220 | } | ||||
221 | } | ||||
222 | } | ||||
223 | |||||
224 | augment "/other:parking-lot" { | ||||
225 | list cars { | ||||
226 | key 'id'; | ||||
227 | leaf id { | ||||
228 | type int32; | ||||
229 | } | ||||
230 | } | ||||
231 | } | ||||
Jan Kundrát | bb525b4 | 2020-02-04 11:56:59 +0100 | [diff] [blame] | 232 | |
233 | leaf temperature { | ||||
234 | type int32; | ||||
235 | config false; | ||||
236 | } | ||||
Jan Kundrát | 0d8abd1 | 2020-05-07 02:00:14 +0200 | [diff] [blame] | 237 | |
238 | identity Animal { | ||||
239 | } | ||||
240 | |||||
241 | identity Mammal { | ||||
242 | base "Animal"; | ||||
243 | } | ||||
244 | |||||
245 | identity Dog { | ||||
246 | base "Mammal"; | ||||
247 | } | ||||
248 | |||||
249 | identity Whale { | ||||
250 | base "Mammal"; | ||||
251 | } | ||||
252 | |||||
253 | identity Velociraptor { | ||||
254 | base "Animal"; | ||||
255 | } | ||||
256 | |||||
257 | leaf beast { | ||||
258 | type identityref { | ||||
259 | base "Animal"; | ||||
260 | } | ||||
261 | } | ||||
Jan Kundrát | 6898544 | 2020-05-07 02:15:34 +0200 | [diff] [blame] | 262 | |
263 | leaf blob { | ||||
264 | type binary; | ||||
265 | } | ||||
Jan Kundrát | 379bb57 | 2020-05-07 03:23:13 +0200 | [diff] [blame] | 266 | |
267 | leaf dummy { | ||||
268 | type empty; | ||||
269 | } | ||||
Václav Kubernát | 5b8a8f3 | 2020-05-20 00:57:22 +0200 | [diff] [blame] | 270 | |
271 | leaf-list addresses { | ||||
272 | type string; | ||||
273 | } | ||||
Václav Kubernát | bf65dd7 | 2020-05-28 02:32:31 +0200 | [diff] [blame] | 274 | |
275 | leaf-list protocols { | ||||
276 | type string; | ||||
277 | ordered-by user; | ||||
278 | } | ||||
279 | |||||
280 | list players { | ||||
281 | key "name"; | ||||
282 | ordered-by user; | ||||
283 | leaf name { | ||||
284 | type string; | ||||
285 | } | ||||
286 | } | ||||
Václav Kubernát | 70d7f7a | 2020-06-23 14:40:40 +0200 | [diff] [blame] | 287 | |
288 | list point { | ||||
289 | key "x y"; | ||||
290 | leaf x { | ||||
291 | type int32; | ||||
292 | } | ||||
293 | leaf y { | ||||
294 | type int32; | ||||
295 | } | ||||
296 | } | ||||
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 297 | } |