5f7bc14cd60a455cd6bc48f74fee247335b488aa
[sim/o1-interface.git] / ntsimulator / deploy / nts-manager / yang / nts-manager.yang
1 module nts-manager {
2   yang-version 1.1;
3   namespace "urn:o-ran-sc:params:xml:ns:yang:nts:manager";
4   prefix nts-mng;
5
6   import ietf-inet-types {
7     prefix inet;
8   }
9   import nts-common {
10     prefix ntsc;
11   }
12
13   organization
14     "O-RAN-SC";
15   contact
16     " Web: <https://wiki.o-ran-sc.org/display/SIM/SIM>
17         Editors:
18         Alex Stancu <mailto:alexandru.stancu@highstreet-technologies.com>
19         Adrian Lita <mailto:adrian.lita@highstreet-technologies.com>
20         Martin Skorupski <mailto:martin.skorupski@highstreet-technologies.com>";
21   description
22     "This module contains YANG definitions for the Network Topology Simulator - Manager.";
23
24   revision 2021-03-26 {
25     description
26       "Added NTS_PROTOCOL_TYPE_BASE identities and changed instance/networking container; also added multi-base port support.";
27     reference
28       "O-RAN-SC SIM project";
29   }
30   revision 2021-02-15 {
31     description
32       "Added notifications for sending feedback.";
33     reference
34       "O-RAN-SC SIM project";
35   }
36   revision 2021-01-20 {
37     description
38       "Added available-network-functions.";
39     reference
40       "O-RAN-SC SIM project";
41   }
42   revision 2020-11-30 {
43     description
44       "Cleared revision for nts-common import.";
45     reference
46       "O-RAN-SC SIM project";
47   }
48   revision 2020-10-06 {
49     description
50       "Initial revision for the Network Topology Simulator - Next Generation";
51     reference
52       "O-RAN-SC SIM project";
53   }
54
55   identity NTS_PROTOCOL_TYPE_BASE {
56     description
57       "Base identity for protocol.";
58   }
59
60   identity NTS_PROTOCOL_TYPE_NETCONF_SSH {
61     base NTS_PROTOCOL_TYPE_BASE;
62     description
63       "Identity for NETCONF SSH protocol.";
64   }
65
66   identity NTS_PROTOCOL_TYPE_NETCONF_TLS {
67     base NTS_PROTOCOL_TYPE_BASE;
68     description
69       "Identity for NETCONF TLS protocol.";
70   }
71
72   identity NTS_PROTOCOL_TYPE_FTP {
73     base NTS_PROTOCOL_TYPE_BASE;
74     description
75       "Identity for FTP protocol.";
76   }
77
78   identity NTS_PROTOCOL_TYPE_SFTP {
79     base NTS_PROTOCOL_TYPE_BASE;
80     description
81       "Identity for SFTP protocol.";
82   }
83
84   identity NTS_PROTOCOL_TYPE_HTTP {
85     base NTS_PROTOCOL_TYPE_BASE;
86     description
87       "Identity for HTTP protocol.";
88   }
89
90   identity NTS_PROTOCOL_TYPE_HTTPS {
91     base NTS_PROTOCOL_TYPE_BASE;
92     description
93       "Identity for HTTPS protocol.";
94   }
95
96   typedef percent {
97     type decimal64 {
98       fraction-digits 2;
99       range "0 .. 100";
100     }
101     description
102       "Percentage";
103   }
104
105   grouping instance-g {
106     description
107       "An instance of a network function which is running. The equivalent on the host machine is a docker container.";
108     leaf name {
109       type string;
110       description
111         "The name of the running instance. It is the same as the docker container name which exposes this network function.";
112     }
113     leaf is-mounted {
114       type boolean;
115       description
116         "Whether the instance is mounted or not to a controller.";
117     }
118     container networking {
119       description
120         "Groups the details about networking information.";
121       leaf docker-ip {
122         type inet:ip-address;
123         description
124           "The IP address of the docker container implementing the network function instance.";
125       }
126       list docker-ports {
127         key "port";
128         description
129           "The ports which are exposed inside the docker container implementing the network function instance.";
130         leaf port {
131           type inet:port-number;
132           description
133             "Port number.";
134         }
135         leaf protocol {
136           type identityref {
137             base NTS_PROTOCOL_TYPE_BASE;
138           }
139           description
140             "Protocol attached to current port.";
141         }
142       }
143       leaf host-ip {
144         type inet:ip-address;
145         description
146           "The Host machine IP address pointing to the docker container implementing the network function instance.";
147       }
148       list host-ports {
149         key "port";
150         description
151           "The Host machine ports mapped to the docker container implementing the network function instance.";
152         leaf port {
153           type inet:port-number;
154           description
155             "Port number.";
156         }
157         leaf protocol {
158           type identityref {
159             base NTS_PROTOCOL_TYPE_BASE;
160           }
161           description
162             "Protocol attached to current port.";
163         }
164       }
165     }
166   }
167
168   grouping network-function-g {
169     description
170       "Contains all the details of a simulated device.";
171     leaf function-type {
172       type identityref {
173         base ntsc:NTS_FUNCTION_TYPE_BASE;
174       }
175       description
176         "Type of network function to be simulated.";
177     }
178     leaf started-instances {
179       type uint16;
180       mandatory true;
181       description
182         "How many instances of this type are started.";
183     }
184     leaf mounted-instances {
185       type uint16;
186       must '. <= ../started-instances' {
187         error-message "The number of mounted instances cannot be greater that the number of started instances.";
188       }
189       mandatory true;
190       description
191         "How many instances of this type are mounted in the SDN Controller.";
192     }
193     uses ntsc:mount-point-details-g;
194     leaf docker-instance-name {
195       type string;
196       mandatory true;
197       description
198         "The prefix of each docker container being started.";
199     }
200     leaf docker-version-tag {
201       type string;
202       mandatory true;
203       description
204         "The version tag of the docker image to be started.";
205     }
206     leaf docker-repository {
207       type string;
208       mandatory true;
209       description
210         "The prefix containing the docker repository information, if needed.";
211     }
212     uses ntsc:faults-g;
213     uses ntsc:netconf-config-g;
214     uses ntsc:ves-config-g;
215     container instances {
216       config false;
217       description
218         "Groups details about instances which are running.";
219       list instance {
220         key "name";
221         description
222           "Describes a running instance.";
223         uses ntsc:mount-point-details-g;
224         uses instance-g;
225       }
226     }
227   }
228
229   grouping simulation-information-g {
230     description
231       "Groups information about the simulation status.";
232     container ports {
233       config false;
234       description
235         "Contains information on ports used.";
236       leaf netconf-ssh-port {
237         type inet:port-number;
238         description
239           "The base Host machine port from where the simulation can allocate ports incrementally for NETCONF SSH protocol.";
240       }
241       leaf netconf-tls-port {
242         type inet:port-number;
243         description
244           "The base Host machine port from where the simulation can allocate ports incrementally for NETCONF TLS protocol.";
245       }
246       leaf transport-ftp-port {
247         type inet:port-number;
248         description
249           "The base Host machine port from where the simulation can allocate ports incrementally for FTP protocol.";
250       }
251       leaf transport-sftp-port {
252         type inet:port-number;
253         description
254           "The base Host machine port from where the simulation can allocate ports incrementally for SFTP protocol.";
255       }
256     }
257     leaf ssh-connections {
258       type uint8;
259       config false;
260       description
261         "The number of SSH Endpoints each network function instance exposes.";
262     }
263     leaf tls-connections {
264       type uint8;
265       config false;
266       description
267         "The number of TLS Endpoints each network function instance exposes.";
268     }
269     leaf cpu-usage {
270       type percent;
271       config false;
272       description
273         "Specifies the CPU load generated by the simulation.";
274     }
275     leaf mem-usage {
276       type uint32;
277       config false;
278       description
279         "Specifies the RAM in MB used by the simulation.";
280     }
281     leaf last-operation-status {
282       type string;
283       config false;
284       description
285         "Specifies the status of the most recent operation performed by the Manager.";
286     }
287   }
288
289   grouping network-function-image-g {
290     description
291       "Groups details about a NF docker image.";
292     leaf function-type {
293       type identityref {
294         base ntsc:NTS_FUNCTION_TYPE_BASE;
295       }
296       config false;
297       description
298         "Type of network function to be simulated.";
299     }
300     leaf docker-image-name {
301       type string;
302       config false;
303       mandatory true;
304       description
305         "The prefix of each docker container being started.";
306     }
307     leaf docker-version-tag {
308       type string;
309       config false;
310       mandatory true;
311       description
312         "The version tag of the docker image to be started.";
313     }
314     leaf docker-repository {
315       type string;
316       config false;
317       mandatory true;
318       description
319         "The prefix containing the docker repository information, if needed.";
320     }
321   }
322
323   notification instance-changed {
324     description
325       "Sent by the Manager every time something occurs in any of the simulated NF instances.";
326     leaf change-status {
327       type string;
328       mandatory true;
329       description
330         "The status of the change which was executed to the NF instance.";
331     }
332     leaf function-type {
333       type identityref {
334         base ntsc:NTS_FUNCTION_TYPE_BASE;
335       }
336       mandatory true;
337       description
338         "Type of the NF instance.";
339     }
340     uses instance-g {
341       refine "name" {
342         mandatory true;
343       }
344     }
345   }
346
347   notification operation-status-changed {
348     description
349       "Sent by the Manager every time a user operation is finished.";
350     leaf operation-status {
351       type string;
352       mandatory true;
353       description
354         "The status of the operation which was executed by the Manager.";
355     }
356     leaf error-message {
357       type string;
358       description
359         "Detailed error message from the Manager.";
360     }
361   }
362
363   container simulation {
364     presence "Enables simulation configuration.";
365     description
366       "Root level container which controls the NTS.";
367     container available-images {
368       config false;
369       description
370         "Container which encompasses all NF docker images available on the host machine.";
371       list network-function-image {
372         description
373           "List containing available network function docker images and their respective details.";
374         uses network-function-image-g;
375       }
376     }
377     container network-functions {
378       presence "Enables NF configuration.";
379       description
380         "Container which encompasses all simulated network functions.";
381       list network-function {
382         key "function-type";
383         unique "docker-instance-name";
384         description
385           "List containing different simulated network function types and their details.";
386         uses network-function-g;
387       }
388     }
389     container sdn-controller {
390       presence "Enables SDN Controller detail configuration.";
391       description
392         "Groups details about the SDN Controller.";
393       uses ntsc:controller-g;
394     }
395     container ves-endpoint {
396       presence "Enables VES endpoint detail configuration.";
397       description
398         "Groups details about the VES Collector endpoint.";
399       uses ntsc:ves-endpoint-g;
400     }
401     uses simulation-information-g;
402   }
403 }