1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
6 ANNEX B: Promise YANG schema based on YangForge
7 ===============================================
11 module opnfv-promise {
12 namespace "urn:opnfv:promise";
15 import complex-types { prefix ct; }
16 import ietf-yang-types { prefix yang; }
17 import ietf-inet-types { prefix inet; }
18 import access-control-models { prefix acm; }
19 import nfv-infrastructure { prefix nfvi; }
20 import nfv-mano { prefix mano; }
23 "OPNFV Promise Resource Reservation/Allocation controller module";
26 description "Complete coverage of reservation related intents";
30 description "Updated to incorporate YangForge framework";
34 description "Initial revision.";
37 feature reservation-service {
38 description "When enabled, provides resource reservation service";
41 feature multi-provider {
42 description "When enabled, provides resource management across multiple providers";
45 typedef reference-identifier {
46 description "defines valid formats for external reference id";
54 grouping resource-utilization {
56 container total { description 'Conceptual container that should be extended'; }
57 container reserved { description 'Conceptual container that should be extended';
59 container usage { description 'Conceptual container that should be extended';
61 container available { description 'Conceptual container that should be extended';
66 grouping temporal-resource-collection {
68 "Information model capturing resource-collection with start/end time window";
70 leaf start { type yang:date-and-time; }
71 leaf end { type yang:date-and-time; }
73 uses nfvi:resource-collection;
76 grouping resource-usage-request {
78 "Information model capturing available parameters to make a resource
80 reference "OPNFV-PROMISE, Section 3.4.1";
82 uses temporal-resource-collection {
85 "Reference to a list of 'pre-existing' resource elements that are
86 required for fulfillment of the resource-usage-request.
88 It can contain any instance derived from ResourceElement,
89 such as ServerInstances or even other
90 ResourceReservations. If the resource-usage-request is
91 accepted, the ResourceElement(s) listed here will be placed
92 into 'protected' mode as to prevent accidental removal.
94 If any of these resource elements become 'unavailable' due to
95 environmental or administrative activity, a notification will
96 be issued informing of the issue.";
101 description "Optional identifier to an Availability Zone";
102 type instance-identifier { ct:instance-type nfvi:AvailabilityZone; }
106 grouping query-start-end-window {
108 description "Matches entries that are within the specified start/end time window";
109 leaf start { type yang:date-and-time; }
110 leaf end { type yang:date-and-time; }
114 description "Matches entries that start AND end within the window";
117 description "Matches entries that start OR end within the window";
125 grouping query-resource-collection {
126 uses query-start-end-window {
127 description "Match for ResourceCollection(s) that are within the specified
128 start/end time window";
131 description "Excludes specified collection identifiers from the result";
132 type instance-identifier { ct:instance-type ResourceCollection; }
134 leaf show-utilization { type boolean; default true; }
137 description "Query for ResourceCollection(s) that contain some or more of
139 type instance-identifier { ct:instance-type nfvi:ResourceElement; }
142 description "Query for ResourceCollection(s) that contain all of
144 type instance-identifier { ct:instance-type nfvi:ResourceElement; }
149 grouping common-intent-output {
157 leaf message { type string; }
160 grouping utilization-output {
163 leaf timestamp { type yang:date-and-time; }
164 leaf count { type int16; }
165 container capacity { uses nfvi:resource-capacity; }
169 ct:complex-type ResourceCollection {
170 ct:extends nfvi:ResourceContainer;
174 "Describes an abstract ResourceCollection data model, which represents
175 a grouping of capacity and elements available during a given
176 window in time which must be extended by other resource
177 collection related models";
179 leaf start { type yang:date-and-time; }
180 leaf end { type yang:date-and-time; }
185 "Provides current state of this record whether it is enabled and within
186 specified start/end time";
191 ct:complex-type ResourcePool {
192 ct:extends ResourceCollection;
195 "Describes an instance of an active ResourcePool record, which
196 represents total available capacity and elements from a given
200 type instance-identifier {
201 ct:instance-type nfvi:ResourceContainer;
202 require-instance true;
208 // following 'must' statement applies to each element
209 // NOTE: just a non-working example for now...
210 must "boolean(/source/elements/*[@id=id])" {
211 error-message "One or more of the ResourceElement(s) does not exist in
212 the provider to be reserved";
217 ct:complex-type ResourceReservation {
218 ct:extends ResourceCollection;
221 "Describes an instance of an accepted resource reservation request,
222 created usually as a result of 'create-reservation' request.
224 A ResourceReservation is a derived instance of a generic
225 ResourceCollection which has additional parameters to map the
226 pool(s) that were referenced to accept this reservation as well
227 as to track allocations made referencing this reservation.
229 Contains the capacities of various resource attributes being
230 reserved along with any resource elements that are needed to be
231 available at the time of allocation(s).";
233 reference "OPNFV-PROMISE, Section 3.4.1";
235 leaf created-on { type yang:date-and-time; config false; }
236 leaf modified-on { type yang:date-and-time; config false; }
241 "Provides list of one or more pools that were referenced for providing
242 the requested resources for this reservation. This is an
243 important parameter for informing how/where allocation
244 requests can be issued using this reservation since it is
245 likely that the total reserved resource capacity/elements are
246 made availble from multiple sources.";
247 type instance-identifier {
248 ct:instance-type ResourcePool;
249 require-instance true;
253 container remaining {
256 "Provides visibility into total remaining capacity for this
257 reservation based on allocations that took effect utilizing
258 this reservation ID as a reference.";
260 uses nfvi:resource-capacity;
263 leaf-list allocations {
266 "Reference to a collection of consumed allocations referencing
268 type instance-identifier {
269 ct:instance-type ResourceAllocation;
270 require-instance true;
275 ct:complex-type ResourceAllocation {
276 ct:extends ResourceCollection;
279 "A ResourceAllocation record denotes consumption of resources from a
280 referenced ResourcePool.
282 It does not reflect an accepted request but is created to
283 represent the actual state about the ResourcePool. It is
284 created once the allocation(s) have successfully taken effect
285 on the 'source' of the ResourcePool.
287 The 'priority' state indicates the classification for dealing
288 with resource starvation scenarios. Lower priority allocations
289 will be forcefully terminated to allow for higher priority
290 allocations to be fulfilled.
292 Allocations without reference to an existing reservation will
293 receive the lowest priority.";
295 reference "OPNFV-PROMISE, Section 3.4.3";
298 description "Reference to an existing reservation identifier (optional)";
300 type instance-identifier {
301 ct:instance-type ResourceReservation;
302 require-instance true;
307 description "Reference to an existing resource pool from which allocation is drawn";
309 type instance-identifier {
310 ct:instance-type ResourcePool;
311 require-instance true;
315 container instance-ref {
318 "Reference to actual instance identifier of the provider/server
319 for this allocation";
321 type instance-identifier { ct:instance-type ResourceProvider; }
323 leaf server { type yang:uuid; }
329 "Reflects current priority level of the allocation according to
330 classification rules";
332 enum "high" { value 1; }
333 enum "normal" { value 2; }
334 enum "low" { value 3; }
340 ct:complex-type ResourceProvider {
341 ct:extends nfvi:ResourceContainer;
344 leaf token { type string; mandatory true; }
346 container services { // read-only
349 leaf endpoint { type inet:uri; }
350 ct:instance-list flavors { ct:instance-type nfvi:ComputeFlavor; }
357 "Provides list of one or more pools that are referencing this provider.";
359 type instance-identifier {
360 ct:instance-type ResourcePool;
361 require-instance true;
369 uses resource-utilization {
370 description "Describes current state info about capacity utilization info";
372 augment "capacity/total" { uses nfvi:resource-capacity; }
373 augment "capacity/reserved" { uses nfvi:resource-capacity; }
374 augment "capacity/usage" { uses nfvi:resource-capacity; }
375 augment "capacity/available" { uses nfvi:resource-capacity; }
378 ct:instance-list providers {
379 if-feature multi-provider;
380 description "Aggregate collection of all registered ResourceProvider instances
381 for Promise resource management service";
382 ct:instance-type ResourceProvider;
385 ct:instance-list pools {
386 if-feature reservation-service;
387 description "Aggregate collection of all ResourcePool instances";
388 ct:instance-type ResourcePool;
391 ct:instance-list reservations {
392 if-feature reservation-service;
393 description "Aggregate collection of all ResourceReservation instances";
394 ct:instance-type ResourceReservation;
397 ct:instance-list allocations {
398 description "Aggregate collection of all ResourceAllocation instances";
399 ct:instance-type ResourceAllocation;
403 container reservation {
404 leaf max-future-start-range {
406 "Enforce reservation request 'start' time is within allowed range from now";
407 type uint16 { range 0..365; }
410 leaf max-future-end-range {
412 "Enforce reservation request 'end' time is within allowed range from now";
413 type uint16 { range 0..365; }
418 "Enforce reservation duration (end-start) does not exceed specified threshold";
421 default 8760; // for now cap it at max one year as default
425 "Duration in minutes from start when unallocated reserved resources
426 will be released back into the pool";
434 //-------------------
436 //-------------------
438 // RESERVATION INTENTS
439 rpc create-reservation {
440 if-feature reservation-service;
441 description "Make a request to the reservation system to reserve resources";
443 uses resource-usage-request;
446 uses common-intent-output;
447 leaf reservation-id {
448 type instance-identifier { ct:instance-type ResourceReservation; }
453 rpc update-reservation {
454 description "Update reservation details for an existing reservation";
456 leaf reservation-id {
457 type instance-identifier {
458 ct:instance-type ResourceReservation;
459 require-instance true;
463 uses resource-usage-request;
466 uses common-intent-output;
470 rpc cancel-reservation {
471 description "Cancel the reservation and be a good steward";
473 leaf reservation-id {
474 type instance-identifier { ct:instance-type ResourceReservation; }
479 uses common-intent-output;
483 rpc query-reservation {
484 if-feature reservation-service;
485 description "Query the reservation system to return matching reservation(s)";
487 leaf zone { type instance-identifier { ct:instance-type nfvi:AvailabilityZone; } }
488 uses query-resource-collection;
491 leaf-list reservations { type instance-identifier
492 { ct:instance-type ResourceReservation; } }
493 uses utilization-output;
498 rpc increase-capacity {
499 description "Increase total capacity for the reservation system
500 between a window in time";
502 uses temporal-resource-collection;
504 type instance-identifier {
505 ct:instance-type nfvi:ResourceContainer;
510 uses common-intent-output;
512 type instance-identifier { ct:instance-type ResourcePool; }
517 rpc decrease-capacity {
518 description "Decrease total capacity for the reservation system
519 between a window in time";
521 uses temporal-resource-collection;
523 type instance-identifier {
524 ct:instance-type nfvi:ResourceContainer;
529 uses common-intent-output;
531 type instance-identifier { ct:instance-type ResourcePool; }
537 description "Check available capacity information about a specified
538 resource collection";
549 leaf zone { type instance-identifier { ct:instance-type nfvi:AvailabilityZone; } }
550 uses query-resource-collection;
551 // TBD: additional parameters for query-capacity
554 leaf-list collections { type instance-identifier
555 { ct:instance-type ResourceCollection; } }
556 uses utilization-output;
560 // ALLOCATION INTENTS (should go into VIM module in the future)
561 rpc create-instance {
562 description "Create an instance of specified resource(s) utilizing capacity
566 if-feature multi-provider;
567 type instance-identifier { ct:instance-type ResourceProvider;
568 require-instance true; }
570 leaf name { type string; mandatory true; }
572 type reference-identifier;
576 type reference-identifier;
580 type reference-identifier;
581 description "optional, will assign default network if not provided";
584 // TODO: consider supporting a template-id (such as HEAT) for more complex instantiation
586 leaf reservation-id {
587 type instance-identifier { ct:instance-type ResourceReservation;
588 require-instance true; }
592 uses common-intent-output;
594 type instance-identifier { ct:instance-type ResourceAllocation; }
599 rpc destroy-instance {
600 description "Destroy an instance of resource utilization and release it
604 type instance-identifier { ct:instance-type ResourceAllocation;
605 require-instance true; }
609 uses common-intent-output;
613 // PROVIDER INTENTS (should go into VIM module in the future)
615 description "Register a new resource provider into reservation system";
618 description "Select a specific resource provider type";
636 uses mano:provider-credentials {
638 default "http://localhost:5000/v2.0/tokens";
642 leaf id { type string; }
643 leaf name { type string; }
647 uses common-intent-output;
649 type instance-identifier { ct:instance-type ResourceProvider; }
655 notification reservation-event;
656 notification capacity-event;
657 notification allocation-event;