[SDFAB-338] Revisit DistributedFabricUpfStore in fabric.p4
Remove the global far id consistent map and uses consistent hashing
for the allocation of the farId. Stores the reverse lookup (far -> ruleId)
into an EC consistent map and purges its entries on the far removal
Change-Id: Ia401d081c9dcb28329fab4424b1fcd3d8e8ad916
diff --git a/pipelines/fabric/impl/src/test/java/org/onosproject/pipelines/fabric/impl/behaviour/upf/TestUpfConstants.java b/pipelines/fabric/impl/src/test/java/org/onosproject/pipelines/fabric/impl/behaviour/upf/TestUpfConstants.java
index c24f382..6fee244 100644
--- a/pipelines/fabric/impl/src/test/java/org/onosproject/pipelines/fabric/impl/behaviour/upf/TestUpfConstants.java
+++ b/pipelines/fabric/impl/src/test/java/org/onosproject/pipelines/fabric/impl/behaviour/upf/TestUpfConstants.java
@@ -16,6 +16,7 @@
package org.onosproject.pipelines.fabric.impl.behaviour.upf;
+import com.google.common.hash.Hashing;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip4Prefix;
import org.onlab.util.ImmutableByteSequence;
@@ -75,9 +76,19 @@
public static final int DOWNLINK_COUNTER_CELL_ID = 2;
public static final int PDR_ID = 0; // TODO: PDR ID currently not stored on writes, so all reads are 0
public static final int UPLINK_FAR_ID = 1;
- public static final int UPLINK_PHYSICAL_FAR_ID = 4;
+ public static final int UPLINK_PHYSICAL_FAR_ID = Hashing.murmur3_32()
+ .newHasher()
+ .putInt(UPLINK_FAR_ID)
+ .putBytes(SESSION_ID.asArray())
+ .hash()
+ .asInt();
public static final int DOWNLINK_FAR_ID = 2;
- public static final int DOWNLINK_PHYSICAL_FAR_ID = 5;
+ public static final int DOWNLINK_PHYSICAL_FAR_ID = Hashing.murmur3_32()
+ .newHasher()
+ .putInt(DOWNLINK_FAR_ID)
+ .putBytes(SESSION_ID.asArray())
+ .hash()
+ .asInt();
public static final int UPLINK_PRIORITY = 9;
public static final int DOWNLINK_PRIORITY = 1;