|
@@ -2800,4 +2800,37 @@ TEST_F(Dhcp4ParserTest, invalidD2ClientConfig) {
|
|
|
ASSERT_FALSE(CfgMgr::instance().ddnsEnabled());
|
|
|
}
|
|
|
|
|
|
+// This test checks if it is possible to specify relay information
|
|
|
+TEST_F(Dhcp4ParserTest, subnetRelayInfo) {
|
|
|
+
|
|
|
+ ConstElementPtr status;
|
|
|
+
|
|
|
+ // A config with relay information.
|
|
|
+ string config = "{ \"interfaces\": [ \"*\" ],"
|
|
|
+ "\"rebind-timer\": 2000, "
|
|
|
+ "\"renew-timer\": 1000, "
|
|
|
+ "\"subnet4\": [ { "
|
|
|
+ " \"pool\": [ \"192.0.2.1 - 192.0.2.100\" ],"
|
|
|
+ " \"renew-timer\": 1, "
|
|
|
+ " \"rebind-timer\": 2, "
|
|
|
+ " \"valid-lifetime\": 4,"
|
|
|
+ " \"relay\": { "
|
|
|
+ " \"ip-address\": \"192.0.2.123\""
|
|
|
+ " },"
|
|
|
+ " \"subnet\": \"192.0.2.0/24\" } ],"
|
|
|
+ "\"valid-lifetime\": 4000 }";
|
|
|
+
|
|
|
+ ElementPtr json = Element::fromJSON(config);
|
|
|
+
|
|
|
+ EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
|
|
|
+
|
|
|
+ // returned value should be 0 (configuration success)
|
|
|
+ checkResult(status, 0);
|
|
|
+
|
|
|
+ Subnet4Ptr subnet = CfgMgr::instance().getSubnet4(IOAddress("192.0.2.200"));
|
|
|
+ ASSERT_TRUE(subnet);
|
|
|
+ EXPECT_EQ("192.0.2.123", subnet->relay_.addr_.toText());
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
}
|