a4e5868c4f9e26f098c760ac74f2336b8abf4c60
[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         leaf address {
140             type string;
141             description "Target IP address";
142         }
143         container port {
144             description "Target port container";
145         }
146         
147         list addresses {
148             key "id";
149             leaf id {
150                 type int8;
151             }
152         }
153     }
154
155     container peer {
156         container destination {
157             uses target {
158                 refine address {
159                     default "1.2.3.4";
160                     description "description of address defined by refine";
161                     reference "address reference added by refine";
162                     config false;
163                     mandatory true;
164                     must "ifType != 'ethernet' or " +
165                             "(ifType = 'ethernet' and ifMTU = 1500)" {
166                         error-message "An ethernet MTU must be 1500";
167                     }
168                 }
169                 refine port {
170                     must "must-condition" {
171                         error-message "An error message test";
172                         error-app-tag "An error app tag test";
173                     }
174                     description "description of port defined by refine";
175                     reference "port reference added by refine";
176                     config false;
177                     presence "presence is required";
178                 }
179                 refine addresses {
180                     description "description of addresses defined by refine";
181                     reference "addresses reference added by refine";
182                     config false;
183                     min-elements 2;
184                     max-elements 12;
185                 }
186             }
187         }
188     }
189     
190     container interfaces {
191          list ifEntry {
192              key "ifIndex";
193
194              leaf ifIndex {
195                  type uint32;
196                  units minutes;
197              }
198              
199              leaf ifMtu {
200                  type int32;
201              }
202              
203              min-elements 1;
204              max-elements 11;
205          }
206     }
207
208 }