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