2 namespace "urn:opnfv:promise";
5 import complex-types { prefix ct; }
6 import ietf-yang-types { prefix yang; }
7 import ietf-inet-types { prefix inet; }
8 import access-control-models { prefix acm; }
9 import nfv-infrastructure { prefix nfvi; }
12 "OPNFV Promise Resource Reservation/Allocation controller module";
15 description "Complete coverage of reservation related intents";
19 description "Updated to incorporate YangForge framework";
23 description "Initial revision.";
26 feature reservation-service {
27 description "When enabled, provides resource reservation service";
30 feature multi-provider {
31 description "When enabled, provides resource management across multiple providers";
34 typedef reference-identifier {
35 description "defines valid formats for external reference id";
43 grouping resource-utilization {
45 container total { description 'Conceptual container that should be extended'; }
46 container reserved { description 'Conceptual container that should be extended'; config false; }
47 container usage { description 'Conceptual container that should be extended'; config false; }
48 container available { description 'Conceptual container that should be extended'; config false; }
52 grouping temporal-resource-collection {
54 "Information model capturing resource-collection with start/end time window";
56 leaf start { type yang:date-and-time; }
57 leaf end { type yang:date-and-time; }
59 uses nfvi:resource-collection;
62 grouping resource-usage-request {
64 "Information model capturing available parameters to make a resource
66 reference "OPNFV-PROMISE, Section 3.4.1";
68 uses temporal-resource-collection {
71 "Reference to a list of 'pre-existing' resource elements that are
72 required for fulfillment of the resource-usage-request.
74 It can contain any instance derived from ResourceElement,
75 such as ServerInstances or even other
76 ResourceReservations. If the resource-usage-request is
77 accepted, the ResourceElement(s) listed here will be placed
78 into 'protected' mode as to prevent accidental removal.
80 If any of these resource elements become 'unavailable' due to
81 environmental or administrative activity, a notification will
82 be issued informing of the issue.";
87 description "Optional identifier to an Availability Zone";
88 type instance-identifier { ct:instance-type nfvi:AvailabilityZone; }
92 grouping query-start-end-window {
94 description "Matches entries that are within the specified start/end time window";
95 leaf start { type yang:date-and-time; }
96 leaf end { type yang:date-and-time; }
100 description "Matches entries that start AND end within the window";
103 description "Matches entries that start OR end within the window";
111 grouping query-resource-collection {
112 uses query-start-end-window {
113 description "Match for ResourceCollection(s) that are within the specified start/end time window";
116 description "Excludes specified collection identifiers from the result";
117 type instance-identifier { ct:instance-type ResourceCollection; }
119 leaf show-utilization { type boolean; default true; }
122 description "Query for ResourceCollection(s) that contain some or more of these element(s)";
123 type instance-identifier { ct:instance-type nfvi:ResourceElement; }
126 description "Query for ResourceCollection(s) that contain all of these element(s)";
127 type instance-identifier { ct:instance-type nfvi:ResourceElement; }
132 grouping common-intent-output {
140 leaf message { type string; }
143 grouping utilization-output {
146 leaf timestamp { type yang:date-and-time; }
147 leaf count { type int16; }
148 container capacity { uses nfvi:resource-capacity; }
152 ct:complex-type ResourceCollection {
153 ct:extends nfvi:ResourceContainer;
157 "Describes an abstract ResourceCollection data model, which represents
158 a grouping of capacity and elements available during a given
159 window in time which must be extended by other resource
160 collection related models";
162 leaf start { type yang:date-and-time; }
163 leaf end { type yang:date-and-time; }
168 "Provides current state of this record whether it is enabled and within
169 specified start/end time";
174 ct:complex-type ResourcePool {
175 ct:extends ResourceCollection;
178 "Describes an instance of an active ResourcePool record, which
179 represents total available capacity and elements from a given
183 type instance-identifier {
184 ct:instance-type nfvi:ResourceContainer;
185 require-instance true;
191 // following 'must' statement applies to each element
192 // NOTE: just a non-working example for now...
193 must "boolean(/source/elements/*[@id=id])" {
194 error-message "One or more of the ResourceElement(s) does not exist in the provider to be reserved";
199 ct:complex-type ResourceReservation {
200 ct:extends ResourceCollection;
203 "Describes an instance of an accepted resource reservation request,
204 created usually as a result of 'create-reservation' request.
206 A ResourceReservation is a derived instance of a generic
207 ResourceCollection which has additional parameters to map the
208 pool(s) that were referenced to accept this reservation as well
209 as to track allocations made referencing this reservation.
211 Contains the capacities of various resource attributes being
212 reserved along with any resource elements that are needed to be
213 available at the time of allocation(s).";
215 reference "OPNFV-PROMISE, Section 3.4.1";
217 leaf created-on { type yang:date-and-time; config false; }
218 leaf modified-on { type yang:date-and-time; config false; }
223 "Provides list of one or more pools that were referenced for providing
224 the requested resources for this reservation. This is an
225 important parameter for informing how/where allocation
226 requests can be issued using this reservation since it is
227 likely that the total reserved resource capacity/elements are
228 made availble from multiple sources.";
229 type instance-identifier {
230 ct:instance-type ResourcePool;
231 require-instance true;
235 container remaining {
238 "Provides visibility into total remaining capacity for this
239 reservation based on allocations that took effect utilizing
240 this reservation ID as a reference.";
242 uses nfvi:resource-capacity;
245 leaf-list allocations {
248 "Reference to a collection of consumed allocations referencing
250 type instance-identifier {
251 ct:instance-type ResourceAllocation;
252 require-instance true;
257 ct:complex-type ResourceAllocation {
258 ct:extends ResourceCollection;
261 "A ResourceAllocation record denotes consumption of resources from a
262 referenced ResourcePool.
264 It does not reflect an accepted request but is created to
265 represent the actual state about the ResourcePool. It is
266 created once the allocation(s) have successfully taken effect
267 on the 'source' of the ResourcePool.
269 The 'priority' state indicates the classification for dealing
270 with resource starvation scenarios. Lower priority allocations
271 will be forcefully terminated to allow for higher priority
272 allocations to be fulfilled.
274 Allocations without reference to an existing reservation will
275 receive the lowest priority.";
277 reference "OPNFV-PROMISE, Section 3.4.3";
280 description "Reference to an existing reservation identifier (optional)";
282 type instance-identifier {
283 ct:instance-type ResourceReservation;
284 require-instance true;
289 description "Reference to an existing resource pool from which allocation is drawn";
291 type instance-identifier {
292 ct:instance-type ResourcePool;
293 require-instance true;
297 container instance-ref {
300 "Reference to actual instance identifier of the provider/server for this allocation";
302 type instance-identifier { ct:instance-type ResourceProvider; }
304 leaf server { type yang:uuid; }
310 "Reflects current priority level of the allocation according to classification rules";
312 enum "high" { value 1; }
313 enum "normal" { value 2; }
314 enum "low" { value 3; }
320 ct:complex-type ResourceFlavor {
321 description "currently NOT an extension of ResourceElement.";
323 leaf id { type string; }
324 leaf name { type string; }
325 leaf disk { type uint32; units 'GB'; default 0; }
326 leaf ram { type uint32; units 'MB'; default 0; }
327 leaf vcpus { type uint16; default 0; }
330 ct:complex-type ResourceProvider {
331 ct:extends nfvi:ResourceContainer;
334 leaf token { type string; mandatory true; }
336 container services { // read-only
339 leaf endpoint { type inet:uri; }
340 ct:instance-list flavors { ct:instance-type ResourceFlavor; }
347 "Provides list of one or more pools that are referencing this provider.";
349 type instance-identifier {
350 ct:instance-type ResourcePool;
351 require-instance true;
359 uses resource-utilization {
360 description "Describes current state info about capacity utilization info";
362 augment "capacity/total" { uses nfvi:resource-capacity; }
363 augment "capacity/reserved" { uses nfvi:resource-capacity; }
364 augment "capacity/usage" { uses nfvi:resource-capacity; }
365 augment "capacity/available" { uses nfvi:resource-capacity; }
368 ct:instance-list providers {
369 if-feature multi-provider;
370 description "Aggregate collection of all registered ResourceProvider instances for Promise resource management service";
371 ct:instance-type ResourceProvider;
374 ct:instance-list pools {
375 if-feature reservation-service;
376 description "Aggregate collection of all ResourcePool instances";
377 ct:instance-type ResourcePool;
380 ct:instance-list reservations {
381 if-feature reservation-service;
382 description "Aggregate collection of all ResourceReservation instances";
383 ct:instance-type ResourceReservation;
386 ct:instance-list allocations {
387 description "Aggregate collection of all ResourceAllocation instances";
388 ct:instance-type ResourceAllocation;
392 container reservation {
393 leaf max-future-start-range {
395 "Enforce reservation request 'start' time is within allowed range from now";
396 type uint16 { range 0..365; }
399 leaf max-future-end-range {
401 "Enforce reservation request 'end' time is within allowed range from now";
402 type uint16 { range 0..365; }
407 "Enforce reservation duration (end-start) does not exceed specified threshold";
410 default 8760; // for now cap it at max one year as default
414 "Duration in minutes from start when unallocated reserved resources
415 will be released back into the pool";
423 //-------------------
425 //-------------------
427 // RESERVATION INTENTS
428 rpc create-reservation {
429 if-feature reservation-service;
430 description "Make a request to the reservation system to reserve resources";
432 uses resource-usage-request;
435 uses common-intent-output;
436 leaf reservation-id {
437 type instance-identifier { ct:instance-type ResourceReservation; }
442 rpc update-reservation {
443 description "Update reservation details for an existing reservation";
445 leaf reservation-id {
446 type instance-identifier {
447 ct:instance-type ResourceReservation;
448 require-instance true;
452 uses resource-usage-request;
455 uses common-intent-output;
459 rpc cancel-reservation {
460 description "Cancel the reservation and be a good steward";
462 leaf reservation-id {
463 type instance-identifier { ct:instance-type ResourceReservation; }
468 uses common-intent-output;
472 rpc query-reservation {
473 if-feature reservation-service;
474 description "Query the reservation system to return matching reservation(s)";
476 leaf zone { type instance-identifier { ct:instance-type nfvi:AvailabilityZone; } }
477 uses query-resource-collection;
480 leaf-list reservations { type instance-identifier { ct:instance-type ResourceReservation; } }
481 uses utilization-output;
486 rpc increase-capacity {
487 description "Increase total capacity for the reservation system between a window in time";
489 uses temporal-resource-collection;
491 type instance-identifier {
492 ct:instance-type nfvi:ResourceContainer;
497 uses common-intent-output;
499 type instance-identifier { ct:instance-type ResourcePool; }
504 rpc decrease-capacity {
505 description "Decrease total capacity for the reservation system between a window in time";
507 uses temporal-resource-collection;
509 type instance-identifier {
510 ct:instance-type nfvi:ResourceContainer;
515 uses common-intent-output;
517 type instance-identifier { ct:instance-type ResourcePool; }
523 description "Check available capacity information about a specified resource collection";
534 leaf zone { type instance-identifier { ct:instance-type nfvi:AvailabilityZone; } }
535 uses query-resource-collection;
536 // TBD: additional parameters for query-capacity
539 leaf-list collections { type instance-identifier { ct:instance-type ResourceCollection; } }
540 uses utilization-output;
544 // ALLOCATION INTENTS (should go into VIM module in the future)
545 rpc create-instance {
546 description "Create an instance of specified resource(s) utilizing capacity from the pool";
549 if-feature multi-provider;
550 type instance-identifier { ct:instance-type ResourceProvider; require-instance true; }
552 leaf name { type string; mandatory true; }
554 type reference-identifier;
558 type reference-identifier;
562 type reference-identifier;
563 description "optional, will assign default network if not provided";
566 // TODO: consider supporting a template-id (such as HEAT) for more complex instantiation
568 leaf reservation-id {
569 type instance-identifier { ct:instance-type ResourceReservation; require-instance true; }
573 uses common-intent-output;
575 type instance-identifier { ct:instance-type ResourceAllocation; }
580 rpc destroy-instance {
581 description "Destroy an instance of resource utilization and release it back to the pool";
584 type instance-identifier { ct:instance-type ResourceAllocation; require-instance true; }
588 uses common-intent-output;
592 // PROVIDER INTENTS (should go into VIM module in the future)
594 description "Register a new resource provider into reservation system";
597 description "Select a specific resource provider type";
615 uses acm:access-credentials {
620 default "http://localhost:5000/v2.0";
624 leaf id { type string; }
625 leaf name { type string; }
629 uses common-intent-output;
631 type instance-identifier { ct:instance-type ResourceProvider; }
637 notification reservation-event;
638 notification capacity-event;
639 notification allocation-event;