3 ANNEX B: Promise YANG schema based on YangForge
4 ===============================================
9 namespace "urn:opnfv:promise";
12 import complex-types { prefix ct; }
13 import iana-crypt-hash { prefix ianach; }
14 import ietf-inet-types { prefix inet; }
15 import ietf-yang-types { prefix yang; }
16 import opnfv-promise-vim { prefix vim; }
18 feature multi-provider {
23 "OPNFV Promise Resource Reservation/Allocation controller module";
26 description "Initial revision.";
30 description "Updated to incorporate YangForge framework";
33 grouping resource-capacity {
35 container quota { description 'Conceptual container that should be extended'; }
36 container usage { description 'Conceptual container that should be extended';
38 container reserved { description 'Conceptual container that should be extended';
40 container available { description 'Conceptual container that should be extended';
45 grouping compute-capacity {
46 leaf cores { type number; }
47 leaf ram { type number; }
48 leaf instances { type number; }
51 grouping networking-capacity {
52 leaf network { type number; }
53 leaf port { type number; }
54 leaf router { type number; }
55 leaf subnet { type number; }
56 leaf address { type number; }
59 ct:complex-type ResourceReservation {
60 ct:extends vim:ResourceElement;
63 "Contains the capacities of various resource services being reserved
64 along with any resource elements needed to be available at
65 the time of allocation(s).";
67 reference "OPNFV-PROMISE, Section 3.4.1";
69 leaf start { type yang:date-and-time; }
70 leaf end { type yang:date-and-time; }
72 description "Duration in seconds from start when unallocated reserved resources
73 will be released back into the pool";
74 type number; units "seconds";
76 leaf zone { type instance-identifier { ct:instance-type vim:AvailabilityZone; } }
78 uses vim:compute-capacity;
79 uses vim:networking-capcity;
80 uses vim:storage-capacity;
84 "Reference to a collection of existing resource elements required by
85 this reservation. It can contain any instance derived from
86 ResourceElement, such as ServerInstances or even other
87 ResourceReservations. If the ResourceReservation request is
88 accepted, the ResourceElement(s) listed here will be placed
89 into 'protected' mode as to prevent accidental delete.";
90 type instance-identifier {
91 ct:instance-type vim:ResourceElement;
93 // following 'must' statement applies to each element
94 must "boolean(/provider/elements/*[@id=id])" {
95 error-message "One or more of the ResourceElement(s) does not exist in
96 the provider to be reserved";
101 if-feature multi-provider;
105 "Reference to a specified existing provider from which this reservation
106 will be drawn if used in the context of multi-provider
108 type instance-identifier {
109 ct:instance-type vim:ResourceProvider;
110 require-instance true;
114 container remaining {
117 "Provides visibility into total remaining capacity for this
118 reservation based on allocations that took effect utilizing
119 this reservation ID as a reference.";
121 uses vim:compute-capacity;
122 uses vim:networking-capcity;
123 uses vim:storage-capacity;
126 leaf-list allocations {
129 "Reference to a collection of consumed allocations referencing
131 type instance-identifier {
132 ct:instance-type ResourceAllocation;
137 ct:complex-type ResourceAllocation {
138 ct:extends vim:ResourceElement;
141 "Contains a list of resources to be allocated with optional reference
142 to an existing reservation.
144 If reservation is specified but this request is received prior
145 to reservation start timestamp, then it will be rejected unless
146 'allocate-on-start' is set to true. 'allocate-on-start' allows
147 the allocation to be auto-initiated and scheduled to run in the
150 The 'priority' state indicates the classification for dealing
151 with resource starvation scenarios. Lower priority allocations
152 will be forcefully terminated to allow for higher priority
153 allocations to be fulfilled.
155 Allocations without reference to an existing reservation will
156 receive the lowest priority.";
158 reference "OPNFV-PROMISE, Section 3.4.3";
161 description "Reference to an existing reservation identifier";
163 type instance-identifier {
164 ct:instance-type ResourceReservation;
165 require-instance true;
169 leaf allocate-on-start {
171 "If 'allocate-on-start' is set to true, the 'planned' allocations will
172 take effect automatically at the reservation 'start' date/time.";
173 type boolean; default false;
176 ct:instance-list resources {
177 description "Contains list of new ResourceElements that will be allocated";
178 ct:instance-type vim:ResourceElement;
183 "Reflects current priority level of the allocation according to classification rules";
191 ct:instance-list providers {
192 description "Aggregate collection of all registered ResourceProvider instances";
193 ct:instance-type vim:ResourceProvider;
196 // augment compute container with capacity elements
198 uses resource-capacity {
199 augment "capacity/quota" { uses compute-capacity; }
200 augment "capacity/usage" { uses compute-capacity; }
201 augment "capacity/reserved" { uses compute-capacity; }
202 augment "capacity/available" { uses compute-capacity; }
206 // augment networking container with capacity elements
207 augment "networking" {
208 uses resource-capacity {
209 if-feature has-networking-capacity;
210 augment "capacity/quota" { uses networking-capacity; }
211 augment "capacity/usage" { uses networking-capacity; }
212 augment "capacity/reserved" { uses networking-capacity; }
213 augment "capacity/available" { uses networking-capacity; }
217 // track references to reservations for this resource provider
218 leaf-list reservations {
219 type instance-identifier {
220 ct:instance-type ResourceReservation;
225 ct:instance-list reservations {
226 description "Aggregate collection of all registered ResourceReservation instances";
227 ct:instance-type ResourceReservation;
230 ct:instance-list allocations {
231 description "Aggregate collection of all active ResourceAllocation instances";
232 ct:instance-type ResourceAllocation;
237 description "This operation allows you to register a new ResourceProvider
238 into promise management service";
241 description "Select a specific resource provider";
263 type ianach:crypt-hash;
268 description "The target URL endpoint for the resource provider";
273 description "Optional specified regsion for the provider";
278 description "Unique identifier for the newly added provider found in /promise/providers";
279 type instance-identifier {
280 ct:instance-type ResourceProvider;
296 rpc list-reservations;
297 rpc create-reservation;
298 rpc update-reservation;
299 rpc cancel-reservation;
301 rpc list-allocations;
302 rpc create-allocation;
304 notification reservation-event;
305 notification capacity-event;
306 notification allocation-event;