mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 14:05:33 +00:00
[#2834] Adding UTs for relayed v6 opts
This commit is contained in:
@@ -1498,6 +1498,33 @@ TEST_F(TestControlTest, Packet6Relayed) {
|
||||
EXPECT_EQ(pkt6->relay_info_[0].peeraddr_, tc.socket_.addr_);
|
||||
}
|
||||
|
||||
TEST_F(TestControlTest, Packet6RelayedWithRelayOpts) {
|
||||
CommandOptions opt;
|
||||
processCmdLine(opt, "perfdhcp -6 -l fake -A1 --o1r 32,00000E10 -L 10547 servers");
|
||||
NakedTestControl tc(opt);
|
||||
uint32_t transid = 123;
|
||||
boost::shared_ptr<Pkt6> pkt6(new Pkt6(DHCPV6_SOLICIT, transid));
|
||||
// Set packet's parameters.
|
||||
tc.setDefaults6(pkt6);
|
||||
// Validate if parameters have been set correctly.
|
||||
EXPECT_EQ(tc.fake_sock_.iface_->getName(), pkt6->getIface());
|
||||
EXPECT_EQ(tc.socket_.ifindex_, pkt6->getIndex());
|
||||
EXPECT_EQ(DHCP6_CLIENT_PORT, pkt6->getLocalPort());
|
||||
EXPECT_EQ(DHCP6_SERVER_PORT, pkt6->getRemotePort());
|
||||
EXPECT_EQ(tc.socket_.addr_, pkt6->getLocalAddr());
|
||||
EXPECT_EQ(asiolink::IOAddress("FF05::1:3"), pkt6->getRemoteAddr());
|
||||
// Packet should be relayed.
|
||||
EXPECT_EQ(pkt6->relay_info_.size(), 1);
|
||||
EXPECT_EQ(pkt6->relay_info_[0].hop_count_, 0);
|
||||
EXPECT_EQ(pkt6->relay_info_[0].msg_type_, DHCPV6_RELAY_FORW);
|
||||
EXPECT_EQ(pkt6->relay_info_[0].linkaddr_, tc.socket_.addr_);
|
||||
EXPECT_EQ(pkt6->relay_info_[0].peeraddr_, tc.socket_.addr_);
|
||||
// Checking if relayed option is there.
|
||||
OptionBuffer opt_data = pkt6->relay_info_[0].options_.find(32)->second->getData();
|
||||
EXPECT_EQ(4, opt_data.size());
|
||||
EXPECT_EQ("0x00000E10", pkt6->relay_info_[0].options_.find(32)->second->toHexString());
|
||||
}
|
||||
|
||||
TEST_F(TestControlTest, Packet4Exchange) {
|
||||
const int iterations_num = 100;
|
||||
CommandOptions opt;
|
||||
|
Reference in New Issue
Block a user