]
}
</screen>
- The effect is the same than adding the option code in the
+ The effect is the same as if the client added the option code in the
Parameter Request List option (or its equivalent for vendor
options) so in:
<screen>
]
}
</screen>
- The effect is the same than adding the option code in the
+ The effect is the same as if the client added the option code in the
Option Request Option (or its equivalent for vendor options) so in:
<screen>
"Dhcp6": {
" \"valid-lifetime\": 4000,"
" \"interface\": \"eth0\" "
" } ],"
- "\"valid-lifetime\": 4000 }"
-};
+ "\"valid-lifetime\": 4000 }",
+
+ // Configuration 2:
+ // - 1 subnet, 2 global options (one forced with always-send)
+ "{"
+ " \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ] }, "
+ " \"rebind-timer\": 2000, "
+ " \"renew-timer\": 1000, "
+ " \"valid-lifetime\": 4000, "
+ " \"subnet4\": [ {"
+ " \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ], "
+ " \"subnet\": \"192.0.2.0/24\""
+ " } ], "
+ " \"option-data\": ["
+ " {"
+ " \"name\": \"default-ip-ttl\", "
+ " \"data\": \"FF\", "
+ " \"csv-format\": false"
+ " }, "
+ " {"
+ " \"name\": \"ip-forwarding\", "
+ " \"data\": \"false\", "
+ " \"always-send\": true"
+ " }"
+ " ]"
+ "}" };
// This test verifies that the destination address of the response
// message is set to giaddr, when giaddr is set to non-zero address
CfgMgr::instance().getStagingCfg()->getCfgSubnets4()->add(subnets->at(0));
CfgMgr::instance().getStagingCfg()->setEchoClientId(false);
CfgMgr::instance().commit();
-
+
offer = srv.processDiscover(dis);
// Check if we get response at all
IfaceMgrTestConfig test_config(true);
IfaceMgr::instance().openSockets4();
- NakedDhcpv4Srv srv(0);
-
- string config = "{ \"interfaces-config\": {"
- " \"interfaces\": [ \"*\" ] }, "
- "\"rebind-timer\": 2000, "
- "\"renew-timer\": 1000, "
- "\"valid-lifetime\": 4000, "
- "\"subnet4\": [ "
- "{ \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ], "
- " \"subnet\": \"192.0.2.0/24\" } ], "
- "\"option-data\": ["
- " { \"name\": \"default-ip-ttl\", "
- " \"data\": \"FF\", "
- " \"csv-format\": false }, "
- " { \"name\": \"ip-forwarding\", "
- " \"data\": \"false\", "
- " \"always-send\": true } ] }";
-
- ConstElementPtr json;
- ASSERT_NO_THROW(json = parseDHCP4(config));
- ConstElementPtr status;
-
- // Configure the server and make sure the config is accepted
- EXPECT_NO_THROW(status = configureDhcp4Server(srv, json));
- ASSERT_TRUE(status);
- comment_ = config::parseAnswer(rcode_, status);
- ASSERT_EQ(0, rcode_);
-
- CfgMgr::instance().commit();
+ ASSERT_NO_THROW(configure(CONFIGS[2]));
// Create a packet with enough to select the subnet and go through
// the DISCOVER processing
ASSERT_TRUE(hostname);
query->addOption(hostname);
- // Process the query
- Pkt4Ptr response = srv.processDiscover(query);
+ // Let the server process it.
+ Pkt4Ptr response = srv_.processDiscover(query);
// Processing should add an ip-forwarding option
ASSERT_TRUE(response->getOption(DHO_IP_FORWARDING));
prl->addValue(DHO_DEFAULT_IP_TTL);
query->addOption(prl);
- // Process query
- response = srv.processDiscover(query);
+ // Let the server process it again.
+ response = srv_.processDiscover(query);
// Processing should add an ip-forwarding option
ASSERT_TRUE(response->getOption(DHO_IP_FORWARDING));
" \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
" \"subnet\": \"2001:db8:1::/48\" "
" } ],"
- "\"valid-lifetime\": 4000 }"
+ "\"valid-lifetime\": 4000 }",
+
+ // Configuration 2:
+ // - a single subnet
+ // - two global options (one enforced with always-send)
+ "{"
+ " \"interfaces-config\": { \"interfaces\": [ \"*\" ] }, "
+ " \"preferred-lifetime\": 3000, "
+ " \"rebind-timer\": 2000, "
+ " \"renew-timer\": 1000, "
+ " \"valid-lifetime\": 4000, "
+ " \"subnet6\": [ {"
+ " \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ], "
+ " \"subnet\": \"2001:db8:1::/48\""
+ " } ], "
+ " \"option-data\": ["
+ " {"
+ " \"name\": \"dns-servers\", "
+ " \"data\": \"2001:db8:1234:FFFF::1\""
+ " }, "
+ " {"
+ " \"name\": \"subscriber-id\", "
+ " \"data\": \"1234\", "
+ " \"always-send\": true"
+ " }"
+ " ]"
+ "}"
};
// This test verifies that incoming SOLICIT can be handled properly when
TEST_F(Dhcpv6SrvTest, prlPersistency) {
IfaceMgrTestConfig test_config(true);
- NakedDhcpv6Srv srv(0);
-
- string config = "{ \"interfaces-config\": {"
- " \"interfaces\": [ \"*\" ] }, "
- "\"preferred-lifetime\": 3000, "
- "\"rebind-timer\": 2000, "
- "\"renew-timer\": 1000, "
- "\"valid-lifetime\": 4000, "
- "\"subnet6\": [ "
- "{ \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ], "
- " \"subnet\": \"2001:db8:1::/48\" } ], "
- "\"option-data\": ["
- " { \"name\": \"dns-servers\", "
- " \"data\": \"2001:db8:1234:FFFF::1\" }, "
- " { \"name\": \"subscriber-id\", "
- " \"data\": \"1234\", "
- " \"always-send\": true } ] }";
-
- ConstElementPtr json;
- ASSERT_NO_THROW(json = parseDHCP6(config));
- ConstElementPtr status;
-
- // Configure the server and make sure the config is accepted
- EXPECT_NO_THROW(status = configureDhcp6Server(srv, json));
- ASSERT_TRUE(status);
- comment_ = config::parseAnswer(rcode_, status);
- ASSERT_EQ(0, rcode_);
-
- CfgMgr::instance().commit();
+ ASSERT_NO_THROW(configure(CONFIGS[2]));
// Create a packet with enough to select the subnet and go through
// the SOLICIT processing
oro->addValue(D6O_SNTP_SERVERS);
sol->addOption(oro);
- // Process the solicit
- Pkt6Ptr response = srv.processSolicit(sol);
+ // Let the server process it and generate a response.
+ Pkt6Ptr response = srv_.processSolicit(sol);
- // Processing should add a subscriber-id option
+ // The server should a subscriber-id option
ASSERT_TRUE(response->getOption(D6O_SUBSCRIBER_ID));
// But no dns-servers
ASSERT_FALSE(response->getOption(D6O_NAME_SERVERS));
oro->addValue(D6O_NAME_SERVERS);
sol->addOption(oro);
- // Process solicit
- response = srv.processSolicit(sol);
+ // Let the server process it again. This time the name-servers
+ // option should be present.
+ response = srv_.processSolicit(sol);
// Processing should add a subscriber-id option
ASSERT_TRUE(response->getOption(D6O_SUBSCRIBER_ID));