Moved MD SAL from sal/yang-prototype to md-sal
[controller.git] / opendaylight / md-sal / samples / toaster / src / main / 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         length "0 .. 255";
64       }
65       description
66         "YANG version of the SMIv2 DisplayString TEXTUAL-CONVENTION.";
67       reference
68         "RFC 2579, section 2.";
69
70     }
71
72     container toaster {
73       presence
74         "Indicates the toaster service is available";
75       description
76         "Top-level container for all toaster database objects.";
77       leaf toasterManufacturer {
78         type DisplayString;
79         config false;
80         mandatory true;
81         description
82           "The name of the toaster's manufacturer. For instance, 
83                 Microsoft Toaster.";
84       }
85
86       leaf toasterModelNumber {
87         type DisplayString;
88         config false;
89         mandatory true;
90         description
91           "The name of the toaster's model. For instance,
92                Radiant Automatic.";
93       }
94
95       leaf toasterStatus {
96         type enumeration {
97           enum "up" {
98             value 1;
99             description
100               "The toaster knob position is up.
101                       No toast is being made now.";
102           }
103           enum "down" {
104             value 2;
105             description
106               "The toaster knob position is down.
107                       Toast is being made now.";
108           }
109         }
110         config false;
111         mandatory true;
112         description
113           "This variable indicates the current state of 
114                the toaster.";
115       }
116     }  // container toaster
117
118     rpc make-toast {
119       description
120         "Make some toast.
121            The toastDone notification will be sent when 
122            the toast is finished.
123            An 'in-use' error will be returned if toast
124            is already being made.
125            A 'resource-denied' error will be returned 
126            if the toaster service is disabled.";
127       input {
128         leaf toasterDoneness {
129           type uint32 {
130             range "1 .. 10";
131           }
132           default '5';
133           description
134             "This variable controls how well-done is the 
135                    ensuing toast. It should be on a scale of 1 to 10.
136                    Toast made at 10 generally is considered unfit 
137                    for human consumption; toast made at 1 is warmed 
138                    lightly.";
139         }
140
141         leaf toasterToastType {
142           type identityref {
143             base toast:toast-type;
144           }
145           default 'wheat-bread';
146           description
147             "This variable informs the toaster of the type of 
148                    material that is being toasted. The toaster 
149                    uses this information, combined with 
150                    toasterDoneness, to compute for how 
151                    long the material must be toasted to achieve 
152                    the required doneness.";
153         }
154       }
155     }  // rpc make-toast
156
157     rpc cancel-toast {
158       description
159         "Stop making toast, if any is being made.
160            A 'resource-denied' error will be returned 
161            if the toaster service is disabled.";
162     }  // rpc cancel-toast
163
164     notification toastDone {
165       description
166         "Indicates that the toast in progress has completed.";
167       leaf toastStatus {
168         type enumeration {
169           enum "done" {
170             value 0;
171             description "The toast is done.";
172           }
173           enum "cancelled" {
174             value 1;
175             description
176               "The toast was cancelled.";
177           }
178           enum "error" {
179             value 2;
180             description
181               "The toaster service was disabled or
182                      the toaster is broken.";
183           }
184         }
185         description
186           "Indicates the final toast status";
187       }
188     }  // notification toastDone
189   }  // module toaster