Added more tests for yang parser. Updated current tests.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-impl / src / test / resources / model / custom.yang
1 module custom {
2     yang-version 1;
3     namespace "urn:custom.nodes.test";
4     prefix "c";
5
6     import types {
7         prefix "types";
8         revision-date 2013-07-03;
9     }
10
11     organization "opendaylight";
12     contact "http://www.opendaylight.org/";
13
14     revision "2013-02-27" {
15         reference " WILL BE DEFINED LATER";
16     }
17
18     typedef union1 {
19         type union2;
20     }
21
22     typedef union2 {
23         type union {
24             type int32;
25             type types:nested-union2;
26         }
27     }
28
29     augment "/types:interfaces/types:ifEntry" {
30         when "if:ifType='ds0'";
31         container augment-holder {
32             description "Description for augment holder";
33         }
34     }
35
36     augment "/types:interfaces/types:ifEntry" {
37         when "if:ifType='ds2'";
38         container augment-holder2 {
39             description "Description for augment holder";
40         }
41     }
42
43     augment "/types:interfaces/types:ifEntry/t3:augment-holder/t1:schemas" {
44         when "if:leafType='ds1'";
45         leaf linkleaf {
46             type binary;
47         }
48     }
49
50     container network {
51         mnt:mountpoint point {
52             mnt:target-ref target;
53         }
54
55         description "network-description";
56         reference "network-reference";
57         status obsolete;
58         config true;
59         presence "some presence text";
60     }
61
62     feature local-storage {
63         description
64             "This feature means the device supports local
65              storage (memory, flash or disk) that can be used to
66              store syslog messages.";
67     }
68
69     extension c-define {
70         description
71         "Takes as argument a name string. Makes the code generator use the given name in the #define.";
72         argument "name" {
73             yin-element "true";
74         }
75     }
76
77     notification event {
78         leaf event-class {
79             type string;
80         }
81         anyxml reporting-entity;
82         leaf severity {
83             type string;
84         }
85     }
86
87     rpc get-config {
88         description
89           "Retrieve all or part of a specified configuration.";
90
91         reference "RFC 6241, Section 7.1";
92
93         input {
94             container source {
95                 description
96                   "Particular configuration to retrieve.";
97
98                 choice config-source {
99                     mandatory true;
100                     description
101                       "The configuration to retrieve.";
102                     case a {
103                         leaf candidate {
104                             if-feature candidate;
105                             type empty;
106                             description
107                               "The candidate configuration is the config source.";
108                         }
109                     }
110                     case b {
111                         leaf running {
112                             type empty;
113                             description
114                               "The running configuration is the config source.";
115                         }
116                     }
117                     case c {
118                         leaf startup {
119                             if-feature startup;
120                             type empty;
121                             description
122                               "The startup configuration is the config source.
123                                This is optional-to-implement on the server because
124                                not all servers will support filtering for this
125                                datastore.";
126                         }
127                     }
128                 }
129             }
130
131             anyxml filter {
132                 description
133                   "Subtree or XPath filter to use.";
134                    nc:get-filter-element-attributes;
135             }
136         }
137
138         output {
139             anyxml data {
140                 description
141                   "Copy of the source datastore subset that matched
142                    the filter criteria (if any).  An empty data container
143                    indicates that the request did not produce any results.";
144             }
145         }
146     }
147
148     grouping target {
149         anyxml data {
150             config true;
151             description "Copy of the source datastore subset.";
152             mandatory false;
153             must "test-condition-text";
154             reference "test-no-reference";
155             status "obsolete";
156             when "test-when-text";
157         }
158         choice how {
159             description "test choice description";
160             default interval;
161             case interval {
162                 leaf interval {
163                     type uint16;
164                     default 30;
165                     units minutes;
166                 }
167             }
168             case daily {
169                 leaf daily {
170                     type empty;
171                 }
172                 leaf time-of-day {
173                     type string;
174                     units 24-hour-clock;
175                     default 1am;
176                 }
177             }
178         }
179         leaf address {
180             type string;
181             description "Target IP address";
182         }
183         container port {
184             description "Target port container";
185         }
186         list addresses {
187             key "id";
188             leaf id {
189                 type int8;
190             }
191         }
192         grouping target-inner {
193             description "target-inner default description";
194             leaf inner-grouping-id {
195                 type int8;
196             }
197         }
198         typedef group-type {
199             type types:my-decimal-type;
200         }
201
202         opendaylight;
203     }
204
205 }