e27dd0b9c09fdc74666c05abcd3985a90bf4cfd2
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-impl / src / test / resources / model / nodes.yang
1 module nodes {
2     yang-version 1;
3     namespace "urn:simple.nodes.test";
4     prefix "n";
5
6     import types {
7         prefix "t";
8         revision-date 2013-07-03;
9     }
10
11    import custom {
12         prefix "c";
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 t:int32-ext2 {
25             range "12..max";
26         }
27     }
28
29     leaf string-leaf {
30         type t:string-ext4;
31     }
32
33     leaf length-leaf {
34         type t:string-ext2 {
35             length "7..max";
36         }
37     }
38
39     leaf decimal-leaf {
40         type t:my-decimal-type {
41             fraction-digits 4;
42         }
43     }
44
45     leaf decimal-leaf2 {
46         type t:my-decimal-type;
47     }
48
49     container ext {
50         types:c-define "MY_INTERFACES";
51     }
52
53     leaf union-leaf {
54         type t:my-union-ext;
55     }
56
57     deviation /t:interfaces/t:ifEntry {
58         deviate add {
59             default "admin"; // new users are 'admin' by default
60             config "true";
61         }
62         reference "system/user ref";
63     }
64
65     leaf custom-union-leaf {
66         type c: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 data {
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 "/t:interfaces/t:ifEntry/c: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 t: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     container peer {
155         container destination {
156             uses c:target {
157                 refine address {
158                     default "1.2.3.4";
159                     description "IP address of target node";
160                     reference "address reference added by refine";
161                     config false;
162                     mandatory true;
163                     must "ifType != 'ethernet' or " +
164                             "(ifType = 'ethernet' and ifMTU = 1500)" {
165                         error-message "An ethernet MTU must be 1500";
166                     }
167                 }
168                 refine port {
169                     description "description of port defined by refine";
170                     reference "port reference added by refine";
171                     config false;
172                     presence "presence is required";
173                 }
174                 refine addresses {
175                     description "description of addresses defined by refine";
176                     reference "addresses reference added by refine";
177                     config false;
178                     min-elements 2;
179                     max-elements 12;
180                 }
181                 refine target-inner {
182                     description "new target-inner grouping description";
183                 }
184                 refine group-type {
185                     description "new group-type description";
186                     reference "new group-type reference";
187                 }
188             }
189         }
190     }
191
192 }