2 * Copyright (c) 2014 Brocade Communications Systems others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
11 * => Comments that start with "SPEC:" are feedback for the ONF
12 * => Comments that start with "REFINE:" are notes for where we could enhance things
13 * => Comments that start with "TODO:" are places where we *need* to do work
16 * => add "mandatory true;" where things are required
17 * - note that this might involve variants of universal TTP properties when some are required
18 * => how to handle the "all", "one_or_more", "zero_or_more", "exactly_one", and "zero_or_one"
19 * meta-member keywords?
20 * - We currently support "all", "one_or_more" and "zero_or_more" directly under
21 * "flow_mod_types" because that is all that was illustrated.
22 * - We currently support "exactly_one" and "zero_or_one" directly under "match_set" and
23 * "instruction_set" because that was all that was illustrated.
24 * - We currently support "exactly_one" and "zero_or_one" for action lists, i.e., actions in
25 * instructions_set, action_set in bucket_type, and actions in packet_out
26 * - In all the above cases, I believe we accept JSON which would not be a valid TTP and
27 * might need to add extra validation. This is true elsewhere as well.
29 * - "all" is only used in one example under "flow_mod_types" in the middle of page 43
30 * - "one_or_more" is never illustrated with an example
31 * - "zero_or_more" sometimes points to an object and sometimes to an array. It seems like it
32 * should always do one or the other. Only used under "flow_mod_types" in the
34 * - "exactly_one" examples for "instruction_set" and "match_set"
35 * - "zero_or_one" is only used in "instruction_set" and only to point to a single object;
36 * never to an array. It seems like it should always point to an array, even
37 * if it is an array with a single element.
39 * - SPEC: It's really unclear how these work. For example, "instruction_set" usually points
40 * to a list, but at the bottom of page 26 it points to an object with a single
41 * "exactly_one" list. While at the top of page 27, it points to a list which contains
42 * an object with a single "zero_or_more" list.
43 * - SPEC: It's not clear what "optional support" vs. "optional use" meta-member keywords are.
46 * => where are (and aren't) universal ttp properties valid?
47 * - everywhere but lists? this seems the most likely.
50 namespace "urn:onf:ttp";
53 // Not using these because the TTP spec makes it difficult to reuse prior modeling efforts. Maybe
54 // we can use it in the future.
55 //import openflow-extensible-match {prefix oxm;}
56 //import openflow-instruction {prefix ofi;}
57 //import openflow-types {prefix oft;}
60 description "ONF TTP schema 2014/07/11";
63 grouping name-property {
64 description "denotes something that has a name, which is a string";
71 grouping opt-tag-property {
72 description "denotes strings that represent optional functionality in the TTP";
79 grouping doc-property {
80 description "denotes something that has documentation as a list of strings";
87 grouping universal-TTP-properties {
88 //SPEC: exactly what can have have these?
89 description "these properties are applicable to all objects in TTPs";
92 uses opt-tag-property;
97 grouping type-property {
98 description "denotes something that has a type identified with a string";
105 grouping NDM_metadata-properties {
106 description "metadata about an NDM (or TTP)";
112 leaf OF_protocol_version {
121 uses universal-TTP-properties;
124 grouping action-properties {
125 uses universal-TTP-properties;
128 // REFINE: enum ofp_action_type string after "OFPAT_"
131 type string; // REFINE: port number or variable name or reserved port name (enum ofp_port_no
132 // string after "OFPP_")
135 type string; // TODO: or number?
138 type string; // TODO: or number?
141 description "MPLS or IP TTL";
145 type string; // TODO: or number?
148 type string; // REFINE: enum oxm_ofb_match_fields string after "OFPXMT_OFB_"
151 type string; // REFINE: value for the field being set, e.g., bitmap of the appropriate size,
156 grouping action-all-properties{
157 uses action-properties;
159 uses action-properties;
162 uses action-properties;
166 // possible bug in yangtools? using this works, but pasting it's content where it's used fails
167 grouping action-zero-exactly-one-properties {
168 uses action-properties;
170 uses action-all-properties;
173 uses action-all-properties;
176 //TODO: are these two allowed here?
178 uses action-all-properties;
181 uses action-all-properties;
185 grouping match_set-properties {
187 // SPEC: mentions that pre-requisites are assumed even if not listed
188 // SPEC: this implies requirement that explicit pre-reqs that mismatch are illegal
190 uses universal-TTP-properties;
192 type string; //REFINE: enum oxm_ofb_match_fields string after "OFPXMT_OFB_"
193 // type identityref {
194 // base oxm:match-field;
197 leaf match_type { // was "wc_type" in older (pre-spec) TTP
199 enum exact; // exact match, as if all mask bits = 1 (also default)
200 enum mask; // arbitrary mask field allowed for this field
201 // SPEC: is it clear what happens if no mask present? All 1's?
202 enum prefix; // mask must be contiguous ones from MSB of field (like subnet mask)
203 enum all_or_exact; // field may be omitted, but exact match if present
206 leaf mask { // has 1's where must match. Presence and value must agree with match_type
207 type string; // a string representing numbers (dec, hex, etc)
210 type string; // either a variable name or fixed value for the field
211 // REFINE: add pattern to say it's either a string or variable?
212 // SPEC: would be nice if this was easier to specify in a schema
214 leaf const_mask { // mask for specifying value bits that cannot be varied
216 // SPEC: would be good to have an example! [There is one on the middle of page 24]
218 leaf const_value { // value used to specify the value of unvarying bits
221 // SPEC: seems like const_mask and const_value must come together?
222 // SPEC: const_mask and const_value invalid with "exact" or "all_or_exact"?
223 // SPEC: const_mask and const_value valid with mask...but prefix? Clarify
227 grouping instruction_set-properties {
228 uses universal-TTP-properties;
230 type string; //REFINE: enum ofp_instruction_type string after "OFPIT_"
232 // Perhaps come back to this approach?
233 // type identityref {
234 // base oft:instruction-base;
238 type string; //REFINE: should be the name of a table defined here
241 type uint64; //SPEC: is this an integer in JSON or a string storing a 64-bit value?
244 type uint64; //SPEC: is this an integer in JSON or a string storing a 64-bit value?
247 uses action-zero-exactly-one-properties;
251 // SPEC: this belongs in "instruction_set" not in "actions"
255 grouping flow_mod-properties {
256 uses universal-TTP-properties;
259 "Must have exactly one of priority or priority_rank. Integer greater than zero, or an
260 integer range of the form \"n..m\" where n and m are integers with 0 < n < m.";
261 type string; //REFINE: add pattern for integer or integer range
263 // TODO: all flow_mod_type entries must select the same one of priority and priority_rank
264 // SPEC: how to schema the constraints on priority?
268 "Must have exactly one of priority or priority_rank. An integer greater than zero
269 indicating relative priority of flow_mod_types.";
270 type string; // strings that represent numbers
272 // SPEC: priority ranks must be unique within flow table?
273 // SPEC: priority-rank is incompatible with built-in-flow-mods
274 // SPEC: That is, cannot be used in the same flow table (see below)
277 // NOTE: in the ODL version, this *must* be a list (in the spec it can also be a singleton)
278 uses match_set-properties;
280 uses match_set-properties;
283 uses match_set-properties;
286 list instruction_set {
287 // NOTE: in the ODL version, this *must* be a list (in the spec it can also be a singleton)
288 description "A list of the instructions possible. Can also optionally include lists of
289 other instructions in the \"exactly_one\" and \"zero_or_one\" lists.";
290 uses instruction_set-properties;
292 uses instruction_set-properties;
295 uses instruction_set-properties;
297 // TODO: I think the intention is to be ale to specify multiple entries for exactly_one
298 // as well as zero_or_one, but this gives one list. We could do a list of lists, but
299 // the inner lists wouldn't be anonymous.
300 // SPEC: The spec says this is an array, but there are examples where it is not, e.g., the
301 // bottom of page 26.
305 grouping table-type-pattern-properties {
306 container NDM_metadata {
307 uses NDM_metadata-properties;
311 uses universal-TTP-properties;
316 //REFINE: we can add a regex patter to restrict this
317 //REFINE: also make sure range in YANG doesn't do this
333 type string; //TODO: is this a string?
334 //SPEC: not state what this is.
337 type string; //TODO: is this a string?
338 //SPEC: not state what this is.
341 //SPEC: should be clearer about Variables vs. Identifiers
345 uses universal-TTP-properties;
348 //REFINE: can we restrict this more than just a string?
352 list table_map { // intentionally not using the "univ TTP props"
362 //SPEC: you can't do what is there in YANG, maybe put name in the tables in flow_tables?
365 container meter_table {
366 uses universal-TTP-properties;
368 uses universal-TTP-properties;
370 uses universal-TTP-properties;
379 //REFINE: use a regex patter?
380 //SPEC: make min and max as ints?
384 //REFINE: use a regex patter?
385 //SPEC: make min and max as ints?
389 list built_in_meters {
390 uses universal-TTP-properties;
392 type uint32; //borrowed from OF spec
396 //REFINE: should be enum ofp_meter_band_type string after "OFPMBT_"
412 uses universal-TTP-properties;
413 list flow_mod_types {
414 uses flow_mod-properties;
416 uses flow_mod-properties;
419 uses flow_mod-properties;
422 uses flow_mod-properties;
425 list built_in_flow_mods {
426 uses flow_mod-properties;
428 // SPEC: says "usually are flow_mods that ..." Usually? Always?
430 // built-ins are flow_mods, not just templates like flow_mod_types
431 // so the allowed fields are similar
432 // can we leverage similarity, or do we need to repeat the fields?
433 // as flow-mod-types get more complex, leverage is important
435 // SPEC: Only "priority" allowed for built-ins? (rank doesn't work?) (rank doesn't work
436 // because implies "specified later")
437 // SPEC: if built-in and flow-mod-types are defined for same table...
438 // and if "priority" is required for built-in, then...
439 // then flow-mod-types in same table must be "priority" (not rank)
441 // SPEC: For built-in flow mods, these are not templates (constraints), but actual flow
442 // mods. For flow mod, match type is expressed, not described as such, "match_type"
443 // seems pointless? Or maybe "prefix"? const_value and const_mask meaningless
446 uses universal-TTP-properties; //REFINE: "name" is a required field, used as alias
449 //REFINE: should be "MISS", a flow_mod_type name or a "built_in_flow_mod" name
454 list group_entry_types {
455 uses universal-TTP-properties;
457 type string; // REFINE: enum ofp_group_type string after "OFPGT_"
460 uses universal-TTP-properties;
462 uses action-zero-exactly-one-properties;
468 uses universal-TTP-properties;
470 uses action-zero-exactly-one-properties;
472 //SPEC: no examples in the spec and text is ambiguous
476 uses universal-TTP-properties;
482 //TODO: is this sufficient?
483 //SPEC: this seems ambiguous in the spec
489 uses universal-TTP-properties;
491 description "a list of strings each of which must be the name of a
492 table from the table_map or the name of a table in square
495 //SPEC: rework, can't have this in YANG
496 // We wanted: "flow_paths": ["path": ["table1", ["table2"] ] ]
497 // We did: "flow_paths": ["path": ["table1", "[table2]" ] ]
500 description "a list of strings each of which must be the name of a
501 table from the table_map or the name of a table in square
505 //REFINE: this is really either path or no-path. can we do better in modeling?
506 //SPEC: could be clearer about whether you can mix path and no-path and if so, what happens.
510 uses universal-TTP-properties;
514 container opendaylight-ttps {
515 container table-type-patterns {
516 list table-type-pattern {
517 uses table-type-pattern-properties;
520 description "The global TTP registry for OpenDaylight";