[VOL-2672] dhcpl2relay should relay DHCPNAK and DHCPDECLINE messages
Change-Id: I545f8c18766c08c00ae6fedc40ebf950e6f4c78f
diff --git a/app/src/test/java/org/opencord/dhcpl2relay/impl/DhcpL2RelayTest.java b/app/src/test/java/org/opencord/dhcpl2relay/impl/DhcpL2RelayTest.java
index a0cab4a..6d0524e 100755
--- a/app/src/test/java/org/opencord/dhcpl2relay/impl/DhcpL2RelayTest.java
+++ b/app/src/test/java/org/opencord/dhcpl2relay/impl/DhcpL2RelayTest.java
@@ -151,6 +151,39 @@
}
/**
+ * Tests the DHCP relay app by sending DHCP Nak Packet.
+ *
+ * @throws Exception when an unhandled error occurs
+ */
+ @Test
+ public void testDhcpNak() {
+
+ Ethernet nakPacket = constructDhcpNakPacket(SERVER_MAC,
+ CLIENT_MAC, DESTINATION_ADDRESS_IP, DHCP_CLIENT_IP_ADDRESS);
+
+ sendPacket(nakPacket, ConnectPoint.deviceConnectPoint(OLT_DEV_ID + "/" + 1));
+
+ Ethernet nakRelayed = (Ethernet) getPacket();
+ compareServerPackets(nakPacket, nakRelayed);
+ }
+
+ /**
+ * Tests the DHCP relay app by sending DHCP Decline Packet.
+ *
+ * @throws Exception when an unhandled error occurs
+ */
+ @Test
+ public void testDhcpDecline() {
+
+ Ethernet declinePacket = constructDhcpDeclinePacket(CLIENT_MAC);
+
+ sendPacket(declinePacket, ConnectPoint.deviceConnectPoint(OLT_DEV_ID + "/" + 1));
+
+ Ethernet declineRelayed = (Ethernet) getPacket();
+ compareClientPackets(declinePacket, declineRelayed);
+ }
+
+ /**
* Tests the DHCP global counters.
*/
@Test