Add NETCONF CallHome via TLS feature.
[sim/o1-interface.git] / ntsimulator / deploy / base / yang / nts-network-function.yang
1 module nts-network-function {
2   yang-version 1.1;
3   namespace "urn:o-ran-sc:params:xml:ns:yang:nts:network:function";
4   prefix ntsnf;
5
6   import ietf-inet-types {
7     prefix inet;
8   }
9   import nts-common {
10     prefix ntsc;
11   }
12   import ietf-yang-types {
13     prefix yang;
14   }
15
16   organization
17     "O-RAN-SC";
18   contact
19     " Web: <https://wiki.o-ran-sc.org/display/SIM/SIM>
20         Editors:
21         Alex Stancu <mailto:alexandru.stancu@highstreet-technologies.com>
22         Adrian Lita <mailto:adrian.lita@highstreet-technologies.com>
23         Martin Skorupski <mailto:martin.skorupski@highstreet-technologies.com>";
24   description
25     "This module contains YANG definitions for the Network Topology Simulator - Network Functions";
26
27   revision 2021-06-18 {
28     description
29       "Added test-list for NETCONF hardware delay emulation.";
30     reference
31       "O-RAN-SC SIM project";
32   }
33   revision 2021-06-14 {
34     description
35       "Added total loss network emulation RPC and NETCONF write-delay emulation.";
36     reference
37       "O-RAN-SC SIM project";
38   }
39   revision 2021-06-08 {
40     description
41       "Added more info and NETCONF latency emulation.";
42     reference
43       "O-RAN-SC SIM project";
44   }
45   revision 2021-05-17 {
46     description
47       "Added support for network emulation.";
48     reference
49       "O-RAN-SC SIM project";
50   }
51   revision 2021-03-26 {
52     description
53       "Added info container, and expanted feature control mechanism and status.";
54     reference
55       "O-RAN-SC SIM project";
56   }
57   revision 2021-03-17 {
58     description
59       "Renamed datastore-random-populate RPC to datastore-populate";
60     reference
61       "O-RAN-SC SIM project";
62   }
63   revision 2020-12-11 {
64     description
65       "Added function-type to simulated function.";
66     reference
67       "O-RAN-SC SIM project";
68   }
69   revision 2020-11-30 {
70     description
71       "Cleared revision for nts-common import.";
72     reference
73       "O-RAN-SC SIM project";
74   }
75   revision 2020-10-28 {
76     description
77       "Add RPC for clearing the fault counters.";
78     reference
79       "O-RAN-SC SIM project";
80   }
81   revision 2020-10-13 {
82     description
83       "Add RPC for datastore populating and feature control.";
84     reference
85       "O-RAN-SC SIM project";
86   }
87   revision 2020-09-07 {
88     description
89       "Initial revision for the Network Topology Simulator - Next Generation";
90     reference
91       "O-RAN-SC SIM project";
92   }
93
94   rpc datastore-populate {
95     description
96       "Operation to populate the datastore with data for all the containing YANG models, based on settings in config.json";
97     output {
98       uses ntsc:rpc-status-g;
99     }
100   }
101
102   rpc feature-control {
103     description
104       "Operation to control the features in a Network Function.";
105     input {
106       leaf start-features {
107         type ntsc:feature-type;
108         description
109           "A bit-wise list with features to be activated.";
110       }
111       leaf stop-features {
112         type ntsc:feature-type;
113         description
114           "A bit-wise list with features to be deactivated.";
115       }
116     }
117     output {
118       uses ntsc:rpc-status-g;
119     }
120   }
121
122   rpc invoke-notification {
123     description
124       "Operation to control the features in a Network Function.";
125     input {
126       leaf notification-format {
127         type enumeration {
128           enum xml {
129             description
130               "The notification string is formatted as XML.";
131           }
132           enum json {
133             description
134               "The notification string is formatted as JSON.";
135           }
136         }
137         mandatory true;
138         description
139           "The format of the notification string.";
140       }
141       leaf notification-object {
142         type string;
143         mandatory true;
144         description
145           "A JSON string containing the notification object to be sent by the device.";
146       }
147     }
148     output {
149       uses ntsc:rpc-status-g;
150     }
151   }
152
153   rpc invoke-ves-pm-file-ready {
154     description
155       "Operation to generate a VES  notification from a Network Function.";
156     input {
157       leaf file-location {
158         type string;
159         mandatory true;
160         description
161           "A string containing the location of the file on the server.";
162       }
163     }
164     output {
165       uses ntsc:rpc-status-g;
166     }
167   }
168
169   rpc clear-fault-counters {
170     description
171       "Operation to clear the fault counters.";
172     output {
173       uses ntsc:rpc-status-g;
174     }
175   }
176
177   rpc emulate-total-loss {
178     description
179       "Operation to emulate 100% loss in network packets. Operation will resume after specified timeout.";
180     input {
181       leaf timeout {
182         type uint32;
183         units "miliseconds (ms)";
184         description
185           "Period after which loss will stop being 100%.";
186       }
187     }
188     output {
189       uses ntsc:rpc-status-g;
190     }
191   }
192
193   container info {
194     config false;
195     description
196       "Information about NTS application and modules.";
197     leaf build-time {
198       type yang:date-and-time;
199       description
200         "Build time of NTS application.";
201     }
202     leaf version {
203       type string;
204       description
205         "NTS version of current network-function.";
206     }
207     leaf started-features {
208       type ntsc:feature-type;
209       description
210         "A bit-wise list with currently started features.";
211     }
212     leaf ssh-connections {
213       type uint8;
214       config false;
215       description
216         "The number of SSH Endpoints the network function instance exposes.";
217     }
218     leaf tls-connections {
219       type uint8;
220       config false;
221       description
222         "The number of TLS Endpoints the network function instance exposes.";
223     }
224     leaf hostname {
225       type string;
226       description
227         "Current network function hostname.";
228     }
229     list docker-ports {
230       key "port";
231       description
232         "The ports which are exposed inside the docker container implementing this network function instance.";
233       leaf port {
234         type inet:port-number;
235         description
236           "Port number.";
237       }
238       leaf protocol {
239         type identityref {
240           base ntsc:NTS_PROTOCOL_TYPE_BASE;
241         }
242         description
243           "Protocol attached to current port.";
244       }
245     }
246   }
247   container simulation {
248     description
249       "Root level container which controls the Network Function.";
250     container network-function {
251       description
252         "Container which encompasses the details of the network function.";
253       leaf function-type {
254         type string;
255         description
256           "Type of network function that is simulated.";
257       }
258       uses ntsc:mount-point-details-g;
259       uses ntsc:faults-g;
260       uses ntsc:netconf-config-g;
261       uses ntsc:ves-config-g;
262     }
263     container network-emulation {
264       description
265         "Container which encompasses the details of the network emulation.";
266       leaf limit {
267         type uint16 {
268           range "16 .. max";
269         }
270         units "packets";
271         default "1000";
272         description
273           "Maximum number of packets the qdisc may hold queued at a time.";
274       }
275       container delay {
276         description
277           "Adds the chosen delay to the packets outgoing to chosen network interface.";
278         leaf time {
279           type uint16;
280           units "miliseconds (ms)";
281           description
282             "Delay time between packets.";
283         }
284         leaf jitter {
285           type uint16;
286           units "miliseconds (ms)";
287           description
288             "Delay jitter.";
289         }
290         leaf correlation {
291           type uint8 {
292             range "0 .. 100";
293           }
294           units "percentage";
295           description
296             "Delay correlation.";
297         }
298         leaf distribution {
299           type enumeration {
300             enum uniform {
301               description
302                 "Uniform delay distribution.";
303             }
304             enum normal {
305               description
306                 "Normal delay distribution.";
307             }
308             enum pareto {
309               description
310                 "Pareto delay distribution.";
311             }
312             enum paretonormal {
313               description
314                 "Paretonormal delay distribution.";
315             }
316           }
317           description
318             "Delay distribution.";
319         }
320       }
321       leaf loss {
322         type uint8 {
323           range "0 .. 100";
324         }
325         units "percentage";
326         description
327           "Adds an independent loss probability to the packets outgoing from the chosen network interface.";
328       }
329       container corruption {
330         description
331           "Allows the emulation of random noise introducing an error in a random position for a chosen percent of packets.";
332         leaf percentage {
333           type uint8 {
334             range "0 .. 100";
335           }
336           units "percentage";
337           description
338             "Corruption percentage.";
339         }
340         leaf correlation {
341           type uint8 {
342             range "0 .. 100";
343           }
344           units "percentage";
345           description
346             "Corruption correlation.";
347         }
348       }
349       container duplication {
350         description
351           "Using this option the chosen percent of packets is duplicated before queuing them.";
352         leaf percentage {
353           type uint8 {
354             range "0 .. 100";
355           }
356           units "percentage";
357           description
358             "Duplication percentage.";
359         }
360         leaf correlation {
361           type uint8 {
362             range "0 .. 100";
363           }
364           units "percentage";
365           description
366             "Duplication correlation.";
367         }
368       }
369       container reordering {
370         description
371           "Used together with delay; a percentage of packets are sent immediately (with defined correlation) while the others are delayed (by specified delay).";
372         leaf percentage {
373           type uint8 {
374             range "0 .. 100";
375           }
376           units "percentage";
377           description
378             "Reordering percentage.";
379         }
380         leaf correlation {
381           type uint8 {
382             range "0 .. 100";
383           }
384           units "percentage";
385           description
386             "Reordering correlation.";
387         }
388       }
389       leaf rate {
390         type uint16;
391         units "kbits";
392         description
393           "Delay packets based on packet size.";
394       }
395     }
396     container hardware-emulation {
397       description
398         "Container which encompasses the details of hardware emulation.";
399       container netconf-delay {
400         description
401           "Emulates delay on an operational leaf.";
402         leaf delay {
403           type uint32;
404           units "miliseconds (ms)";
405           default "0";
406           description
407             "Delay time to be set for get operation on test leaf.";
408         }
409         leaf get-test {
410           type uint32;
411           units "miliseconds (ms)";
412           config false;
413           description
414             "Read to test. Value represents emulated delay.";
415         }
416         leaf edit-test {
417           type uint32;
418           units "miliseconds (ms)";
419           description
420             "Writing non-null value will emulate a write-delay.";
421         }
422         list get-test-list {
423           config false;
424           description
425             "Read to test. Returned values are saved from edit-test-list.";
426           leaf value {
427             type string;
428             description
429               "Values from edit-test-list.";
430           }
431         }
432         list edit-test-list {
433           key "value";
434           description
435             "Write to test.";
436           leaf value {
437             type string;
438             description
439               "Unique values for testing.";
440           }
441         }
442       }
443     }
444     container sdn-controller {
445       description
446         "Groups details about the SDN Controller.";
447       uses ntsc:controller-g;
448     }
449     container ves-endpoint {
450       description
451         "Groups details about the VES Collector endpoint.";
452       uses ntsc:ves-endpoint-g;
453     }
454   }
455 }