Merge "Change yang-maven-plugin to write yang files to build output"
[yangtools.git] / yang / yang-parser-impl / src / test / resources / model / foo.yang
1 module foo {
2     yang-version 1;
3     namespace "urn:opendaylight.foo";
4     prefix "foo";
5
6     import bar {
7         prefix "br";
8         revision-date 2013-07-03;
9     }
10
11     import baz {
12         prefix "bz";
13         revision-date 2013-02-27;
14     }
15
16     include subfoo;
17
18     organization "opendaylight";
19     contact "http://www.opendaylight.org/";
20
21     revision "2013-02-27" {
22         reference " WILL BE DEFINED LATER";
23     }
24
25     typedef identifier {
26         type int32;
27     }
28
29     leaf int32-leaf {
30         type br:int32-ext2 {
31             range "12..max";
32         }
33     }
34
35     leaf string-leaf {
36         type br:string-ext4;
37     }
38
39     leaf length-leaf {
40         type br:string-ext2 {
41             length "7..max";
42         }
43     }
44
45     leaf decimal-leaf {
46         type br:my-decimal-type {
47             fraction-digits 4;
48         }
49     }
50
51     leaf decimal-leaf2 {
52         type br:my-decimal-type;
53     }
54
55     container ext {
56         bz:c-define "MY_INTERFACES";
57     }
58
59     leaf union-leaf {
60         type br:my-union-ext;
61     }
62
63     deviation /br:interfaces/br:ifEntry {
64         deviate add {
65             default "admin";
66             config "true";
67         }
68         reference "system/user ref";
69     }
70
71     leaf custom-union-leaf {
72         type bz:union1;
73     }
74
75     container transfer {
76         choice how {
77             default interval;
78             container input {
79             }
80             list output {
81                 leaf id {
82                     type string;
83                 }
84             }
85             case interval {
86                 leaf interval {
87                     type uint16;
88                     default 30;
89                     units minutes;
90                 }
91             }
92             case daily {
93                 leaf daily {
94                     type empty;
95                 }
96                 leaf time-of-day {
97                     type string;
98                     units 24-hour-clock;
99                     default 1am;
100                 }
101             }
102             case manual {
103                 leaf manual {
104                     type empty;
105                 }
106             }
107         }
108     }
109
110     anyxml datas {
111         description
112           "Copy of the source typesstore subset that matched
113            the filter criteria (if any).  An empty types container
114            indicates that the request did not produce any results.";
115         status obsolete;
116     }
117
118     augment "/br:interfaces/br:ifEntry/bz:augment-holder" {
119         when "if:ifType='ds0'";
120         leaf ds0ChannelNumber {
121             type string;
122         }
123         leaf interface-id {
124             type leafref {
125                 path "/if:interfaces/if:interface/if:name";
126             }
127         }
128         leaf my-type {
129             type br:int32-ext2;
130         }
131         container schemas {
132         }
133         choice odl {
134             leaf id {
135                 type int8;
136             }
137             case node1 {
138                 description "node1";
139             }
140             case node2 {
141                 description "node2";
142             }
143             container node3 {
144                 description "node3";
145             }
146         }
147     }
148
149     container mycont {
150         container innercont {
151             typedef mytype {
152                 type string;
153             }
154             leaf myleaf {
155                 type mytype;
156             }
157         }
158     }
159
160     uses bz:target {
161         augment "how/interval" {
162             description "inner augment";
163             leaf name {
164                 type string;
165             }
166         }
167     }
168
169     container peer {
170         container destination {
171             uses bz:target {
172                 refine address {
173                     default "1.2.3.4";
174                     description "IP address of target node";
175                     reference "address reference added by refine";
176                     config false;
177                     mandatory false;
178                     must "ifType != 'ethernet' or " +
179                             "(ifType = 'ethernet' and ifMTU = 1500)" {
180                         error-message "An ethernet MTU must be 1500";
181                     }
182                     mountpoint "mnt-extension";
183                 }
184                 refine port {
185                     description "description of port defined by refine";
186                     reference "port reference added by refine";
187                     config false;
188                     presence "presence is required";
189                 }
190                 refine "addresses" {
191                     description "description of addresses defined by refine";
192                     reference "addresses reference added by refine";
193                     config false;
194                     min-elements 2;
195                     max-elements unbounded;
196                 }
197                 refine addresses/id {
198                     description "id of address";
199                 }
200             }
201         }
202     }
203
204     extension mountpoint {
205         description "enter point";
206         argument "name" {
207             yin-element "true";
208         }
209     }
210
211 }