Use max_group_size 1 for INDIRECT groups

Change-Id: I8db03a88af06b373d615e05c4b01e47579df2398
diff --git a/core/net/src/main/java/org/onosproject/net/pi/impl/PiGroupTranslatorImpl.java b/core/net/src/main/java/org/onosproject/net/pi/impl/PiGroupTranslatorImpl.java
index 5302856..6e7e2d7 100644
--- a/core/net/src/main/java/org/onosproject/net/pi/impl/PiGroupTranslatorImpl.java
+++ b/core/net/src/main/java/org/onosproject/net/pi/impl/PiGroupTranslatorImpl.java
@@ -102,13 +102,16 @@
                     actionProfileId, actionProfileModel.maxGroupSize()));
         }
 
+        // If not INDIRECT, we set the maximum group size as specified in the
+        // model, however this might be highly inefficient for some HW targets
+        // which pre-allocate resources for the whole group.
+        final int maxGroupSize = group.type() == GroupDescription.Type.INDIRECT
+                ? 1 : group.buckets().buckets().size();
+
         final PiActionProfileGroup.Builder piActionGroupBuilder = PiActionProfileGroup.builder()
                 .withId(PiActionProfileGroupId.of(group.id().id()))
                 .withActionProfileId(groupKey.actionProfileId())
-                // We set the maximum group size as specified in the model,
-                // however this might be highly inefficient for some HW targets
-                // which pre-allocate resources for the whole group.
-                .withMaxSize(actionProfileModel.maxGroupSize());
+                .withMaxSize(maxGroupSize);
 
         // Translate group buckets to PI group members
         final PiPipelineInterpreter interpreter = getInterpreterOrNull(device, pipeconf);