Provide a module to manage resources manually.
[alto.git] / alto-core / basic-types / model / src / main / yang / types.yang
1 module alto-basic-types {
2     yang-version 1;
3
4     namespace "urn:opendaylight:alto:core:types";
5
6     prefix "alto-basic-types";
7
8     organization "Yale University";
9
10     contact "alto-dev@lists.opendaylight.org";
11
12     revision "2015-09-21" {
13         description "Initial revision of alto core types";
14     }
15
16     /* See https://tools.ietf.org/html/rfc7285#section-10.1 */
17     typedef "pid-name" {
18         type string {
19             pattern "[0-9a-zA-Z\-:@_]*";
20             length "1..64";
21         }
22     }
23
24     /* See https://tools.ietf.org/html/rfc7285#section-10.2 */
25     typedef "resource-id" {
26         type string {
27             pattern "[0-9a-zA-Z\-:@_]*";
28             length "1..64";
29         }
30     }
31
32     /* See https://tools.ietf.org/html/rfc7285#section-10.3 */
33     typedef "tag" {
34         type string {
35             pattern "[!-~]*";
36             length "1..32";
37         }
38     }
39
40     /* See https://tools.ietf.org/html/rfc7285#section-10.6 */
41     typedef "cost-metric" {
42         type string {
43             pattern "[0-9a-zA-Z\-_:]*";
44             length "1..32";
45         }
46     }
47
48     /* See https://tools.ietf.org/html/rfc7285#section-10.8.1 */
49     typedef "specific-endpoint-property" {
50         type string {
51             pattern "[0-9a-zA-Z\-:@_]{1,64}\.[0-9a-zA-Z\-:_]{1,32}";
52             length "3..97";
53         }
54     }
55
56     /* See https://tools.ietf.org/html/rfc7285#section-10.8.2 */
57     typedef "global-endpoint-property" {
58         type string {
59             pattern "[0-9a-zA-Z\-:_]*";
60             length "1..32";
61         }
62     }
63
64     grouping "cost-type-data" {
65         leaf "cost-metric" {
66             type cost-metric;
67         }
68
69         leaf "cost-mode" {
70             mandatory true;
71             type string;
72         }
73     }
74
75     grouping "vtag" {
76         leaf "resource-id" {
77             type resource-id;
78             mandatory true;
79         }
80
81         leaf "tag" {
82             type tag;
83             mandatory true;
84         }
85     }
86
87     grouping "dependent-vtags" {
88         list "dependent-vtags" {
89             key "resource-id";
90             uses "vtag";
91             min-elements 1;
92         }
93     }
94 }