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