Allow multiple NTS Manager instances to run on the same machine.
[sim/o1-interface.git] / ntsimulator / yang / 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 2019-10-25 {
20     description
21       "Modify notifications. Add VES message configuration options.";
22     reference
23       "O-RAN SC SIM project";
24   }
25   revision 2019-06-07 {
26     description
27       "Modify controller details.";
28     reference
29       "O-RAN SC SIM project";
30   }
31   revision 2019-03-07 {
32     description
33       "Initial version";
34     reference
35       "O-RAN SC SIM project";
36   }
37
38   typedef operational-state-type {
39     type enumeration {
40       enum not-specified {
41         description
42           "none";
43       }
44       enum running {
45         description
46           "none";
47       }
48       enum created {
49         description
50           "none";
51       }
52       enum exited {
53         description
54           "none";
55       }
56     }
57     description
58       "The operation state of the simulated device.";
59   }
60
61   typedef authentication-method-type {
62     type enumeration {
63       enum no-auth {
64         description
65           "no security (http)";
66       }
67       enum cert-only {
68         description
69           "auth by certificate (https)";
70       }
71       enum basic-auth {
72         description
73           "auth by basic auth username and password (https)";
74       }
75       enum cert-basic-auth {
76         description
77           "auth by certificate and basic auth username / password (https)";
78       }
79     }
80     description
81       "The authentication method for VES messaging.";
82   }
83
84   typedef percent {
85     type decimal64 {
86       fraction-digits 2;
87       range "0 .. 100";
88     }
89     description
90       "Percentage";
91   }
92
93   grouping controller-details-type-g {
94     leaf controller-ip {
95       type inet:ip-address;
96       description
97         "The IP Address of the SDN Controller.";
98     }
99     leaf controller-port {
100       type inet:port-number;
101       description
102         "The Port of the SDN Controller.";
103     }
104     leaf controller-username {
105       type string;
106       description
107         "The Username of the SDN Controller.";
108     }
109     leaf controller-password {
110       type string;
111       description
112         "The Password of the SDN Controller.";
113     }
114     description
115       "none";
116   }
117
118   grouping simulated-devices-type-g {
119     leaf uuid {
120       type string;
121       description
122         "The UUID of the simulated device.";
123     }
124     leaf device-ip {
125       type string;
126       description
127         "The IP Address of the simulated device.";
128     }
129     leaf-list device-port {
130       type uint32;
131       description
132         "A NETCONF endpoint (port) of the simulated device.";
133     }
134     leaf is-mounted {
135       type boolean;
136       description
137         "Specifies if the simulated device is mounted in the SDN Controller.";
138     }
139     leaf operational-state {
140       type operational-state-type;
141       description
142         "Specifies the operational state of the simulated device.";
143     }
144     description
145       "none";
146   }
147
148   container simulator-config {
149     description
150       "Configuration container of the simulator.";
151     leaf simulated-devices {
152       type uint32;
153       default "0";
154       description
155         "The number of devices to be simulated.";
156     }
157     leaf mounted-devices {
158       type uint32;
159       default "0";
160       description
161         "The number of devices to be mounted in ODL. The configured number should not exceed the number of mounted devices.";
162     }
163     container notification-config {
164       leaf fault-notification-delay-period {
165         type uint32;
166         default "0";
167         description
168           "Interval in seconds between two consecutive notifications. If the attribute is set to 0, nofitications are not generated.";
169       }
170       leaf ves-heartbeat-period {
171         type uint32;
172         default "0";
173         description
174           "Interval in seconds between two VES heartbeat messages. If the attribute is set to 0, heartbeat messages are not generated.";
175       }
176       leaf is-netconf-available {
177         type boolean;
178         default "true";
179         description
180           "If set to 'true', NETCONF notifications will be generated.";
181       }
182       leaf is-ves-available {
183         type boolean;
184         default "true";
185         description
186           "If set to 'true', VES messages will be generated.";
187       }
188       description
189         "none";
190     }
191     container controller-details {
192       uses controller-details-type-g;
193       description
194         "The connectivity details of the SDN Controller where we want to mount our simulated devices.";
195     }
196     container ves-endpoint-details {
197       must 'ves-registration = "false" or ../mounted-devices = 0' {
198         error-message "VES registration cannot be active while devices are still mounted to ODL not via VES.";
199       }
200       leaf ves-endpoint-ip {
201         type inet:ip-address;
202         description
203           "The IP Address of the VES Endpoint.";
204       }
205       leaf ves-endpoint-port {
206         type inet:port-number;
207         description
208           "The Port of the VES Endpoint.";
209       }
210       leaf ves-endpoint-auth-method {
211         type authentication-method-type;
212         default "no-auth";
213         description
214           "The type of the authentication to be used with the VES Endpoint.";
215       }
216       leaf ves-endpoint-username {
217         when "../ves-endpoint-auth-method = 'basic-auth' or ../ves-endpoint-auth-method = 'cert-basic-auth'";
218         type string;
219         description
220           "The Username to be used to authenticate to the VES Endpoint.";
221       }
222       leaf ves-endpoint-password {
223         when "../ves-endpoint-auth-method = 'basic-auth' or ../ves-endpoint-auth-method = 'cert-basic-auth'";
224         type string;
225         description
226           "The Password to be used to authenticate to the VES Endpoint.";
227       }
228       leaf ves-endpoint-certificate {
229         when "../ves-endpoint-auth-method = 'cert-only' or ../ves-endpoint-auth-method = 'cert-basic-auth'";
230         type string;
231         description
232           "The Certificate to be used to authenticate to the VES Endpoint.";
233       }
234       leaf ves-registration {
235         type boolean;
236         default "false";
237         description
238           "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.";
239       }
240       description
241         "none";
242     }
243   }
244   container simulator-status {
245     config false;
246     container simulation-usage-details {
247       config false;
248       leaf running-simulated-devices {
249         type uint32;
250         description
251           "The current number of running simulated devices.";
252       }
253       leaf running-mounted-devices {
254         type uint32;
255         description
256           "The current number of running simulated devices that are mounted in ODL.";
257       }
258       leaf base-netconf-port {
259         type uint32;
260         default "30000";
261         description
262           "The starting port number for the NETCONF connections exposed.";
263       }
264       leaf cpu-usage {
265         type percent;
266         description
267           "Specifies the CPU load generated by this simulated device.";
268       }
269       leaf mem-usage {
270         type uint32;
271         description
272           "Specifies the RAM in MB used by this simulated device.";
273       }
274       description
275         "The details about the simulation, including resources consumed.";
276     }
277     list simulated-devices-list {
278       key "uuid";
279       config false;
280       uses simulated-devices-type-g;
281       description
282         "The list of the devices that are currently simulated.";
283     }
284     description
285       "State data container of the simulator.";
286   }
287
288   rpc restart-simulation {
289     description
290       "Operation to restart all the simulated devices with the new configuration of the simulator.";
291   }
292
293   rpc add-key-pair-to-odl {
294     description
295       "Operation to add a key pair signed by the NTS to OpenDaylight, such that it can connect to devices using TLS.";
296   }
297 }