157e45a5365dfebf026c00d3ae65f281bc97206f
[genius.git] / resourcemanager / resourcemanager-api / src / main / yang / resource-manager.yang
1 module resource-manager {
2     namespace "urn:opendaylight:genius:resourcemanager";
3     prefix resourcemgr;
4
5     import id-manager {
6         prefix idmgr;
7     }
8
9     revision "2016-06-22" {
10         description "YANG model exposes RPCs that can be used by the applications for allocating a block of IDs for tables, groups, meters, etc. This yang-model enables ODL Resource Sharing Framework";
11     }
12
13
14     identity resource-type-base {
15         description "Base identity for all resource-types";
16     }
17
18     identity resource-type-table-ids {
19         description "Resource type for tables";
20         base resource-type-base;
21     }
22
23     identity resource-type-group-ids {
24         description "Resource type for groups";
25         base resource-type-base;
26     }
27
28     identity resource-type-meter-ids {
29         description "Resource type for meters";
30         base resource-type-base;
31     }
32
33     rpc releaseResource {
34         input {
35              leaf resource-type {
36                 type identityref{
37                     base resource-type-base;
38                 }
39              }
40              leaf id-key {
41                 type string;
42              }
43         }
44     }
45
46     rpc allocateResource {
47         input {
48              leaf resource-type {
49                 type identityref{
50                     base resource-type-base;
51                 }
52              }
53              leaf id-key {
54                 type string;
55              }
56              leaf size {
57                 type uint32;
58              }
59         }
60         output {
61              leaf-list id-values{
62                 type uint32;
63                 ordered-by user;
64              }
65         }
66     }
67
68     rpc getAvailableResources{
69         input {
70              leaf resource-type {
71                 type identityref{
72                     base resource-type-base;
73                 }
74              }
75         }
76         output{
77              leaf total-available-id-count {
78                 type uint32;
79              }
80         }
81     }
82
83     rpc getResourcePool{
84         input{
85              leaf resource-type {
86                 type identityref{
87                     base resource-type-base;
88                 }
89              }
90         }
91         output{
92              list available-ids{
93                 uses available-resource-ids;
94              }
95              uses released-resource-ids;
96         }
97     }
98
99     grouping available-resource-ids {
100         leaf start {
101              type uint32;
102         }
103         leaf end {
104              type uint32;
105         }
106     }
107
108     grouping released-resource-ids {
109         list delayed-resource-entries {
110             uses idmgr:delayed-id-entry;
111         }
112     }
113 }