Refactored SchemaPath for yang java types. Fixed SchemaPath for augmented nodes types.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-impl / src / test / resources / model / testfile2.yang
1 module types2 {
2     yang-version 1;
3     namespace "urn:simple.types.data.demo";
4     prefix "t2";
5     
6     organization "opendaylight";
7     contact "http://www.opendaylight.org/";
8     
9     description "This is types-data test description";
10
11     revision "2013-02-27" {
12         reference " WILL BE DEFINED LATER";
13     }
14     
15     typedef my-base-int32-type {
16         type int32 {
17             range "2..20";
18         }
19     }
20
21     typedef my-type1 {
22         type my-base-int32-type {
23             range "3..9|11..max";
24         }
25         units "mile";
26         default "11";
27     }
28     
29     typedef my-custom-string {
30         type string {
31             pattern "[a-k]*";
32             length "5..11";
33         }
34     }
35     
36     typedef my-string-type {
37         type my-custom-string {
38             length "5..10";
39         }
40     }
41     
42     typedef my-string-type2 {
43         type my-string-type {
44             pattern "[b-u]*";
45         }
46     }
47
48     typedef my-string-type-ext {
49         type my-string-type2 {
50             pattern "[e-z]*";
51         }
52     }
53
54     typedef my-int-type {
55         type int32 {
56             range "10..20";
57         }
58     }
59     
60     typedef my-int-type2 {
61         type my-int-type {
62             range "12..18";
63         }
64     }
65     
66     typedef my-int-type-ext {
67         type my-int-type2 {
68             range "14..16";
69         }
70     }
71     
72     typedef my-decimal-type {
73         type decimal64 {
74             fraction-digits 6;
75         }
76     }
77     
78     typedef my-decimal-type-ext {
79         type decimal64 {
80             fraction-digits 5;
81         }
82     }
83
84     typedef my-union {
85         type union {
86             type int16 {
87                 range "1..100";
88             }
89             type int32;
90         }
91     }
92
93     typedef my-union-ext {
94         type my-union;
95     }
96
97     typedef nested-union1 {
98         type nested-union2;
99     }
100
101     typedef nested-union2 {
102         type union {
103             type my-union-ext;
104             type string;
105         }
106     }
107
108     leaf if-name {
109         type leafref {
110             path "/interface/name";
111         }
112     }
113      
114     leaf name {
115         type string;
116     }
117      
118     leaf nested-type-leaf {
119         type my-type1;
120     }
121     
122     extension c-define {
123         description
124         "Takes as argument a name string.
125         Makes the code generator use the given name in the
126         #define.";
127         argument "name" {
128             yin-element "true";
129         }
130     }
131     
132     container system {
133         leaf user {
134             type string;
135         }
136     }
137     
138     grouping target {
139         anyxml data {
140             config true;
141             description "Copy of the source datastore subset.";
142             mandatory false;
143             must "test-condition-text";
144             reference "test-no-reference";
145             status "obsolete";
146             when "test-when-text";
147         }
148         choice how {
149             description "test choice description";
150             default interval;
151             case interval {
152                 leaf interval {
153                     type uint16;
154                     default 30;
155                     units minutes;
156                 }
157             }
158             case daily {
159                 leaf daily {
160                     type empty;
161                 }
162                 leaf time-of-day {
163                     type string;
164                     units 24-hour-clock;
165                     default 1am;
166                 }
167             }
168         }
169         leaf address {
170             type string;
171             description "Target IP address";
172         }
173         container port {
174             description "Target port container";
175         }
176         list addresses {
177             key "id";
178             leaf id {
179                 type int8;
180             }
181         }
182         grouping target-inner {
183             description "target-inner default description";
184             leaf inner-grouping-id {
185                 type int8;
186             }
187         }
188         typedef group-type {
189             type my-decimal-type;
190         }
191     }
192
193     container peer {
194         container destination {
195             uses target {
196                 refine address {
197                     default "1.2.3.4";
198                     description "description of address defined by refine";
199                     reference "address reference added by refine";
200                     config false;
201                     mandatory true;
202                     must "ifType != 'ethernet' or " +
203                             "(ifType = 'ethernet' and ifMTU = 1500)" {
204                         error-message "An ethernet MTU must be 1500";
205                     }
206                 }
207                 refine port {
208                     must "must-condition" {
209                         error-message "An error message test";
210                         error-app-tag "An error app tag test";
211                     }
212                     description "description of port defined by refine";
213                     reference "port reference added by refine";
214                     config false;
215                     presence "presence is required";
216                 }
217                 refine addresses {
218                     description "description of addresses defined by refine";
219                     reference "addresses reference added by refine";
220                     config false;
221                     min-elements 2;
222                     max-elements 12;
223                 }
224                 refine target-inner {
225                     description "new target-inner grouping description";
226                 }
227                 refine group-type {
228                     description "new group-type description";
229                     reference "new group-type reference";
230                 }
231             }
232         }
233     }
234     
235     container interfaces {
236          list ifEntry {
237              key "ifIndex";
238
239              leaf ifIndex {
240                  type uint32;
241                  units minutes;
242              }
243              
244              leaf ifMtu {
245                  type int32;
246              }
247              
248              min-elements 1;
249              max-elements 11;
250          }
251     }
252
253 }