Fix NOT_FOUND error when removing P4Runtime table entries

Differently from the case where we insert/modify entries, when deleting,
we were not checking the content of the mirror. Now we do, and ignore
the delete operation if the entry is missing from the mirror in the
first place.

Change-Id: Ib7648e3b5e01c87521b1d9a23c88a665092c9707
(cherry picked from commit 1a4f1b288f8c96edab06f2d5fdcb79c55c17b9f6)
diff --git a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeFlowRuleProgrammable.java b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeFlowRuleProgrammable.java
index 7432d2d..fbc512a 100644
--- a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeFlowRuleProgrammable.java
+++ b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeFlowRuleProgrammable.java
@@ -421,12 +421,20 @@
             if (piEntryToApply.isDefaultAction()) {
                 // Cannot remove default action. Instead we should use the
                 // original defined by the interpreter (if any).
-                piEntryToApply = getOriginalDefaultEntry(piEntryToApply.table());
-                if (piEntryToApply == null) {
+                final PiTableEntry originalDefaultEntry = getOriginalDefaultEntry(
+                        piEntryToApply.table());
+                if (originalDefaultEntry == null) {
                     return false;
                 }
-                updateType = MODIFY;
+                return appendEntryToWriteRequestOrSkip(
+                        writeRequest, originalDefaultEntry.handle(deviceId),
+                        originalDefaultEntry, APPLY);
             } else {
+                if (piEntryOnDevice == null) {
+                    log.debug("Ignoring delete of missing entry: {}",
+                              piEntryToApply);
+                    return true;
+                }
                 updateType = DELETE;
             }
         }