fa3028c6c48b4953a6b4c5d3ccfcb51c11e4aa8b
[osm/SO.git] / rwlaunchpad / plugins / yang / rw-staging-mgmt.yang
1 /*
2  *
3  *   Copyright 2016-2017 RIFT.IO Inc
4  *
5  *   Licensed under the Apache License, Version 2.0 (the "License");
6  *   you may not use this file except in compliance with the License.
7  *   You may obtain a copy of the License at
8  *
9  *       http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *   Unless required by applicable law or agreed to in writing, software
12  *   distributed under the License is distributed on an "AS IS" BASIS,
13  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *   See the License for the specific language governing permissions and
15  *   limitations under the License.
16  *
17  *
18  */
19
20 /**
21  * @file rw-staging-mgmt.yang
22  * @author Varun Prasad
23  * @date 2016/09/21
24  * @brief Pacakage Management Yang
25  */
26
27 module rw-staging-mgmt
28 {
29   namespace "http://riftio.com/ns/riftware-1.0/rw-staging-mgmt";
30   prefix "rw-staging-mgmt";
31
32   import ietf-yang-types {
33     prefix "yang";
34   }
35
36   import rw-cli-ext {
37     prefix "rwcli";
38   }
39
40   import rw-cloud {
41     prefix "rwcloud";
42   }
43
44   import rwcal {
45     prefix "rwcal";
46   }
47
48   import mano-types {
49     prefix "manotypes";
50   }
51
52   import rw-project {
53     prefix "rw-project";
54   }
55
56   import rw-project-mano {
57     prefix "rw-project-mano";
58   }
59
60   revision 2017-02-08 {
61     description
62       "Update model to support projects.";
63   }
64
65   revision 2016-06-01 {
66     description
67       "Initial revision.";
68   }
69
70   typedef staging-area-status {
71     type enumeration {
72       enum LIVE;
73       enum EXPIRED;
74     }
75   }
76
77   grouping staging-area-config {
78     leaf package-type {
79       mandatory true;
80       type manotypes:package-type;
81     }
82
83     leaf name {
84       description "name of the binary";
85       type string;
86     }
87
88     leaf validity-time {
89       description "lifetime of the staging area (in seconds)";
90       type uint64;
91       default 3600;
92     }
93
94     leaf project-name {
95       description "Project to which this belongs";
96       type leafref {
97         path "/rw-project:project/rw-project:name";
98       }
99     }
100   }
101
102   grouping staging-area-meta {
103
104     leaf status {
105       description "The status of the staging area";
106       type staging-area-status;
107     }
108
109     leaf created-time {
110       description "start time (unix epoch)";
111       type uint32;
112     }
113
114     leaf deleted-time {
115       description "stop time (unix epoch)";
116       type uint32;
117     }
118
119     leaf size {
120       description "size of the binary in bytes";
121       type uint64;
122     }
123
124     leaf path {
125       description "Path of the staging area";
126       type string;
127     }
128
129   }
130
131   augment "/rw-project:project" {
132     container staging-areas {
133       description "Staging Areas";
134       config false;
135
136       list staging-area {
137         key "area-id";
138
139         leaf area-id {
140           description "Staging Area ID";
141           type string;
142         }
143
144         uses staging-area-config;
145         uses staging-area-meta;
146       }
147     }
148   }
149
150   rpc create-staging-area {
151     description "Creates a staging area for the upload.";
152
153     input {
154       uses staging-area-config;
155     }
156
157     output {
158       leaf port {
159         type uint32;
160       }
161
162       leaf endpoint {
163         description "Endpoint that contains all the package-related data";
164         type string;
165       }
166     }
167   }
168 }