decoupling extension types from of protocol
numbers renaming extension instruction to
extension treatment
Change-Id: Ie949d6235c2a5a984f7c7867262f8336721f1ee7
diff --git a/drivers/src/main/java/org/onosproject/driver/extensions/NiciraExtensionInterpreter.java b/drivers/src/main/java/org/onosproject/driver/extensions/NiciraExtensionTreatmentInterpreter.java
similarity index 63%
rename from drivers/src/main/java/org/onosproject/driver/extensions/NiciraExtensionInterpreter.java
rename to drivers/src/main/java/org/onosproject/driver/extensions/NiciraExtensionTreatmentInterpreter.java
index b8f1fd9..544888d 100644
--- a/drivers/src/main/java/org/onosproject/driver/extensions/NiciraExtensionInterpreter.java
+++ b/drivers/src/main/java/org/onosproject/driver/extensions/NiciraExtensionTreatmentInterpreter.java
@@ -17,11 +17,11 @@
package org.onosproject.driver.extensions;
import org.onlab.packet.Ip4Address;
-import org.onosproject.net.behaviour.ExtensionResolver;
+import org.onosproject.net.behaviour.ExtensionTreatmentResolver;
import org.onosproject.net.driver.AbstractHandlerBehaviour;
-import org.onosproject.net.flow.instructions.ExtensionInstruction;
-import org.onosproject.net.flow.instructions.ExtensionType;
-import org.onosproject.openflow.controller.ExtensionInterpreter;
+import org.onosproject.net.flow.instructions.ExtensionTreatment;
+import org.onosproject.net.flow.instructions.ExtensionTreatmentType;
+import org.onosproject.openflow.controller.ExtensionTreatmentInterpreter;
import org.projectfloodlight.openflow.protocol.OFActionType;
import org.projectfloodlight.openflow.protocol.OFFactory;
import org.projectfloodlight.openflow.protocol.action.OFAction;
@@ -33,36 +33,38 @@
/**
* Interpreter for Nicira OpenFlow extensions.
*/
-public class NiciraExtensionInterpreter extends AbstractHandlerBehaviour
- implements ExtensionInterpreter, ExtensionResolver {
+public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviour
+ implements ExtensionTreatmentInterpreter, ExtensionTreatmentResolver {
@Override
- public boolean supported(ExtensionType extensionType) {
- if (extensionType.equals(ExtensionType.ExtensionTypes.NICIRA_SET_TUNNEL_DST.type())) {
+ public boolean supported(ExtensionTreatmentType extensionTreatmentType) {
+ if (extensionTreatmentType.equals(
+ ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type())) {
return true;
}
- if (extensionType.equals(ExtensionType.ExtensionTypes.NICIRA_RESUBMIT.type())) {
+ if (extensionTreatmentType.equals(
+ ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT.type())) {
return true;
}
return false;
}
@Override
- public OFAction mapInstruction(OFFactory factory, ExtensionInstruction extensionInstruction) {
- ExtensionType type = extensionInstruction.type();
- if (type.equals(ExtensionType.ExtensionTypes.NICIRA_SET_TUNNEL_DST.type())) {
- NiciraSetTunnelDst tunnelDst = (NiciraSetTunnelDst) extensionInstruction;
+ public OFAction mapInstruction(OFFactory factory, ExtensionTreatment extensionTreatment) {
+ ExtensionTreatmentType type = extensionTreatment.type();
+ if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type())) {
+ NiciraSetTunnelDst tunnelDst = (NiciraSetTunnelDst) extensionTreatment;
return factory.actions().setField(factory.oxms().tunnelIpv4Dst(
IPv4Address.of(tunnelDst.tunnelDst().toInt())));
}
- if (type.equals(ExtensionType.ExtensionTypes.NICIRA_RESUBMIT.type())) {
+ if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT.type())) {
// TODO this will be implemented later
}
return null;
}
@Override
- public ExtensionInstruction mapAction(OFAction action) {
+ public ExtensionTreatment mapAction(OFAction action) {
if (action.getType().equals(OFActionType.SET_FIELD)) {
OFActionSetField setFieldAction = (OFActionSetField) action;
OFOxm<?> oxm = setFieldAction.getField();
@@ -79,11 +81,11 @@
}
@Override
- public ExtensionInstruction getExtensionInstruction(ExtensionType type) {
- if (type.equals(ExtensionType.ExtensionTypes.NICIRA_SET_TUNNEL_DST.type())) {
+ public ExtensionTreatment getExtensionInstruction(ExtensionTreatmentType type) {
+ if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type())) {
return new NiciraSetTunnelDst();
}
- if (type.equals(ExtensionType.ExtensionTypes.NICIRA_RESUBMIT.type())) {
+ if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT.type())) {
return new NiciraResubmit();
}
throw new UnsupportedOperationException(
diff --git a/drivers/src/main/java/org/onosproject/driver/extensions/NiciraResubmit.java b/drivers/src/main/java/org/onosproject/driver/extensions/NiciraResubmit.java
index 0fd1731..481b6f9 100644
--- a/drivers/src/main/java/org/onosproject/driver/extensions/NiciraResubmit.java
+++ b/drivers/src/main/java/org/onosproject/driver/extensions/NiciraResubmit.java
@@ -19,8 +19,8 @@
import com.google.common.base.MoreObjects;
import org.onlab.util.KryoNamespace;
import org.onosproject.net.PortNumber;
-import org.onosproject.net.flow.instructions.AbstractExtensionInstruction;
-import org.onosproject.net.flow.instructions.ExtensionType;
+import org.onosproject.net.flow.instructions.AbstractExtensionTreatment;
+import org.onosproject.net.flow.instructions.ExtensionTreatmentType;
import org.onosproject.store.serializers.PortNumberSerializer;
import java.util.Objects;
@@ -30,7 +30,7 @@
/**
* Nicira resubmit extension instruction.
*/
-public class NiciraResubmit extends AbstractExtensionInstruction {
+public class NiciraResubmit extends AbstractExtensionTreatment {
private PortNumber inPort;
@@ -66,8 +66,8 @@
}
@Override
- public ExtensionType type() {
- return ExtensionType.ExtensionTypes.NICIRA_RESUBMIT.type();
+ public ExtensionTreatmentType type() {
+ return ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT.type();
}
@Override
diff --git a/drivers/src/main/java/org/onosproject/driver/extensions/NiciraSetTunnelDst.java b/drivers/src/main/java/org/onosproject/driver/extensions/NiciraSetTunnelDst.java
index a20b247..ec23a9e 100644
--- a/drivers/src/main/java/org/onosproject/driver/extensions/NiciraSetTunnelDst.java
+++ b/drivers/src/main/java/org/onosproject/driver/extensions/NiciraSetTunnelDst.java
@@ -19,8 +19,8 @@
import com.google.common.base.MoreObjects;
import org.onlab.packet.Ip4Address;
import org.onlab.util.KryoNamespace;
-import org.onosproject.net.flow.instructions.AbstractExtensionInstruction;
-import org.onosproject.net.flow.instructions.ExtensionType;
+import org.onosproject.net.flow.instructions.AbstractExtensionTreatment;
+import org.onosproject.net.flow.instructions.ExtensionTreatmentType;
import org.onosproject.store.serializers.Ip4AddressSerializer;
import java.util.Objects;
@@ -30,7 +30,7 @@
/**
* Nicira set tunnel destination extension instruction.
*/
-public class NiciraSetTunnelDst extends AbstractExtensionInstruction {
+public class NiciraSetTunnelDst extends AbstractExtensionTreatment {
private Ip4Address tunnelDst;
@@ -67,8 +67,8 @@
}
@Override
- public ExtensionType type() {
- return ExtensionType.ExtensionTypes.NICIRA_SET_TUNNEL_DST.type();
+ public ExtensionTreatmentType type() {
+ return ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type();
}
@Override
diff --git a/drivers/src/main/resources/onos-drivers.xml b/drivers/src/main/resources/onos-drivers.xml
index c6d48d2..774f514 100644
--- a/drivers/src/main/resources/onos-drivers.xml
+++ b/drivers/src/main/resources/onos-drivers.xml
@@ -32,10 +32,10 @@
impl="org.onosproject.driver.handshaker.NiciraSwitchHandshaker"/>
<behaviour api="org.onosproject.net.behaviour.ControllerConfig"
impl="org.onosproject.driver.ovsdb.OvsdbControllerConfig"/>
- <behaviour api="org.onosproject.openflow.controller.ExtensionInterpreter"
- impl="org.onosproject.driver.extensions.NiciraExtensionInterpreter" />
- <behaviour api="org.onosproject.net.behaviour.ExtensionResolver"
- impl="org.onosproject.driver.extensions.NiciraExtensionInterpreter" />
+ <behaviour api="org.onosproject.openflow.controller.ExtensionTreatmentInterpreter"
+ impl="org.onosproject.driver.extensions.NiciraExtensionTreatmentInterpreter" />
+ <behaviour api="org.onosproject.net.behaviour.ExtensionTreatmentResolver"
+ impl="org.onosproject.driver.extensions.NiciraExtensionTreatmentInterpreter" />
</driver>
<!--This driver is for simulated NETCONF devices through of-config tool on top og OVSDB-->
<driver name="ovs-netconf" extends="default"