Use instance 0 for first replica of P4RT clone groups
Some switch implementations do not support non-zero values
Change-Id: I6fb7e9075fe0c6f48448f43c58054e03f4e9781b
(cherry picked from commit 8767511609393c7d4b3aa63700c0c6957096a245)
diff --git a/core/net/src/main/java/org/onosproject/net/pi/impl/PiReplicationGroupTranslatorImpl.java b/core/net/src/main/java/org/onosproject/net/pi/impl/PiReplicationGroupTranslatorImpl.java
index 1f562a4..53fb9d2 100644
--- a/core/net/src/main/java/org/onosproject/net/pi/impl/PiReplicationGroupTranslatorImpl.java
+++ b/core/net/src/main/java/org/onosproject/net/pi/impl/PiReplicationGroupTranslatorImpl.java
@@ -118,7 +118,7 @@
// Use incremental instance IDs for replicas of the same port.
replicaMap.putIfAbsent(port, Sets.newHashSet());
replicaMap.get(port).add(
- new PiPreReplica(port, replicaMap.get(port).size() + 1));
+ new PiPreReplica(port, replicaMap.get(port).size()));
}
return replicaMap.values().stream()
.flatMap(Collection::stream)
diff --git a/core/net/src/test/java/org/onosproject/net/pi/impl/PiReplicationGroupTranslatorImplTest.java b/core/net/src/test/java/org/onosproject/net/pi/impl/PiReplicationGroupTranslatorImplTest.java
index 7b5e213..8ca78cf 100644
--- a/core/net/src/test/java/org/onosproject/net/pi/impl/PiReplicationGroupTranslatorImplTest.java
+++ b/core/net/src/test/java/org/onosproject/net/pi/impl/PiReplicationGroupTranslatorImplTest.java
@@ -74,15 +74,15 @@
allOutputBucket(3));
private static final Set<PiPreReplica> REPLICAS = ImmutableSet.of(
- new PiPreReplica(PortNumber.portNumber(1), 1),
- new PiPreReplica(PortNumber.portNumber(2), 1),
- new PiPreReplica(PortNumber.portNumber(3), 1));
+ new PiPreReplica(PortNumber.portNumber(1), 0),
+ new PiPreReplica(PortNumber.portNumber(2), 0),
+ new PiPreReplica(PortNumber.portNumber(3), 0));
private static final Set<PiPreReplica> REPLICAS_2 = ImmutableSet.of(
- new PiPreReplica(PortNumber.portNumber(1), 1),
+ new PiPreReplica(PortNumber.portNumber(1), 0),
+ new PiPreReplica(PortNumber.portNumber(2), 0),
new PiPreReplica(PortNumber.portNumber(2), 1),
- new PiPreReplica(PortNumber.portNumber(2), 2),
- new PiPreReplica(PortNumber.portNumber(3), 1),
- new PiPreReplica(PortNumber.portNumber(3), 2));
+ new PiPreReplica(PortNumber.portNumber(3), 0),
+ new PiPreReplica(PortNumber.portNumber(3), 1));
private static final PiMulticastGroupEntry PI_MULTICAST_GROUP =
PiMulticastGroupEntry.builder()