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 typedef reference-identifier {
43 description "defines valid formats for external reference id";
51 grouping resource-utilization {
53 container total { description 'Conceptual container that should be extended'; }
54 container reserved { description 'Conceptual container that should be extended';
56 container usage { description 'Conceptual container that should be extended';
58 container available { description 'Conceptual container that should be extended';
63 grouping temporal-resource-collection {
65 "Information model capturing resource-collection with start/end time window";
67 leaf start { type yang:date-and-time; }
68 leaf end { type yang:date-and-time; }
70 uses nfvi:resource-collection;
73 grouping resource-usage-request {
75 "Information model capturing available parameters to make a resource
77 reference "OPNFV-PROMISE, Section 3.4.1";
79 uses temporal-resource-collection {
82 "Reference to a list of 'pre-existing' resource elements that are
83 required for fulfillment of the resource-usage-request.
85 It can contain any instance derived from ResourceElement,
86 such as ServerInstances or even other
87 ResourceReservations. If the resource-usage-request is
88 accepted, the ResourceElement(s) listed here will be placed
89 into 'protected' mode as to prevent accidental removal.
91 If any of these resource elements become 'unavailable' due to
92 environmental or administrative activity, a notification will
93 be issued informing of the issue.";
98 description "Optional identifier to an Availability Zone";
99 type instance-identifier { ct:instance-type nfvi:AvailabilityZone; }
103 grouping query-start-end-window {
105 description "Matches entries that are within the specified start/end time window";
106 leaf start { type yang:date-and-time; }
107 leaf end { type yang:date-and-time; }
111 description "Matches entries that start AND end within the window";
114 description "Matches entries that start OR end within the window";
122 grouping query-resource-collection {
123 uses query-start-end-window {
124 description "Match for ResourceCollection(s) that are within the specified
125 start/end time window";
128 description "Excludes specified collection identifiers from the result";
129 type instance-identifier { ct:instance-type ResourceCollection; }
131 leaf show-utilization { type boolean; default true; }
134 description "Query for ResourceCollection(s) that contain some or more of
136 type instance-identifier { ct:instance-type nfvi:ResourceElement; }
139 description "Query for ResourceCollection(s) that contain all of
141 type instance-identifier { ct:instance-type nfvi:ResourceElement; }
146 grouping common-intent-output {
154 leaf message { type string; }
157 grouping utilization-output {
160 leaf timestamp { type yang:date-and-time; }
161 leaf count { type int16; }
162 container capacity { uses nfvi:resource-capacity; }
166 ct:complex-type ResourceCollection {
167 ct:extends nfvi:ResourceContainer;
171 "Describes an abstract ResourceCollection data model, which represents
172 a grouping of capacity and elements available during a given
173 window in time which must be extended by other resource
174 collection related models";
176 leaf start { type yang:date-and-time; }
177 leaf end { type yang:date-and-time; }
182 "Provides current state of this record whether it is enabled and within
183 specified start/end time";
188 ct:complex-type ResourcePool {
189 ct:extends ResourceCollection;
192 "Describes an instance of an active ResourcePool record, which
193 represents total available capacity and elements from a given
197 type instance-identifier {
198 ct:instance-type nfvi:ResourceContainer;
199 require-instance true;
205 // following 'must' statement applies to each element
206 // NOTE: just a non-working example for now...
207 must "boolean(/source/elements/*[@id=id])" {
208 error-message "One or more of the ResourceElement(s) does not exist in
209 the provider to be reserved";
214 ct:complex-type ResourceReservation {
215 ct:extends ResourceCollection;
218 "Describes an instance of an accepted resource reservation request,
219 created usually as a result of 'create-reservation' request.
221 A ResourceReservation is a derived instance of a generic
222 ResourceCollection which has additional parameters to map the
223 pool(s) that were referenced to accept this reservation as well
224 as to track allocations made referencing this reservation.
226 Contains the capacities of various resource attributes being
227 reserved along with any resource elements that are needed to be
228 available at the time of allocation(s).";
230 reference "OPNFV-PROMISE, Section 3.4.1";
232 leaf created-on { type yang:date-and-time; config false; }
233 leaf modified-on { type yang:date-and-time; config false; }
238 "Provides list of one or more pools that were referenced for providing
239 the requested resources for this reservation. This is an
240 important parameter for informing how/where allocation
241 requests can be issued using this reservation since it is
242 likely that the total reserved resource capacity/elements are
243 made availble from multiple sources.";
244 type instance-identifier {
245 ct:instance-type ResourcePool;
246 require-instance true;
250 container remaining {
253 "Provides visibility into total remaining capacity for this
254 reservation based on allocations that took effect utilizing
255 this reservation ID as a reference.";
257 uses nfvi:resource-capacity;
260 leaf-list allocations {
263 "Reference to a collection of consumed allocations referencing
265 type instance-identifier {
266 ct:instance-type ResourceAllocation;
267 require-instance true;
272 ct:complex-type ResourceAllocation {
273 ct:extends ResourceCollection;
276 "A ResourceAllocation record denotes consumption of resources from a
277 referenced ResourcePool.
279 It does not reflect an accepted request but is created to
280 represent the actual state about the ResourcePool. It is
281 created once the allocation(s) have successfully taken effect
282 on the 'source' of the ResourcePool.
284 The 'priority' state indicates the classification for dealing
285 with resource starvation scenarios. Lower priority allocations
286 will be forcefully terminated to allow for higher priority
287 allocations to be fulfilled.
289 Allocations without reference to an existing reservation will
290 receive the lowest priority.";
292 reference "OPNFV-PROMISE, Section 3.4.3";
295 description "Reference to an existing reservation identifier (optional)";
297 type instance-identifier {
298 ct:instance-type ResourceReservation;
299 require-instance true;
304 description "Reference to an existing resource pool from which allocation is drawn";
306 type instance-identifier {
307 ct:instance-type ResourcePool;
308 require-instance true;
312 container instance-ref {
315 "Reference to actual instance identifier of the provider/server
316 for this allocation";
318 type instance-identifier { ct:instance-type ResourceProvider; }
320 leaf server { type yang:uuid; }
326 "Reflects current priority level of the allocation according to
327 classification rules";
329 enum "high" { value 1; }
330 enum "normal" { value 2; }
331 enum "low" { value 3; }
337 ct:complex-type ResourceProvider {
338 ct:extends nfvi:ResourceContainer;
341 leaf token { type string; mandatory true; }
343 container services { // read-only
346 leaf endpoint { type inet:uri; }
347 ct:instance-list flavors { ct:instance-type nfvi:ComputeFlavor; }
354 "Provides list of one or more pools that are referencing this provider.";
356 type instance-identifier {
357 ct:instance-type ResourcePool;
358 require-instance true;
366 uses resource-utilization {
367 description "Describes current state info about capacity utilization info";
369 augment "capacity/total" { uses nfvi:resource-capacity; }
370 augment "capacity/reserved" { uses nfvi:resource-capacity; }
371 augment "capacity/usage" { uses nfvi:resource-capacity; }
372 augment "capacity/available" { uses nfvi:resource-capacity; }
375 ct:instance-list providers {
376 if-feature multi-provider;
377 description "Aggregate collection of all registered ResourceProvider instances
378 for Promise resource management service";
379 ct:instance-type ResourceProvider;
382 ct:instance-list pools {
383 if-feature reservation-service;
384 description "Aggregate collection of all ResourcePool instances";
385 ct:instance-type ResourcePool;
388 ct:instance-list reservations {
389 if-feature reservation-service;
390 description "Aggregate collection of all ResourceReservation instances";
391 ct:instance-type ResourceReservation;
394 ct:instance-list allocations {
395 description "Aggregate collection of all ResourceAllocation instances";
396 ct:instance-type ResourceAllocation;
400 container reservation {
401 leaf max-future-start-range {
403 "Enforce reservation request 'start' time is within allowed range from now";
404 type uint16 { range 0..365; }
407 leaf max-future-end-range {
409 "Enforce reservation request 'end' time is within allowed range from now";
410 type uint16 { range 0..365; }
415 "Enforce reservation duration (end-start) does not exceed specified threshold";
418 default 8760; // for now cap it at max one year as default
422 "Duration in minutes from start when unallocated reserved resources
423 will be released back into the pool";
431 //-------------------
433 //-------------------
435 // RESERVATION INTENTS
436 rpc create-reservation {
437 if-feature reservation-service;
438 description "Make a request to the reservation system to reserve resources";
440 uses resource-usage-request;
443 uses common-intent-output;
444 leaf reservation-id {
445 type instance-identifier { ct:instance-type ResourceReservation; }
450 rpc update-reservation {
451 description "Update reservation details for an existing reservation";
453 leaf reservation-id {
454 type instance-identifier {
455 ct:instance-type ResourceReservation;
456 require-instance true;
460 uses resource-usage-request;
463 uses common-intent-output;
467 rpc cancel-reservation {
468 description "Cancel the reservation and be a good steward";
470 leaf reservation-id {
471 type instance-identifier { ct:instance-type ResourceReservation; }
476 uses common-intent-output;
480 rpc query-reservation {
481 if-feature reservation-service;
482 description "Query the reservation system to return matching reservation(s)";
484 leaf zone { type instance-identifier { ct:instance-type nfvi:AvailabilityZone; } }
485 uses query-resource-collection;
488 leaf-list reservations { type instance-identifier
489 { ct:instance-type ResourceReservation; } }
490 uses utilization-output;
495 rpc increase-capacity {
496 description "Increase total capacity for the reservation system
497 between a window in time";
499 uses temporal-resource-collection;
501 type instance-identifier {
502 ct:instance-type nfvi:ResourceContainer;
507 uses common-intent-output;
509 type instance-identifier { ct:instance-type ResourcePool; }
514 rpc decrease-capacity {
515 description "Decrease total capacity for the reservation system
516 between a window in time";
518 uses temporal-resource-collection;
520 type instance-identifier {
521 ct:instance-type nfvi:ResourceContainer;
526 uses common-intent-output;
528 type instance-identifier { ct:instance-type ResourcePool; }
534 description "Check available capacity information about a specified
535 resource collection";
546 leaf zone { type instance-identifier { ct:instance-type nfvi:AvailabilityZone; } }
547 uses query-resource-collection;
548 // TBD: additional parameters for query-capacity
551 leaf-list collections { type instance-identifier
552 { ct:instance-type ResourceCollection; } }
553 uses utilization-output;
557 // ALLOCATION INTENTS (should go into VIM module in the future)
558 rpc create-instance {
559 description "Create an instance of specified resource(s) utilizing capacity
563 if-feature multi-provider;
564 type instance-identifier { ct:instance-type ResourceProvider;
565 require-instance true; }
567 leaf name { type string; mandatory true; }
569 type reference-identifier;
573 type reference-identifier;
577 type reference-identifier;
578 description "optional, will assign default network if not provided";
581 // TODO: consider supporting a template-id (such as HEAT) for more complex instantiation
583 leaf reservation-id {
584 type instance-identifier { ct:instance-type ResourceReservation;
585 require-instance true; }
589 uses common-intent-output;
591 type instance-identifier { ct:instance-type ResourceAllocation; }
596 rpc destroy-instance {
597 description "Destroy an instance of resource utilization and release it
601 type instance-identifier { ct:instance-type ResourceAllocation;
602 require-instance true; }
606 uses common-intent-output;
610 // PROVIDER INTENTS (should go into VIM module in the future)
612 description "Register a new resource provider into reservation system";
615 description "Select a specific resource provider type";
633 uses mano:provider-credentials {
635 default "http://localhost:5000/v2.0/tokens";
639 leaf id { type string; }
640 leaf name { type string; }
644 uses common-intent-output;
646 type instance-identifier { ct:instance-type ResourceProvider; }
652 notification reservation-event;
653 notification capacity-event;
654 notification allocation-event;