update from RIFT as of 696b75d2fe9fb046261b08c616f1bcf6c0b54a9b second try
[osm/SO.git] / rwcm / plugins / yang / rw-conman.yang
1
2 /*
3  * 
4  *   Copyright 2016-2017 RIFT.IO Inc
5  *
6  *   Licensed under the Apache License, Version 2.0 (the "License");
7  *   you may not use this file except in compliance with the License.
8  *   You may obtain a copy of the License at
9  *
10  *       http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *   Unless required by applicable law or agreed to in writing, software
13  *   distributed under the License is distributed on an "AS IS" BASIS,
14  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *   See the License for the specific language governing permissions and
16  *   limitations under the License.
17  *
18  */
19
20
21
22 /**
23  * @file rw-conman.yang
24  * @author Manish Patel
25  * @date 2015/10/27
26  * @brief Service Orchestrator configuration yang
27  */
28
29 module rw-conman
30 {
31   namespace "http://riftio.com/ns/riftware-1.0/rw-conman";
32   prefix "rw-conman";
33
34   import rw-cli-ext {
35     prefix "rwcli";
36   }
37
38   import rw-project-vnfd {
39     prefix "rw-project-vnfd";
40   }
41
42   import rw-project-nsd {
43     prefix "rw-project-nsd";
44   }
45
46   import nsr {
47     prefix "nsr";
48   }
49
50   import rw-nsr {
51     prefix "rw-nsr";
52   }
53
54   import rw-vnfr {
55     prefix "rw-vnfr";
56   }
57
58   import rw-vlr {
59     prefix "rwvlr";
60   }
61
62   import rw-yang-types {
63     prefix "rwt";
64   }
65
66   import ietf-inet-types {
67     prefix "inet";
68   }
69
70   import ietf-yang-types {
71     prefix "yang";
72   }
73
74   import mano-base {
75     prefix "manobase";
76   }
77
78   import mano-types {
79     prefix "manotypes";
80   }
81
82   import rw-config-agent {
83     prefix "rw-config-agent";
84   }
85
86   import rw-project {
87     prefix "rw-project";
88   }
89
90   import rw-project-mano {
91     prefix "rw-project-mano";
92   }
93
94   revision 2017-02-08 {
95     description
96       "Update model to support projects.";
97   }
98
99   revision 2015-10-27 {
100     description
101       "Initial revision.";
102   }
103
104   // typedef ro-endpoint-method {
105   //   type enumeration {
106   //     enum netconf;
107   //     enum restconf;
108   //   }
109   // }
110   
111   grouping ro-endpoint {
112     // leaf ro-endpoint-method {
113     //   description "interface between CM & RO, defaults to netconf";
114     //   type ro-endpoint-method;
115     //   default netconf;
116     // }
117     leaf ro-ip-address {
118       type inet:ip-address;
119       description "IP Address";
120       default "127.0.0.1";
121     }
122     leaf ro-port {
123       type inet:port-number;
124       description "Port Number";
125       default 2022;
126     }
127     leaf ro-username {
128       description "RO endpoint username";
129       type string;
130       default "@rift";
131     }
132     leaf ro-password {
133       description "RO endpoint password";
134       type string;
135       default "rift";
136     }
137   }
138   
139   // =================== SHOW ==================
140   typedef record-state {
141     type enumeration {
142       enum init;
143       enum received;
144       enum cfg-process;
145       enum cfg-process-failed;
146       enum cfg-sched;
147       enum connecting;
148       enum failed-connection;
149       enum cfg-send;
150       enum cfg-failed;
151       enum ready-no-cfg;
152       enum ready;
153       enum terminate;
154     }
155   }
156
157
158   grouping primitive-parameter {
159     leaf name {
160       description
161           "Name of the parameter.";
162       type string;
163     }
164
165     leaf data-type {
166       description
167           "Data type associated with the name.";
168       type manotypes:parameter-data-type;
169     }
170
171     leaf mandatory {
172       description "Is this field mandatory";
173       type boolean;
174       default false;
175     }
176
177     leaf default-value {
178       description "The default value for this field";
179       type string;
180     }
181
182     leaf parameter-pool {
183       description "NSD parameter pool name to use for this parameter";
184       type string;
185     }
186
187     leaf read-only {
188       description
189         "The value should be dimmed by the UI.
190         Only applies to parameters with default values.";
191       type boolean;
192       default false;
193     }
194
195     leaf hidden {
196       description
197         "The value should be hidden by the UI.
198         Only applies to parameters with default values.";
199       type boolean;
200       default false;
201     }
202
203     leaf out {
204       description "If this is an output of the primitive execution";
205       type boolean;
206       default false;
207     }
208   }
209
210   grouping vnf-configuration {
211     container vnf-configuration {
212       description
213           "Information about the VNF configuration. Note:
214            If the NS contains multiple instances of the
215            same VNF, each instance could have a different
216            configuration.";
217
218       choice config-method {
219         description
220             "Defines the configuration method for the VNF.";
221         case script {
222           description
223               "Use custom script for configuring the VNF.
224                This script is executed in the context of
225                Orchestrator (The same system and environment
226                as the Launchpad).";
227           container script {
228             leaf script-type {
229               description
230                   "Script type - currently supported - Scripts confirming to Rift CA plugin";
231               type enumeration {
232                 enum rift;
233               }
234             }
235           }
236         }
237
238         case juju {
239           description
240             "Configure the VNF through Juju.";
241           container juju {
242             leaf charm {
243               description "Juju charm to use with the VNF.";
244               type string;
245             }
246           }
247         }
248       }
249
250       list config-primitive {
251         description
252           "List of config primitives supported by the
253           configuration agent for this VNF.";
254         key "name";
255
256         leaf name {
257           description
258             "Name of the config primitive.";
259           type string;
260         }
261
262         list parameter {
263           description
264             "List of parameters to the config primitive.";
265           key "name";
266           uses primitive-parameter;
267         }
268
269         leaf user-defined-script {
270           description
271             "A user defined script. If user defined script is defined,
272              the script will be executed using bash";
273           type string;
274         }
275       }
276
277       list initial-config-primitive {
278         description
279           "Initial set of configuration primitives.";
280         key "seq";
281         leaf seq {
282           description
283               "Sequence number for the configuration primitive.";
284           type uint64;
285         }
286
287         choice primitive-type {
288           case primitive-definition {
289             leaf name {
290               description
291                 "Name of the configuration primitive.";
292               type string;
293             }
294
295             uses manotypes:primitive-parameter-value;
296
297             leaf user-defined-script {
298               description
299                 "A user defined script.";
300               type string;
301             }
302           }
303           case primitive-ref {
304             leaf config-primitive-ref {
305               description
306                 "Reference to a config primitive name.
307                  NOTE: The config primitive referred should have
308                        all the input parameters predefined either
309                        with default values or dependency references.";
310               type leafref {
311                 path "../../config-primitive/name";
312               }
313             }
314           }
315         }
316       }
317     }
318   } // END - grouping vnf-configuration
319
320
321   // This is also used by RO (Resource Orchestrator) to indicate NSR is ready
322   // It will only fill in IDs
323   augment "/rw-project:project" {
324     container cm-state {
325       config false;
326       description "CM NS & VNF states";
327
328       leaf states {
329         description "CM various states";
330         type string;
331       }
332     
333       list cm-nsr {
334         description "List of NS Records";
335         key "id";
336         leaf id {
337           type yang:uuid;
338         }
339         leaf name {
340           description "NSR name.";
341           type string;
342         }
343         leaf state {
344           description "State of NSR";
345           type record-state;
346         }
347         leaf state-details {
348           description "Details of the state of NSR, in case of errors";
349           type string;
350         }
351       
352         list cm-vnfr {
353           description "List of VNF Records within NS Record";
354           key "id";
355           leaf id {
356             type yang:uuid;
357           }
358           leaf name {
359             description "VNFR name.";
360             type string;
361           }
362           leaf state {
363             description "Last known state of this VNFR";
364             type record-state;
365           }
366
367           container mgmt-interface {
368             leaf ip-address {
369               type inet:ip-address;
370             }
371             leaf port {
372               type inet:port-number;
373             }
374           }
375           leaf cfg-type {
376             type string;
377           }
378           list connection-point {
379             key "name";
380             leaf name {
381               description "Connection Point name";
382               type string;
383             }
384             leaf ip-address {
385               description "IP address assigned to this connection point";
386               type inet:ip-address;
387             }
388             leaf connection-point-id {
389               type string;
390             }
391           }
392
393           // Publish the resolved capabilites and dependecies here
394           container config-parameter {
395             description
396               "The resolved config parameter for a VNF";
397             list config-parameter-source {
398               description "List of resolved sources";
399               key "name";
400
401               leaf name {
402                 type string {
403                   length 1..128;
404                 }
405                 description
406                   "Name of the source as defined in VNFD";
407               }
408               leaf value {
409                 type string;
410                 description
411                   "Resovled value for the source";
412               }
413               list parameter {
414                 key "config-primitive-ref";
415                 leaf config-primitive-ref {
416                   type string;
417                 }
418                 leaf parameter-ref {
419                   type string;
420                 }
421               }
422             }
423
424             list config-parameter-request {
425               description
426                 "List of resolved requests for the the VNF";
427               key "name";
428
429               leaf name {
430                 type string {
431                   length 1..128;
432                 }
433                 description
434                   "Name of the request as defined in VNFD";
435               }
436               leaf value {
437                 type string;
438                 description
439                   "Resovled value for the request";
440               }
441               list parameter {
442                 key "config-primitive-ref";
443                 leaf config-primitive-ref {
444                   type string;
445                 }
446                 leaf parameter-ref {
447                   type string;
448                 }
449               }
450             }
451           }
452
453           // Resolve the VNF config-primitives and publish it
454           // here. VNFR will use this and update config-primitives
455           // from here.
456           uses vnf-configuration;
457         } // list VNFR
458       } // list NSR
459     } // cm-state
460   }
461 } // rw-conman