[ONOS-6935] ActionProfile supports in P4RuntimeClient

Change-Id: I9f0ac307985c03b7ed93e14e41ba468c481a4e4f
diff --git a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroup.java b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroup.java
index f023e05..1de4d61 100644
--- a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroup.java
+++ b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiActionGroup.java
@@ -47,11 +47,15 @@
     private final PiActionGroupId id;
     private final Type type;
     private final ImmutableSet<PiActionGroupMember> members;
+    private final PiActionProfileId piActionProfileId;
 
-    private PiActionGroup(PiActionGroupId id, Type type, ImmutableSet<PiActionGroupMember> members) {
+    private PiActionGroup(PiActionGroupId id, Type type,
+                          ImmutableSet<PiActionGroupMember> members,
+                          PiActionProfileId piActionProfileId) {
         this.id = id;
         this.type = type;
         this.members = members;
+        this.piActionProfileId = piActionProfileId;
     }
 
     /**
@@ -81,18 +85,28 @@
         return members;
     }
 
+    /**
+     * Gets identifier of the action profile.
+     *
+     * @return action profile id
+     */
+    public PiActionProfileId actionProfileId() {
+        return piActionProfileId;
+    }
+
     @Override
     public boolean equals(Object o) {
         if (this == o) {
             return true;
         }
-        if (o == null || getClass() != o.getClass()) {
+        if (o == null || !(o instanceof PiActionGroup)) {
             return false;
         }
         PiActionGroup that = (PiActionGroup) o;
-        return id == that.id &&
+        return Objects.equal(id, that.id) &&
                 Objects.equal(type, that.type) &&
-                Objects.equal(members, that.members);
+                Objects.equal(members, that.members) &&
+                Objects.equal(piActionProfileId, that.piActionProfileId);
     }
 
     @Override
@@ -106,6 +120,7 @@
                 .add("groupId", id)
                 .add("type", type)
                 .add("members", members)
+                .add("piActionProfileId", piActionProfileId)
                 .toString();
     }
 
@@ -126,6 +141,7 @@
         private PiActionGroupId id;
         private Type type;
         private Map<PiActionGroupMemberId, PiActionGroupMember> members = Maps.newHashMap();
+        private PiActionProfileId piActionProfileId;
 
         private Builder() {
             // hides constructor.
@@ -176,6 +192,17 @@
         }
 
         /**
+         * Sets the identifier of the action profile.
+         *
+         * @param piActionProfileId the identifier of the action profile
+         * @return this
+         */
+        public Builder withActionProfileId(PiActionProfileId piActionProfileId) {
+            this.piActionProfileId = piActionProfileId;
+            return this;
+        }
+
+        /**
          * Creates a new action group.
          *
          * @return action group
@@ -183,8 +210,11 @@
         public PiActionGroup build() {
             checkNotNull(id);
             checkNotNull(type);
-            checkArgument(members.size() > 0, "Members cannot be empty");
-            return new PiActionGroup(id, type, ImmutableSet.copyOf(members.values()));
+            checkArgument(!members.isEmpty(), "Members cannot be empty");
+            checkNotNull(piActionProfileId);
+            return new PiActionGroup(id, type,
+                                     ImmutableSet.copyOf(members.values()),
+                                     piActionProfileId);
         }
     }
 }