Implemented refine statement parsing.
[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     augment "/if:interfaces/if:ifEntry" {
114         when "if:ifType='ds0'";
115         leaf ds0ChannelNumber {
116             type string;
117         }
118     }
119
120     leaf if-name {
121         type leafref {
122             path "/interface/name";
123         }
124     }
125      
126     leaf name {
127         type string;
128     }
129      
130     leaf nested-type-leaf {
131         type my-type1;
132     }
133     
134     extension c-define {
135         description
136         "Takes as argument a name string.
137         Makes the code generator use the given name in the
138         #define.";
139         argument "name" {
140             yin-element "true";
141         }
142     }
143     
144     container system {
145         leaf user {
146             type string;
147         }
148     }
149     
150     grouping target {
151         leaf address {
152             type string;
153             description "Target IP address";
154         }
155         container port {
156             description "Target port container";
157         }
158     }
159
160     container peer {
161         container destination {
162             uses target {
163                 refine address {
164                     default "1.2.3.4";
165                 }
166                 refine port {
167                     must "must-condition" {
168                         error-message "An error message test";
169                         error-app-tag "An error app tag test";
170                     }
171                 }
172             }
173         }
174     }
175     
176     container interfaces {
177          list ifEntry {
178              key "ifIndex";
179
180              leaf ifIndex {
181                  type uint32;
182                  units minutes;
183              }
184              
185              leaf ifMtu {
186                  type int32;
187              }
188          }
189     }
190
191 }