- protected MatchBuilder translateMatch(FlowRemoved flowRemoved, DeviceState deviceState) {
- return MatchConvertorImpl.fromOFMatchToSALMatch(flowRemoved.getMatch(),
- deviceState.getFeatures().getDatapathId(), OpenflowVersion.OF13);
+ protected MatchBuilder translateMatch(FlowRemoved flowRemoved, DeviceInfo deviceInfo) {
+ final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(deviceInfo.getVersion());
+ datapathIdConvertorData.setDatapathId(deviceInfo.getDatapathId());
+
+ final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(
+ flowRemoved.getMatch(),
+ datapathIdConvertorData);
+
+ return matchBuilderOptional.orElse(new MatchBuilder());
+ }
+
+ /**
+ * Translate the table ID in the FLOW_REMOVED message to SAL table ID.
+ *
+ * @param flowRemoved FLOW_REMOVED message.
+ * @return SAL table ID.
+ */
+ protected Short translateTableId(FlowRemoved flowRemoved) {
+ return flowRemoved.getTableId().getValue().shortValue();
+ }
+
+
+ private RemovedFlowReason translateReason(FlowRemoved removedFlow) {
+ logger.debug("--Entering translateReason within FlowRemovedTranslator with reason:{} " + removedFlow.getReason());
+ switch (removedFlow.getReason()) {
+ case OFPRRIDLETIMEOUT:
+ return RemovedFlowReason.OFPRRIDLETIMEOUT;
+ case OFPRRHARDTIMEOUT:
+ return RemovedFlowReason.OFPRRHARDTIMEOUT;
+ case OFPRRDELETE:
+ return RemovedFlowReason.OFPRRDELETE;
+ case OFPRRGROUPDELETE:
+ return RemovedFlowReason.OFPRRGROUPDELETE;
+ default:
+ logger.debug("The flow is being deleted for some unknown reason ");
+ return RemovedFlowReason.OFPRRDELETE;
+ }