Jian Li
Committed by Gerrit Code Review

Remove redundant extensionTreatmentInterpreter support check

Change-Id: I1bcaefcdf8f97a7bed4916734142cabc04f566e4
...@@ -161,7 +161,7 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou ...@@ -161,7 +161,7 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou
161 } 161 }
162 162
163 @Override 163 @Override
164 - public ExtensionTreatment mapAction(OFAction action) { 164 + public ExtensionTreatment mapAction(OFAction action) throws UnsupportedOperationException {
165 if (action.getType().equals(OFActionType.SET_FIELD)) { 165 if (action.getType().equals(OFActionType.SET_FIELD)) {
166 OFActionSetField setFieldAction = (OFActionSetField) action; 166 OFActionSetField setFieldAction = (OFActionSetField) action;
167 OFOxm<?> oxm = setFieldAction.getField(); 167 OFOxm<?> oxm = setFieldAction.getField();
......
...@@ -58,7 +58,7 @@ public class OfdpaExtensionTreatmentInterpreter extends AbstractHandlerBehaviou ...@@ -58,7 +58,7 @@ public class OfdpaExtensionTreatmentInterpreter extends AbstractHandlerBehaviou
58 } 58 }
59 59
60 @Override 60 @Override
61 - public ExtensionTreatment mapAction(OFAction action) { 61 + public ExtensionTreatment mapAction(OFAction action) throws UnsupportedOperationException {
62 if (action.getType().equals(OFActionType.SET_FIELD)) { 62 if (action.getType().equals(OFActionType.SET_FIELD)) {
63 OFActionSetField setFieldAction = (OFActionSetField) action; 63 OFActionSetField setFieldAction = (OFActionSetField) action;
64 OFOxm<?> oxm = setFieldAction.getField(); 64 OFOxm<?> oxm = setFieldAction.getField();
......
...@@ -52,7 +52,8 @@ public interface ExtensionTreatmentInterpreter extends HandlerBehaviour { ...@@ -52,7 +52,8 @@ public interface ExtensionTreatmentInterpreter extends HandlerBehaviour {
52 * 52 *
53 * @param action OpenFlow action 53 * @param action OpenFlow action
54 * @return extension treatment 54 * @return extension treatment
55 + * @throws UnsupportedOperationException if driver does not support extension type
55 */ 56 */
56 - ExtensionTreatment mapAction(OFAction action); 57 + ExtensionTreatment mapAction(OFAction action) throws UnsupportedOperationException;
57 58
58 } 59 }
......
...@@ -45,7 +45,6 @@ import org.onosproject.net.flow.FlowRule; ...@@ -45,7 +45,6 @@ import org.onosproject.net.flow.FlowRule;
45 import org.onosproject.net.flow.TrafficSelector; 45 import org.onosproject.net.flow.TrafficSelector;
46 import org.onosproject.net.flow.TrafficTreatment; 46 import org.onosproject.net.flow.TrafficTreatment;
47 import org.onosproject.net.flow.criteria.ExtensionSelectorType.ExtensionSelectorTypes; 47 import org.onosproject.net.flow.criteria.ExtensionSelectorType.ExtensionSelectorTypes;
48 -import org.onosproject.net.flow.instructions.ExtensionTreatmentType.ExtensionTreatmentTypes;
49 import org.onosproject.net.flow.instructions.Instructions; 48 import org.onosproject.net.flow.instructions.Instructions;
50 import org.onosproject.openflow.controller.ExtensionSelectorInterpreter; 49 import org.onosproject.openflow.controller.ExtensionSelectorInterpreter;
51 import org.onosproject.openflow.controller.ExtensionTreatmentInterpreter; 50 import org.onosproject.openflow.controller.ExtensionTreatmentInterpreter;
...@@ -393,7 +392,8 @@ public class FlowEntryBuilder { ...@@ -393,7 +392,8 @@ public class FlowEntryBuilder {
393 break; 392 break;
394 case ENQUEUE: 393 case ENQUEUE:
395 OFActionEnqueue enqueue = (OFActionEnqueue) act; 394 OFActionEnqueue enqueue = (OFActionEnqueue) act;
396 - builder.setQueue(enqueue.getQueueId(), PortNumber.portNumber(enqueue.getPort().getPortNumber())); 395 + builder.setQueue(enqueue.getQueueId(),
396 + PortNumber.portNumber(enqueue.getPort().getPortNumber()));
397 break; 397 break;
398 case STRIP_VLAN: 398 case STRIP_VLAN:
399 case POP_VLAN: 399 case POP_VLAN:
...@@ -447,10 +447,12 @@ public class FlowEntryBuilder { ...@@ -447,10 +447,12 @@ public class FlowEntryBuilder {
447 builder.setVlanPcp(vlanpcp.getValue().getValue()); 447 builder.setVlanPcp(vlanpcp.getValue().getValue());
448 break; 448 break;
449 case VLAN_VID: 449 case VLAN_VID:
450 - if (treatmentInterpreter != null && 450 + if (treatmentInterpreter != null) {
451 - treatmentInterpreter.supported(ExtensionTreatmentTypes.OFDPA_SET_VLAN_ID.type())) { 451 + try {
452 - builder.extension(treatmentInterpreter.mapAction(action), 452 + builder.extension(treatmentInterpreter.mapAction(action), deviceId);
453 - deviceId); 453 + } catch (UnsupportedOperationException e) {
454 + log.warn(e.getMessage());
455 + }
454 } else { 456 } else {
455 @SuppressWarnings("unchecked") 457 @SuppressWarnings("unchecked")
456 OFOxm<OFVlanVidMatch> vlanvid = (OFOxm<OFVlanVidMatch>) oxm; 458 OFOxm<OFVlanVidMatch> vlanvid = (OFOxm<OFVlanVidMatch>) oxm;
...@@ -515,9 +517,12 @@ public class FlowEntryBuilder { ...@@ -515,9 +517,12 @@ public class FlowEntryBuilder {
515 builder.setUdpSrc(TpPort.tpPort(udpsrc.getValue().getPort())); 517 builder.setUdpSrc(TpPort.tpPort(udpsrc.getValue().getPort()));
516 break; 518 break;
517 case TUNNEL_IPV4_DST: 519 case TUNNEL_IPV4_DST:
518 - if (treatmentInterpreter != null && 520 + if (treatmentInterpreter != null) {
519 - treatmentInterpreter.supported(ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type())) { 521 + try {
520 - builder.extension(treatmentInterpreter.mapAction(action), deviceId); 522 + builder.extension(treatmentInterpreter.mapAction(action), deviceId);
523 + } catch (UnsupportedOperationException e) {
524 + log.warn(e.getMessage());
525 + }
521 } 526 }
522 break; 527 break;
523 case EXP_ODU_SIG_ID: 528 case EXP_ODU_SIG_ID:
...@@ -895,9 +900,9 @@ public class FlowEntryBuilder { ...@@ -895,9 +900,9 @@ public class FlowEntryBuilder {
895 return builder.build(); 900 return builder.build();
896 } 901 }
897 902
898 - private DriverHandler getDriver(DeviceId deviceId) { 903 + private DriverHandler getDriver(DeviceId devId) {
899 - Driver driver = driverService.getDriver(deviceId); 904 + Driver driver = driverService.getDriver(devId);
900 - DriverHandler handler = new DefaultDriverHandler(new DefaultDriverData(driver, deviceId)); 905 + DriverHandler handler = new DefaultDriverHandler(new DefaultDriverData(driver, devId));
901 return handler; 906 return handler;
902 } 907 }
903 } 908 }
......