Fix docgen failure on multi-level choice definition
[netconf.git] / restconf / sal-rest-docgen / src / test / resources / yang / toaster.yang
1 module toaster {
2
3     yang-version 1;
4
5     namespace
6       "http://netconfcentral.org/ns/toaster";
7
8     prefix toast;
9
10     organization "Netconf Central";
11
12     contact
13       "Andy Bierman <andy@netconfcentral.org>";
14
15     description
16       "YANG version of the TOASTER-MIB.";
17
18     revision "2009-11-20" {
19       description
20         "Toaster module in progress.";
21     }
22
23     leaf domain {
24         description
25             "Toaster domain.";
26
27         config true;
28
29         type string;
30     }
31
32     identity toast-type {
33       description
34           "Base for all bread types supported by the toaster.
35            New bread types not listed here nay be added in the
36            future.";
37     }
38
39     identity white-bread {
40       base toast:toast-type;
41       description "White bread.";
42     }
43
44     identity wheat-bread {
45       base toast-type;
46       description "Wheat bread.";
47     }
48
49     identity wonder-bread {
50       base toast-type;
51       description "Wonder bread.";
52     }
53
54     identity frozen-waffle {
55       base toast-type;
56       description "Frozen waffle.";
57     }
58
59     identity frozen-bagel {
60       base toast-type;
61       description "Frozen bagel.";
62     }
63
64     identity hash-brown {
65       base toast-type;
66       description "Hash browned potatos.";
67     }
68
69     typedef DisplayString {
70       type string;
71       description
72         "YANG version of the SMIv2 DisplayString TEXTUAL-CONVENTION.";
73       reference
74         "RFC 2579, section 2.";
75
76     }
77
78     container toaster {
79       presence
80         "Indicates the toaster service is available";
81       description
82         "Top-level container for all toaster database objects.";
83
84       leaf testToasterBits {
85          type bits {
86              bit testbit1 {
87                  position 0;
88              }
89              bit testbit2 {
90                  position 1;
91              }
92          }
93          default "testbit2";
94      }
95
96      leaf testUnion {
97         type union {
98          type int32;
99          type string;
100         }
101
102      }
103
104      leaf-list allow-user  {
105           type string;
106           description "A list of user name patterns to allow";
107
108         }
109
110         choice how {
111              default interval;
112              case interval {
113                  leaf interval {
114                      type uint16;
115                      default 30;
116                      units minutes;
117                  }
118              }
119              case daily {
120                  leaf daily {
121                      type string;
122                  }
123                  leaf time-of-day {
124                      type string;
125                      units 24-hour-clock;
126                      default 1am;
127                  }
128              }
129              case manual {
130                  leaf manual {
131                      type string;
132                  }
133              }
134
135             case other {
136               description "2nd level choice";
137
138               choice scheduled {
139                 case weekly {
140                   leaf weekly {
141                     type string;
142                   }
143                 }
144                 case monthly {
145                   leaf monthly {
146                     type string;
147                   }
148                 }
149                 case yearly {
150                   leaf yearly {
151                     type string;
152                   }
153                 }
154               }
155             }
156          }
157
158       leaf toasterManufacturer {
159         type DisplayString;
160         config false;
161         mandatory true;
162         description
163           "The name of the toaster's manufacturer. For instance,
164                 Microsoft Toaster.";
165       }
166
167       leaf toasterModelNumber {
168         type DisplayString;
169         config false;
170         mandatory true;
171         description
172           "The name of the toaster's model. For instance,
173                Radiant Automatic.";
174       }
175
176       leaf toasterStatus {
177         type enumeration {
178           enum "up" {
179             value 1;
180             description
181               "The toaster knob position is up.
182                       No toast is being made now.";
183           }
184           enum "down" {
185             value 2;
186             description
187               "The toaster knob position is down.
188                       Toast is being made now.";
189           }
190         }
191         config false;
192         mandatory true;
193         description
194           "This variable indicates the current state of
195                the toaster.";
196       }
197     }
198
199     rpc make-toast {
200       description
201         "Make some toast.
202            The toastDone notification will be sent when
203            the toast is finished.
204            An 'in-use' error will be returned if toast
205            is already being made.
206            A 'resource-denied' error will be returned
207            if the toaster service is disabled.";
208       input {
209         leaf toasterDoneness {
210           type uint32 {
211             range "1 .. 10";
212           }
213           default '5';
214           description
215             "This variable controls how well-done is the
216                    ensuing toast. It should be on a scale of 1 to 10.
217                    Toast made at 10 generally is considered unfit
218                    for human consumption; toast made at 1 is warmed
219                    lightly.";
220         }
221
222         leaf toasterToastType {
223           type identityref {
224             base toast:toast-type;
225           }
226           default 'wheat-bread';
227           description
228             "This variable informs the toaster of the type of
229                    material that is being toasted. The toaster
230                    uses this information, combined with
231                    toasterDoneness, to compute for how
232                    long the material must be toasted to achieve
233                    the required doneness.";
234         }
235       }
236     }
237
238     rpc cancel-toast {
239       description
240         "Stop making toast, if any is being made.
241            A 'resource-denied' error will be returned
242            if the toaster service is disabled.";
243     }
244
245     notification toastDone {
246       description
247         "Indicates that the toast in progress has completed.";
248       leaf toastStatus {
249         type enumeration {
250           enum "done" {
251             value 0;
252             description "The toast is done.";
253           }
254           enum "cancelled" {
255             value 1;
256             description
257               "The toast was cancelled.";
258           }
259           enum "error" {
260             value 2;
261             description
262               "The toaster service was disabled or
263                      the toaster is broken.";
264           }
265         }
266         description
267           "Indicates the final toast status";
268       }
269     }
270   }