4f146f705d0b692d9ed3deda75ccf3f9346f540b
[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     import types1 {
7          prefix "if";
8          revision-date 2013-02-27;
9      }
10
11     organization "opendaylight";
12     contact "http://www.opendaylight.org/";
13     
14     description "This is types-data test description";
15
16     revision "2013-02-27" {
17         reference " WILL BE DEFINED LATER";
18     }
19     
20     typedef my-base-int32-type {
21         type int32 {
22             range "2..20";
23         }
24     }
25
26     typedef my-type1 {
27         type my-base-int32-type {
28             range "11..max";
29         }
30         units "mile";
31         default "11";
32     }
33     
34     typedef my-custom-string {
35         type string {
36             pattern "[a-k]*";
37             length "5..11";
38         }
39     }
40     
41     typedef my-string-type {
42         type my-custom-string {
43             length "5..10";
44         }
45     }
46     
47     typedef my-string-type2 {
48         type my-string-type {
49             pattern "[b-u]*";
50         }
51     }
52
53     typedef my-string-type-ext {
54         type my-string-type2 {
55             pattern "[e-z]*";
56         }
57     }
58
59     typedef my-int-type {
60         type int32 {
61             range "10..20";
62         }
63     }
64     
65     typedef my-int-type2 {
66         type my-int-type {
67             range "12..18";
68         }
69     }
70     
71     typedef my-int-type-ext {
72         type my-int-type2 {
73             range "14..16";
74         }
75     }
76     
77     typedef my-decimal-type {
78         type decimal64 {
79             fraction-digits 6;
80         }
81     }
82     
83     typedef my-decimal-type-ext {
84         type decimal64 {
85             fraction-digits 5;
86         }
87     }
88
89     typedef my-union {
90         type union {
91                 type int16 {
92                         range "1..100";
93                 }
94                 type int32;
95         }
96     }
97
98     typedef my-union-ext {
99         type my-union;
100     }
101
102     typedef nested-union1 {
103         type nested-union2;
104     }
105
106     typedef nested-union2 {
107         type union {
108                 type my-union-ext;
109                 type string;
110         }
111     }
112
113     leaf if-name {
114         type leafref {
115             path "/interface/name";
116         }
117     }
118      
119     leaf name {
120         type string;
121     }
122      
123     leaf nested-type-leaf {
124         type my-type1;
125     }
126     
127     extension c-define {
128         description
129         "Takes as argument a name string.
130         Makes the code generator use the given name in the
131         #define.";
132         argument "name" {
133             yin-element "true";
134         }
135     }
136     
137     container system {
138         leaf user {
139             type string;
140         }
141     }
142     
143     grouping target {
144         leaf address {
145             type string;
146             description "Target IP address";
147         }
148         container port {
149             description "Target port container";
150         }
151     }
152
153     container peer {
154         container destination {
155             uses target {
156                 refine address {
157                     default "1.2.3.4";
158                 }
159                 refine port {
160                     must "must-condition" {
161                         error-message "An error message test";
162                         error-app-tag "An error app tag test";
163                     }
164                 }
165             }
166         }
167     }
168     
169     container interfaces {
170          list ifEntry {
171              key "ifIndex";
172
173              leaf ifIndex {
174                  type uint32;
175                  units minutes;
176              }
177              
178              leaf ifMtu {
179                  type int32;
180              }
181          }
182     }
183
184 }