Jian Li
Committed by Gerrit Code Review

[ONOS-2225] Implement REST API for Flow Objectives

This commit implements REST API for Flow Objective Service.
The corresponding unit test will be followed in a separated commit.

Change-Id: I94d1dc6cfc07fc9d07fcf8c303c8e395b40ed122
...@@ -43,7 +43,8 @@ public class CoreWebApplication extends AbstractWebApplication { ...@@ -43,7 +43,8 @@ public class CoreWebApplication extends AbstractWebApplication {
43 ConfigWebResource.class, 43 ConfigWebResource.class,
44 PathsWebResource.class, 44 PathsWebResource.class,
45 StatisticsWebResource.class, 45 StatisticsWebResource.class,
46 - MetricsWebResource.class 46 + MetricsWebResource.class,
47 + FlowObjectiveWebResource.class
47 ); 48 );
48 } 49 }
49 } 50 }
...\ No newline at end of file ...\ No newline at end of file
......
1 +/*
2 + * Copyright 2016 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.rest.resources;
17 +
18 +import com.fasterxml.jackson.databind.JsonNode;
19 +import com.fasterxml.jackson.databind.node.ObjectNode;
20 +import org.onosproject.net.DeviceId;
21 +import org.onosproject.net.flowobjective.FilteringObjective;
22 +import org.onosproject.net.flowobjective.FlowObjectiveService;
23 +import org.onosproject.net.flowobjective.ForwardingObjective;
24 +import org.onosproject.net.flowobjective.NextObjective;
25 +import org.onosproject.rest.AbstractWebResource;
26 +
27 +import javax.ws.rs.Consumes;
28 +import javax.ws.rs.GET;
29 +import javax.ws.rs.POST;
30 +import javax.ws.rs.Path;
31 +import javax.ws.rs.PathParam;
32 +import javax.ws.rs.Produces;
33 +import javax.ws.rs.core.MediaType;
34 +import javax.ws.rs.core.Response;
35 +import java.io.IOException;
36 +import java.io.InputStream;
37 +import java.net.URI;
38 +import java.net.URISyntaxException;
39 +
40 +/**
41 + * Manage flow objectives.
42 + */
43 +@Path("flowobjectives")
44 +public class FlowObjectiveWebResource extends AbstractWebResource {
45 +
46 + public static final String DEVICE_INVALID =
47 + "Invalid deviceId in objective creation request";
48 + public static final String POLICY_INVALID = "Invalid policy";
49 +
50 + final FlowObjectiveService flowObjectiveService = get(FlowObjectiveService.class);
51 + final ObjectNode root = mapper().createObjectNode();
52 +
53 + /**
54 + * Creates and installs a new filtering objective for the specified device.
55 + *
56 + * @param deviceId device identifier
57 + * @param stream filtering objective JSON
58 + * @return status of the request - CREATED if the JSON is correct,
59 + * BAD_REQUEST if the JSON is invalid
60 + * @onos.rsModel FilteringObjective
61 + */
62 + @POST
63 + @Path("{deviceId}/filter")
64 + @Consumes(MediaType.APPLICATION_JSON)
65 + @Produces(MediaType.APPLICATION_JSON)
66 + public Response createFilteringObjective(@PathParam("deviceId") String deviceId,
67 + InputStream stream) {
68 + URI location = null;
69 + try {
70 + ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
71 + if (validateDeviceId(deviceId, jsonTree)) {
72 + DeviceId did = DeviceId.deviceId(deviceId);
73 + FilteringObjective filteringObjective =
74 + codec(FilteringObjective.class).decode(jsonTree, this);
75 + flowObjectiveService.filter(did, filteringObjective);
76 + location = new URI(Integer.toString(filteringObjective.id()));
77 + }
78 + } catch (IOException | URISyntaxException e) {
79 + throw new IllegalArgumentException(e);
80 + }
81 +
82 + return Response
83 + .created(location)
84 + .build();
85 + }
86 +
87 + /**
88 + * Creates and installs a new forwarding objective for the specified device.
89 + *
90 + * @param deviceId device identifier
91 + * @param stream forwarding objective JSON
92 + * @return status of the request - CREATED if the JSON is correct,
93 + * BAD_REQUEST if the JSON is invalid
94 + * @onos.rsModel ForwardingObjective
95 + */
96 + @POST
97 + @Path("{deviceId}/forward")
98 + @Consumes(MediaType.APPLICATION_JSON)
99 + @Produces(MediaType.APPLICATION_JSON)
100 + public Response createForwardingObjective(@PathParam("deviceId") String deviceId,
101 + InputStream stream) {
102 + URI location = null;
103 + try {
104 + ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
105 + if (validateDeviceId(deviceId, jsonTree)) {
106 + DeviceId did = DeviceId.deviceId(deviceId);
107 + ForwardingObjective forwardingObjective =
108 + codec(ForwardingObjective.class).decode(jsonTree, this);
109 + flowObjectiveService.forward(did, forwardingObjective);
110 + location = new URI(Integer.toString(forwardingObjective.id()));
111 + }
112 + } catch (IOException | URISyntaxException e) {
113 + throw new IllegalArgumentException(e);
114 + }
115 +
116 + return Response
117 + .created(location)
118 + .build();
119 + }
120 +
121 + /**
122 + * Creates and installs a new next objective for the specified device.
123 + *
124 + * @param deviceId device identifier
125 + * @param stream next objective JSON
126 + * @return status of the request - CREATED if the JSON is correct,
127 + * BAD_REQUEST if the JSON is invalid
128 + * @onos.rsModel NextObjective
129 + */
130 + @POST
131 + @Path("{deviceId}/next")
132 + @Consumes(MediaType.APPLICATION_JSON)
133 + @Produces(MediaType.APPLICATION_JSON)
134 + public Response createNextObjective(@PathParam("deviceId") String deviceId,
135 + InputStream stream) {
136 + URI location = null;
137 + try {
138 + ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
139 + if (validateDeviceId(deviceId, jsonTree)) {
140 + DeviceId did = DeviceId.deviceId(deviceId);
141 + NextObjective nextObjective =
142 + codec(NextObjective.class).decode(jsonTree, this);
143 + flowObjectiveService.next(did, nextObjective);
144 + location = new URI(Integer.toString(nextObjective.id()));
145 + }
146 + } catch (IOException | URISyntaxException e) {
147 + throw new IllegalArgumentException(e);
148 + }
149 +
150 + return Response
151 + .created(location)
152 + .build();
153 + }
154 +
155 + /**
156 + * Returns the globally unique nextId.
157 + *
158 + * @return nextId
159 + * @onos.rsModel nextid
160 + */
161 + @GET
162 + @Path("next")
163 + @Produces(MediaType.APPLICATION_JSON)
164 + public Response getNextId() {
165 + root.put("nextId", flowObjectiveService.allocateNextId());
166 + return ok(root).build();
167 + }
168 +
169 + /**
170 + * Installs the filtering rules onto the specified device.
171 + *
172 + * @param stream filtering rule JSON
173 + * @return status of the request
174 + * @onos.rsModel ObjectivePolicy
175 + */
176 + @POST
177 + @Path("policy")
178 + @Consumes(MediaType.APPLICATION_JSON)
179 + @Produces(MediaType.APPLICATION_JSON)
180 + public void initPolicy(InputStream stream) {
181 +
182 + try {
183 + ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
184 + JsonNode policyJson = jsonTree.get("policy");
185 +
186 + if (policyJson == null || policyJson.asText().isEmpty()) {
187 + throw new IllegalArgumentException(POLICY_INVALID);
188 + }
189 +
190 + flowObjectiveService.initPolicy(policyJson.asText());
191 + } catch (IOException e) {
192 + throw new IllegalArgumentException(e);
193 + }
194 + }
195 +
196 + /**
197 + * Validate the deviceId that is contained in json string against the
198 + * input deviceId.
199 + *
200 + * @param deviceId device identifier
201 + * @param node object node
202 + * @return validity
203 + */
204 + private boolean validateDeviceId(String deviceId, ObjectNode node) {
205 + JsonNode specifiedDeviceId = node.get("deviceId");
206 +
207 + if (specifiedDeviceId != null &&
208 + !specifiedDeviceId.asText().equals(deviceId)) {
209 + throw new IllegalArgumentException(DEVICE_INVALID);
210 + }
211 + return true;
212 + }
213 +}
1 +{
2 + "type": "object",
3 + "title": "filteringObjective",
4 + "required": [
5 + "type",
6 + "priority",
7 + "timeout",
8 + "isPermanent",
9 + "deviceId",
10 + "operation",
11 + "key",
12 + "conditions",
13 + "meta"
14 + ],
15 + "properties": {
16 + "type": {
17 + "type": "string",
18 + "example": "PERMIT"
19 + },
20 + "priority": {
21 + "type": "integer",
22 + "format": "int64",
23 + "example": 400000
24 + },
25 + "timeout": {
26 + "type": "integer",
27 + "format": "int64",
28 + "example": 0
29 + },
30 + "isPermanent": {
31 + "type": "boolean",
32 + "example": true
33 + },
34 + "deviceId": {
35 + "type": "string",
36 + "example": "of:0000000000000001"
37 + },
38 + "operation": {
39 + "type": "string",
40 + "example": "ADD"
41 + },
42 + "key": {
43 + "type": "object",
44 + "title": "key",
45 + "properties": {
46 + "type": {
47 + "type": "string",
48 + "description": "Ethernet field name",
49 + "example": "ETH_TYPE"
50 + },
51 + "ethType": {
52 + "type": "int64",
53 + "format": "int64",
54 + "example": "0x88cc",
55 + "description": "Ethernet frame type"
56 + },
57 + "mac": {
58 + "type": "string",
59 + "example": "00:00:11:00:00:01"
60 + },
61 + "port": {
62 + "type": "int64",
63 + "format": "int64",
64 + "example": 1,
65 + "description": "Match port"
66 + },
67 + "metadata": {
68 + "type": "Hex16",
69 + "format": "Hex16",
70 + "example": "0xabcdL",
71 + "description": "Metadata passed between tables"
72 + },
73 + "vlanId": {
74 + "type": "uint16",
75 + "format": "uint16",
76 + "example": "0x1000"
77 + },
78 + "priority": {
79 + "type": "int64",
80 + "format": "int64",
81 + "example": 1,
82 + "description": "VLAN priority."
83 + },
84 + "ipDscp": {
85 + "type": "byte",
86 + "format": "byte",
87 + "description": "IP DSCP (6 bits in ToS field)"
88 + },
89 + "ipEcn": {
90 + "type": "byte",
91 + "format": "byte",
92 + "description": "IP ECN (2 bits in ToS field)."
93 + },
94 + "protocol": {
95 + "type": "uint16",
96 + "format": "uint16",
97 + "example": 1,
98 + "description": "IP protocol"
99 + },
100 + "ip": {
101 + "type": "string",
102 + "example": "10.1.1.0/24",
103 + "description": "IP source address"
104 + },
105 + "tcpPort": {
106 + "type": "integer",
107 + "format": "uint16",
108 + "example": 1,
109 + "description": "TCP source address"
110 + },
111 + "udpPort": {
112 + "type": "uint16",
113 + "format": "uint16",
114 + "example": 1,
115 + "description": "UDP source address"
116 + },
117 + "sctpPort": {
118 + "type": "uint16",
119 + "format": "uint16",
120 + "example": 1,
121 + "description": "SCTP source address"
122 + },
123 + "icmpType": {
124 + "type": "uint16",
125 + "format": "uint16",
126 + "example": 1,
127 + "description": "Internet Control Message Protocol for IPV4 code (RFC0792)"
128 + },
129 + "icmpCode": {
130 + "type": "uint16",
131 + "format": "uint16",
132 + "example": 1,
133 + "description": "Internet Control Message Protocol for IPV4 code (RFC0792)"
134 + },
135 + "flowLabel": {
136 + "type": "Hex16",
137 + "format": "Hex16",
138 + "example": "0xffffe",
139 + "description": "IPv6 Flow Label (RFC 6437)"
140 + },
141 + "icmpv6Type": {
142 + "type": "uint16",
143 + "format": "uint16",
144 + "example": 1,
145 + "description": "Internet Control Message Protocol for IPV6 type (RFC2463)"
146 + },
147 + "icmpv6Code": {
148 + "type": "uint16",
149 + "format": "uint16",
150 + "example": 1,
151 + "description": "Internet Control Message Protocol for IPV6 code (RFC2463)"
152 + },
153 + "targetAddress": {
154 + "type": "String",
155 + "example": "10.1.1.0/24",
156 + "description": "IPv6 Neighbor discovery target address"
157 + },
158 + "label": {
159 + "type": "int32",
160 + "format": "int32",
161 + "example": 1,
162 + "description": "MPLS label"
163 + },
164 + "exthdrFlags": {
165 + "type": "int64",
166 + "format": "int64",
167 + "example": 1,
168 + "description": "IPv6 extension header pseudo-field"
169 + },
170 + "lambda": {
171 + "type": "int64",
172 + "format": "int64",
173 + "example": 1,
174 + "description": "wavelength abstraction"
175 + },
176 + "gridType": {
177 + "type": "String",
178 + "example": "DWDM",
179 + "description": "Type of wavelength grid"
180 + },
181 + "channelSpacing": {
182 + "type": "int64",
183 + "format": "int64",
184 + "example": 100,
185 + "description": "Optical channel spacing"
186 + },
187 + "spacingMultiplier": {
188 + "type": "integer",
189 + "format": "int64",
190 + "example": 4,
191 + "description": "Optical channel spacing multiplier"
192 + },
193 + "slotGranularity": {
194 + "type": "int64",
195 + "format": "int64",
196 + "example": 8
197 + },
198 + "ochSignalId": {
199 + "type": "integer",
200 + "format": "int64",
201 + "example": 1,
202 + "description": "Optical channel signal ID"
203 + },
204 + "tunnelId": {
205 + "type": "int64",
206 + "format": "int64",
207 + "example": 5,
208 + "description": "Tunnel ID"
209 + },
210 + "ochSignalType": {
211 + "type": "int64",
212 + "format": "int64",
213 + "example": 1,
214 + "description": "Optical channel signal type"
215 + },
216 + "oduSignalId": {
217 + "type": "int64",
218 + "format": "int64",
219 + "example": 1,
220 + "description": "ODU (Optical channel Data Unit) signal ID."
221 + },
222 + "tributaryPortNumber": {
223 + "type": "int64",
224 + "format": "int64",
225 + "example": 11,
226 + "description": "OPU (Optical channel Payload Unit) port number."
227 + },
228 + "tributarySlotLen": {
229 + "type": "int64",
230 + "format": "int64",
231 + "example": 80,
232 + "description": "OPU (Optical channel Payload Unit) slot length."
233 + },
234 + "tributarySlotBitmap": {
235 + "type": "array",
236 + "title": "tributarySlotBitmap",
237 + "description": "OPU (Optical channel Payload Unit) slot bitmap.",
238 + "required": [
239 + "byte",
240 + "port"
241 + ],
242 + "items": {
243 + "type": "byte",
244 + "title": "byte",
245 + "example": 1
246 + }
247 + },
248 + "oduSignalType": {
249 + "type": "int64",
250 + "format": "int64",
251 + "example": 4,
252 + "description": "ODU (Optical channel Data Unit) signal type."
253 + }
254 + }
255 + },
256 + "conditions": {
257 + "type": "array",
258 + "xml": {
259 + "name": "conditions",
260 + "wrapped": true
261 + },
262 + "items": {
263 + "type": "object",
264 + "title": "conditions",
265 + "properties": {
266 + "type": {
267 + "type": "string",
268 + "description": "Ethernet field name",
269 + "example": "ETH_TYPE"
270 + },
271 + "ethType": {
272 + "type": "int64",
273 + "format": "int64",
274 + "example": "0x88cc",
275 + "description": "Ethernet frame type"
276 + },
277 + "mac": {
278 + "type": "string",
279 + "example": "00:00:11:00:00:01"
280 + },
281 + "port": {
282 + "type": "int64",
283 + "format": "int64",
284 + "example": 1,
285 + "description": "Match port"
286 + },
287 + "metadata": {
288 + "type": "Hex16",
289 + "format": "Hex16",
290 + "example": "0xabcdL",
291 + "description": "Metadata passed between tables"
292 + },
293 + "vlanId": {
294 + "type": "uint16",
295 + "format": "uint16",
296 + "example": "0x1000"
297 + },
298 + "priority": {
299 + "type": "int64",
300 + "format": "int64",
301 + "example": 1,
302 + "description": "VLAN priority."
303 + },
304 + "ipDscp": {
305 + "type": "byte",
306 + "format": "byte",
307 + "description": "IP DSCP (6 bits in ToS field)"
308 + },
309 + "ipEcn": {
310 + "type": "byte",
311 + "format": "byte",
312 + "description": "IP ECN (2 bits in ToS field)."
313 + },
314 + "protocol": {
315 + "type": "uint16",
316 + "format": "uint16",
317 + "example": 1,
318 + "description": "IP protocol"
319 + },
320 + "ip": {
321 + "type": "string",
322 + "example": "10.1.1.0/24",
323 + "description": "IP source address"
324 + },
325 + "tcpPort": {
326 + "type": "integer",
327 + "format": "uint16",
328 + "example": 1,
329 + "description": "TCP source address"
330 + },
331 + "udpPort": {
332 + "type": "uint16",
333 + "format": "uint16",
334 + "example": 1,
335 + "description": "UDP source address"
336 + },
337 + "sctpPort": {
338 + "type": "uint16",
339 + "format": "uint16",
340 + "example": 1,
341 + "description": "SCTP source address"
342 + },
343 + "icmpType": {
344 + "type": "uint16",
345 + "format": "uint16",
346 + "example": 1,
347 + "description": "Internet Control Message Protocol for IPV4 code (RFC0792)"
348 + },
349 + "icmpCode": {
350 + "type": "uint16",
351 + "format": "uint16",
352 + "example": 1,
353 + "description": "Internet Control Message Protocol for IPV4 code (RFC0792)"
354 + },
355 + "flowLabel": {
356 + "type": "Hex16",
357 + "format": "Hex16",
358 + "example": "0xffffe",
359 + "description": "IPv6 Flow Label (RFC 6437)"
360 + },
361 + "icmpv6Type": {
362 + "type": "uint16",
363 + "format": "uint16",
364 + "example": 1,
365 + "description": "Internet Control Message Protocol for IPV6 type (RFC2463)"
366 + },
367 + "icmpv6Code": {
368 + "type": "uint16",
369 + "format": "uint16",
370 + "example": 1,
371 + "description": "Internet Control Message Protocol for IPV6 code (RFC2463)"
372 + },
373 + "targetAddress": {
374 + "type": "String",
375 + "example": "10.1.1.0/24",
376 + "description": "IPv6 Neighbor discovery target address"
377 + },
378 + "label": {
379 + "type": "int32",
380 + "format": "int32",
381 + "example": 1,
382 + "description": "MPLS label"
383 + },
384 + "exthdrFlags": {
385 + "type": "int64",
386 + "format": "int64",
387 + "example": 1,
388 + "description": "IPv6 extension header pseudo-field"
389 + },
390 + "lambda": {
391 + "type": "int64",
392 + "format": "int64",
393 + "example": 1,
394 + "description": "wavelength abstraction"
395 + },
396 + "gridType": {
397 + "type": "String",
398 + "example": "DWDM",
399 + "description": "Type of wavelength grid"
400 + },
401 + "channelSpacing": {
402 + "type": "int64",
403 + "format": "int64",
404 + "example": 100,
405 + "description": "Optical channel spacing"
406 + },
407 + "spacingMultiplier": {
408 + "type": "integer",
409 + "format": "int64",
410 + "example": 4,
411 + "description": "Optical channel spacing multiplier"
412 + },
413 + "slotGranularity": {
414 + "type": "int64",
415 + "format": "int64",
416 + "example": 8
417 + },
418 + "ochSignalId": {
419 + "type": "integer",
420 + "format": "int64",
421 + "example": 1,
422 + "description": "Optical channel signal ID"
423 + },
424 + "tunnelId": {
425 + "type": "int64",
426 + "format": "int64",
427 + "example": 5,
428 + "description": "Tunnel ID"
429 + },
430 + "ochSignalType": {
431 + "type": "int64",
432 + "format": "int64",
433 + "example": 1,
434 + "description": "Optical channel signal type"
435 + },
436 + "oduSignalId": {
437 + "type": "int64",
438 + "format": "int64",
439 + "example": 1,
440 + "description": "ODU (Optical channel Data Unit) signal ID."
441 + },
442 + "tributaryPortNumber": {
443 + "type": "int64",
444 + "format": "int64",
445 + "example": 11,
446 + "description": "OPU (Optical channel Payload Unit) port number."
447 + },
448 + "tributarySlotLen": {
449 + "type": "int64",
450 + "format": "int64",
451 + "example": 80,
452 + "description": "OPU (Optical channel Payload Unit) slot length."
453 + },
454 + "tributarySlotBitmap": {
455 + "type": "array",
456 + "title": "tributarySlotBitmap",
457 + "description": "OPU (Optical channel Payload Unit) slot bitmap.",
458 + "required": [
459 + "byte",
460 + "port"
461 + ],
462 + "items": {
463 + "type": "byte",
464 + "title": "byte",
465 + "example": 1
466 + }
467 + },
468 + "oduSignalType": {
469 + "type": "int64",
470 + "format": "int64",
471 + "example": 4,
472 + "description": "ODU (Optical channel Data Unit) signal type."
473 + }
474 + }
475 + }
476 + },
477 + "treatment": {
478 + "type": "object",
479 + "title": "treatment",
480 + "required": [
481 + "instructions"
482 + ],
483 + "properties": {
484 + "instructions": {
485 + "type": "array",
486 + "title": "treatment",
487 + "required": [
488 + "properties",
489 + "port"
490 + ],
491 + "items": {
492 + "type": "object",
493 + "title": "instructions",
494 + "required": [
495 + "type",
496 + "port"
497 + ],
498 + "properties": {
499 + "type": {
500 + "type": "string",
501 + "example": "OUTPUT"
502 + },
503 + "port": {
504 + "type": "string",
505 + "example": "CONTROLLER"
506 + }
507 + }
508 + }
509 + }
510 + }
511 + }
512 + }
513 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "type": "object",
3 + "title": "forwardingObjective",
4 + "required": [
5 + "flag",
6 + "priority",
7 + "timeout",
8 + "isPermanent",
9 + "deviceId",
10 + "operation",
11 + "selector",
12 + "treatment"
13 + ],
14 + "properties": {
15 + "flag": {
16 + "type": "string",
17 + "example": "SPECIFIC"
18 + },
19 + "priority": {
20 + "type": "integer",
21 + "format": "int64",
22 + "example": 400000
23 + },
24 + "timeout": {
25 + "type": "integer",
26 + "format": "int64",
27 + "example": 0
28 + },
29 + "isPermanent": {
30 + "type": "boolean",
31 + "example": true
32 + },
33 + "deviceId": {
34 + "type": "string",
35 + "example": "of:0000000000000001"
36 + },
37 + "operation": {
38 + "type": "string",
39 + "example": "ADD"
40 + },
41 + "selector": {
42 + "type": "object",
43 + "title": "selector",
44 + "required": [
45 + "criteria"
46 + ],
47 + "properties": {
48 + "criteria": {
49 + "type": "array",
50 + "xml": {
51 + "name": "criteria",
52 + "wrapped": true
53 + },
54 + "items": {
55 + "type": "object",
56 + "title": "criteria",
57 + "properties": {
58 + "type": {
59 + "type": "string",
60 + "description": "Ethernet field name",
61 + "example": "ETH_TYPE"
62 + },
63 + "ethType": {
64 + "type": "int64",
65 + "format": "int64",
66 + "example": "0x88cc",
67 + "description": "Ethernet frame type"
68 + },
69 + "mac": {
70 + "type": "string",
71 + "example": "00:00:11:00:00:01"
72 + },
73 + "port": {
74 + "type": "int64",
75 + "format": "int64",
76 + "example": 1,
77 + "description": "Match port"
78 + },
79 + "metadata": {
80 + "type": "Hex16",
81 + "format": "Hex16",
82 + "example": "0xabcdL",
83 + "description": "Metadata passed between tables"
84 + },
85 + "vlanId": {
86 + "type": "uint16",
87 + "format": "uint16",
88 + "example": "0x1000"
89 + },
90 + "priority": {
91 + "type": "int64",
92 + "format": "int64",
93 + "example": 1,
94 + "description": "VLAN priority."
95 + },
96 + "ipDscp": {
97 + "type": "byte",
98 + "format": "byte",
99 + "description": "IP DSCP (6 bits in ToS field)"
100 + },
101 + "ipEcn": {
102 + "type": "byte",
103 + "format": "byte",
104 + "description": "IP ECN (2 bits in ToS field)."
105 + },
106 + "protocol": {
107 + "type": "uint16",
108 + "format": "uint16",
109 + "example": 1,
110 + "description": "IP protocol"
111 + },
112 + "ip": {
113 + "type": "string",
114 + "example": "10.1.1.0/24",
115 + "description": "IP source address"
116 + },
117 + "tcpPort": {
118 + "type": "integer",
119 + "format": "uint16",
120 + "example": 1,
121 + "description": "TCP source address"
122 + },
123 + "udpPort": {
124 + "type": "uint16",
125 + "format": "uint16",
126 + "example": 1,
127 + "description": "UDP source address"
128 + },
129 + "sctpPort": {
130 + "type": "uint16",
131 + "format": "uint16",
132 + "example": 1,
133 + "description": "SCTP source address"
134 + },
135 + "icmpType": {
136 + "type": "uint16",
137 + "format": "uint16",
138 + "example": 1,
139 + "description": "Internet Control Message Protocol for IPV4 code (RFC0792)"
140 + },
141 + "icmpCode": {
142 + "type": "uint16",
143 + "format": "uint16",
144 + "example": 1,
145 + "description": "Internet Control Message Protocol for IPV4 code (RFC0792)"
146 + },
147 + "flowLabel": {
148 + "type": "Hex16",
149 + "format": "Hex16",
150 + "example": "0xffffe",
151 + "description": "IPv6 Flow Label (RFC 6437)"
152 + },
153 + "icmpv6Type": {
154 + "type": "uint16",
155 + "format": "uint16",
156 + "example": 1,
157 + "description": "Internet Control Message Protocol for IPV6 type (RFC2463)"
158 + },
159 + "icmpv6Code": {
160 + "type": "uint16",
161 + "format": "uint16",
162 + "example": 1,
163 + "description": "Internet Control Message Protocol for IPV6 code (RFC2463)"
164 + },
165 + "targetAddress": {
166 + "type": "String",
167 + "example": "10.1.1.0/24",
168 + "description": "IPv6 Neighbor discovery target address"
169 + },
170 + "label": {
171 + "type": "int32",
172 + "format": "int32",
173 + "example": 1,
174 + "description": "MPLS label"
175 + },
176 + "exthdrFlags": {
177 + "type": "int64",
178 + "format": "int64",
179 + "example": 1,
180 + "description": "IPv6 extension header pseudo-field"
181 + },
182 + "lambda": {
183 + "type": "int64",
184 + "format": "int64",
185 + "example": 1,
186 + "description": "wavelength abstraction"
187 + },
188 + "gridType": {
189 + "type": "String",
190 + "example": "DWDM",
191 + "description": "Type of wavelength grid"
192 + },
193 + "channelSpacing": {
194 + "type": "int64",
195 + "format": "int64",
196 + "example": 100,
197 + "description": "Optical channel spacing"
198 + },
199 + "spacingMultiplier": {
200 + "type": "integer",
201 + "format": "int64",
202 + "example": 4,
203 + "description": "Optical channel spacing multiplier"
204 + },
205 + "slotGranularity": {
206 + "type": "int64",
207 + "format": "int64",
208 + "example": 8
209 + },
210 + "ochSignalId": {
211 + "type": "integer",
212 + "format": "int64",
213 + "example": 1,
214 + "description": "Optical channel signal ID"
215 + },
216 + "tunnelId": {
217 + "type": "int64",
218 + "format": "int64",
219 + "example": 5,
220 + "description": "Tunnel ID"
221 + },
222 + "ochSignalType": {
223 + "type": "int64",
224 + "format": "int64",
225 + "example": 1,
226 + "description": "Optical channel signal type"
227 + },
228 + "oduSignalId": {
229 + "type": "int64",
230 + "format": "int64",
231 + "example": 1,
232 + "description": "ODU (Optical channel Data Unit) signal ID."
233 + },
234 + "tributaryPortNumber": {
235 + "type": "int64",
236 + "format": "int64",
237 + "example": 11,
238 + "description": "OPU (Optical channel Payload Unit) port number."
239 + },
240 + "tributarySlotLen": {
241 + "type": "int64",
242 + "format": "int64",
243 + "example": 80,
244 + "description": "OPU (Optical channel Payload Unit) slot length."
245 + },
246 + "tributarySlotBitmap": {
247 + "type": "array",
248 + "title": "tributarySlotBitmap",
249 + "description": "OPU (Optical channel Payload Unit) slot bitmap.",
250 + "required": [
251 + "byte",
252 + "port"
253 + ],
254 + "items": {
255 + "type": "byte",
256 + "title": "byte",
257 + "example": 1
258 + }
259 + },
260 + "oduSignalType": {
261 + "type": "int64",
262 + "format": "int64",
263 + "example": 4,
264 + "description": "ODU (Optical channel Data Unit) signal type."
265 + }
266 + }
267 + }
268 + }
269 + }
270 + },
271 + "treatment": {
272 + "type": "object",
273 + "title": "treatment",
274 + "required": [
275 + "instructions"
276 + ],
277 + "properties": {
278 + "instructions": {
279 + "type": "array",
280 + "title": "treatment",
281 + "required": [
282 + "properties",
283 + "port"
284 + ],
285 + "items": {
286 + "type": "object",
287 + "title": "instructions",
288 + "required": [
289 + "type",
290 + "port"
291 + ],
292 + "properties": {
293 + "type": {
294 + "type": "string",
295 + "example": "OUTPUT"
296 + },
297 + "port": {
298 + "type": "string",
299 + "example": "CONTROLLER"
300 + }
301 + }
302 + }
303 + }
304 + }
305 + }
306 + }
307 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "type": "object",
3 + "title": "nextId",
4 + "required": [
5 + "id"
6 + ],
7 + "properties": {
8 + "nextId": {
9 + "type": "integer",
10 + "format": "int64",
11 + "example": 3
12 + }
13 + }
14 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "type": "object",
3 + "title": "nextObjective",
4 + "required": [
5 + "type",
6 + "priority",
7 + "timeout",
8 + "isPermanent",
9 + "deviceId",
10 + "operation",
11 + "meta",
12 + "treatments"
13 + ],
14 + "properties": {
15 + "type": {
16 + "type": "string",
17 + "example": "HASHED"
18 + },
19 + "priority": {
20 + "type": "integer",
21 + "format": "int64",
22 + "example": 400000
23 + },
24 + "timeout": {
25 + "type": "integer",
26 + "format": "int64",
27 + "example": 0
28 + },
29 + "isPermanent": {
30 + "type": "boolean",
31 + "example": true
32 + },
33 + "deviceId": {
34 + "type": "string",
35 + "example": "of:0000000000000001"
36 + },
37 + "operation": {
38 + "type": "string",
39 + "example": "ADD"
40 + },
41 + "meta": {
42 + "type": "object",
43 + "title": "meta",
44 + "required": [
45 + "criteria"
46 + ],
47 + "properties": {
48 + "criteria": {
49 + "type": "array",
50 + "xml": {
51 + "name": "criteria",
52 + "wrapped": true
53 + },
54 + "items": {
55 + "type": "object",
56 + "title": "criteria",
57 + "properties": {
58 + "type": {
59 + "type": "string",
60 + "description": "Ethernet field name",
61 + "example": "ETH_TYPE"
62 + },
63 + "ethType": {
64 + "type": "int64",
65 + "format": "int64",
66 + "example": "0x88cc",
67 + "description": "Ethernet frame type"
68 + },
69 + "mac": {
70 + "type": "string",
71 + "example": "00:00:11:00:00:01"
72 + },
73 + "port": {
74 + "type": "int64",
75 + "format": "int64",
76 + "example": 1,
77 + "description": "Match port"
78 + },
79 + "metadata": {
80 + "type": "Hex16",
81 + "format": "Hex16",
82 + "example": "0xabcdL",
83 + "description": "Metadata passed between tables"
84 + },
85 + "vlanId": {
86 + "type": "uint16",
87 + "format": "uint16",
88 + "example": "0x1000"
89 + },
90 + "priority": {
91 + "type": "int64",
92 + "format": "int64",
93 + "example": 1,
94 + "description": "VLAN priority."
95 + },
96 + "ipDscp": {
97 + "type": "byte",
98 + "format": "byte",
99 + "description": "IP DSCP (6 bits in ToS field)"
100 + },
101 + "ipEcn": {
102 + "type": "byte",
103 + "format": "byte",
104 + "description": "IP ECN (2 bits in ToS field)."
105 + },
106 + "protocol": {
107 + "type": "uint16",
108 + "format": "uint16",
109 + "example": 1,
110 + "description": "IP protocol"
111 + },
112 + "ip": {
113 + "type": "string",
114 + "example": "10.1.1.0/24",
115 + "description": "IP source address"
116 + },
117 + "tcpPort": {
118 + "type": "integer",
119 + "format": "uint16",
120 + "example": 1,
121 + "description": "TCP source address"
122 + },
123 + "udpPort": {
124 + "type": "uint16",
125 + "format": "uint16",
126 + "example": 1,
127 + "description": "UDP source address"
128 + },
129 + "sctpPort": {
130 + "type": "uint16",
131 + "format": "uint16",
132 + "example": 1,
133 + "description": "SCTP source address"
134 + },
135 + "icmpType": {
136 + "type": "uint16",
137 + "format": "uint16",
138 + "example": 1,
139 + "description": "Internet Control Message Protocol for IPV4 code (RFC0792)"
140 + },
141 + "icmpCode": {
142 + "type": "uint16",
143 + "format": "uint16",
144 + "example": 1,
145 + "description": "Internet Control Message Protocol for IPV4 code (RFC0792)"
146 + },
147 + "flowLabel": {
148 + "type": "Hex16",
149 + "format": "Hex16",
150 + "example": "0xffffe",
151 + "description": "IPv6 Flow Label (RFC 6437)"
152 + },
153 + "icmpv6Type": {
154 + "type": "uint16",
155 + "format": "uint16",
156 + "example": 1,
157 + "description": "Internet Control Message Protocol for IPV6 type (RFC2463)"
158 + },
159 + "icmpv6Code": {
160 + "type": "uint16",
161 + "format": "uint16",
162 + "example": 1,
163 + "description": "Internet Control Message Protocol for IPV6 code (RFC2463)"
164 + },
165 + "targetAddress": {
166 + "type": "String",
167 + "example": "10.1.1.0/24",
168 + "description": "IPv6 Neighbor discovery target address"
169 + },
170 + "label": {
171 + "type": "int32",
172 + "format": "int32",
173 + "example": 1,
174 + "description": "MPLS label"
175 + },
176 + "exthdrFlags": {
177 + "type": "int64",
178 + "format": "int64",
179 + "example": 1,
180 + "description": "IPv6 extension header pseudo-field"
181 + },
182 + "lambda": {
183 + "type": "int64",
184 + "format": "int64",
185 + "example": 1,
186 + "description": "wavelength abstraction"
187 + },
188 + "gridType": {
189 + "type": "String",
190 + "example": "DWDM",
191 + "description": "Type of wavelength grid"
192 + },
193 + "channelSpacing": {
194 + "type": "int64",
195 + "format": "int64",
196 + "example": 100,
197 + "description": "Optical channel spacing"
198 + },
199 + "spacingMultiplier": {
200 + "type": "integer",
201 + "format": "int64",
202 + "example": 4,
203 + "description": "Optical channel spacing multiplier"
204 + },
205 + "slotGranularity": {
206 + "type": "int64",
207 + "format": "int64",
208 + "example": 8
209 + },
210 + "ochSignalId": {
211 + "type": "integer",
212 + "format": "int64",
213 + "example": 1,
214 + "description": "Optical channel signal ID"
215 + },
216 + "tunnelId": {
217 + "type": "int64",
218 + "format": "int64",
219 + "example": 5,
220 + "description": "Tunnel ID"
221 + },
222 + "ochSignalType": {
223 + "type": "int64",
224 + "format": "int64",
225 + "example": 1,
226 + "description": "Optical channel signal type"
227 + },
228 + "oduSignalId": {
229 + "type": "int64",
230 + "format": "int64",
231 + "example": 1,
232 + "description": "ODU (Optical channel Data Unit) signal ID."
233 + },
234 + "tributaryPortNumber": {
235 + "type": "int64",
236 + "format": "int64",
237 + "example": 11,
238 + "description": "OPU (Optical channel Payload Unit) port number."
239 + },
240 + "tributarySlotLen": {
241 + "type": "int64",
242 + "format": "int64",
243 + "example": 80,
244 + "description": "OPU (Optical channel Payload Unit) slot length."
245 + },
246 + "tributarySlotBitmap": {
247 + "type": "array",
248 + "title": "tributarySlotBitmap",
249 + "description": "OPU (Optical channel Payload Unit) slot bitmap.",
250 + "required": [
251 + "byte",
252 + "port"
253 + ],
254 + "items": {
255 + "type": "byte",
256 + "title": "byte",
257 + "example": 1
258 + }
259 + },
260 + "oduSignalType": {
261 + "type": "int64",
262 + "format": "int64",
263 + "example": 4,
264 + "description": "ODU (Optical channel Data Unit) signal type."
265 + }
266 + }
267 + }
268 + }
269 + }
270 + },
271 + "treatments": {
272 + "type": "array",
273 + "xml": {
274 + "name": "treatments",
275 + "wrapped": true
276 + },
277 + "items": {
278 + "type": "object",
279 + "title": "treatments",
280 + "properties": {
281 + "instructions": {
282 + "type": "array",
283 + "title": "instructions",
284 + "required": [
285 + "properties",
286 + "port"
287 + ],
288 + "items": {
289 + "type": "object",
290 + "title": "instructions",
291 + "required": [
292 + "type",
293 + "port"
294 + ],
295 + "properties": {
296 + "type": {
297 + "type": "string",
298 + "example": "OUTPUT"
299 + },
300 + "port": {
301 + "type": "string",
302 + "example": "CONTROLLER"
303 + }
304 + }
305 + }
306 + }
307 + }
308 + }
309 + }
310 + }
311 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "type": "object",
3 + "title": "objectivePolicy",
4 + "required": [
5 + "policy"
6 + ],
7 + "properties": {
8 + "policy": {
9 + "type": "string",
10 + "example": "policy expression"
11 + }
12 + }
13 +}
...\ No newline at end of file ...\ No newline at end of file