BUG-4638: Convert to using new types
[yangtools.git] / yang / yang-parser-impl / src / test / resources / type-tests / types.yang
1 module types {
2
3     yang-version 1;
4     namespace "urn:custom.types.demo";
5     prefix "typ";
6     revision "2015-08-08";
7
8     leaf leaf-int8 {
9         type int8;
10     }
11
12     leaf leaf-int16 {
13         type int16;
14     }
15
16     leaf leaf-int32 {
17         type int32;
18     }
19
20     leaf leaf-int64 {
21         type int64;
22     }
23
24     leaf leaf-uint8 {
25         type uint8;
26     }
27
28     leaf leaf-uint16 {
29         type uint16;
30     }
31
32     leaf leaf-uint32 {
33         type uint32;
34     }
35
36     leaf leaf-uint64 {
37         type uint64;
38     }
39
40     leaf leaf-binary {
41         type binary;
42     }
43
44     leaf leaf-boolean {
45         type boolean;
46     }
47
48     leaf leaf-instance-identifier {
49         type instance-identifier;
50     }
51
52     leaf leaf-identityref {
53         type identityref {
54             base "test-identity";
55             units "test-unit";
56         }
57     }
58
59     leaf leaf-string {
60         type string;
61     }
62
63     leaf leaf-length-pattern {
64         type string {
65             length "1..255";
66             pattern "[0-9a-fA-F]*";
67         }
68     }
69
70     leaf leaf-length-pattern-second {
71         type string {
72             length "2..10";
73             pattern "[0-9a-fA-F]";
74         }
75     }
76
77     identity test-identity {
78         description "test identity description";
79     }
80
81     leaf leaf-decimal64 {
82         type decimal64 {
83             fraction-digits 2;
84             range "1 .. 3.14 | 10 | 20..max";
85             description "test decimal64";
86             reference "test decimal64 ref";
87             status current;
88         }
89     }
90
91     leaf leaf-empty {
92         type empty;
93     }
94
95     leaf leaf-bits {
96         type bits {
97             bit one {
98                 position 0;
99                 description "test bit";
100                 reference "test bit ref";
101                 status current;
102                 value 0;
103             }
104             bit two {
105                 position 1;
106                 value 1;
107             }
108             bit three {
109                 position 2;
110                 description "test bit";
111                 reference "test bit ref";
112                 status current;
113                 value 0;
114             }
115         }
116     default "one";
117     }
118
119     leaf leaf-enum {
120         type enumeration {
121             enum zero {
122                 description "test enum";
123                 reference "test enum ref";
124                 status current;
125                 value 0;
126             }
127             enum one;
128             enum two;
129         }
130     }
131
132     leaf leaf-union {
133         type union {
134             type int8;
135             type int16;
136         }
137     }
138
139     leaf leaf-leafref {
140          type leafref {
141              path "/container-test/leaf-test";
142          }
143     }
144
145     container container-test {
146         leaf leaf-test {
147             type int8;
148         }
149     }
150 }