Reflect changes in spgw.p4
diff --git a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/protocols/DpnP4Communicator.java b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/protocols/DpnP4Communicator.java
index 609275a..dbaa7ac 100644
--- a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/protocols/DpnP4Communicator.java
+++ b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/protocols/DpnP4Communicator.java
@@ -59,8 +59,6 @@
private final Logger log = LoggerFactory.getLogger(getClass());
- private static String HDR = "hdr.";
-
private static final PiTableId TBL_ID_UE_FILTER = PiTableId
.of("spgw_ingress.ue_filter_table");
private static final PiTableId TBL_ID_S1U_FILTER = PiTableId
@@ -69,30 +67,25 @@
.of("spgw_ingress.dl_sess_lookup");
private static final PiMatchFieldId MF_ID_IPV4_DST = PiMatchFieldId
- .of(HDR + "ipv4.dst_addr");
- private static final PiMatchFieldId MF_ID_GTPU_IPV4_DST = PiMatchFieldId
- .of(HDR + "gtpu_ipv4.dst_addr");
+ .of("ipv4.dst_addr");
+ private static final PiMatchFieldId MF_ID_S1U_SGW_ADDR = PiMatchFieldId
+ .of("spgw_meta.s1u_sgw_addr");
private static final PiActionId ACT_ID_SET_DL_SESS_INFO = PiActionId
.of("spgw_ingress.set_dl_sess_info");
- private static final PiActionParamId ACT_PARAM_ID_DL_TEID = PiActionParamId
- .of("dl_sess_teid");
- private static final PiActionParamId ACT_PARAM_ID_DL_ENB_ADDR = PiActionParamId
- .of("dl_sess_enb_addr");
- private static final PiActionParamId ACT_PARAM_ID_DL_S1U_ADDR = PiActionParamId
- .of("dl_sess_s1u_addr");
+ private static final PiActionParamId TEID = PiActionParamId
+ .of("teid");
+ private static final PiActionParamId PARAM_S1U_ENB_ADDR = PiActionParamId
+ .of("s1u_enb_addr");
+ private static final PiActionParamId PARAM_ID_S1U_SGW_ADDR = PiActionParamId
+ .of("s1u_sgw_addr");
private static final PiAction NO_ACTION = PiAction.builder()
.withId(PiActionId.of("NoAction"))
.build();
- private static final byte DIR_UPLINK = (byte) 0;
- private static final byte DIR_DOWNLINK = (byte) 1;
-
private static final ConcurrentMap<Long, Ip4Address> SESS_ID_TO_UE_ADDR =
Maps.newConcurrentMap();
- private static final ConcurrentMap<Long, Ip4Address> SESS_ID_TO_S1U_ADDR =
- Maps.newConcurrentMap();
private static final ConcurrentMap<Long, Set<FlowRule>> SESS_ID_TO_FLOWS =
Maps.newConcurrentMap();
@@ -166,7 +159,7 @@
SESS_ID_TO_FLOWS.get(sessionId).forEach(f -> log.debug("{}", f));
}
- // If old session is there. We keep the old rules.
+ // If old session is there, we keep the old rules.
SESS_ID_TO_FLOWS.putIfAbsent(sessionId, Sets.newHashSet());
SESS_ID_TO_UE_ADDR.put(sessionId, ueIpv4);
@@ -208,8 +201,6 @@
}
final Ip4Address ueAddr = SESS_ID_TO_UE_ADDR.get(sessionId);
- SESS_ID_TO_S1U_ADDR.put(sessionId, s1USgwIpv4);
-
SESS_ID_TO_FLOWS.get(sessionId).add(s1uFilterRule(s1USgwIpv4));
SESS_ID_TO_FLOWS.get(sessionId)
.add(dlSessLookupRule(ueAddr, s1UEnodebTeid,
@@ -241,7 +232,6 @@
SESS_LOCKS.putIfAbsent(sessionId, new ReentrantLock());
SESS_LOCKS.get(sessionId).lock();
try {
- SESS_ID_TO_S1U_ADDR.remove(sessionId);
SESS_ID_TO_UE_ADDR.remove(sessionId);
if (!SESS_ID_TO_FLOWS.containsKey(sessionId)
@@ -296,7 +286,7 @@
private FlowRule s1uFilterRule(Ip4Address s1uAddr) {
final PiCriterion piCriterion = PiCriterion.builder()
- .matchExact(MF_ID_GTPU_IPV4_DST, s1uAddr.toOctets())
+ .matchExact(MF_ID_S1U_SGW_ADDR, s1uAddr.toOctets())
.build();
return flowRuleBuilder()
@@ -315,11 +305,11 @@
// Add rule to
final PiAction action = PiAction.builder()
.withId(ACT_ID_SET_DL_SESS_INFO)
- .withParameter(new PiActionParam(ACT_PARAM_ID_DL_TEID,
+ .withParameter(new PiActionParam(TEID,
copyFrom(teid)))
- .withParameter(new PiActionParam(ACT_PARAM_ID_DL_ENB_ADDR,
+ .withParameter(new PiActionParam(PARAM_S1U_ENB_ADDR,
copyFrom(enbAddr.toOctets())))
- .withParameter(new PiActionParam(ACT_PARAM_ID_DL_S1U_ADDR,
+ .withParameter(new PiActionParam(PARAM_ID_S1U_SGW_ADDR,
copyFrom(s1uAddr.toOctets())))
.build();
@@ -338,11 +328,6 @@
.build();
}
- private FlowRule ueCdrRule(Ip4Address ueAddr) {
- // FIXME: should we count on downlink, uplink or both?
- return null;
- }
-
private FlowRule.Builder flowRuleBuilder() {
return DefaultFlowRule.builder()
.forDevice(deviceId)