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 f795769..11c2c06 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
@@ -94,6 +94,8 @@
             Maps.newConcurrentMap();
     private static final ConcurrentMap<Long, Set<FlowRule>> SESS_ID_TO_FLOWS =
             Maps.newConcurrentMap();
+    private static final ConcurrentMap<Long, Set<Route>> SESS_ID_TO_ROUTES =
+            Maps.newConcurrentMap();
 
     // FIXME: should use a cache with timeout
     private static final Map<Long, Lock> SESS_LOCKS = Maps.newConcurrentMap();
@@ -157,8 +159,8 @@
         log.info("createSession(topic_id={}, imsi={}, default_ebi={}, " +
                          "ue_ipv4={}, s1u_sgw_teid={}, s1u_sgw_ipv4={}, " +
                          "session_id={}, client_id={}, op_id={})",
-                topicId, imsi, defaultEbi, ueIpv4, s1USgwTeid,
-                s1USgwIpv4, sessionId, clientId, opId);
+                 topicId, imsi, defaultEbi, ueIpv4, s1USgwTeid,
+                 s1USgwIpv4, sessionId, clientId, opId);
 
         if (isNotInit()) {
             return;
@@ -169,8 +171,8 @@
         try {
             if (SESS_ID_TO_FLOWS.containsKey(sessionId)
                     && !SESS_ID_TO_FLOWS.get(sessionId).isEmpty()) {
-                log.warn("Creating session {}, but {} rules already exists for such session.",
-                        sessionId, SESS_ID_TO_FLOWS.get(sessionId).size());
+                log.error("Creating session {}, but {} rules already exists for such session.",
+                          sessionId, SESS_ID_TO_FLOWS.get(sessionId).size());
                 SESS_ID_TO_FLOWS.get(sessionId).forEach(f -> log.debug("{}", f));
             }
 
@@ -199,8 +201,8 @@
         log.info("modifyBearer(topic_id={}, s1u_sgw_ipv4={}, " +
                          "s1u_enodeb_teid={}, s1u_enodeb_ipv4={}, " +
                          "session_id={}, client_id={}, op_id={})",
-                topicId, s1USgwIpv4, s1UEnodebTeid, s1UEnodebIpv4,
-                sessionId, clientId, opId);
+                 topicId, s1USgwIpv4, s1UEnodebTeid, s1UEnodebIpv4,
+                 sessionId, clientId, opId);
 
         if (isNotInit()) {
             return;
@@ -211,19 +213,27 @@
         try {
             if (!SESS_ID_TO_UE_ADDR.containsKey(sessionId)) {
                 log.error("Missing sess ID in SESS_ID_TO_UE_ADDR map: {}",
-                        sessionId);
+                          sessionId);
                 return;
             }
             final Ip4Address ueAddr = SESS_ID_TO_UE_ADDR.get(sessionId);
 
+            if (SESS_ID_TO_ROUTES.containsKey(sessionId)
+                    && !SESS_ID_TO_ROUTES.get(sessionId).isEmpty()) {
+                log.error("Modifying session {}, but {} DL routes already exists for such session.",
+                          sessionId, SESS_ID_TO_ROUTES.get(sessionId).size());
+                SESS_ID_TO_ROUTES.get(sessionId).forEach(r -> log.debug("{}", r));
+            }
+            SESS_ID_TO_ROUTES.putIfAbsent(sessionId, Sets.newHashSet());
+
             SESS_ID_TO_FLOWS.get(sessionId).add(s1uFilterRule(s1USgwIpv4));
             SESS_ID_TO_FLOWS.get(sessionId)
                     .add(dlSessLookupRule(ueAddr, s1UEnodebTeid,
-                            s1UEnodebIpv4, s1USgwIpv4));
+                                          s1UEnodebIpv4, s1USgwIpv4));
 
             // Segment routing configuration
-            Route route = new Route(Route.Source.STATIC, ueAddr.toIpPrefix(), s1UEnodebIpv4);
-            routeStore.updateRoute(route);
+            SESS_ID_TO_ROUTES.get(sessionId).add(
+                    new Route(Route.Source.STATIC, ueAddr.toIpPrefix(), s1UEnodebIpv4));
 
 //            List<InterfaceIpAddress> ifaceIpAddrList = Lists.newArrayList();
 //            ifaceIpAddrList.add(InterfaceIpAddress.valueOf(s1USgwIpv4.toIpPrefix().toString()));
@@ -251,7 +261,7 @@
 
         log.info("deleteSession(topic_id={}, session_id={}, client_id={}, " +
                          "op_id={})",
-                topicId, sessionId, clientId, opId);
+                 topicId, sessionId, clientId, opId);
 
         if (isNotInit()) {
             return;
@@ -260,20 +270,17 @@
         SESS_LOCKS.putIfAbsent(sessionId, new ReentrantLock());
         SESS_LOCKS.get(sessionId).lock();
         try {
+            removeSessionRules(sessionId);
+
             SESS_ID_TO_UE_ADDR.remove(sessionId);
+            SESS_ID_TO_FLOWS.remove(sessionId);
+            SESS_ID_TO_ROUTES.remove(sessionId);
 
-            if (!SESS_ID_TO_FLOWS.containsKey(sessionId)
-                    || SESS_ID_TO_FLOWS.get(sessionId).isEmpty()) {
-                log.warn("Deleting session {}, but no rules exist for this session",
-                        sessionId);
-            } else {
-                removeSessionRules(sessionId);
+            sendNotification(
+                    clientId.toString(),
+                    createConfigResultNotification(OpIdentifier.of(opId), (short) 16)
+            );
 
-                sendNotification(
-                        clientId.toString(),
-                        createConfigResultNotification(OpIdentifier.of(opId), (short) 16)
-                );
-            }
         } finally {
             SESS_LOCKS.get(sessionId).unlock();
         }
@@ -287,7 +294,7 @@
         log.info("sendAdcRules(topic={}, domain_name={}, ip={}, drop={}, " +
                          "rating_group={}, service_ID={}, sponsor_ID={})",
                  topic, domainName, ip, drop, ratingGroup, serviceId,
-                sponsorId);
+                 sponsorId);
 
         if (isNotInit()) {
             return;
@@ -375,12 +382,18 @@
         if (SESS_ID_TO_FLOWS.containsKey(sessionId)) {
             batchApply(SESS_ID_TO_FLOWS.get(sessionId));
         }
+        if (SESS_ID_TO_ROUTES.containsKey(sessionId)) {
+            SESS_ID_TO_ROUTES.get(sessionId).forEach(routeStore::updateRoute);
+        }
     }
 
     private void removeSessionRules(long sessionId) {
         if (SESS_ID_TO_FLOWS.containsKey(sessionId)) {
             batchRemove(SESS_ID_TO_FLOWS.get(sessionId));
         }
+        if (SESS_ID_TO_ROUTES.containsKey(sessionId)) {
+            SESS_ID_TO_ROUTES.get(sessionId).forEach(routeStore::removeRoute);
+        }
     }
 
     private void batchApply(Collection<FlowRule> rules) {
