Adding TestVNF netconf server
[demo.git] / vnfs / TestVNF / netconftemplates / netconftemplates / turing-machine@2013-12-27.yang
1 <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="m-1">
2   <data xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">module turing-machine {
3   namespace "http://example.net/turing-machine";
4   prefix tm;
5
6   description
7     "Data model for the Turing Machine.";
8
9   revision 2013-12-27 {
10     description
11       "Initial revision.";
12   }
13
14   typedef tape-symbol {
15     type string {
16       length "0..1";
17     }
18     description
19       "Type of symbols appearing in tape cells.
20
21        A blank is represented as an empty string where necessary.";
22   }
23
24   typedef cell-index {
25     type int64;
26     description
27       "Type for indexing tape cells.";
28   }
29
30   typedef state-index {
31     type uint16;
32     description
33       "Type for indexing states of the control unit.";
34   }
35
36   typedef head-dir {
37     type enumeration {
38       enum "left";
39       enum "right";
40     }
41     default "right";
42     description
43       "Possible directions for moving the read/write head, one cell
44        to the left or right (default).";
45   }
46
47   grouping tape-cells {
48     description
49       "The tape of the Turing Machine is represented as a sparse
50        array.";
51     list cell {
52       key "coord";
53       description
54         "List of non-blank cells.";
55       leaf coord {
56         type cell-index;
57         description
58           "Coordinate (index) of the tape cell.";
59       }
60
61       leaf symbol {
62         type tape-symbol {
63           length "1";
64         }
65         description
66           "Symbol appearing in the tape cell.
67
68            Blank (empty string) is not allowed here because the
69            'cell' list only contains non-blank cells.";
70       }
71     }
72   }
73
74   container turing-machine {
75     description
76       "State data and configuration of a Turing Machine.";
77     leaf state {
78       type state-index;
79       config false;
80       mandatory true;
81       description
82         "Current state of the control unit.
83
84          The initial state is 0.";
85     }
86
87     leaf head-position {
88       type cell-index;
89       config false;
90       mandatory true;
91       description
92         "Position of tape read/write head.";
93     }
94
95     container tape {
96       config false;
97       description
98         "The contents of the tape.";
99       uses tape-cells;
100     }
101
102     container transition-function {
103       description
104         "The Turing Machine is configured by specifying the
105          transition function.";
106       list delta {
107         key "label";
108         unique "input/state input/symbol";
109         description
110           "The list of transition rules.";
111         leaf label {
112           type string;
113           description
114             "An arbitrary label of the transition rule.";
115         }
116
117         container input {
118           description
119             "Input parameters (arguments) of the transition rule.";
120           leaf state {
121             type state-index;
122             mandatory true;
123             description
124               "Current state of the control unit.";
125           }
126
127           leaf symbol {
128             type tape-symbol;
129             mandatory true;
130             description
131               "Symbol read from the tape cell.";
132           }
133         }
134
135         container output {
136           description
137             "Output values of the transition rule.";
138           leaf state {
139             type state-index;
140             description
141               "New state of the control unit. If this leaf is not
142                present, the state doesn't change.";
143           }
144
145           leaf symbol {
146             type tape-symbol;
147             description
148               "Symbol to be written to the tape cell. If this leaf is
149                not present, the symbol doesn't change.";
150           }
151
152           leaf head-move {
153             type head-dir;
154             description
155               "Move the head one cell to the left or right";
156           }
157         }
158       }
159     }
160   }
161
162   rpc initialize {
163     description
164       "Initialize the Turing Machine as follows:
165
166        1. Put the control unit into the initial state (0).
167
168        2. Move the read/write head to the tape cell with coordinate
169           zero.
170
171        3. Write the string from the 'tape-content' input parameter to
172           the tape, character by character, starting at cell 0. The
173           tape is othewise empty.";
174     input {
175       leaf tape-content {
176         type string;
177         default "";
178         description
179           "The string with which the tape shall be initialized. The
180            leftmost symbol will be at tape coordinate 0.";
181       }
182     }
183   }
184
185   rpc run {
186     description
187       "Start the Turing Machine operation.";
188   }
189
190   rpc run-until {
191     description
192       "Start the Turing Machine operation and let it run until it is halted
193        or ALL the defined breakpoint conditions are satisfied.";
194     input {
195       leaf state {
196         type state-index;
197         description
198           "What state the control unit has to be at for the execution to be paused.";
199       }
200
201       leaf head-position {
202         type cell-index;
203         description
204           "Position of tape read/write head for which the breakpoint applies.";
205       }
206
207       container tape {
208         description
209           "What content the tape has to have for the breakpoint to apply.";
210         uses tape-cells;
211       }
212     }
213
214     output {
215       leaf step-count {
216         type uint64;
217         description
218           "The number of steps executed since the last 'run-until' call.";
219       }
220
221       leaf halted {
222         type boolean;
223         description
224           "'True' if the Turing machine is halted, 'false' if it is only paused.";
225       }
226     }
227   }
228
229   notification halted {
230     description
231       "The Turing Machine has halted. This means that there is no
232        transition rule for the current state and tape symbol.";
233     leaf state {
234       type state-index;
235       mandatory true;
236       description
237         "The state of the control unit in which the machine has
238          halted.";
239     }
240   }
241
242   notification paused {
243     description
244       "The Turing machine has reached a breakpoint and was paused.";
245     leaf state {
246       type state-index;
247       mandatory true;
248       description
249         "State of the control unit in which the machine was paused.";
250     }
251
252     leaf head-position {
253       type cell-index;
254       mandatory true;
255       description
256         "Position of tape read/write head when the machine was paused.";
257     }
258
259     container tape {
260       description
261         "Content of the tape when the machine was paused.";
262       uses tape-cells;
263     }
264   }
265 }
266 </data>
267 </rpc-reply>