Fix P4Runtime driver ignoring CLONE groups
Change-Id: I24d9b52bc5ea89320d9ef6afa5f82c4778edfc21
diff --git a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/AbstractP4RuntimeHandlerBehaviour.java b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/AbstractP4RuntimeHandlerBehaviour.java
index 7bbc00b..222cdaa 100644
--- a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/AbstractP4RuntimeHandlerBehaviour.java
+++ b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/AbstractP4RuntimeHandlerBehaviour.java
@@ -64,11 +64,11 @@
final PiPipeconfService pipeconfService = handler().get(
PiPipeconfService.class);
- if (!pipeconfService.getPipeconf(deviceId).isPresent()) {
+ pipeconf = pipeconfService.getPipeconf(deviceId).orElse(null);
+ if (pipeconf == null) {
log.warn("Missing pipeconf for {}, cannot perform {}", deviceId, opName);
return false;
}
- pipeconf = pipeconfService.getPipeconf(deviceId).get();
translationService = handler().get(PiTranslationService.class);
diff --git a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeActionGroupProgrammable.java b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeActionGroupProgrammable.java
index 97a721b..e0805a6 100644
--- a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeActionGroupProgrammable.java
+++ b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeActionGroupProgrammable.java
@@ -99,24 +99,22 @@
return;
}
- groupOps.operations().stream()
- .filter(op -> !op.groupType().equals(GroupDescription.Type.ALL))
- .forEach(op -> {
- // ONOS-7785 We need the group app cookie (which includes
- // the action profile ID) but this is not part of the
- // GroupDescription.
- Group groupOnStore = groupStore.getGroup(deviceId, op.groupId());
- if (groupOnStore == null) {
- log.warn("Unable to find group {} in store, aborting {} operation [{}]",
- op.groupId(), op.opType(), op);
- return;
- }
- GroupDescription groupDesc = new DefaultGroupDescription(
- deviceId, groupOnStore.type(), groupOnStore.buckets(), groupOnStore.appCookie(),
- groupOnStore.id().id(), groupOnStore.appId());
- DefaultGroup groupToApply = new DefaultGroup(op.groupId(), groupDesc);
- processPdGroup(groupToApply, op.opType());
- });
+ groupOps.operations().forEach(op -> {
+ // ONOS-7785 We need the group app cookie (which includes
+ // the action profile ID) but this is not part of the
+ // GroupDescription.
+ Group groupOnStore = groupStore.getGroup(deviceId, op.groupId());
+ if (groupOnStore == null) {
+ log.warn("Unable to find group {} in store, aborting {} operation [{}]",
+ op.groupId(), op.opType(), op);
+ return;
+ }
+ GroupDescription groupDesc = new DefaultGroupDescription(
+ deviceId, groupOnStore.type(), groupOnStore.buckets(), groupOnStore.appCookie(),
+ groupOnStore.id().id(), groupOnStore.appId());
+ DefaultGroup groupToApply = new DefaultGroup(op.groupId(), groupDesc);
+ processPdGroup(groupToApply, op.opType());
+ });
}
@Override
diff --git a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeReplicationGroupProgrammable.java b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeReplicationGroupProgrammable.java
index 483bd0e..f0b9e5a 100644
--- a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeReplicationGroupProgrammable.java
+++ b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeReplicationGroupProgrammable.java
@@ -23,7 +23,6 @@
import org.onosproject.net.DeviceId;
import org.onosproject.net.group.DefaultGroup;
import org.onosproject.net.group.Group;
-import org.onosproject.net.group.GroupDescription;
import org.onosproject.net.group.GroupOperation;
import org.onosproject.net.group.GroupOperations;
import org.onosproject.net.group.GroupProgrammable;
@@ -77,17 +76,15 @@
if (!setupBehaviour("performGroupOperation()")) {
return;
}
- groupOps.operations().stream()
- .filter(op -> op.groupType().equals(GroupDescription.Type.ALL))
- .forEach(op -> {
- final Group group = groupStore.getGroup(deviceId, op.groupId());
- if (group == null) {
- log.warn("Unable to find group {} in store, aborting {} operation [{}]",
- op.groupId(), op.opType(), op);
- return;
- }
- processGroupOp(group, op.opType());
- });
+ groupOps.operations().forEach(op -> {
+ final Group group = groupStore.getGroup(deviceId, op.groupId());
+ if (group == null) {
+ log.warn("Unable to find group {} in store, aborting {} operation [{}]",
+ op.groupId(), op.opType(), op);
+ return;
+ }
+ processGroupOp(group, op.opType());
+ });
}
@Override