Do not insert or delete default action entries in P4Runtime

Spec says:
the default entry for a table is always set. It can be set at
compile-time by the P4 programmer - or defaults to NoAction (which is a
no-op) otherwise - and assuming it is not declared as const, can be
modified by the P4Runtime client. Because the default entry is always
set, we do not allow INSERT and DELETE updates on the default entry and
the P4Runtime server must return an INVALID_ARGUMENT error code if the
client attempts one.

With this patch we convert insert or delete operations into modify ones
(unless specified by a driver property, to support non-compliant devices).
For delete, we use the interpreter to suggest a default action that is
the same as the one when the pipeline was originally deployed.

Also, we introduce the capability of synchronizing the device mirror
with the device state.

Change-Id: I3758fc11780eb0f1cf4ed5a295bd98b54b182e29
diff --git a/protocols/p4runtime/model/src/main/java/org/onosproject/p4runtime/model/P4TableModel.java b/protocols/p4runtime/model/src/main/java/org/onosproject/p4runtime/model/P4TableModel.java
index 77f55ec..5afad85 100644
--- a/protocols/p4runtime/model/src/main/java/org/onosproject/p4runtime/model/P4TableModel.java
+++ b/protocols/p4runtime/model/src/main/java/org/onosproject/p4runtime/model/P4TableModel.java
@@ -48,7 +48,7 @@
     private final boolean supportAging;
     private final ImmutableMap<PiMatchFieldId, PiMatchFieldModel> matchFields;
     private final ImmutableMap<PiActionId, PiActionModel> actions;
-    private final PiActionModel defaultAction;
+    private final PiActionModel constDefaultAction;
     private final boolean hasDefaultMutableParams;
     private final boolean isConstTable;
 
@@ -58,7 +58,7 @@
                  ImmutableMap<PiMeterId, PiMeterModel> meters, boolean supportAging,
                  ImmutableMap<PiMatchFieldId, PiMatchFieldModel> matchFields,
                  ImmutableMap<PiActionId, PiActionModel> actions,
-                 PiActionModel defaultAction, boolean hasDefaultMutableParams,
+                 PiActionModel constDefaultAction, boolean hasDefaultMutableParams,
                  boolean isConstTable) {
         this.id = id;
         this.tableType = tableType;
@@ -69,7 +69,7 @@
         this.supportAging = supportAging;
         this.matchFields = matchFields;
         this.actions = actions;
-        this.defaultAction = defaultAction;
+        this.constDefaultAction = constDefaultAction;
         this.hasDefaultMutableParams = hasDefaultMutableParams;
         this.isConstTable = isConstTable;
     }
@@ -120,8 +120,8 @@
     }
 
     @Override
-    public Optional<PiActionModel> defaultAction() {
-        return Optional.ofNullable(defaultAction);
+    public Optional<PiActionModel> constDefaultAction() {
+        return Optional.ofNullable(constDefaultAction);
     }
 
     @Override
@@ -148,7 +148,7 @@
     public int hashCode() {
         return Objects.hash(id, tableType, actionProfile, maxSize, counters,
                             meters, supportAging, matchFields, actions,
-                            defaultAction, hasDefaultMutableParams);
+                            constDefaultAction, hasDefaultMutableParams);
     }
 
     @Override
@@ -169,7 +169,7 @@
                 && Objects.equals(this.supportAging, other.supportAging)
                 && Objects.equals(this.matchFields, other.matchFields)
                 && Objects.equals(this.actions, other.actions)
-                && Objects.equals(this.defaultAction, other.defaultAction)
+                && Objects.equals(this.constDefaultAction, other.constDefaultAction)
                 && Objects.equals(this.hasDefaultMutableParams, other.hasDefaultMutableParams);
     }
 }
diff --git a/protocols/p4runtime/model/src/test/java/org/onosproject/p4runtime/model/P4InfoParserTest.java b/protocols/p4runtime/model/src/test/java/org/onosproject/p4runtime/model/P4InfoParserTest.java
index e23a49c..3a803d4 100644
--- a/protocols/p4runtime/model/src/test/java/org/onosproject/p4runtime/model/P4InfoParserTest.java
+++ b/protocols/p4runtime/model/src/test/java/org/onosproject/p4runtime/model/P4InfoParserTest.java
@@ -193,7 +193,7 @@
                    wcmpTableModel.actions(), IsIterableContainingInAnyOrder.containsInAnyOrder(
                         setEgressPortAction, noAction));
 
-        PiActionModel table0DefaultAction = table0Model.defaultAction().orElse(null);
+        PiActionModel table0DefaultAction = table0Model.constDefaultAction().orElse(null);
 
         new EqualsTester().addEqualityGroup(table0DefaultAction, dropAction).testEquals();