7f8ed0cc96440f8b656ac0f867e066b95b4936bb
[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         }
56     }
57
58     leaf leaf-string {
59         type string;
60     }
61
62     leaf leaf-length-pattern {
63         type string {
64             length "1..255";
65             pattern "[0-9a-fA-F]*";
66         }
67     }
68
69     leaf leaf-length-pattern-second {
70         type string {
71             length "2..10";
72             pattern "[0-9a-fA-F]";
73         }
74     }
75
76     identity test-identity {
77         description "test identity description";
78     }
79
80     leaf leaf-decimal64 {
81         type decimal64 {
82             fraction-digits 2;
83             range "1 .. 3.14 | 10 | 20..max";
84         }
85     }
86
87     leaf leaf-empty {
88         type empty;
89     }
90
91     leaf leaf-bits {
92         type bits {
93             bit one {
94                 position 0;
95                 description "test bit";
96                 reference "test bit ref";
97                 status current;
98             }
99             bit two {
100                 position 1;
101             }
102             bit three {
103                 position 2;
104                 description "test bit";
105                 reference "test bit ref";
106                 status current;
107             }
108         }
109     default "one";
110     }
111
112     leaf leaf-enum {
113         type enumeration {
114             enum zero {
115                 description "test enum";
116                 reference "test enum ref";
117                 status current;
118                 value 0;
119             }
120             enum one;
121             enum two;
122         }
123     }
124
125     leaf leaf-union {
126         type union {
127             type int8;
128             type int16;
129         }
130     }
131
132     leaf leaf-leafref {
133          type leafref {
134              path "/container-test/leaf-test";
135          }
136     }
137
138     container container-test {
139         leaf leaf-test {
140             type int8;
141         }
142     }
143 }