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