"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/bin/dhcp4/tests/inform_unittest.cc" between
kea-1.6.1.tar.gz and kea-1.6.2.tar.gz

About: Kea is a modern DHCPv4 & DHCPv6 Server (potential successor of ISC DHCP).

inform_unittest.cc  (kea-1.6.1):inform_unittest.cc  (kea-1.6.2)
// Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC") // Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h> #include <config.h>
#include <asiolink/io_address.h> #include <asiolink/io_address.h>
#include <cc/data.h> #include <cc/data.h>
#include <dhcp/dhcp4.h> #include <dhcp/dhcp4.h>
#include <dhcp/tests/iface_mgr_test_config.h> #include <dhcp/tests/iface_mgr_test_config.h>
skipping to change at line 178 skipping to change at line 178
// Send DHCPINFORM message to the server. // Send DHCPINFORM message to the server.
ASSERT_NO_THROW(client.doInform()); ASSERT_NO_THROW(client.doInform());
// Make sure that the server responded. // Make sure that the server responded.
ASSERT_TRUE(client.getContext().response_); ASSERT_TRUE(client.getContext().response_);
Pkt4Ptr resp = client.getContext().response_; Pkt4Ptr resp = client.getContext().response_;
// Make sure that the server has responded with DHCPACK. // Make sure that the server has responded with DHCPACK.
ASSERT_EQ(DHCPACK, static_cast<int>(resp->getType())); ASSERT_EQ(DHCPACK, static_cast<int>(resp->getType()));
// Response should have been unicast to the ciaddr. // Response should have been unicast to the ciaddr.
EXPECT_EQ(IOAddress("10.0.0.56"), resp->getLocalAddr()); EXPECT_EQ(IOAddress("10.0.0.56"), resp->getLocalAddr());
// The ciaddr should have been copied.
EXPECT_EQ(IOAddress("10.0.0.56"), resp->getCiaddr());
// Response must not be relayed. // Response must not be relayed.
EXPECT_FALSE(resp->isRelayed()); EXPECT_FALSE(resp->isRelayed());
// Make sure that the server id is present. // Make sure that the server id is present.
EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText()); EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText());
// Make sure that the Routers option has been received. // Make sure that the Routers option has been received.
ASSERT_EQ(2, client.config_.routers_.size()); ASSERT_EQ(2, client.config_.routers_.size());
EXPECT_EQ("10.0.0.200", client.config_.routers_[0].toText()); EXPECT_EQ("10.0.0.200", client.config_.routers_[0].toText());
EXPECT_EQ("10.0.0.201", client.config_.routers_[1].toText()); EXPECT_EQ("10.0.0.201", client.config_.routers_[1].toText());
// Make sure that the DNS Servers option has been received. // Make sure that the DNS Servers option has been received.
skipping to change at line 217 skipping to change at line 219
// Send DHCPINFORM. // Send DHCPINFORM.
ASSERT_NO_THROW(client.doInform()); ASSERT_NO_THROW(client.doInform());
// Make sure that the server responded. // Make sure that the server responded.
resp = client.getContext().response_; resp = client.getContext().response_;
ASSERT_TRUE(resp); ASSERT_TRUE(resp);
// Make sure that the server has responded with DHCPACK. // Make sure that the server has responded with DHCPACK.
ASSERT_EQ(DHCPACK, static_cast<int>(resp->getType())); ASSERT_EQ(DHCPACK, static_cast<int>(resp->getType()));
// Response should have been unicast to the ciaddr. // Response should have been unicast to the ciaddr.
EXPECT_EQ(IOAddress("10.0.0.12"), resp->getLocalAddr()); EXPECT_EQ(IOAddress("10.0.0.12"), resp->getLocalAddr());
// The ciaddr should have been copied.
EXPECT_EQ(IOAddress("10.0.0.12"), resp->getCiaddr());
// Response must not be relayed. // Response must not be relayed.
EXPECT_FALSE(resp->isRelayed()); EXPECT_FALSE(resp->isRelayed());
// Make sure that the server id is present. // Make sure that the server id is present.
EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText()); EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText());
// Make sure that the Routers option has been received. // Make sure that the Routers option has been received.
ASSERT_EQ(2, client.config_.routers_.size()); ASSERT_EQ(2, client.config_.routers_.size());
EXPECT_EQ("10.0.0.200", client.config_.routers_[0].toText()); EXPECT_EQ("10.0.0.200", client.config_.routers_[0].toText());
EXPECT_EQ("10.0.0.201", client.config_.routers_[1].toText()); EXPECT_EQ("10.0.0.201", client.config_.routers_[1].toText());
// Make sure that the DNS Servers option has been received. // Make sure that the DNS Servers option has been received.
skipping to change at line 268 skipping to change at line 272
client.setDestAddress(IOAddress("10.0.0.1")); client.setDestAddress(IOAddress("10.0.0.1"));
// Send DHCPINFORM message to the server. // Send DHCPINFORM message to the server.
ASSERT_NO_THROW(client.doInform()); ASSERT_NO_THROW(client.doInform());
// Make sure that the server responded. // Make sure that the server responded.
ASSERT_TRUE(client.getContext().response_); ASSERT_TRUE(client.getContext().response_);
Pkt4Ptr resp = client.getContext().response_; Pkt4Ptr resp = client.getContext().response_;
// Make sure that the server has responded with DHCPACK. // Make sure that the server has responded with DHCPACK.
ASSERT_EQ(DHCPACK, static_cast<int>(resp->getType())); ASSERT_EQ(DHCPACK, static_cast<int>(resp->getType()));
// Response should have been unicast to the ciaddr. // Response should have been unicast to the ciaddr.
EXPECT_EQ(IOAddress("10.0.0.56"), resp->getLocalAddr()); EXPECT_EQ(IOAddress("10.0.0.56"), resp->getLocalAddr());
// The ciaddr should have been copied.
EXPECT_EQ(IOAddress("10.0.0.56"), resp->getCiaddr());
// Response must not be relayed. // Response must not be relayed.
EXPECT_FALSE(resp->isRelayed()); EXPECT_FALSE(resp->isRelayed());
// Make sure that the server id is present. // Make sure that the server id is present.
EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText()); EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText());
// Make sure that the Routers option has been received. // Make sure that the Routers option has been received.
ASSERT_EQ(2, client.config_.routers_.size()); ASSERT_EQ(2, client.config_.routers_.size());
EXPECT_EQ("10.0.0.200", client.config_.routers_[0].toText()); EXPECT_EQ("10.0.0.200", client.config_.routers_[0].toText());
EXPECT_EQ("10.0.0.201", client.config_.routers_[1].toText()); EXPECT_EQ("10.0.0.201", client.config_.routers_[1].toText());
// Make sure that the DNS Servers option has been received. // Make sure that the DNS Servers option has been received.
ASSERT_EQ(2, client.config_.dns_servers_.size()); ASSERT_EQ(2, client.config_.dns_servers_.size());
skipping to change at line 298 skipping to change at line 304
configure(INFORM_CONFIGS[0], *client.getServer()); configure(INFORM_CONFIGS[0], *client.getServer());
// Preconfigure the client with the IP address. // Preconfigure the client with the IP address.
client.createLease(IOAddress("10.0.0.56"), 600); client.createLease(IOAddress("10.0.0.56"), 600);
// Send DHCPINFORM message (with ciaddr not set) to the server. // Send DHCPINFORM message (with ciaddr not set) to the server.
ASSERT_NO_THROW(client.doInform(false)); ASSERT_NO_THROW(client.doInform(false));
// Make sure that the server responded. // Make sure that the server responded.
ASSERT_TRUE(client.getContext().response_); ASSERT_TRUE(client.getContext().response_);
Pkt4Ptr resp = client.getContext().response_; Pkt4Ptr resp = client.getContext().response_;
// Make sure that the server has responded with DHCPACK. // Make sure that the server has responded with DHCPACK.
ASSERT_EQ(DHCPACK, static_cast<int>(resp->getType())); ASSERT_EQ(DHCPACK, static_cast<int>(resp->getType()));
// Response should have been unicast to the ciaddr. // Response should have been unicast to the client address.
EXPECT_EQ(IOAddress("10.0.0.56"), resp->getLocalAddr()); EXPECT_EQ(IOAddress("10.0.0.56"), resp->getLocalAddr());
// The ciaddr should be 0.
EXPECT_EQ(IOAddress("0.0.0.0"), resp->getCiaddr());
// Response must not be relayed. // Response must not be relayed.
EXPECT_FALSE(resp->isRelayed()); EXPECT_FALSE(resp->isRelayed());
EXPECT_EQ(DHCP4_CLIENT_PORT, resp->getLocalPort()); EXPECT_EQ(DHCP4_CLIENT_PORT, resp->getLocalPort());
EXPECT_EQ(DHCP4_SERVER_PORT, resp->getRemotePort()); EXPECT_EQ(DHCP4_SERVER_PORT, resp->getRemotePort());
// Make sure that the server id is present. // Make sure that the server id is present.
EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText()); EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText());
// Make sure that the Routers option has been received. // Make sure that the Routers option has been received.
ASSERT_EQ(2, client.config_.routers_.size()); ASSERT_EQ(2, client.config_.routers_.size());
EXPECT_EQ("10.0.0.200", client.config_.routers_[0].toText()); EXPECT_EQ("10.0.0.200", client.config_.routers_[0].toText());
EXPECT_EQ("10.0.0.201", client.config_.routers_[1].toText()); EXPECT_EQ("10.0.0.201", client.config_.routers_[1].toText());
skipping to change at line 337 skipping to change at line 345
client.createLease(IOAddress("192.0.2.56"), 600); client.createLease(IOAddress("192.0.2.56"), 600);
// Send DHCPINFORM message to the server. // Send DHCPINFORM message to the server.
ASSERT_NO_THROW(client.doInform()); ASSERT_NO_THROW(client.doInform());
// Make sure that the server responded. // Make sure that the server responded.
ASSERT_TRUE(client.getContext().response_); ASSERT_TRUE(client.getContext().response_);
Pkt4Ptr resp = client.getContext().response_; Pkt4Ptr resp = client.getContext().response_;
// Make sure that the server has responded with DHCPACK. // Make sure that the server has responded with DHCPACK.
ASSERT_EQ(DHCPACK, static_cast<int>(resp->getType())); ASSERT_EQ(DHCPACK, static_cast<int>(resp->getType()));
// Response should have been unicast to the ciaddr. // Response should have been unicast to the ciaddr.
EXPECT_EQ(IOAddress("192.0.2.56"), resp->getLocalAddr()); EXPECT_EQ(IOAddress("192.0.2.56"), resp->getLocalAddr());
// The ciaddr should have been copied.
EXPECT_EQ(IOAddress("192.0.2.56"), resp->getCiaddr());
// Response is unicast to the client, so it must not be relayed. // Response is unicast to the client, so it must not be relayed.
EXPECT_FALSE(resp->isRelayed()); EXPECT_FALSE(resp->isRelayed());
EXPECT_EQ(DHCP4_CLIENT_PORT, resp->getLocalPort()); EXPECT_EQ(DHCP4_CLIENT_PORT, resp->getLocalPort());
EXPECT_EQ(DHCP4_SERVER_PORT, resp->getRemotePort()); EXPECT_EQ(DHCP4_SERVER_PORT, resp->getRemotePort());
// Make sure that the server id is present. // Make sure that the server id is present.
EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText()); EXPECT_EQ("10.0.0.1", client.config_.serverid_.toText());
// Make sure that the Routers option has been received. // Make sure that the Routers option has been received.
ASSERT_EQ(2, client.config_.routers_.size()); ASSERT_EQ(2, client.config_.routers_.size());
EXPECT_EQ("192.0.2.200", client.config_.routers_[0].toText()); EXPECT_EQ("192.0.2.200", client.config_.routers_[0].toText());
EXPECT_EQ("192.0.2.201", client.config_.routers_[1].toText()); EXPECT_EQ("192.0.2.201", client.config_.routers_[1].toText());
 End of changes. 7 change blocks. 
2 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)