Fix initializer for vpp classifier
[honeycomb.git] / v3po / api / src / main / yang / vpp-classifier.yang
1 module vpp-classifier {
2   yang-version 1;
3   namespace "urn:opendaylight:params:xml:ns:yang:vpp:classifier";
4   prefix "vpp-classifier";
5
6   revision "2015-06-03" {
7     description
8       "Initial revision of model for VPP packet classifier.
9       The model can be used ony to implement ACLs.
10       Other classify table usages are not supported yet,
11       see https://jira.fd.io/browse/VPP-203 for details.";
12     reference
13       "https://wiki.fd.io/view/VPP/Introduction_To_N-tuple_Classifiers";
14   }
15
16   import ietf-yang-types {
17     prefix "yang";
18   }
19
20   typedef classify-table-ref {
21     type leafref {
22       path "/vpp-classifier:vpp-classifier/classify-table/name";
23     }
24     description
25       "This type is used by data models that need to reference
26        configured classify tables.";
27   }
28
29   typedef packet-handling-action {
30     type enumeration {
31       enum "deny" {
32         // by VPP convention, first neighbour node (at index 0) is a drop node
33         value 0;
34       }
35       enum "permit" {
36         value -1; // indicates that the next node not set
37       }
38     }
39   }
40
41   typedef vpp-node {
42     type union {
43       // FIXME: enable after VPP-203 is fixed
44       // type string; // name of vpp-node neighbour, TODO: base node also needs to be defined
45       type packet-handling-action;
46     }
47     description
48       "Defines VPP node reference using relative node name or packet handling action.";
49   }
50
51   typedef opaque-index {
52     type union {
53       type vpp-node;
54       type uint32;
55     }
56     description
57       "Defines opaque-index type - metadata that can be attached to session-hit packets.
58        Vpp nodes can't be referenced by index, because node indexes might change after vpp restart.";
59   }
60
61   grouping classify-session-attributes {
62     description
63       "Defines classify session attributes that are mapped to classify_add_del_session
64        and classify_session_details messages parameters.";
65
66     leaf hit_next {
67       type vpp-node;
68       mandatory true;
69       description
70         "Vpp node to which packet will be send when it produces a match.";
71     }
72     leaf opaque_index {
73       type opaque-index;
74     }
75     leaf advance {
76       type int32;
77       default 0;
78       description
79         "Nodes like ip4/6-classify use the parameter to \"consume\" networking layer.
80         Example: tunnel decapsulation.";
81     }
82   }
83
84   grouping classify-table-base-attributes {
85     description
86       "Defines classify table attributes that are mapped to classify_add_del_table message parameters.";
87
88     leaf nbuckets {
89       mandatory true;
90       type uint32;
91       description
92         "Used by classifier hashing algorithm. It is not possible to resize the bucket array,
93         therefore suggested value is approximate number of expected entries.";
94     }
95     leaf skip_n_vectors {
96       type uint32;
97       default 0;
98       description
99         "Number of 16 byte vectors to be skipped before applying mask.";
100     }
101     leaf next_table {
102       type classify-table-ref;
103       description
104         "Reference to the next classify table. Required when multiple table chaining is used.";
105     }
106     leaf miss_next {
107       mandatory true;
108       type vpp-node;
109       description
110         "Vpp node to which packet will be send when it falis to produce a match";
111     }
112     leaf mask {
113       type yang:hex-string;
114       mandatory true;
115       description
116         "Defines match mask (multiple of 16 bytes)";
117     }
118
119     list classify-session {
120       key "match";
121
122       leaf match {
123         type yang:hex-string;
124         description
125           "Defines actual value to be matched that is
126            a byte vector, which length is multiple of 16 bytes";
127
128         must "string-length(match) = string-length(../../mask)" {
129           error-message
130             "Match length is not equal to classify table mask length.";
131           description
132             "Match length must be equal to classify table mask length.";
133         }
134       }
135
136       uses classify-session-attributes;
137     }
138   }
139
140   grouping classify-table-config-attributes {
141     description
142       "Defines classify table config only attributes (present in classify_add_del_table message
143        but not in classify_table_info_reply).";
144
145     // FIXME move to classify-table-base-attributes
146     // after https://jira.fd.io/browse/VPP-208 is fixed
147     leaf memory_size {
148       type uint32;
149       mandatory true;
150       description
151         "Memory size for classify table and its entries.";
152     }
153   }
154
155   grouping classify-table-operational-attributes {
156     description
157       "Defines classify table operational attributes (present in classify_table_info_reply message
158        but not in classify_add_del_table).";
159
160     leaf active_sessions {
161       type uint32;
162       config false;
163       description
164         "Number of sessions defined for the classify table.";
165     }
166   }
167
168   container vpp-classifier {
169     list classify-table {
170       key "name";
171
172       leaf name {
173         type string;
174         description
175           "Hides classify table identifier managed by vpp.";
176       }
177
178       uses classify-table-base-attributes;
179       uses classify-table-config-attributes;
180     }
181   }
182
183   container vpp-classifier-state {
184     config false;
185
186     list classify-table {
187       key "name";
188
189       leaf name {
190         type string;
191         description
192           "Hides classify table identifier managed by vpp.";
193       }
194
195       uses classify-table-base-attributes;
196       uses classify-table-operational-attributes;
197     }
198   }
199
200 }