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