Fixes bug 2114
[controller.git] / opendaylight / md-sal / 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
136       leaf toasterManufacturer {
137         type DisplayString;
138         config false;
139         mandatory true;
140         description
141           "The name of the toaster's manufacturer. For instance,
142                 Microsoft Toaster.";
143       }
144
145       leaf toasterModelNumber {
146         type DisplayString;
147         config false;
148         mandatory true;
149         description
150           "The name of the toaster's model. For instance,
151                Radiant Automatic.";
152       }
153
154       leaf toasterStatus {
155         type enumeration {
156           enum "up" {
157             value 1;
158             description
159               "The toaster knob position is up.
160                       No toast is being made now.";
161           }
162           enum "down" {
163             value 2;
164             description
165               "The toaster knob position is down.
166                       Toast is being made now.";
167           }
168         }
169         config false;
170         mandatory true;
171         description
172           "This variable indicates the current state of
173                the toaster.";
174       }
175     }
176
177     rpc make-toast {
178       description
179         "Make some toast.
180            The toastDone notification will be sent when
181            the toast is finished.
182            An 'in-use' error will be returned if toast
183            is already being made.
184            A 'resource-denied' error will be returned
185            if the toaster service is disabled.";
186       input {
187         leaf toasterDoneness {
188           type uint32 {
189             range "1 .. 10";
190           }
191           default '5';
192           description
193             "This variable controls how well-done is the
194                    ensuing toast. It should be on a scale of 1 to 10.
195                    Toast made at 10 generally is considered unfit
196                    for human consumption; toast made at 1 is warmed
197                    lightly.";
198         }
199
200         leaf toasterToastType {
201           type identityref {
202             base toast:toast-type;
203           }
204           default 'wheat-bread';
205           description
206             "This variable informs the toaster of the type of
207                    material that is being toasted. The toaster
208                    uses this information, combined with
209                    toasterDoneness, to compute for how
210                    long the material must be toasted to achieve
211                    the required doneness.";
212         }
213       }
214     }
215
216     rpc cancel-toast {
217       description
218         "Stop making toast, if any is being made.
219            A 'resource-denied' error will be returned
220            if the toaster service is disabled.";
221     }
222
223     notification toastDone {
224       description
225         "Indicates that the toast in progress has completed.";
226       leaf toastStatus {
227         type enumeration {
228           enum "done" {
229             value 0;
230             description "The toast is done.";
231           }
232           enum "cancelled" {
233             value 1;
234             description
235               "The toast was cancelled.";
236           }
237           enum "error" {
238             value 2;
239             description
240               "The toaster service was disabled or
241                      the toaster is broken.";
242           }
243         }
244         description
245           "Indicates the final toast status";
246       }
247     }
248   }