1 ANNEX A: PROMISE YANG SCHEMA BASED ON YANGFORGE
2 ===============================================
7 namespace "urn:opnfv:promise";
10 import complex-types { prefix ct; }
11 import iana-crypt-hash { prefix ianach; }
12 import ietf-inet-types { prefix inet; }
13 import ietf-yang-types { prefix yang; }
14 import opnfv-promise-vim { prefix vim; }
16 feature multi-provider {
21 "OPNFV Promise Resource Reservation/Allocation controller module";
24 description "Initial revision.";
28 description "Updated to incorporate YangForge framework";
31 grouping resource-capacity {
33 container quota { description 'Conceptual container that should be extended'; }
34 container usage { description 'Conceptual container that should be extended';
36 container reserved { description 'Conceptual container that should be extended';
38 container available { description 'Conceptual container that should be extended';
43 grouping compute-capacity {
44 leaf cores { type number; }
45 leaf ram { type number; }
46 leaf instances { type number; }
49 grouping networking-capacity {
50 leaf network { type number; }
51 leaf port { type number; }
52 leaf router { type number; }
53 leaf subnet { type number; }
54 leaf address { type number; }
57 ct:complex-type ResourceReservation {
58 ct:extends vim:ResourceElement;
61 "Contains the capacities of various resource services being reserved
62 along with any resource elements needed to be available at
63 the time of allocation(s).";
65 reference "OPNFV-PROMISE, Section 3.4.1";
67 leaf start { type yang:date-and-time; }
68 leaf end { type yang:date-and-time; }
70 description "Duration in seconds from start when unallocated reserved resources
71 will be released back into the pool";
72 type number; units "seconds";
74 leaf zone { type instance-identifier { ct:instance-type vim:AvailabilityZone; } }
76 uses vim:compute-capacity;
77 uses vim:networking-capcity;
78 uses vim:storage-capacity;
82 "Reference to a collection of existing resource elements required by
83 this reservation. It can contain any instance derived from
84 ResourceElement, such as ServerInstances or even other
85 ResourceReservations. If the ResourceReservation request is
86 accepted, the ResourceElement(s) listed here will be placed
87 into 'protected' mode as to prevent accidental delete.";
88 type instance-identifier {
89 ct:instance-type vim:ResourceElement;
91 // following 'must' statement applies to each element
92 must "boolean(/provider/elements/*[@id=id])" {
93 error-message "One or more of the ResourceElement(s) does not exist in
94 the provider to be reserved";
99 if-feature multi-provider;
103 "Reference to a specified existing provider from which this reservation
104 will be drawn if used in the context of multi-provider
106 type instance-identifier {
107 ct:instance-type vim:ResourceProvider;
108 require-instance true;
112 container remaining {
115 "Provides visibility into total remaining capacity for this
116 reservation based on allocations that took effect utilizing
117 this reservation ID as a reference.";
119 uses vim:compute-capacity;
120 uses vim:networking-capcity;
121 uses vim:storage-capacity;
124 leaf-list allocations {
127 "Reference to a collection of consumed allocations referencing
129 type instance-identifier {
130 ct:instance-type ResourceAllocation;
135 ct:complex-type ResourceAllocation {
136 ct:extends vim:ResourceElement;
139 "Contains a list of resources to be allocated with optional reference
140 to an existing reservation.
142 If reservation is specified but this request is received prior
143 to reservation start timestamp, then it will be rejected unless
144 'allocate-on-start' is set to true. 'allocate-on-start' allows
145 the allocation to be auto-initiated and scheduled to run in the
148 The 'priority' state indicates the classification for dealing
149 with resource starvation scenarios. Lower priority allocations
150 will be forcefully terminated to allow for higher priority
151 allocations to be fulfilled.
153 Allocations without reference to an existing reservation will
154 receive the lowest priority.";
156 reference "OPNFV-PROMISE, Section 3.4.3";
159 description "Reference to an existing reservation identifier";
161 type instance-identifier {
162 ct:instance-type ResourceReservation;
163 require-instance true;
167 leaf allocate-on-start {
169 "If 'allocate-on-start' is set to true, the 'planned' allocations will
170 take effect automatically at the reservation 'start' date/time.";
171 type boolean; default false;
174 ct:instance-list resources {
175 description "Contains list of new ResourceElements that will be allocated";
176 ct:instance-type vim:ResourceElement;
181 "Reflects current priority level of the allocation according to classification rules";
189 ct:instance-list providers {
190 description "Aggregate collection of all registered ResourceProvider instances";
191 ct:instance-type vim:ResourceProvider;
194 // augment compute container with capacity elements
196 uses resource-capacity {
197 augment "capacity/quota" { uses compute-capacity; }
198 augment "capacity/usage" { uses compute-capacity; }
199 augment "capacity/reserved" { uses compute-capacity; }
200 augment "capacity/available" { uses compute-capacity; }
204 // augment networking container with capacity elements
205 augment "networking" {
206 uses resource-capacity {
207 if-feature has-networking-capacity;
208 augment "capacity/quota" { uses networking-capacity; }
209 augment "capacity/usage" { uses networking-capacity; }
210 augment "capacity/reserved" { uses networking-capacity; }
211 augment "capacity/available" { uses networking-capacity; }
215 // track references to reservations for this resource provider
216 leaf-list reservations {
217 type instance-identifier {
218 ct:instance-type ResourceReservation;
223 ct:instance-list reservations {
224 description "Aggregate collection of all registered ResourceReservation instances";
225 ct:instance-type ResourceReservation;
228 ct:instance-list allocations {
229 description "Aggregate collection of all active ResourceAllocation instances";
230 ct:instance-type ResourceAllocation;
235 description "This operation allows you to register a new ResourceProvider
236 into promise management service";
239 description "Select a specific resource provider";
261 type ianach:crypt-hash;
266 description "The target URL endpoint for the resource provider";
271 description "Optional specified regsion for the provider";
276 description "Unique identifier for the newly added provider found in /promise/providers";
277 type instance-identifier {
278 ct:instance-type ResourceProvider;
294 rpc list-reservations;
295 rpc create-reservation;
296 rpc update-reservation;
297 rpc cancel-reservation;
299 rpc list-allocations;
300 rpc create-allocation;
302 notification reservation-event;
303 notification capacity-event;
304 notification allocation-event;