Add counters for generated notifications.
[sim/o1-interface.git] / ntsimulator / yang / nts-manager / network-topology-simulator.yang
1 module network-topology-simulator {
2   yang-version 1.1;
3   namespace "urn:onf:params:xml:ns:yang:network-topology-simulator";
4   prefix network-topology-simulator;
5
6   import ietf-inet-types {
7     prefix inet;
8   }
9
10   organization
11     "Melacon";
12   contact
13     "Web: <https://github.com/Melacon>
14      Editors:  Alex Stancu
15                <mailto:stancu.liviualex@gmail.com>";
16   description
17     "This module contains a collection of YANG definitions for managing the Network Topology Simulator.";
18
19   
20   revision 2020-04-10 {
21     description
22       "Add notification count in status.";
23     reference
24       "O-RAN SC SIM project";
25   }
26   revision 2019-10-25 {
27     description
28       "Modify notifications. Add VES message configuration options.";
29     reference
30       "O-RAN SC SIM project";
31   }
32   revision 2019-06-07 {
33     description
34       "Modify controller details.";
35     reference
36       "O-RAN SC SIM project";
37   }
38   revision 2019-03-07 {
39     description
40       "Initial version";
41     reference
42       "O-RAN SC SIM project";
43   }
44
45   typedef operational-state-type {
46     type enumeration {
47       enum not-specified {
48         description
49           "none";
50       }
51       enum running {
52         description
53           "none";
54       }
55       enum created {
56         description
57           "none";
58       }
59       enum exited {
60         description
61           "none";
62       }
63     }
64     description
65       "The operation state of the simulated device.";
66   }
67
68   typedef authentication-method-type {
69     type enumeration {
70       enum no-auth {
71         description
72           "no security (http)";
73       }
74       enum cert-only {
75         description
76           "auth by certificate (https)";
77       }
78       enum basic-auth {
79         description
80           "auth by basic auth username and password (https)";
81       }
82       enum cert-basic-auth {
83         description
84           "auth by certificate and basic auth username / password (https)";
85       }
86     }
87     description
88       "The authentication method for VES messaging.";
89   }
90
91   typedef percent {
92     type decimal64 {
93       fraction-digits 2;
94       range "0 .. 100";
95     }
96     description
97       "Percentage";
98   }
99
100   grouping controller-details-type-g {
101     leaf controller-ip {
102       type inet:ip-address;
103       description
104         "The IP Address of the SDN Controller.";
105     }
106     leaf controller-port {
107       type inet:port-number;
108       description
109         "The Port of the SDN Controller.";
110     }
111     leaf controller-username {
112       type string;
113       description
114         "The Username of the SDN Controller.";
115     }
116     leaf controller-password {
117       type string;
118       description
119         "The Password of the SDN Controller.";
120     }
121     description
122       "none";
123   }
124
125   grouping simulated-devices-type-g {
126     leaf uuid {
127       type string;
128       description
129         "The UUID of the simulated device.";
130     }
131     leaf device-ip {
132       type string;
133       description
134         "The IP Address of the simulated device.";
135     }
136     leaf-list device-port {
137       type uint32;
138       description
139         "A NETCONF endpoint (port) of the simulated device.";
140     }
141     leaf is-mounted {
142       type boolean;
143       description
144         "Specifies if the simulated device is mounted in the SDN Controller.";
145     }
146     leaf operational-state {
147       type operational-state-type;
148       description
149         "Specifies the operational state of the simulated device.";
150     }
151     description
152       "none";
153   }
154
155   grouping notification-count-per-severity-g {
156     leaf normal {
157     type uint32;
158     description
159     "The number of normal notifications.";
160     }
161     leaf warning {
162     type uint32;
163     description
164     "The number of warning notifications.";
165     }
166     leaf minor {
167     type uint32;
168     description
169     "The number of minor notifications.";
170     }
171     leaf major {
172     type uint32;
173     description
174     "The number of major notifications.";
175     }
176     leaf critical {
177     type uint32;
178     description
179     "The number of normal notifications.";
180     }
181     description
182       "none";
183   }
184
185   container simulator-config {
186     description
187       "Configuration container of the simulator.";
188     leaf simulated-devices {
189       type uint32;
190       default "0";
191       description
192         "The number of devices to be simulated.";
193     }
194     leaf mounted-devices {
195       type uint32;
196       default "0";
197       description
198         "The number of devices to be mounted in ODL. The configured number should not exceed the number of mounted devices.";
199     }
200     container notification-config {
201       leaf fault-notification-delay-period {
202         type uint32;
203         default "0";
204         description
205           "Interval in seconds between two consecutive notifications. If the attribute is set to 0, nofitications are not generated.";
206       }
207       leaf ves-heartbeat-period {
208         type uint32;
209         default "0";
210         description
211           "Interval in seconds between two VES heartbeat messages. If the attribute is set to 0, heartbeat messages are not generated.";
212       }
213       leaf is-netconf-available {
214         type boolean;
215         default "true";
216         description
217           "If set to 'true', NETCONF notifications will be generated.";
218       }
219       leaf is-ves-available {
220         type boolean;
221         default "true";
222         description
223           "If set to 'true', VES messages will be generated.";
224       }
225       description
226         "none";
227     }
228     container controller-details {
229       uses controller-details-type-g;
230       description
231         "The connectivity details of the SDN Controller where we want to mount our simulated devices.";
232     }
233     container ves-endpoint-details {
234       must 'ves-registration = "false" or ../mounted-devices = 0' {
235         error-message "VES registration cannot be active while devices are still mounted to ODL not via VES.";
236       }
237       leaf ves-endpoint-ip {
238         type inet:ip-address;
239         description
240           "The IP Address of the VES Endpoint.";
241       }
242       leaf ves-endpoint-port {
243         type inet:port-number;
244         description
245           "The Port of the VES Endpoint.";
246       }
247       leaf ves-endpoint-auth-method {
248         type authentication-method-type;
249         default "no-auth";
250         description
251           "The type of the authentication to be used with the VES Endpoint.";
252       }
253       leaf ves-endpoint-username {
254         when "../ves-endpoint-auth-method = 'basic-auth' or ../ves-endpoint-auth-method = 'cert-basic-auth'";
255         type string;
256         description
257           "The Username to be used to authenticate to the VES Endpoint.";
258       }
259       leaf ves-endpoint-password {
260         when "../ves-endpoint-auth-method = 'basic-auth' or ../ves-endpoint-auth-method = 'cert-basic-auth'";
261         type string;
262         description
263           "The Password to be used to authenticate to the VES Endpoint.";
264       }
265       leaf ves-endpoint-certificate {
266         when "../ves-endpoint-auth-method = 'cert-only' or ../ves-endpoint-auth-method = 'cert-basic-auth'";
267         type string;
268         description
269           "The Certificate to be used to authenticate to the VES Endpoint.";
270       }
271       leaf ves-registration {
272         type boolean;
273         default "false";
274         description
275           "If this is set to 'True', the simulated devices will automatically send a pnfRegistration VES message when they start. This cannot be set to 'True' if we already have 'mounted-devices' greater that 0, because we already mounted the devices directly to ODL.";
276       }
277       description
278         "none";
279     }
280   }
281   container simulator-status {
282     config false;
283     container simulation-usage-details {
284       config false;
285       leaf running-simulated-devices {
286         type uint32;
287         description
288           "The current number of running simulated devices.";
289       }
290       leaf running-mounted-devices {
291         type uint32;
292         description
293           "The current number of running simulated devices that are mounted in ODL.";
294       }
295       leaf base-netconf-port {
296         type uint32;
297         default "30000";
298         description
299           "The starting port number for the NETCONF connections exposed.";
300       }
301       leaf cpu-usage {
302         type percent;
303         description
304           "Specifies the CPU load generated by this simulated device.";
305       }
306       leaf mem-usage {
307         type uint32;
308         description
309           "Specifies the RAM in MB used by this simulated device.";
310       }
311       description
312         "The details about the simulation, including resources consumed.";
313     }
314     container notification-count {
315         config false;
316         container total-ves-notifications {
317             config false;
318             uses  notification-count-per-severity-g;
319             description
320               "The total number of VES notifications that were sent by all the simulated devices managed by this NTS Manager instance.";
321         }
322         container total-netconf-notifications {
323             config false;
324             uses  notification-count-per-severity-g;
325             description
326               "The total number of NETCONF notifications that were sent by all the simulated devices managed by this NTS Manager instance.";
327         }
328         description 
329           "The total number of notifications sent by the devices managed by this NTS Manager instance.";
330         
331     }
332     list simulated-devices-list {
333       key "uuid";
334       config false;
335       uses simulated-devices-type-g;
336       container notification-count {
337         config false;
338         container ves-notifications {
339             config false;
340             uses  notification-count-per-severity-g;
341             description
342               "The total number of VES notifications that were sent by this simulated device.";
343         }
344         container netconf-notifications {
345             config false;
346             uses  notification-count-per-severity-g;
347             description
348               "The total number of NETCONF notifications that were sent by this simulated device.";
349         }
350         description 
351           "The total number of notifications sent by this simulated device.";
352         
353     }
354       description
355         "The list of the devices that are currently simulated.";
356     }
357     description
358       "State data container of the simulator.";
359   }
360
361   rpc restart-simulation {
362     description
363       "Operation to restart all the simulated devices with the new configuration of the simulator.";
364   }
365
366   rpc add-key-pair-to-odl {
367     description
368       "Operation to add a key pair signed by the NTS to OpenDaylight, such that it can connect to devices using TLS.";
369   }
370 }