diff --git a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/RouteServletTest.java b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/RouteServletTest.java
index f1082ba..226dae0 100755
--- a/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/RouteServletTest.java
+++ b/datarouter-prov/src/test/java/org/onap/dmaap/datarouter/provisioning/RouteServletTest.java
@@ -23,21 +23,21 @@
 
 package org.onap.dmaap.datarouter.provisioning;
 
-import org.apache.commons.lang3.reflect.FieldUtils;
-import org.json.JSONObject;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import org.junit.AfterClass;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.onap.dmaap.datarouter.provisioning.beans.*;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
 import org.powermock.modules.junit4.PowerMockRunner;
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.SortedSet;
-import java.util.TreeSet;
+
 import static org.hamcrest.Matchers.notNullValue;
 import static org.mockito.Matchers.*;
 import static org.mockito.Mockito.mock;
@@ -45,12 +45,10 @@
 import static org.mockito.Mockito.when;
 
 @RunWith(PowerMockRunner.class)
-@SuppressStaticInitializationFor({"org.onap.dmaap.datarouter.provisioning.beans.IngressRoute",
-        "org.onap.dmaap.datarouter.provisioning.beans.EgressRoute",
-        "org.onap.dmaap.datarouter.provisioning.beans.NodeClass",
-        "org.onap.dmaap.datarouter.provisioning.beans.NetworkRoute"})
-public class RouteServletTest extends DrServletTestBase
-{
+public class RouteServletTest {
+
+    private static EntityManagerFactory emf;
+    private static EntityManager em;
     private RouteServlet routeServlet;
 
     @Mock
@@ -59,53 +57,55 @@
     @Mock
     private HttpServletResponse response;
 
+    @BeforeClass
+    public static void init() {
+        emf = Persistence.createEntityManagerFactory("dr-unit-tests");
+        em = emf.createEntityManager();
+        System.setProperty(
+                "org.onap.dmaap.datarouter.provserver.properties",
+                "src/test/resources/h2Database.properties");
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        em.clear();
+        em.close();
+        emf.close();
+    }
+
     @Before
     public void setUp() throws Exception {
-        super.setUp();
-        setPokerToNotCreateTimersWhenDeleteFeedIsCalled();
-        setRouteToReturnValid();
         routeServlet = new RouteServlet();
     }
 
     @Test
-    public void Given_Request_Is_HTTP_DELETE_And_Is_Not_Authorized() throws Exception {
-        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "isAddressAuthEnabled", "true", true);
+    public void Given_Request_Is_HTTP_DELETE_And_Is_Not_Authorized_Then_Forbidden_Response_Is_Generated()
+            throws Exception {
+        when(request.getRemoteAddr()).thenReturn("stub_addr");
         routeServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
     }
 
     @Test
-    public void Given_Request_Is_HTTP_DELETE_And_Ingress_Route_Does_Not_Exist_In_Path() throws Exception {
+    public void Given_Request_Is_HTTP_DELETE_And_Ingress_Route_Does_Not_Exist_In_Path_Then_Route_Does_Not_Exist_Is_Returned()
+            throws Exception {
         when(request.getPathInfo()).thenReturn("/ingress/3/internal/route/");
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
     }
 
     @Test
-    public void Given_Request_Is_HTTP_DELETE_And_Ingress_Path_Contains_Invalid_FeedID() throws Exception {
+    public void Given_Request_Is_HTTP_DELETE_And_Ingress_Path_Contains_Invalid_FeedID_Then_Feed_Not_Found_Is_Returned()
+            throws Exception {
         when(request.getPathInfo()).thenReturn("/ingress/feedID/internal/route/");
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
     }
 
     @Test
-    public void Given_Request_Is_HTTP_DELETE_And_Ingress_Path_Contains_Invalid_Sequence_Number() throws Exception {
+    public void Given_Request_Is_HTTP_DELETE_And_Ingress_Path_Contains_Invalid_Sequence_Number_Then_Invalid_Sequence_Is_Returned()
+            throws Exception {
         when(request.getPathInfo()).thenReturn("/ingress/feedID/");
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
     }
@@ -113,11 +113,6 @@
     @Test
     public void Given_Request_Is_HTTP_DELETE_And_Ingress_Path_Contains_Invalid_Number_Of_Arguments() throws Exception {
         when(request.getPathInfo()).thenReturn("/ingress/");
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
     }
@@ -125,11 +120,6 @@
     @Test
     public void Given_Request_Is_HTTP_DELETE_And_Egress_Route_Does_Not_Exist_In_Path() throws Exception {
         when(request.getPathInfo()).thenReturn("/egress/3");
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
     }
@@ -137,11 +127,6 @@
     @Test
     public void Given_Request_Is_HTTP_DELETE_And_Egress_Path_Contains_Invalid_SubID() throws Exception {
         when(request.getPathInfo()).thenReturn("/egress/subID");
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
     }
@@ -149,11 +134,6 @@
     @Test
     public void Given_Request_Is_HTTP_DELETE_And_Egress_Path_Contains_Invalid_Number_Of_Arguments() throws Exception {
         when(request.getPathInfo()).thenReturn("/egress/");
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
     }
@@ -161,37 +141,20 @@
     @Test
     public void Given_Request_Is_HTTP_DELETE_And_Network_Path_Contains_Invalid_Number_Of_Arguments() throws Exception {
         when(request.getPathInfo()).thenReturn("/network/");
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
     }
 
     @Test
-    public void Given_Request_Is_HTTP_DELETE_And_Deletable_Is_Null() throws Exception {
+    public void Given_Request_Is_HTTP_DELETE_And_Deletable_Is_Null_Then_Bad_Url_Is_Returned() throws Exception {
         when(request.getPathInfo()).thenReturn("/route/");
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-
-            @Override
-            protected boolean doDelete(Deleteable bean) {
-                return true;
-            }
-        };
         routeServlet.doDelete(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
     }
 
     @Test
     public void Given_Request_Is_HTTP_DELETE_And_Fails() throws Exception {
-        when(request.getPathInfo()).thenReturn("/network/subID/route");
-        PowerMockito.mockStatic(NodeClass.class);
-        PowerMockito.when(NodeClass.normalizeNodename(anyString())).thenReturn("stub_val");
+        when(request.getPathInfo()).thenReturn("/network/node01/node02");
         RouteServlet routeServlet = new RouteServlet() {
             protected boolean isAuthorizedForInternal(HttpServletRequest req) {
                 return true;
@@ -203,12 +166,13 @@
             }
         };
         routeServlet.doDelete(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
+        verify(response)
+                .sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
     }
 
     @Test
     public void Given_Request_Is_HTTP_GET_And_Is_Not_Authorized() throws Exception {
-        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "isAddressAuthEnabled", "true", true);
+        when(request.getRemoteAddr()).thenReturn("stub_addr");
         routeServlet.doGet(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
     }
@@ -216,11 +180,6 @@
     @Test
     public void Given_Request_Is_HTTP_GET_And_Path_Does_Not_Start_With_Valid_Route() throws Exception {
         when(request.getPathInfo()).thenReturn("/route/");
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doGet(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
     }
@@ -229,14 +188,8 @@
     @Test
     public void Given_Request_Is_HTTP_GET_And_Path_Equals_Ingress_And_Get_Succeeds() throws Exception {
         when(request.getPathInfo()).thenReturn("/ingress/");
-        when(request.getRemoteAddr()).thenReturn("stub_addr");
         ServletOutputStream outStream = mock(ServletOutputStream.class);
         when(response.getOutputStream()).thenReturn(outStream);
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doGet(request, response);
         verify(response).setStatus(eq(HttpServletResponse.SC_OK));
     }
@@ -244,14 +197,8 @@
     @Test
     public void Given_Request_Is_HTTP_GET_And_Path_Equals_Egress_And_Get_Succeeds() throws Exception {
         when(request.getPathInfo()).thenReturn("/egress/");
-        when(request.getRemoteAddr()).thenReturn("stub_addr");
         ServletOutputStream outStream = mock(ServletOutputStream.class);
         when(response.getOutputStream()).thenReturn(outStream);
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doGet(request, response);
         verify(response).setStatus(eq(HttpServletResponse.SC_OK));
     }
@@ -259,32 +206,21 @@
     @Test
     public void Given_Request_Is_HTTP_GET_And_Ingress_Path_Equals_Network_And_Get_Succeeds() throws Exception {
         when(request.getPathInfo()).thenReturn("/network/");
-        when(request.getRemoteAddr()).thenReturn("stub_addr");
         ServletOutputStream outStream = mock(ServletOutputStream.class);
         when(response.getOutputStream()).thenReturn(outStream);
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doGet(request, response);
         verify(response).setStatus(eq(HttpServletResponse.SC_OK));
     }
 
     @Test
     public void Given_Request_Is_HTTP_PUT_And_Is_Not_Authorized() throws Exception {
-        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "isAddressAuthEnabled", "true", true);
+        when(request.getRemoteAddr()).thenReturn("stub_addr");
         routeServlet.doPut(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
     }
 
     @Test
     public void Given_Request_Is_HTTP_PUT_And_Contains_Bad_URL() throws Exception {
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doPut(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
     }
@@ -292,55 +228,38 @@
 
     @Test
     public void Given_Request_Is_HTTP_POST_And_Is_Not_Authorized() throws Exception {
-        FieldUtils.writeDeclaredStaticField(BaseServlet.class, "isAddressAuthEnabled", "true", true);
+        when(request.getRemoteAddr()).thenReturn("stub_addr");
         routeServlet.doPost(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_FORBIDDEN), argThat(notNullValue(String.class)));
     }
 
     @Test
-    public void Given_Request_Is_HTTP_POST_And_Ingress_Path_Starts_With_Ingress_And_Contains_Invalid_Arguments() throws Exception {
+    public void Given_Request_Is_HTTP_POST_And_Ingress_Path_Starts_With_Ingress_And_Contains_Invalid_Arguments()
+            throws Exception {
         when(request.getPathInfo()).thenReturn("/ingress/");
-        when(request.getRemoteAddr()).thenReturn("stub_addr");
         when(request.getParameter("feed")).thenReturn("3");
         when(request.getParameter("user")).thenReturn(null);
         when(request.getParameter("subnet")).thenReturn(null);
         when(request.getParameter("nodepatt")).thenReturn(null);
         when(request.getParameter("seq")).thenReturn(null);
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doPost(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
     }
 
     @Test
-    public void Given_Request_Is_HTTP_POST_And_Path_Starts_With_Egress_And_EgressRoute_Already_Exists() throws Exception {
+    public void Given_Request_Is_HTTP_POST_And_Path_Starts_With_Egress_And_EgressRoute_Already_Exists()
+            throws Exception {
         when(request.getPathInfo()).thenReturn("/egress/");
-        when(request.getRemoteAddr()).thenReturn("stub_addr");
-        when(request.getParameter("sub")).thenReturn("3");
-        EgressRoute e = mock(EgressRoute.class);
-        PowerMockito.when(EgressRoute.getEgressRoute(anyInt())).thenReturn(e);
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
+        when(request.getParameter("sub")).thenReturn("1");
         routeServlet.doPost(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
     }
 
     @Test
-    public void Given_Request_Is_HTTP_POST_And_Path_Starts_With_Egress_And_Contains_Invalid_Arguments() throws Exception {
+    public void Given_Request_Is_HTTP_POST_And_Path_Starts_With_Egress_And_Contains_Invalid_Arguments()
+            throws Exception {
         when(request.getPathInfo()).thenReturn("/egress/");
-        when(request.getRemoteAddr()).thenReturn("stub_addr");
         when(request.getParameter("sub")).thenReturn("3");
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doPost(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
     }
@@ -348,12 +267,6 @@
     @Test
     public void Given_Request_Is_HTTP_POST_And_Path_Starts_With_Network_And_Is_Missing_Arguments() throws Exception {
         when(request.getPathInfo()).thenReturn("/network/");
-        when(request.getRemoteAddr()).thenReturn("stub_addr");
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doPost(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
     }
@@ -361,20 +274,9 @@
     @Test
     public void Given_Request_Is_HTTP_POST_And_Path_Starts_With_Network_And_Route_Already_Exists() throws Exception {
         when(request.getPathInfo()).thenReturn("/network/");
-        when(request.getRemoteAddr()).thenReturn("stub_addr");
         when(request.getParameter("from")).thenReturn("stub_from");
         when(request.getParameter("to")).thenReturn("stub_to");
         when(request.getParameter("via")).thenReturn("stub_via");
-        PowerMockito.mockStatic(NodeClass.class);
-        PowerMockito.when(NodeClass.normalizeNodename(anyString())).thenReturn("stub_val");
-        SortedSet<NetworkRoute> networkSet = new TreeSet();
-        networkSet.add(mock(NetworkRoute.class));
-        PowerMockito.when(NetworkRoute.getAllNetworkRoutes()).thenReturn(networkSet);
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doPost(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_BAD_REQUEST), argThat(notNullValue(String.class)));
     }
@@ -382,17 +284,9 @@
     @Test
     public void Given_Request_Is_HTTP_POST_And_Path_URL_Is_Null() throws Exception {
         when(request.getPathInfo()).thenReturn("/route/");
-        when(request.getRemoteAddr()).thenReturn("stub_addr");
         when(request.getParameter("from")).thenReturn("stub_from");
         when(request.getParameter("to")).thenReturn("stub_to");
         when(request.getParameter("via")).thenReturn("stub_via");
-        PowerMockito.mockStatic(NodeClass.class);
-        PowerMockito.when(NodeClass.normalizeNodename(anyString())).thenReturn("stub_val");
-        RouteServlet routeServlet = new RouteServlet() {
-            protected boolean isAuthorizedForInternal(HttpServletRequest req) {
-                return true;
-            }
-        };
         routeServlet.doPost(request, response);
         verify(response).sendError(eq(HttpServletResponse.SC_NOT_FOUND), argThat(notNullValue(String.class)));
     }
@@ -400,12 +294,9 @@
     @Test
     public void Given_Request_Is_HTTP_POST_And_Fails() throws Exception {
         when(request.getPathInfo()).thenReturn("/network/");
-        when(request.getRemoteAddr()).thenReturn("stub_addr");
-        when(request.getParameter("from")).thenReturn("stub_from");
-        when(request.getParameter("to")).thenReturn("stub_to");
-        when(request.getParameter("via")).thenReturn("stub_via");
-        PowerMockito.mockStatic(NodeClass.class);
-        PowerMockito.when(NodeClass.normalizeNodename(anyString())).thenReturn("stub_val");
+        when(request.getParameter("from")).thenReturn("node01");
+        when(request.getParameter("to")).thenReturn("node02");
+        when(request.getParameter("via")).thenReturn("node03");
         RouteServlet routeServlet = new RouteServlet() {
             protected boolean isAuthorizedForInternal(HttpServletRequest req) {
                 return true;
@@ -416,39 +307,9 @@
                 return false;
             }
         };
+
         routeServlet.doPost(request, response);
-        verify(response).sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
-    }
-
-    private void setRouteToReturnValid() throws IllegalAccessException {
-        PowerMockito.mockStatic(IngressRoute.class);
-        PowerMockito.when(IngressRoute.getIngressRoute(anyInt(), anyString(), anyString())).thenReturn(null);
-        SortedSet<IngressRoute> ingressSet = new TreeSet();
-        IngressRoute ingressRoute = mock(IngressRoute.class);
-        JSONObject joIngress = mock(JSONObject.class);
-        when(joIngress.toString()).thenReturn("{}");
-        when(ingressRoute.asJSONObject()).thenReturn(joIngress);
-        ingressSet.add(ingressRoute);
-        PowerMockito.when(IngressRoute.getAllIngressRoutes()).thenReturn(ingressSet);
-
-        PowerMockito.mockStatic(EgressRoute.class);
-        PowerMockito.when(EgressRoute.getEgressRoute(anyInt())).thenReturn(null);
-        SortedSet<EgressRoute> egressSet = new TreeSet();
-        EgressRoute egressRoute = mock(EgressRoute.class);
-        JSONObject joEgress = mock(JSONObject.class);
-        when(joEgress.toString()).thenReturn("{}");
-        when(egressRoute.asJSONObject()).thenReturn(joEgress);
-        egressSet.add(egressRoute);
-        PowerMockito.when(EgressRoute.getAllEgressRoutes()).thenReturn(egressSet);
-
-        PowerMockito.mockStatic(NetworkRoute.class);
-        SortedSet<NetworkRoute> networkSet = new TreeSet();
-        PowerMockito.when(NetworkRoute.getAllNetworkRoutes()).thenReturn(networkSet);
-
-    }
-
-    private void setPokerToNotCreateTimersWhenDeleteFeedIsCalled() throws Exception {
-        Poker poker = mock(Poker.class);
-        FieldUtils.writeDeclaredStaticField(Poker.class, "poker", poker, true);
+        verify(response)
+                .sendError(eq(HttpServletResponse.SC_INTERNAL_SERVER_ERROR), argThat(notNullValue(String.class)));
     }
 }
diff --git a/datarouter-prov/src/test/resources/create.sql b/datarouter-prov/src/test/resources/create.sql
index 2f9d3d9..cd87dde 100755
--- a/datarouter-prov/src/test/resources/create.sql
+++ b/datarouter-prov/src/test/resources/create.sql
@@ -164,7 +164,7 @@
 VALUES (2,1,'user',null,2);
 
 insert into NODESETS(SETID, NODEID)
-VALUES (2,0);
+VALUES (2,2);
 
 insert into LOG_RECORDS(RECORD_ID,TYPE,EVENT_TIME,PUBLISH_ID,FEEDID,REQURI,METHOD,CONTENT_TYPE,CONTENT_LENGTH,FEED_FILEID,REMOTE_ADDR,USER,STATUS,DELIVERY_SUBID,DELIVERY_FILEID,RESULT,ATTEMPTS,REASON)
 VALUES(1,'pub',2536159564422,'ID',1,'URL','GET','application/vnd.att-dr.log-list; version=1.0',100,1,'172.0.0.8','user',204,1,1,204,0,'other');
@@ -173,4 +173,18 @@
     String Function(String one, String two, String three){
         return "url";
     }
-$$;
\ No newline at end of file
+$$;
+
+insert into NETWORK_ROUTES(FROMNODE, TONODE, VIANODE)
+VALUES (1, 3, 2);
+
+insert into NODES(NODEID, NAME) values
+    (1, 'stub_from.'),
+    (2, 'stub_via.'),
+    (3, 'stub_to.'),
+    (4, 'node01.'),
+    (5, 'node02.'),
+    (6, 'node03.')
+;
+insert into EGRESS_ROUTES(SUBID, NODEID) values (1, 1);
+
