3 ANNEX B: Promise YANG schema based on YangForge
4 ===============================================
9 namespace "urn:opnfv:promise";
12 import complex-types { prefix ct; }
13 import ietf-yang-types { prefix yang; }
14 import ietf-inet-types { prefix inet; }
15 import access-control-models { prefix acm; }
16 import nfv-infrastructure { prefix nfvi; }
17 import nfv-mano { prefix mano; }
20 "OPNFV Promise Resource Reservation/Allocation controller module";
23 description "Complete coverage of reservation related intents";
27 description "Updated to incorporate YangForge framework";
31 description "Initial revision.";
34 feature reservation-service {
35 description "When enabled, provides resource reservation service";
38 feature multi-provider {
39 description "When enabled, provides resource management across multiple providers";
42 grouping resource-utilization {
44 container total { description 'Conceptual container that should be extended'; }
45 container reserved { description 'Conceptual container that should be extended';
47 container usage { description 'Conceptual container that should be extended';
49 container available { description 'Conceptual container that should be extended';
54 grouping temporal-resource-collection {
56 "Information model capturing resource-collection with start/end time window";
58 leaf start { type yang:date-and-time; }
59 leaf end { type yang:date-and-time; }
61 uses nfvi:resource-collection;
64 grouping resource-usage-request {
66 "Information model capturing available parameters to make a resource
68 reference "OPNFV-PROMISE, Section 3.4.1";
70 uses temporal-resource-collection {
73 "Reference to a list of 'pre-existing' resource elements that are
74 required for fulfillment of the resource-usage-request.
76 It can contain any instance derived from ResourceElement,
77 such as ServerInstances or even other
78 ResourceReservations. If the resource-usage-request is
79 accepted, the ResourceElement(s) listed here will be placed
80 into 'protected' mode as to prevent accidental removal.
82 If any of these resource elements become 'unavailable' due to
83 environmental or administrative activity, a notification will
84 be issued informing of the issue.";
89 description "Optional identifier to an Availability Zone";
90 type instance-identifier { ct:instance-type nfvi:AvailabilityZone; }
94 grouping query-start-end-window {
96 description "Matches entries that are within the specified start/end time window";
97 leaf start { type yang:date-and-time; }
98 leaf end { type yang:date-and-time; }
102 description "Matches entries that start AND end within the window";
105 description "Matches entries that start OR end within the window";
113 grouping query-resource-collection {
114 uses query-start-end-window {
115 description "Match for ResourceCollection(s) that are within the specified
116 start/end time window";
119 description "Excludes specified collection identifiers from the result";
120 type instance-identifier { ct:instance-type ResourceCollection; }
122 leaf show-utilization { type boolean; default true; }
125 description "Query for ResourceCollection(s) that contain some or more of
127 type instance-identifier { ct:instance-type nfvi:ResourceElement; }
130 description "Query for ResourceCollection(s) that contain all of
132 type instance-identifier { ct:instance-type nfvi:ResourceElement; }
137 grouping common-intent-output {
145 leaf message { type string; }
148 grouping utilization-output {
151 leaf timestamp { type yang:date-and-time; }
152 leaf count { type int16; }
153 container capacity { uses nfvi:resource-capacity; }
157 ct:complex-type ResourceCollection {
158 ct:extends nfvi:ResourceContainer;
162 "Describes an abstract ResourceCollection data model, which represents
163 a grouping of capacity and elements available during a given
164 window in time which must be extended by other resource
165 collection related models";
167 leaf start { type yang:date-and-time; }
168 leaf end { type yang:date-and-time; }
173 "Provides current state of this record whether it is enabled and within
174 specified start/end time";
179 ct:complex-type ResourcePool {
180 ct:extends ResourceCollection;
183 "Describes an instance of an active ResourcePool record, which
184 represents total available capacity and elements from a given
188 type instance-identifier {
189 ct:instance-type nfvi:ResourceContainer;
190 require-instance true;
196 // following 'must' statement applies to each element
197 // NOTE: just a non-working example for now...
198 must "boolean(/source/elements/*[@id=id])" {
199 error-message "One or more of the ResourceElement(s) does not exist in
200 the provider to be reserved";
205 ct:complex-type ResourceReservation {
206 ct:extends ResourceCollection;
209 "Describes an instance of an accepted resource reservation request,
210 created usually as a result of 'create-reservation' request.
212 A ResourceReservation is a derived instance of a generic
213 ResourceCollection which has additional parameters to map the
214 pool(s) that were referenced to accept this reservation as well
215 as to track allocations made referencing this reservation.
217 Contains the capacities of various resource attributes being
218 reserved along with any resource elements that are needed to be
219 available at the time of allocation(s).";
221 reference "OPNFV-PROMISE, Section 3.4.1";
223 leaf created-on { type yang:date-and-time; config false; }
224 leaf modified-on { type yang:date-and-time; config false; }
229 "Provides list of one or more pools that were referenced for providing
230 the requested resources for this reservation. This is an
231 important parameter for informing how/where allocation
232 requests can be issued using this reservation since it is
233 likely that the total reserved resource capacity/elements are
234 made availble from multiple sources.";
235 type instance-identifier {
236 ct:instance-type ResourcePool;
237 require-instance true;
241 container remaining {
244 "Provides visibility into total remaining capacity for this
245 reservation based on allocations that took effect utilizing
246 this reservation ID as a reference.";
248 uses nfvi:resource-capacity;
251 leaf-list allocations {
254 "Reference to a collection of consumed allocations referencing
256 type instance-identifier {
257 ct:instance-type ResourceAllocation;
258 require-instance true;
263 ct:complex-type ResourceAllocation {
264 ct:extends ResourceCollection;
267 "A ResourceAllocation record denotes consumption of resources from a
268 referenced ResourcePool.
270 It does not reflect an accepted request but is created to
271 represent the actual state about the ResourcePool. It is
272 created once the allocation(s) have successfully taken effect
273 on the 'source' of the ResourcePool.
275 The 'priority' state indicates the classification for dealing
276 with resource starvation scenarios. Lower priority allocations
277 will be forcefully terminated to allow for higher priority
278 allocations to be fulfilled.
280 Allocations without reference to an existing reservation will
281 receive the lowest priority.";
283 reference "OPNFV-PROMISE, Section 3.4.3";
286 description "Reference to an existing reservation identifier (optional)";
288 type instance-identifier {
289 ct:instance-type ResourceReservation;
290 require-instance true;
295 description "Reference to an existing resource pool from which allocation is drawn";
297 type instance-identifier {
298 ct:instance-type ResourcePool;
299 require-instance true;
303 container instance-ref {
306 "Reference to actual instance identifier of the provider/server
307 for this allocation";
309 type instance-identifier { ct:instance-type ResourceProvider; }
311 leaf server { type yang:uuid; }
317 "Reflects current priority level of the allocation according to
318 classification rules";
320 enum "high" { value 1; }
321 enum "normal" { value 2; }
322 enum "low" { value 3; }
328 ct:complex-type ResourceProvider {
329 ct:extends nfvi:ResourceContainer;
332 leaf token { type string; mandatory true; }
334 container services { // read-only
337 leaf endpoint { type inet:uri; }
338 ct:instance-list flavors { ct:instance-type nfvi:ComputeFlavor; }
345 "Provides list of one or more pools that are referencing this provider.";
347 type instance-identifier {
348 ct:instance-type ResourcePool;
349 require-instance true;
357 uses resource-utilization {
358 description "Describes current state info about capacity utilization info";
360 augment "capacity/total" { uses nfvi:resource-capacity; }
361 augment "capacity/reserved" { uses nfvi:resource-capacity; }
362 augment "capacity/usage" { uses nfvi:resource-capacity; }
363 augment "capacity/available" { uses nfvi:resource-capacity; }
366 ct:instance-list providers {
367 if-feature multi-provider;
368 description "Aggregate collection of all registered ResourceProvider instances
369 for Promise resource management service";
370 ct:instance-type ResourceProvider;
373 ct:instance-list pools {
374 if-feature reservation-service;
375 description "Aggregate collection of all ResourcePool instances";
376 ct:instance-type ResourcePool;
379 ct:instance-list reservations {
380 if-feature reservation-service;
381 description "Aggregate collection of all ResourceReservation instances";
382 ct:instance-type ResourceReservation;
385 ct:instance-list allocations {
386 description "Aggregate collection of all ResourceAllocation instances";
387 ct:instance-type ResourceAllocation;
391 container reservation {
392 leaf max-future-start-range {
394 "Enforce reservation request 'start' time is within allowed range from now";
395 type uint16 { range 0..365; }
398 leaf max-future-end-range {
400 "Enforce reservation request 'end' time is within allowed range from now";
401 type uint16 { range 0..365; }
406 "Enforce reservation duration (end-start) does not exceed specified threshold";
409 default 8760; // for now cap it at max one year as default
413 "Duration in minutes from start when unallocated reserved resources
414 will be released back into the pool";
422 //-------------------
424 //-------------------
426 // RESERVATION INTENTS
427 rpc create-reservation {
428 if-feature reservation-service;
429 description "Make a request to the reservation system to reserve resources";
431 uses resource-usage-request;
434 uses common-intent-output;
435 leaf reservation-id {
436 type instance-identifier { ct:instance-type ResourceReservation; }
441 rpc update-reservation {
442 description "Update reservation details for an existing reservation";
444 leaf reservation-id {
445 type instance-identifier {
446 ct:instance-type ResourceReservation;
447 require-instance true;
451 uses resource-usage-request;
454 uses common-intent-output;
458 rpc cancel-reservation {
459 description "Cancel the reservation and be a good steward";
461 leaf reservation-id {
462 type instance-identifier { ct:instance-type ResourceReservation; }
467 uses common-intent-output;
471 rpc query-reservation {
472 if-feature reservation-service;
473 description "Query the reservation system to return matching reservation(s)";
475 leaf zone { type instance-identifier { ct:instance-type nfvi:AvailabilityZone; } }
476 uses query-resource-collection;
479 leaf-list reservations { type instance-identifier
480 { ct:instance-type ResourceReservation; } }
481 uses utilization-output;
486 rpc increase-capacity {
487 description "Increase total capacity for the reservation system
488 between a window in time";
490 uses temporal-resource-collection;
492 type instance-identifier {
493 ct:instance-type nfvi:ResourceContainer;
498 uses common-intent-output;
500 type instance-identifier { ct:instance-type ResourcePool; }
505 rpc decrease-capacity {
506 description "Decrease total capacity for the reservation system
507 between a window in time";
509 uses temporal-resource-collection;
511 type instance-identifier {
512 ct:instance-type nfvi:ResourceContainer;
517 uses common-intent-output;
519 type instance-identifier { ct:instance-type ResourcePool; }
525 description "Check available capacity information about a specified
526 resource collection";
537 leaf zone { type instance-identifier { ct:instance-type nfvi:AvailabilityZone; } }
538 uses query-resource-collection;
539 // TBD: additional parameters for query-capacity
542 leaf-list collections { type instance-identifier
543 { ct:instance-type ResourceCollection; } }
544 uses utilization-output;
548 // ALLOCATION INTENTS (should go into VIM module in the future)
549 rpc create-instance {
550 description "Create an instance of specified resource(s) utilizing capacity
554 if-feature multi-provider;
555 type instance-identifier { ct:instance-type ResourceProvider;
556 require-instance true; }
558 leaf name { type string; mandatory true; }
573 // TODO: consider supporting a template-id (such as HEAT) for more complex instantiation
575 leaf reservation-id {
576 type instance-identifier { ct:instance-type ResourceReservation;
577 require-instance true; }
581 uses common-intent-output;
583 type instance-identifier { ct:instance-type ResourceAllocation; }
588 rpc destroy-instance {
589 description "Destroy an instance of resource utilization and release it
593 type instance-identifier { ct:instance-type ResourceAllocation;
594 require-instance true; }
598 uses common-intent-output;
602 // PROVIDER INTENTS (should go into VIM module in the future)
604 description "Register a new resource provider into reservation system";
607 description "Select a specific resource provider type";
625 uses mano:provider-credentials {
627 default "http://localhost:5000/v2.0/tokens";
631 leaf id { type string; }
632 leaf name { type string; }
636 uses common-intent-output;
638 type instance-identifier { ct:instance-type ResourceProvider; }
644 notification reservation-event;
645 notification capacity-event;
646 notification allocation-event;