1 ANNEX B: Promise YANG schema based on YangForge
2 ===============================================
7 namespace "urn:opnfv:promise";
10 import complex-types { prefix ct; }
11 import ietf-yang-types { prefix yang; }
12 import ietf-inet-types { prefix inet; }
13 import access-control-models { prefix acm; }
14 import nfv-infrastructure { prefix nfvi; }
15 import nfv-mano { prefix mano; }
18 "OPNFV Promise Resource Reservation/Allocation controller module";
21 description "Complete coverage of reservation related intents";
25 description "Updated to incorporate YangForge framework";
29 description "Initial revision.";
32 feature reservation-service {
33 description "When enabled, provides resource reservation service";
36 feature multi-provider {
37 description "When enabled, provides resource management across multiple providers";
40 grouping resource-utilization {
42 container total { description 'Conceptual container that should be extended'; }
43 container reserved { description 'Conceptual container that should be extended';
45 container usage { description 'Conceptual container that should be extended';
47 container available { description 'Conceptual container that should be extended';
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
114 start/end time window";
117 description "Excludes specified collection identifiers from the result";
118 type instance-identifier { ct:instance-type ResourceCollection; }
120 leaf show-utilization { type boolean; default true; }
123 description "Query for ResourceCollection(s) that contain some or more of
125 type instance-identifier { ct:instance-type nfvi:ResourceElement; }
128 description "Query for ResourceCollection(s) that contain all of
130 type instance-identifier { ct:instance-type nfvi:ResourceElement; }
135 grouping common-intent-output {
143 leaf message { type string; }
146 grouping utilization-output {
149 leaf timestamp { type yang:date-and-time; }
150 leaf count { type int16; }
151 container capacity { uses nfvi:resource-capacity; }
155 ct:complex-type ResourceCollection {
156 ct:extends nfvi:ResourceContainer;
160 "Describes an abstract ResourceCollection data model, which represents
161 a grouping of capacity and elements available during a given
162 window in time which must be extended by other resource
163 collection related models";
165 leaf start { type yang:date-and-time; }
166 leaf end { type yang:date-and-time; }
171 "Provides current state of this record whether it is enabled and within
172 specified start/end time";
177 ct:complex-type ResourcePool {
178 ct:extends ResourceCollection;
181 "Describes an instance of an active ResourcePool record, which
182 represents total available capacity and elements from a given
186 type instance-identifier {
187 ct:instance-type nfvi:ResourceContainer;
188 require-instance true;
194 // following 'must' statement applies to each element
195 // NOTE: just a non-working example for now...
196 must "boolean(/source/elements/*[@id=id])" {
197 error-message "One or more of the ResourceElement(s) does not exist in
198 the provider to be reserved";
203 ct:complex-type ResourceReservation {
204 ct:extends ResourceCollection;
207 "Describes an instance of an accepted resource reservation request,
208 created usually as a result of 'create-reservation' request.
210 A ResourceReservation is a derived instance of a generic
211 ResourceCollection which has additional parameters to map the
212 pool(s) that were referenced to accept this reservation as well
213 as to track allocations made referencing this reservation.
215 Contains the capacities of various resource attributes being
216 reserved along with any resource elements that are needed to be
217 available at the time of allocation(s).";
219 reference "OPNFV-PROMISE, Section 3.4.1";
221 leaf created-on { type yang:date-and-time; config false; }
222 leaf modified-on { type yang:date-and-time; config false; }
227 "Provides list of one or more pools that were referenced for providing
228 the requested resources for this reservation. This is an
229 important parameter for informing how/where allocation
230 requests can be issued using this reservation since it is
231 likely that the total reserved resource capacity/elements are
232 made availble from multiple sources.";
233 type instance-identifier {
234 ct:instance-type ResourcePool;
235 require-instance true;
239 container remaining {
242 "Provides visibility into total remaining capacity for this
243 reservation based on allocations that took effect utilizing
244 this reservation ID as a reference.";
246 uses nfvi:resource-capacity;
249 leaf-list allocations {
252 "Reference to a collection of consumed allocations referencing
254 type instance-identifier {
255 ct:instance-type ResourceAllocation;
256 require-instance true;
261 ct:complex-type ResourceAllocation {
262 ct:extends ResourceCollection;
265 "A ResourceAllocation record denotes consumption of resources from a
266 referenced ResourcePool.
268 It does not reflect an accepted request but is created to
269 represent the actual state about the ResourcePool. It is
270 created once the allocation(s) have successfully taken effect
271 on the 'source' of the ResourcePool.
273 The 'priority' state indicates the classification for dealing
274 with resource starvation scenarios. Lower priority allocations
275 will be forcefully terminated to allow for higher priority
276 allocations to be fulfilled.
278 Allocations without reference to an existing reservation will
279 receive the lowest priority.";
281 reference "OPNFV-PROMISE, Section 3.4.3";
284 description "Reference to an existing reservation identifier (optional)";
286 type instance-identifier {
287 ct:instance-type ResourceReservation;
288 require-instance true;
293 description "Reference to an existing resource pool from which allocation is drawn";
295 type instance-identifier {
296 ct:instance-type ResourcePool;
297 require-instance true;
301 container instance-ref {
304 "Reference to actual instance identifier of the provider/server
305 for this allocation";
307 type instance-identifier { ct:instance-type ResourceProvider; }
309 leaf server { type yang:uuid; }
315 "Reflects current priority level of the allocation according to
316 classification rules";
318 enum "high" { value 1; }
319 enum "normal" { value 2; }
320 enum "low" { value 3; }
326 ct:complex-type ResourceProvider {
327 ct:extends nfvi:ResourceContainer;
330 leaf token { type string; mandatory true; }
332 container services { // read-only
335 leaf endpoint { type inet:uri; }
336 ct:instance-list flavors { ct:instance-type nfvi:ComputeFlavor; }
343 "Provides list of one or more pools that are referencing this provider.";
345 type instance-identifier {
346 ct:instance-type ResourcePool;
347 require-instance true;
355 uses resource-utilization {
356 description "Describes current state info about capacity utilization info";
358 augment "capacity/total" { uses nfvi:resource-capacity; }
359 augment "capacity/reserved" { uses nfvi:resource-capacity; }
360 augment "capacity/usage" { uses nfvi:resource-capacity; }
361 augment "capacity/available" { uses nfvi:resource-capacity; }
364 ct:instance-list providers {
365 if-feature multi-provider;
366 description "Aggregate collection of all registered ResourceProvider instances
367 for Promise resource management service";
368 ct:instance-type ResourceProvider;
371 ct:instance-list pools {
372 if-feature reservation-service;
373 description "Aggregate collection of all ResourcePool instances";
374 ct:instance-type ResourcePool;
377 ct:instance-list reservations {
378 if-feature reservation-service;
379 description "Aggregate collection of all ResourceReservation instances";
380 ct:instance-type ResourceReservation;
383 ct:instance-list allocations {
384 description "Aggregate collection of all ResourceAllocation instances";
385 ct:instance-type ResourceAllocation;
389 container reservation {
390 leaf max-future-start-range {
392 "Enforce reservation request 'start' time is within allowed range from now";
393 type uint16 { range 0..365; }
396 leaf max-future-end-range {
398 "Enforce reservation request 'end' time is within allowed range from now";
399 type uint16 { range 0..365; }
404 "Enforce reservation duration (end-start) does not exceed specified threshold";
407 default 8760; // for now cap it at max one year as default
411 "Duration in minutes from start when unallocated reserved resources
412 will be released back into the pool";
420 //-------------------
422 //-------------------
424 // RESERVATION INTENTS
425 rpc create-reservation {
426 if-feature reservation-service;
427 description "Make a request to the reservation system to reserve resources";
429 uses resource-usage-request;
432 uses common-intent-output;
433 leaf reservation-id {
434 type instance-identifier { ct:instance-type ResourceReservation; }
439 rpc update-reservation {
440 description "Update reservation details for an existing reservation";
442 leaf reservation-id {
443 type instance-identifier {
444 ct:instance-type ResourceReservation;
445 require-instance true;
449 uses resource-usage-request;
452 uses common-intent-output;
456 rpc cancel-reservation {
457 description "Cancel the reservation and be a good steward";
459 leaf reservation-id {
460 type instance-identifier { ct:instance-type ResourceReservation; }
465 uses common-intent-output;
469 rpc query-reservation {
470 if-feature reservation-service;
471 description "Query the reservation system to return matching reservation(s)";
473 leaf zone { type instance-identifier { ct:instance-type nfvi:AvailabilityZone; } }
474 uses query-resource-collection;
477 leaf-list reservations { type instance-identifier
478 { ct:instance-type ResourceReservation; } }
479 uses utilization-output;
484 rpc increase-capacity {
485 description "Increase total capacity for the reservation system
486 between a window in time";
488 uses temporal-resource-collection;
490 type instance-identifier {
491 ct:instance-type nfvi:ResourceContainer;
496 uses common-intent-output;
498 type instance-identifier { ct:instance-type ResourcePool; }
503 rpc decrease-capacity {
504 description "Decrease total capacity for the reservation system
505 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
524 resource collection";
535 leaf zone { type instance-identifier { ct:instance-type nfvi:AvailabilityZone; } }
536 uses query-resource-collection;
537 // TBD: additional parameters for query-capacity
540 leaf-list collections { type instance-identifier
541 { ct:instance-type ResourceCollection; } }
542 uses utilization-output;
546 // ALLOCATION INTENTS (should go into VIM module in the future)
547 rpc create-instance {
548 description "Create an instance of specified resource(s) utilizing capacity
552 if-feature multi-provider;
553 type instance-identifier { ct:instance-type ResourceProvider;
554 require-instance true; }
556 leaf name { type string; mandatory true; }
571 // TODO: consider supporting a template-id (such as HEAT) for more complex instantiation
573 leaf reservation-id {
574 type instance-identifier { ct:instance-type ResourceReservation;
575 require-instance true; }
579 uses common-intent-output;
581 type instance-identifier { ct:instance-type ResourceAllocation; }
586 rpc destroy-instance {
587 description "Destroy an instance of resource utilization and release it
591 type instance-identifier { ct:instance-type ResourceAllocation;
592 require-instance true; }
596 uses common-intent-output;
600 // PROVIDER INTENTS (should go into VIM module in the future)
602 description "Register a new resource provider into reservation system";
605 description "Select a specific resource provider type";
623 uses mano:provider-credentials {
625 default "http://localhost:5000/v2.0/tokens";
629 leaf id { type string; }
630 leaf name { type string; }
634 uses common-intent-output;
636 type instance-identifier { ct:instance-type ResourceProvider; }
642 notification reservation-event;
643 notification capacity-event;
644 notification allocation-event;