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