blob: e73fa9a08d2acf194e4869ac4a4e515330e6d3b9 [file] [log] [blame]
Andrea Campanella2cfe8ef2017-07-13 19:45:15 +02001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Andrea Campanella2cfe8ef2017-07-13 19:45:15 +02003 *
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 */
16package org.onosproject.net.flow;
17
18import com.fasterxml.jackson.databind.node.ObjectNode;
19import org.onosproject.codec.CodecContext;
20import org.onosproject.net.driver.HandlerBehaviour;
21import org.onosproject.net.flow.instructions.ExtensionTreatment;
22
23/**
24 * Interface for encode and decode extension treatment.
25 */
26public interface ExtensionTreatmentCodec extends HandlerBehaviour {
27
28 /**
29 * Encodes an extension treatment to an JSON object.
30 *
31 * @param extensionTreatment extension treatment
32 * @param context encoding context
33 * @return JSON object
34 */
35 default ObjectNode encode(ExtensionTreatment extensionTreatment, CodecContext context) {
36 return null;
37 }
38
39 /**
40 * Decodes an JSON object to an extension treatment.
41 *
42 * @param objectNode JSON object
43 * @param context decoding context
44 * @return extension treatment
45 */
46 default ExtensionTreatment decode(ObjectNode objectNode, CodecContext context) {
47 return null;
48 }
49}