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