Jian Li
Committed by Gerrit Code Review

Remove redundant extensionTreatmentInterpreter support check

Change-Id: I1bcaefcdf8f97a7bed4916734142cabc04f566e4
......@@ -161,7 +161,7 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou
}
@Override
public ExtensionTreatment mapAction(OFAction action) {
public ExtensionTreatment mapAction(OFAction action) throws UnsupportedOperationException {
if (action.getType().equals(OFActionType.SET_FIELD)) {
OFActionSetField setFieldAction = (OFActionSetField) action;
OFOxm<?> oxm = setFieldAction.getField();
......
......@@ -58,7 +58,7 @@ public class OfdpaExtensionTreatmentInterpreter extends AbstractHandlerBehaviou
}
@Override
public ExtensionTreatment mapAction(OFAction action) {
public ExtensionTreatment mapAction(OFAction action) throws UnsupportedOperationException {
if (action.getType().equals(OFActionType.SET_FIELD)) {
OFActionSetField setFieldAction = (OFActionSetField) action;
OFOxm<?> oxm = setFieldAction.getField();
......
......@@ -52,7 +52,8 @@ public interface ExtensionTreatmentInterpreter extends HandlerBehaviour {
*
* @param action OpenFlow action
* @return extension treatment
* @throws UnsupportedOperationException if driver does not support extension type
*/
ExtensionTreatment mapAction(OFAction action);
ExtensionTreatment mapAction(OFAction action) throws UnsupportedOperationException;
}
......
......@@ -45,7 +45,6 @@ import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.flow.criteria.ExtensionSelectorType.ExtensionSelectorTypes;
import org.onosproject.net.flow.instructions.ExtensionTreatmentType.ExtensionTreatmentTypes;
import org.onosproject.net.flow.instructions.Instructions;
import org.onosproject.openflow.controller.ExtensionSelectorInterpreter;
import org.onosproject.openflow.controller.ExtensionTreatmentInterpreter;
......@@ -393,7 +392,8 @@ public class FlowEntryBuilder {
break;
case ENQUEUE:
OFActionEnqueue enqueue = (OFActionEnqueue) act;
builder.setQueue(enqueue.getQueueId(), PortNumber.portNumber(enqueue.getPort().getPortNumber()));
builder.setQueue(enqueue.getQueueId(),
PortNumber.portNumber(enqueue.getPort().getPortNumber()));
break;
case STRIP_VLAN:
case POP_VLAN:
......@@ -447,10 +447,12 @@ public class FlowEntryBuilder {
builder.setVlanPcp(vlanpcp.getValue().getValue());
break;
case VLAN_VID:
if (treatmentInterpreter != null &&
treatmentInterpreter.supported(ExtensionTreatmentTypes.OFDPA_SET_VLAN_ID.type())) {
builder.extension(treatmentInterpreter.mapAction(action),
deviceId);
if (treatmentInterpreter != null) {
try {
builder.extension(treatmentInterpreter.mapAction(action), deviceId);
} catch (UnsupportedOperationException e) {
log.warn(e.getMessage());
}
} else {
@SuppressWarnings("unchecked")
OFOxm<OFVlanVidMatch> vlanvid = (OFOxm<OFVlanVidMatch>) oxm;
......@@ -515,9 +517,12 @@ public class FlowEntryBuilder {
builder.setUdpSrc(TpPort.tpPort(udpsrc.getValue().getPort()));
break;
case TUNNEL_IPV4_DST:
if (treatmentInterpreter != null &&
treatmentInterpreter.supported(ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type())) {
builder.extension(treatmentInterpreter.mapAction(action), deviceId);
if (treatmentInterpreter != null) {
try {
builder.extension(treatmentInterpreter.mapAction(action), deviceId);
} catch (UnsupportedOperationException e) {
log.warn(e.getMessage());
}
}
break;
case EXP_ODU_SIG_ID:
......@@ -895,9 +900,9 @@ public class FlowEntryBuilder {
return builder.build();
}
private DriverHandler getDriver(DeviceId deviceId) {
Driver driver = driverService.getDriver(deviceId);
DriverHandler handler = new DefaultDriverHandler(new DefaultDriverData(driver, deviceId));
private DriverHandler getDriver(DeviceId devId) {
Driver driver = driverService.getDriver(devId);
DriverHandler handler = new DefaultDriverHandler(new DefaultDriverData(driver, devId));
return handler;
}
}
......