Add network emulation 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 nts-common {
7     prefix ntsc;
8   }
9   import ietf-yang-types {
10     prefix yang;
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 - Network Functions";
23
24   revision 2021-05-17 {
25     description
26       "Added support for network emulation.";
27     reference
28       "O-RAN-SC SIM project";
29   }
30   revision 2021-03-26 {
31     description
32       "Added info container, and expanted feature control mechanism and status.";
33     reference
34       "O-RAN-SC SIM project";
35   }
36   revision 2021-03-17 {
37     description
38       "Renamed datastore-random-populate RPC to datastore-populate";
39     reference
40       "O-RAN-SC SIM project";
41   }
42   revision 2020-12-11 {
43     description
44       "Added function-type to simulated function.";
45     reference
46       "O-RAN-SC SIM project";
47   }
48   revision 2020-11-30 {
49     description
50       "Cleared revision for nts-common import.";
51     reference
52       "O-RAN-SC SIM project";
53   }
54   revision 2020-10-28 {
55     description
56       "Add RPC for clearing the fault counters.";
57     reference
58       "O-RAN-SC SIM project";
59   }
60   revision 2020-10-13 {
61     description
62       "Add RPC for datastore populating and feature control.";
63     reference
64       "O-RAN-SC SIM project";
65   }
66   revision 2020-09-07 {
67     description
68       "Initial revision for the Network Topology Simulator - Next Generation";
69     reference
70       "O-RAN-SC SIM project";
71   }
72
73   rpc datastore-populate {
74     description
75       "Operation to populate the datastore with data for all the containing YANG models, based on settings in config.json";
76     output {
77       uses ntsc:rpc-status-g;
78     }
79   }
80
81   rpc feature-control {
82     description
83       "Operation to control the features in a Network Function.";
84     input {
85       leaf start-features {
86         type ntsc:feature-type;
87         description
88           "A bit-wise list with features to be activated.";
89       }
90       leaf stop-features {
91         type ntsc:feature-type;
92         description
93           "A bit-wise list with features to be deactivated.";
94       }
95     }
96     output {
97       uses ntsc:rpc-status-g;
98     }
99   }
100
101   rpc invoke-notification {
102     description
103       "Operation to control the features in a Network Function.";
104     input {
105       leaf notification-format {
106         type enumeration {
107           enum xml {
108             description
109               "The notification string is formatted as XML.";
110           }
111           enum json {
112             description
113               "The notification string is formatted as JSON.";
114           }
115         }
116         mandatory true;
117         description
118           "The format of the notification string.";
119       }
120       leaf notification-object {
121         type string;
122         mandatory true;
123         description
124           "A JSON string containing the notification object to be sent by the device.";
125       }
126     }
127     output {
128       uses ntsc:rpc-status-g;
129     }
130   }
131
132   rpc invoke-ves-pm-file-ready {
133     description
134       "Operation to generate a VES  notification from a Network Function.";
135     input {
136       leaf file-location {
137         type string;
138         mandatory true;
139         description
140           "A string containing the location of the file on the server.";
141       }
142     }
143     output {
144       uses ntsc:rpc-status-g;
145     }
146   }
147
148   rpc clear-fault-counters {
149     description
150       "Operation to clear the fault counters.";
151     output {
152       uses ntsc:rpc-status-g;
153     }
154   }
155
156   container info {
157     config false;
158     description
159       "Information about NTS application and modules.";
160     leaf build-time {
161       type yang:date-and-time;
162       description
163         "Build time of NTS application.";
164     }
165     leaf version {
166       type string;
167       description
168         "NTS version of current network-function.";
169     }
170     leaf started-features {
171       type ntsc:feature-type;
172       description
173         "A bit-wise list with currently started features.";
174     }
175   }
176   container simulation {
177     description
178       "Root level container which controls the Network Function.";
179     container network-function {
180       description
181         "Container which encompasses the details of the network function.";
182       leaf function-type {
183         type string;
184         description
185           "Type of network function that is simulated.";
186       }
187       uses ntsc:mount-point-details-g;
188       uses ntsc:faults-g;
189       uses ntsc:netconf-config-g;
190       uses ntsc:ves-config-g;
191     }
192     container network-emulation {
193       description
194         "Container which encompasses the details of the network emulation.";
195       leaf limit {
196         type uint16 {
197           range "16 .. max";
198         }
199         units "packets";
200         default "1000";
201         description
202           "Maximum number of packets the qdisc may hold queued at a time.";
203       }
204       container delay {
205         description
206           "Adds the chosen delay to the packets outgoing to chosen network interface.";
207         leaf time {
208           type uint16;
209           units "miliseconds (ms)";
210           description
211             "Delay time between packets.";
212         }
213         leaf jitter {
214           type uint16;
215           units "miliseconds (ms)";
216           description
217             "Delay jitter.";
218         }
219         leaf correlation {
220           type uint8 {
221             range "0 .. 100";
222           }
223           units "percentage";
224           description
225             "Delay correlation.";
226         }
227         leaf distribution {
228           type enumeration {
229             enum uniform {
230               description
231                 "Uniform delay distribution.";
232             }
233             enum normal {
234               description
235                 "Normal delay distribution.";
236             }
237             enum pareto {
238               description
239                 "Pareto delay distribution.";
240             }
241             enum paretonormal {
242               description
243                 "Paretonormal delay distribution.";
244             }
245           }
246           description
247             "Delay distribution.";
248         }
249       }
250       leaf loss {
251         type uint8 {
252           range "0 .. 100";
253         }
254         units "percentage";
255         description
256           "Adds an independent loss probability to the packets outgoing from the chosen network interface.";
257       }
258       container corruption {
259         description
260           "Allows the emulation of random noise introducing an error in a random position for a chosen percent of packets.";
261         leaf percentage {
262           type uint8 {
263             range "0 .. 100";
264           }
265           units "percentage";
266           description
267             "Corruption percentage.";
268         }
269         leaf correlation {
270           type uint8 {
271             range "0 .. 100";
272           }
273           units "percentage";
274           description
275             "Corruption correlation.";
276         }
277       }
278       container duplication {
279         description
280           "Using this option the chosen percent of packets is duplicated before queuing them.";
281         leaf percentage {
282           type uint8 {
283             range "0 .. 100";
284           }
285           units "percentage";
286           description
287             "Duplication percentage.";
288         }
289         leaf correlation {
290           type uint8 {
291             range "0 .. 100";
292           }
293           units "percentage";
294           description
295             "Duplication correlation.";
296         }
297       }
298       container reordering {
299         description
300           "Used together with delay; a percentage of packets are sent immediately (with defined correlation) while the others are delayed (by specified delay).";
301         leaf percentage {
302           type uint8 {
303             range "0 .. 100";
304           }
305           units "percentage";
306           description
307             "Reordering percentage.";
308         }
309         leaf correlation {
310           type uint8 {
311             range "0 .. 100";
312           }
313           units "percentage";
314           description
315             "Reordering correlation.";
316         }
317       }
318       leaf rate {
319         type uint16;
320         units "kbits";
321         description
322           "Delay packets based on packet size.";
323       }
324     }
325     container sdn-controller {
326       description
327         "Groups details about the SDN Controller.";
328       uses ntsc:controller-g;
329     }
330     container ves-endpoint {
331       description
332         "Groups details about the VES Collector endpoint.";
333       uses ntsc:ves-endpoint-g;
334     }
335   }
336 }