[CORD-2882] Set route source to DHCP for DHCPv4
In accompany with gerrit 17675
Change-Id: I727bde64ebcc31fe2d758d96a8ad28b279a75c26
diff --git a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp4HandlerImpl.java b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp4HandlerImpl.java
index c4a6ad7..2ec54af 100644
--- a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp4HandlerImpl.java
+++ b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/Dhcp4HandlerImpl.java
@@ -566,7 +566,7 @@
}
log.debug("LQ: *NEW* NH IP for host is " + nextHopIp.getIp4Address());
- Route route = new Route(Route.Source.STATIC, clientIP.toIpPrefix(), nextHopIp);
+ Route route = new Route(Route.Source.DHCP, clientIP.toIpPrefix(), nextHopIp);
routeStore.updateRoute(route);
// and forward to client
@@ -651,7 +651,7 @@
}
log.debug("LQ: *Existing* NH IP for host is " + nextHopIp.getIp4Address() + " removing route for it");
- Route route = new Route(Route.Source.STATIC, clientIP.toIpPrefix(), nextHopIp);
+ Route route = new Route(Route.Source.DHCP, clientIP.toIpPrefix(), nextHopIp);
routeStore.removeRoute(route);
// remove from temp store
@@ -1373,7 +1373,7 @@
return;
}
- Route route = new Route(Route.Source.STATIC, ip.toIpPrefix(), nextHopIp);
+ Route route = new Route(Route.Source.DHCP, ip.toIpPrefix(), nextHopIp);
routeStore.updateRoute(route);
}
}
diff --git a/apps/dhcprelay/src/test/java/org/onosproject/dhcprelay/DhcpRelayManagerTest.java b/apps/dhcprelay/src/test/java/org/onosproject/dhcprelay/DhcpRelayManagerTest.java
index 65518ee..25f7b67 100644
--- a/apps/dhcprelay/src/test/java/org/onosproject/dhcprelay/DhcpRelayManagerTest.java
+++ b/apps/dhcprelay/src/test/java/org/onosproject/dhcprelay/DhcpRelayManagerTest.java
@@ -449,7 +449,7 @@
Route route = mockRouteStore.routes.get(0);
assertEquals(OUTER_RELAY_IP, route.nextHop());
assertEquals(IP_FOR_CLIENT.toIpPrefix(), route.prefix());
- assertEquals(Route.Source.STATIC, route.source());
+ assertEquals(Route.Source.DHCP, route.source());
}
@Test