Fix DHCP handling bug in HostLocationProvider
Change-Id: I69beb697736aec4540d2dfd0ba168141ab466ccf
diff --git a/providers/host/src/test/java/org/onosproject/provider/host/impl/HostLocationProviderTest.java b/providers/host/src/test/java/org/onosproject/provider/host/impl/HostLocationProviderTest.java
index 080e0e4..b43b50f 100644
--- a/providers/host/src/test/java/org/onosproject/provider/host/impl/HostLocationProviderTest.java
+++ b/providers/host/src/test/java/org/onosproject/provider/host/impl/HostLocationProviderTest.java
@@ -371,7 +371,7 @@
// DHCP Ack
testProcessor.process(new TestDhcpAckPacketContext(DEV1, false));
assertThat("receiveDhcpAck. Two additional host descriptions expected",
- providerService.descriptions.size(), is(2));
+ providerService.descriptions.size(), is(3));
// Should also learn the MAC, location of DHCP server
HostDescription descr2 = providerService.descriptions.get(1);
@@ -380,7 +380,14 @@
assertThat(descr2.ipAddress().size(), is(0));
assertThat(descr2.vlan(), is(VLAN));
- // Should not update the IP address of the host.
+ // Should update the IP address of the client.
+ HostDescription descr3 = providerService.descriptions.get(2);
+ assertThat(descr3.location(), is(LOCATION));
+ assertThat(descr3.hwAddress(), is(MAC));
+ assertThat(descr3.ipAddress().size(), is(1));
+ IpAddress ip = descr3.ipAddress().iterator().next();
+ assertThat(ip, is(IP_ADDRESS.getIp4Address()));
+ assertThat(descr3.vlan(), is(VLAN));
}
/**