[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/main/java/org/onosproject/pipelines/fabric/impl/behaviour/upf/FabricUpfTranslator.java b/pipelines/fabric/impl/src/main/java/org/onosproject/pipelines/fabric/impl/behaviour/upf/FabricUpfTranslator.java
index c8cce84..2341e04 100644
--- a/pipelines/fabric/impl/src/main/java/org/onosproject/pipelines/fabric/impl/behaviour/upf/FabricUpfTranslator.java
+++ b/pipelines/fabric/impl/src/main/java/org/onosproject/pipelines/fabric/impl/behaviour/upf/FabricUpfTranslator.java
@@ -136,6 +136,9 @@
// Grab keys and parameters that are present for all PDRs
int globalFarId = FabricUpfTranslatorUtil.getParamInt(action, FAR_ID);
UpfRuleIdentifier farId = fabricUpfStore.localFarIdOf(globalFarId);
+ if (farId == null) {
+ throw new UpfProgrammableException(String.format("Unable to find local far id of %s", globalFarId));
+ }
PiActionId actionId = action.id();
if (actionId.equals(FABRIC_INGRESS_SPGW_LOAD_PDR)) {
@@ -186,6 +189,9 @@
int globalFarId = FabricUpfTranslatorUtil.getFieldInt(match, HDR_FAR_ID);
UpfRuleIdentifier farId = fabricUpfStore.localFarIdOf(globalFarId);
+ if (farId == null) {
+ throw new UpfProgrammableException(String.format("Unable to find local far id of %s", globalFarId));
+ }
boolean dropFlag = FabricUpfTranslatorUtil.getParamInt(action, DROP) > 0;
boolean notifyFlag = FabricUpfTranslatorUtil.getParamInt(action, NOTIFY_CP) > 0;