Jian Li
Committed by Gerrit Code Review

[ONOS-4258] Initial implementation of supporting extension in REST

- Support Nicira extension

Change-Id: I62bf4417e43459727ce7d4b1ac929c6cf0b7826f
Showing 27 changed files with 1028 additions and 18 deletions
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.codec;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onosproject.net.driver.HandlerBehaviour;
import org.onosproject.net.flow.criteria.ExtensionSelector;
/**
* Interface for encode and decode extension selector.
*/
public interface ExtensionSelectorCodec extends HandlerBehaviour {
/**
* Encodes an extension selector to an JSON object.
*
* @param extensionSelector extension selector
* @param context encoding context
* @return JSON object
*/
default ObjectNode encode(ExtensionSelector extensionSelector, CodecContext context) {
return null;
}
/**
* Decodes an JSON object to an extension selector.
*
* @param objectNode JSON object
* @param context decoding context
* @return extension selector
*/
default ExtensionSelector decode(ObjectNode objectNode, CodecContext context) {
return null;
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.codec;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onosproject.net.driver.HandlerBehaviour;
import org.onosproject.net.flow.instructions.ExtensionTreatment;
/**
* Interface for encode and decode extension treatment.
*/
public interface ExtensionTreatmentCodec extends HandlerBehaviour {
/**
* Encodes an extension treatment to an JSON object.
*
* @param extensionTreatment extension treatment
* @param context encoding context
* @return JSON object
*/
default ObjectNode encode(ExtensionTreatment extensionTreatment, CodecContext context) {
return null;
}
/**
* Decodes an JSON object to an extension treatment.
*
* @param objectNode JSON object
* @param context decoding context
* @return extension treatment
*/
default ExtensionTreatment decode(ObjectNode objectNode, CodecContext context) {
return null;
}
}
......@@ -79,6 +79,15 @@ public final class ExtensionTreatmentType {
this.type = type;
}
/**
* Returns extension treatment type.
*
* @return extension treatment type
*/
public int type() {
return type;
}
@Override
public int hashCode() {
return Objects.hash(type);
......
......@@ -15,20 +15,28 @@
*/
package org.onosproject.codec.impl;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onlab.osgi.DefaultServiceDirectory;
import org.onlab.osgi.ServiceDirectory;
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
import org.onlab.packet.MplsLabel;
import org.onlab.packet.TpPort;
import org.onlab.packet.VlanId;
import org.onlab.util.HexString;
import org.onosproject.codec.ExtensionTreatmentCodec;
import org.onosproject.core.DefaultGroupId;
import org.onosproject.core.GroupId;
import org.onosproject.net.ChannelSpacing;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
import org.onosproject.net.GridType;
import org.onosproject.net.OchSignal;
import org.onosproject.net.OduSignalId;
import org.onosproject.net.PortNumber;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.flow.instructions.ExtensionTreatment;
import org.onosproject.net.flow.instructions.Instruction;
import org.onosproject.net.flow.instructions.Instructions;
import org.onosproject.net.flow.instructions.L0ModificationInstruction;
......@@ -37,13 +45,16 @@ import org.onosproject.net.flow.instructions.L2ModificationInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction;
import org.onosproject.net.flow.instructions.L4ModificationInstruction;
import org.onosproject.net.meter.MeterId;
import org.slf4j.Logger;
import static org.onlab.util.Tools.nullIsIllegal;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Decoding portion of the instruction codec.
*/
public final class DecodeInstructionCodecHelper {
protected static final Logger log = getLogger(DecodeInstructionCodecHelper.class);
private final ObjectNode json;
/**
......@@ -227,6 +238,45 @@ public final class DecodeInstructionCodecHelper {
}
/**
* Decodes a extension instruction.
*
* @return extension treatment
*/
private Instruction decodeExtension() {
ObjectNode node = (ObjectNode) json.get(InstructionCodec.EXTENSION);
if (node != null) {
DeviceId deviceId = getDeviceId();
ServiceDirectory serviceDirectory = new DefaultServiceDirectory();
DeviceService deviceService = serviceDirectory.get(DeviceService.class);
Device device = deviceService.getDevice(deviceId);
if (device.is(ExtensionTreatmentCodec.class)) {
ExtensionTreatmentCodec treatmentCodec = device.as(ExtensionTreatmentCodec.class);
ExtensionTreatment treatment = treatmentCodec.decode(node, null);
return Instructions.extension(treatment, deviceId);
} else {
log.warn("There is no codec to decode extension for device {}", deviceId.toString());
}
}
return null;
}
/**
* Returns device identifier.
*
* @return device identifier
* @throws IllegalArgumentException if the JSON is invalid
*/
private DeviceId getDeviceId() {
JsonNode deviceIdNode = json.get(InstructionCodec.DEVICE_ID);
if (deviceIdNode != null) {
return DeviceId.deviceId(deviceIdNode.asText());
}
throw new IllegalArgumentException("Empty device identifier");
}
/**
* Extracts port number of the given json node.
*
* @param jsonNode json node
......@@ -290,6 +340,8 @@ public final class DecodeInstructionCodecHelper {
return decodeL3();
} else if (type.equals(Instruction.Type.L4MODIFICATION.name())) {
return decodeL4();
} else if (type.equals(Instruction.Type.EXTENSION.name())) {
return decodeExtension();
}
throw new IllegalArgumentException("Instruction type "
+ type + " is not supported");
......
......@@ -16,10 +16,16 @@
package org.onosproject.codec.impl;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onlab.osgi.DefaultServiceDirectory;
import org.onlab.osgi.ServiceDirectory;
import org.onlab.util.HexString;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.ExtensionTreatmentCodec;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
import org.onosproject.net.OchSignal;
import org.onosproject.net.OduSignalId;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.flow.instructions.Instruction;
import org.onosproject.net.flow.instructions.Instructions;
import org.onosproject.net.flow.instructions.L0ModificationInstruction;
......@@ -28,13 +34,14 @@ import org.onosproject.net.flow.instructions.L2ModificationInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction;
import org.onosproject.net.flow.instructions.L4ModificationInstruction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.slf4j.LoggerFactory.getLogger;
/**
* JSON encoding of Instructions.
*/
public final class EncodeInstructionCodecHelper {
protected static final Logger log = LoggerFactory.getLogger(EncodeInstructionCodecHelper.class);
protected static final Logger log = getLogger(EncodeInstructionCodecHelper.class);
private final Instruction instruction;
private final CodecContext context;
......@@ -219,14 +226,29 @@ public final class EncodeInstructionCodecHelper {
}
}
/**
* Encode a extension instruction.
* Encodes a extension instruction.
*
* @param result json node that the instruction attributes are added to
*/
private void encodeExtension(ObjectNode result) {
// TODO Support extension in REST API
log.info("Cannot convert instruction type of EXTENSION");
final Instructions.ExtensionInstructionWrapper extensionInstruction =
(Instructions.ExtensionInstructionWrapper) instruction;
DeviceId deviceId = extensionInstruction.deviceId();
ServiceDirectory serviceDirectory = new DefaultServiceDirectory();
DeviceService deviceService = serviceDirectory.get(DeviceService.class);
Device device = deviceService.getDevice(deviceId);
if (device.is(ExtensionTreatmentCodec.class)) {
ExtensionTreatmentCodec treatmentCodec = device.as(ExtensionTreatmentCodec.class);
ObjectNode node = treatmentCodec.encode(extensionInstruction.extensionInstruction(), context);
result.set(InstructionCodec.EXTENSION, node);
} else {
log.warn("There is no codec to encode extension for device {}", deviceId.toString());
}
}
/**
......
......@@ -57,6 +57,8 @@ public final class InstructionCodec extends JsonCodec<Instruction> {
protected static final String TRIBUTARY_PORT_NUMBER = "tributaryPortNumber";
protected static final String TRIBUTARY_SLOT_LEN = "tributarySlotLength";
protected static final String TRIBUTARY_SLOT_BITMAP = "tributarySlotBitmap";
protected static final String EXTENSION = "extension";
protected static final String DEVICE_ID = "deviceId";
protected static final String MISSING_MEMBER_MESSAGE =
" member is required in Instruction";
......
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.driver;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onosproject.codec.CodecService;
import org.onosproject.driver.extensions.MoveExtensionTreatment;
import org.onosproject.driver.extensions.NiciraMatchNshSi;
import org.onosproject.driver.extensions.NiciraMatchNshSpi;
import org.onosproject.driver.extensions.NiciraResubmit;
import org.onosproject.driver.extensions.NiciraResubmitTable;
import org.onosproject.driver.extensions.NiciraSetNshContextHeader;
import org.onosproject.driver.extensions.NiciraSetNshSi;
import org.onosproject.driver.extensions.NiciraSetNshSpi;
import org.onosproject.driver.extensions.NiciraSetTunnelDst;
import org.onosproject.driver.extensions.codec.MoveExtensionTreatmentCodec;
import org.onosproject.driver.extensions.codec.NiciraMatchNshSiCodec;
import org.onosproject.driver.extensions.codec.NiciraMatchNshSpiCodec;
import org.onosproject.driver.extensions.codec.NiciraResubmitCodec;
import org.onosproject.driver.extensions.codec.NiciraResubmitTableCodec;
import org.onosproject.driver.extensions.codec.NiciraSetNshContextHeaderCodec;
import org.onosproject.driver.extensions.codec.NiciraSetNshSiCodec;
import org.onosproject.driver.extensions.codec.NiciraSetNshSpiCodec;
import org.onosproject.driver.extensions.codec.NiciraSetTunnelDstCodec;
import org.slf4j.Logger;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Codec register for default drivers.
*/
@Component(immediate = true)
public class DefaultCodecRegister {
private final Logger log = getLogger(getClass());
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected CodecService codecService;
@Activate
public void activate() {
codecService.registerCodec(MoveExtensionTreatment.class, new MoveExtensionTreatmentCodec());
codecService.registerCodec(NiciraMatchNshSi.class, new NiciraMatchNshSiCodec());
codecService.registerCodec(NiciraMatchNshSpi.class, new NiciraMatchNshSpiCodec());
codecService.registerCodec(NiciraResubmit.class, new NiciraResubmitCodec());
codecService.registerCodec(NiciraResubmitTable.class, new NiciraResubmitTableCodec());
codecService.registerCodec(NiciraSetNshSi.class, new NiciraSetNshSiCodec());
codecService.registerCodec(NiciraSetNshSpi.class, new NiciraSetNshSpiCodec());
codecService.registerCodec(NiciraSetTunnelDst.class, new NiciraSetTunnelDstCodec());
codecService.registerCodec(NiciraSetNshContextHeader.class, new NiciraSetNshContextHeaderCodec());
log.info("Registered default driver codecs.");
}
@Deactivate
public void deactivate() {
codecService.unregisterCodec(MoveExtensionTreatment.class);
codecService.unregisterCodec(NiciraMatchNshSi.class);
codecService.unregisterCodec(NiciraMatchNshSpi.class);
codecService.unregisterCodec(NiciraResubmit.class);
codecService.unregisterCodec(NiciraResubmitTable.class);
codecService.unregisterCodec(NiciraSetNshSi.class);
codecService.unregisterCodec(NiciraSetNshSpi.class);
codecService.unregisterCodec(NiciraSetTunnelDst.class);
codecService.unregisterCodec(NiciraSetNshContextHeader.class);
log.info("Unregistered default driver codecs.");
}
}
......@@ -16,6 +16,8 @@
package org.onosproject.driver.extensions;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onosproject.codec.CodecContext;
import org.onosproject.net.behaviour.ExtensionSelectorResolver;
import org.onosproject.net.driver.AbstractHandlerBehaviour;
import org.onosproject.net.flow.criteria.ExtensionSelector;
......@@ -99,4 +101,16 @@ public class NiciraExtensionSelectorInterpreter
}
return null;
}
@Override
public ObjectNode encode(ExtensionSelector extensionSelector, CodecContext context) {
// TODO
return null;
}
@Override
public ExtensionSelector decode(ObjectNode json, CodecContext context) {
// TODO
return null;
}
}
......
......@@ -16,7 +16,9 @@
package org.onosproject.driver.extensions;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onlab.packet.Ip4Address;
import org.onosproject.codec.CodecContext;
import org.onosproject.net.PortNumber;
import org.onosproject.net.behaviour.ExtensionTreatmentResolver;
import org.onosproject.net.driver.AbstractHandlerBehaviour;
......@@ -35,6 +37,9 @@ import org.projectfloodlight.openflow.protocol.oxm.OFOxm;
import org.projectfloodlight.openflow.protocol.oxm.OFOxmTunnelIpv4Dst;
import org.projectfloodlight.openflow.types.IPv4Address;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.nullIsIllegal;
/**
* Interpreter for Nicira OpenFlow treatment extensions.
*/
......@@ -50,6 +55,18 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou
private static final int SUB_TYPE_RESUBMIT = 1;
private static final int SUB_TYPE_MOVE = 6;
private static final String TUNNEL_DST = "tunnelDst";
private static final String RESUBMIT = "resubmit";
private static final String RESUBMIT_TABLE = "resubmitTable";
private static final String NICIRA_NSH_SPI = "niciraNshSpi";
private static final String NICIRA_NSH_SI = "niciraNshSi";
private static final String NICIRA_NSH_CH = "niciraNshCh";
private static final String NICIRA_MOVE = "niciraMove";
private static final String TYPE = "type";
private static final String MISSING_MEMBER_MESSAGE = " member is required in NiciraExtensionTreatmentInterpreter";
@Override
public boolean supported(ExtensionTreatmentType extensionTreatmentType) {
if (extensionTreatmentType.equals(
......@@ -250,4 +267,106 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou
throw new UnsupportedOperationException(
"Driver does not support extension type " + type.toString());
}
@Override
public ObjectNode encode(ExtensionTreatment extensionTreatment, CodecContext context) {
checkNotNull(extensionTreatment, "Extension treatment cannot be null");
ExtensionTreatmentType type = extensionTreatment.type();
ObjectNode root = context.mapper().createObjectNode();
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type())) {
NiciraSetTunnelDst tunnelDst = (NiciraSetTunnelDst) extensionTreatment;
root.set(TUNNEL_DST, context.codec(NiciraSetTunnelDst.class).encode(tunnelDst, context));
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT.type())) {
NiciraResubmit resubmit = (NiciraResubmit) extensionTreatment;
root.set(RESUBMIT, context.codec(NiciraResubmit.class).encode(resubmit, context));
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT_TABLE.type())) {
NiciraResubmitTable resubmitTable = (NiciraResubmitTable) extensionTreatment;
root.set(RESUBMIT_TABLE, context.codec(NiciraResubmitTable.class).encode(resubmitTable, context));
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SPI.type())) {
NiciraSetNshSpi niciraNshSpi = (NiciraSetNshSpi) extensionTreatment;
root.set(NICIRA_NSH_SPI, context.codec(NiciraSetNshSpi.class).encode(niciraNshSpi, context));
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SI.type())) {
NiciraSetNshSi niciraNshSi = (NiciraSetNshSi) extensionTreatment;
root.set(NICIRA_NSH_SI, context.codec(NiciraSetNshSi.class).encode(niciraNshSi, context));
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH1.type())) {
NiciraSetNshContextHeader niciraNshch = (NiciraSetNshContextHeader) extensionTreatment;
root.set(NICIRA_NSH_CH, context.codec(NiciraSetNshContextHeader.class).encode(niciraNshch, context));
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH2.type())) {
NiciraSetNshContextHeader niciraNshch = (NiciraSetNshContextHeader) extensionTreatment;
root.set(NICIRA_NSH_CH, context.codec(NiciraSetNshContextHeader.class).encode(niciraNshch, context));
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH3.type())) {
NiciraSetNshContextHeader niciraNshch = (NiciraSetNshContextHeader) extensionTreatment;
root.set(NICIRA_NSH_CH, context.codec(NiciraSetNshContextHeader.class).encode(niciraNshch, context));
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH4.type())) {
NiciraSetNshContextHeader niciraNshch = (NiciraSetNshContextHeader) extensionTreatment;
root.set(NICIRA_NSH_CH, context.codec(NiciraSetNshContextHeader.class).encode(niciraNshch, context));
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SHA_TO_THA.type())
|| type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SPA_TO_TPA.type())
|| type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ETH_SRC_TO_DST.type())
|| type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_IP_SRC_TO_DST.type())) {
MoveExtensionTreatment mov = (MoveExtensionTreatment) extensionTreatment;
root.set(NICIRA_MOVE, context.codec(MoveExtensionTreatment.class).encode(mov, context));
}
return root;
}
@Override
public ExtensionTreatment decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse extension type
int typeInt = nullIsIllegal(json.get(TYPE), TYPE + MISSING_MEMBER_MESSAGE).asInt();
ExtensionTreatmentType type = new ExtensionTreatmentType(typeInt);
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type())) {
return context.codec(NiciraSetTunnelDst.class).decode(json, context);
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT.type())) {
return context.codec(NiciraResubmit.class).decode(json, context);
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT_TABLE.type())) {
return context.codec(NiciraResubmitTable.class).decode(json, context);
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SPI.type())) {
return context.codec(NiciraSetNshSpi.class).decode(json, context);
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SI.type())) {
return context.codec(NiciraSetNshSi.class).decode(json, context);
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH1.type())) {
return context.codec(NiciraSetNshContextHeader.class).decode(json, context);
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH2.type())) {
return context.codec(NiciraSetNshContextHeader.class).decode(json, context);
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH3.type())) {
return context.codec(NiciraSetNshContextHeader.class).decode(json, context);
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH4.type())) {
return context.codec(NiciraSetNshContextHeader.class).decode(json, context);
}
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SHA_TO_THA.type())
|| type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SPA_TO_TPA.type())
|| type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ETH_SRC_TO_DST.type())
|| type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_IP_SRC_TO_DST.type())) {
return context.codec(MoveExtensionTreatment.class).decode(json, context);
}
throw new UnsupportedOperationException(
"Driver does not support extension type " + type.toString());
}
}
......
......@@ -15,15 +15,15 @@
*/
package org.onosproject.driver.extensions;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
import org.onlab.util.KryoNamespace;
import org.onosproject.net.NshServiceIndex;
import org.onosproject.net.flow.AbstractExtension;
import org.onosproject.net.flow.criteria.ExtensionSelector;
import org.onosproject.net.flow.criteria.ExtensionSelectorType;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
/**
* Implementation of NSH Service Index(SI).
*/
......@@ -42,6 +42,15 @@ public final class NiciraMatchNshSi extends AbstractExtension implements Extensi
}
/**
* Creates an instance with initialized Nsh Service Index.
*
* @param nshSi nsh service index
*/
public NiciraMatchNshSi(NshServiceIndex nshSi) {
this.nshSi = nshSi;
}
/**
* Gets the nsh service index to match.
*
* @return the si to match
......
......@@ -41,6 +41,15 @@ public final class NiciraMatchNshSpi extends AbstractExtension implements Extens
}
/**
* Creates an instance with initialized Nsh Service Path ID.
*
* @param nshSpi nsh service path ID
*/
public NiciraMatchNshSpi(NshServicePathId nshSpi) {
this.nshSpi = nshSpi;
}
/**
* Gets the network service path id to match.
*
* @return the nshSpi to match
......
......@@ -53,7 +53,7 @@ public class NiciraSetNshContextHeader extends AbstractExtension implements
* @param nshCh nsh context header
* @param type extension treatment type
*/
NiciraSetNshContextHeader(NshContextHeader nshCh, ExtensionTreatmentType type) {
public NiciraSetNshContextHeader(NshContextHeader nshCh, ExtensionTreatmentType type) {
this.nshCh = nshCh;
this.type = type;
}
......
......@@ -48,7 +48,7 @@ public class NiciraSetNshSi extends AbstractExtension implements
*
* @param nshSi nsh service index
*/
NiciraSetNshSi(NshServiceIndex nshSi) {
public NiciraSetNshSi(NshServiceIndex nshSi) {
this.nshSi = nshSi;
}
......
......@@ -48,7 +48,7 @@ public class NiciraSetNshSpi extends AbstractExtension implements
*
* @param nshSpi nsh service path id
*/
NiciraSetNshSpi(NshServicePathId nshSpi) {
public NiciraSetNshSpi(NshServicePathId nshSpi) {
this.nshSpi = nshSpi;
}
......
......@@ -54,7 +54,7 @@ public class NiciraSetTunnelDst extends AbstractExtension implements
*
* @param tunnelDst tunnel destination IPv4 address
*/
NiciraSetTunnelDst(Ip4Address tunnelDst) {
public NiciraSetTunnelDst(Ip4Address tunnelDst) {
checkNotNull(tunnelDst);
this.tunnelDst = tunnelDst;
}
......
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.driver.extensions.codec;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.driver.extensions.DefaultMoveExtensionTreatment;
import org.onosproject.driver.extensions.MoveExtensionTreatment;
import org.onosproject.net.flow.instructions.ExtensionTreatmentType;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.nullIsIllegal;
/**
* JSON Codec for MoveExtensionTreatment class.
*/
public final class MoveExtensionTreatmentCodec extends JsonCodec<MoveExtensionTreatment> {
private static final String SRC_OFS = "srcOfs";
private static final String DST_OFS = "dstOfs";
private static final String N_BITS = "nBits";
private static final String SRC = "src";
private static final String DST = "dst";
private static final String TYPE = "type";
private static final String MISSING_MEMBER_MESSAGE = " member is required in MoveExtensionTreatment";
@Override
public ObjectNode encode(MoveExtensionTreatment moveExtensionTreatment, CodecContext context) {
checkNotNull(moveExtensionTreatment, "Move Extension Treatment cannot be null");
ObjectNode root = context.mapper().createObjectNode()
.put(SRC_OFS, moveExtensionTreatment.srcOffset())
.put(DST_OFS, moveExtensionTreatment.dstOffset())
.put(N_BITS, moveExtensionTreatment.nBits())
.put(SRC, moveExtensionTreatment.src())
.put(DST, moveExtensionTreatment.dst());
return root;
}
@Override
public MoveExtensionTreatment decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse extension treatment type
ExtensionTreatmentType type = new ExtensionTreatmentType(nullIsIllegal(json.get(TYPE),
TYPE + MISSING_MEMBER_MESSAGE).asInt());
// parse src off set
int srcOfs = nullIsIllegal(json.get(SRC_OFS), SRC_OFS + MISSING_MEMBER_MESSAGE).asInt();
// parse dst off set
int dstOfs = nullIsIllegal(json.get(DST_OFS), DST_OFS + MISSING_MEMBER_MESSAGE).asInt();
// parse n bits
int nBits = nullIsIllegal(json.get(N_BITS), N_BITS + MISSING_MEMBER_MESSAGE).asInt();
// parse src
int src = nullIsIllegal(json.get(SRC), SRC + MISSING_MEMBER_MESSAGE).asInt();
// parse dst
int dst = nullIsIllegal(json.get(DST), DST + MISSING_MEMBER_MESSAGE).asInt();
MoveExtensionTreatment moveExtensionTreatment =
new DefaultMoveExtensionTreatment(srcOfs, dstOfs, nBits, src, dst, type);
return moveExtensionTreatment;
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.driver.extensions.codec;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.driver.extensions.NiciraMatchNshSi;
import org.onosproject.net.NshServiceIndex;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.nullIsIllegal;
/**
* JSON Codec for NiciraMatchNshSi class.
*/
public final class NiciraMatchNshSiCodec extends JsonCodec<NiciraMatchNshSi> {
private static final String NSH_SERVICE_INDEX = "nsi";
private static final String MISSING_MEMBER_MESSAGE = " member is required in NiciraMatchNshSi";
@Override
public ObjectNode encode(NiciraMatchNshSi niciraMatchNshSi, CodecContext context) {
checkNotNull(niciraMatchNshSi, "Nicira Match Nsh Si cannot be null");
ObjectNode root = context.mapper().createObjectNode()
.put(NSH_SERVICE_INDEX, niciraMatchNshSi.nshSi().serviceIndex());
return root;
}
@Override
public NiciraMatchNshSi decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse nsh service index
short nshSiShort = (short) nullIsIllegal(json.get(NSH_SERVICE_INDEX),
NSH_SERVICE_INDEX + MISSING_MEMBER_MESSAGE).asInt();
NshServiceIndex nshSi = NshServiceIndex.of(nshSiShort);
NiciraMatchNshSi niciraMatchNshSi = new NiciraMatchNshSi(nshSi);
return niciraMatchNshSi;
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.driver.extensions.codec;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.driver.extensions.NiciraMatchNshSpi;
import org.onosproject.net.NshServicePathId;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.nullIsIllegal;
/**
* JSON Codec for NiciraMatchNshSpi class.
*/
public final class NiciraMatchNshSpiCodec extends JsonCodec<NiciraMatchNshSpi> {
private static final String NSH_PATH_ID = "nsp";
private static final String MISSING_MEMBER_MESSAGE = " member is required in NiciraMatchNshSpi";
@Override
public ObjectNode encode(NiciraMatchNshSpi niciraMatchNshSpi, CodecContext context) {
checkNotNull(niciraMatchNshSpi, "Nicira Match Nsh Spi cannot be null");
ObjectNode root = context.mapper().createObjectNode()
.put(NSH_PATH_ID, niciraMatchNshSpi.nshSpi().servicePathId());
return root;
}
@Override
public NiciraMatchNshSpi decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse nsh path id
int nshSpiInt = nullIsIllegal(json.get(NSH_PATH_ID),
NSH_PATH_ID + MISSING_MEMBER_MESSAGE).asInt();
NshServicePathId nshSpi = NshServicePathId.of(nshSpiInt);
NiciraMatchNshSpi niciraMatchNshSpi = new NiciraMatchNshSpi(nshSpi);
return niciraMatchNshSpi;
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.driver.extensions.codec;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.driver.extensions.NiciraResubmit;
import org.onosproject.net.PortNumber;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.nullIsIllegal;
/**
* JSON Codec for NiciraResubmit class.
*/
public final class NiciraResubmitCodec extends JsonCodec<NiciraResubmit> {
private static final String RESUBMIT_PORT = "inPort";
private static final String RESUBMIT_TABLE = "table";
private static final String MISSING_MEMBER_MESSAGE = " member is required in NiciraResubmit";
@Override
public ObjectNode encode(NiciraResubmit niciraResubmit, CodecContext context) {
checkNotNull(niciraResubmit, "Nicira Resubmit cannot be null");
ObjectNode root = context.mapper().createObjectNode()
.put(RESUBMIT_PORT, niciraResubmit.inPort().toLong())
.put(RESUBMIT_TABLE, niciraResubmit.table());
return root;
}
@Override
public NiciraResubmit decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse in port number
long portNumberLong = nullIsIllegal(json.get(RESUBMIT_PORT), RESUBMIT_PORT + MISSING_MEMBER_MESSAGE).asLong();
PortNumber portNumber = PortNumber.portNumber(portNumberLong);
NiciraResubmit niciraResubmit = new NiciraResubmit(portNumber);
return niciraResubmit;
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.driver.extensions.codec;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.driver.extensions.NiciraResubmitTable;
import org.onosproject.net.PortNumber;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.nullIsIllegal;
/**
* JSON Codec for NiciraResubmitTable class.
*/
public final class NiciraResubmitTableCodec extends JsonCodec<NiciraResubmitTable> {
private static final String RESUBMIT_PORT = "inPort";
private static final String RESUBMIT_TABLE = "table";
private static final String MISSING_MEMBER_MESSAGE = " member is required in NiciraResubmitTable";
@Override
public ObjectNode encode(NiciraResubmitTable niciraResubmitTable, CodecContext context) {
checkNotNull(niciraResubmitTable, "Nicira Resubmit Table cannot be null");
ObjectNode root = context.mapper().createObjectNode()
.put(RESUBMIT_PORT, niciraResubmitTable.inPort().toLong())
.put(RESUBMIT_TABLE, niciraResubmitTable.table());
return root;
}
@Override
public NiciraResubmitTable decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse in port number
long portNumberLong = nullIsIllegal(json.get(RESUBMIT_PORT),
RESUBMIT_PORT + MISSING_MEMBER_MESSAGE).asLong();
PortNumber portNumber = PortNumber.portNumber(portNumberLong);
// parse table id
short tableId = (short) nullIsIllegal(json.get(RESUBMIT_TABLE),
RESUBMIT_TABLE + MISSING_MEMBER_MESSAGE).asInt();
NiciraResubmitTable niciraResubmitTable = new NiciraResubmitTable(portNumber, tableId);
return niciraResubmitTable;
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.driver.extensions.codec;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.driver.extensions.NiciraSetNshContextHeader;
import org.onosproject.net.NshContextHeader;
import org.onosproject.net.flow.instructions.ExtensionTreatmentType;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.nullIsIllegal;
/**
* JSON Codec for NiciraSetNshContextHeader class.
*/
public class NiciraSetNshContextHeaderCodec extends JsonCodec<NiciraSetNshContextHeader> {
private static final String NSH_CONTEXT_HEADER = "nshch";
private static final String TYPE = "type";
private static final String MISSING_MEMBER_MESSAGE = " member is required in NiciraSetNshContextHeader";
@Override
public ObjectNode encode(NiciraSetNshContextHeader niciraSetNshContextHeader, CodecContext context) {
checkNotNull(niciraSetNshContextHeader, "Nicira Set Nsh Context Header cannot be null");
ObjectNode root = context.mapper().createObjectNode()
.put(NSH_CONTEXT_HEADER, niciraSetNshContextHeader.nshCh().nshContextHeader())
.put(TYPE, niciraSetNshContextHeader.type().type());
return root;
}
@Override
public NiciraSetNshContextHeader decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse nsh context header
int contextHeaderInt = nullIsIllegal(json.get(NSH_CONTEXT_HEADER),
NSH_CONTEXT_HEADER + MISSING_MEMBER_MESSAGE).asInt();
NshContextHeader contextHeader = NshContextHeader.of(contextHeaderInt);
// parse type
int extensionTypeInt = nullIsIllegal(json.get(TYPE),
TYPE + MISSING_MEMBER_MESSAGE).asInt();
ExtensionTreatmentType type = new ExtensionTreatmentType(extensionTypeInt);
NiciraSetNshContextHeader niciraSetNshContextHeader =
new NiciraSetNshContextHeader(contextHeader, type);
return niciraSetNshContextHeader;
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.driver.extensions.codec;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.driver.extensions.NiciraSetNshSi;
import org.onosproject.net.NshServiceIndex;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.nullIsIllegal;
/**
* JSON Codec for NiciraSetNshSi class.
*/
public final class NiciraSetNshSiCodec extends JsonCodec<NiciraSetNshSi> {
private static final String NSH_SERVICE_INDEX = "setNsi";
private static final String MISSING_MEMBER_MESSAGE = " member is required in NiciraSetNshSi";
@Override
public ObjectNode encode(NiciraSetNshSi niciraSetNshSi, CodecContext context) {
checkNotNull(niciraSetNshSi, "Nicira Set Nsh Si cannot be null");
ObjectNode root = context.mapper().createObjectNode()
.put(NSH_SERVICE_INDEX, niciraSetNshSi.nshSi().serviceIndex());
return root;
}
@Override
public NiciraSetNshSi decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse service index port
short serviceIndexShort = (short) nullIsIllegal(json.get(NSH_SERVICE_INDEX),
NSH_SERVICE_INDEX + MISSING_MEMBER_MESSAGE).asInt();
NshServiceIndex index = NshServiceIndex.of(serviceIndexShort);
NiciraSetNshSi niciraSetNshSi = new NiciraSetNshSi(index);
return niciraSetNshSi;
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.driver.extensions.codec;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.driver.extensions.NiciraSetNshSpi;
import org.onosproject.net.NshServicePathId;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.nullIsIllegal;
/**
* JSON Codec for NiciraSetNshSpi class.
*/
public final class NiciraSetNshSpiCodec extends JsonCodec<NiciraSetNshSpi> {
private static final String NSH_PATH_ID = "setNsp";
private static final String MISSING_MEMBER_MESSAGE = " member is required in NiciraSetNshSpi";
@Override
public ObjectNode encode(NiciraSetNshSpi niciraSetNshSpi, CodecContext context) {
checkNotNull(niciraSetNshSpi, "Nicira Set Nsh Spi cannot be null");
ObjectNode root = context.mapper().createObjectNode()
.put(NSH_PATH_ID, niciraSetNshSpi.nshSpi().servicePathId());
return root;
}
@Override
public NiciraSetNshSpi decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse service path id
int servicePathIdInt = nullIsIllegal(json.get(NSH_PATH_ID),
NSH_PATH_ID + MISSING_MEMBER_MESSAGE).asInt();
NshServicePathId pathId = NshServicePathId.of(servicePathIdInt);
NiciraSetNshSpi niciraSetNshSpi = new NiciraSetNshSpi(pathId);
return niciraSetNshSpi;
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.driver.extensions.codec;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onlab.packet.Ip4Address;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.driver.extensions.NiciraSetTunnelDst;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.nullIsIllegal;
/**
* JSON Codec for NiciraSetTunnelDst class.
*/
public final class NiciraSetTunnelDstCodec extends JsonCodec<NiciraSetTunnelDst> {
private static final String TUNNEL_DST = "tunnelDst";
private static final String MISSING_MEMBER_MESSAGE = " member is required in NiciraSetTunnelDst";
@Override
public ObjectNode encode(NiciraSetTunnelDst niciraSetTunnelDst, CodecContext context) {
checkNotNull(niciraSetTunnelDst, "Nicira Set Tunnel DST cannot be null");
ObjectNode root = context.mapper().createObjectNode()
.put(TUNNEL_DST, niciraSetTunnelDst.tunnelDst().toString());
return root;
}
@Override
public NiciraSetTunnelDst decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse tunnel destination IP address
String dstIp = nullIsIllegal(json.get(TUNNEL_DST), TUNNEL_DST + MISSING_MEMBER_MESSAGE).asText();
Ip4Address tunnelDst = Ip4Address.valueOf(dstIp);
NiciraSetTunnelDst niciraSetTunnelDst = new NiciraSetTunnelDst(tunnelDst);
return niciraSetTunnelDst;
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Implementations of the codec broker and NICIRA and OFDPA extension JSON codecs.
*/
package org.onosproject.driver.extensions.codec;
......@@ -17,7 +17,7 @@
package org.onosproject.openflow.controller;
import com.google.common.annotations.Beta;
import org.onosproject.net.driver.HandlerBehaviour;
import org.onosproject.codec.ExtensionSelectorCodec;
import org.onosproject.net.flow.criteria.ExtensionSelector;
import org.onosproject.net.flow.criteria.ExtensionSelectorType;
import org.projectfloodlight.openflow.protocol.OFFactory;
......@@ -27,7 +27,7 @@ import org.projectfloodlight.openflow.protocol.oxm.OFOxm;
* Interprets extension selectors and converts them to/from OpenFlow objects.
*/
@Beta
public interface ExtensionSelectorInterpreter extends HandlerBehaviour {
public interface ExtensionSelectorInterpreter extends ExtensionSelectorCodec {
/**
* Returns true if the given extension selector is supported by this
......
......@@ -17,7 +17,7 @@
package org.onosproject.openflow.controller;
import com.google.common.annotations.Beta;
import org.onosproject.net.driver.HandlerBehaviour;
import org.onosproject.codec.ExtensionTreatmentCodec;
import org.onosproject.net.flow.instructions.ExtensionTreatment;
import org.onosproject.net.flow.instructions.ExtensionTreatmentType;
import org.projectfloodlight.openflow.protocol.OFFactory;
......@@ -27,7 +27,7 @@ import org.projectfloodlight.openflow.protocol.action.OFAction;
* Interprets extension treatments and converts them to/from OpenFlow objects.
*/
@Beta
public interface ExtensionTreatmentInterpreter extends HandlerBehaviour {
public interface ExtensionTreatmentInterpreter extends ExtensionTreatmentCodec {
/**
* Returns true if the given extension treatment is supported by this
......@@ -55,5 +55,4 @@ public interface ExtensionTreatmentInterpreter extends HandlerBehaviour {
* @throws UnsupportedOperationException if driver does not support extension type
*/
ExtensionTreatment mapAction(OFAction action) throws UnsupportedOperationException;
}
......