-// Copyright (C) 2017-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2023 Internet Systems Consortium, Inc. ("ISC")
//
// 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
/// @brief Check that a well formed lease4 with a comment can be added.
void testLease4AddComment();
+ /// @brief Check that a well formed lease4 with relay and remote ids
+ /// can be added.
+ void testLease4AddExtendedInfo();
+
/// @brief Check that lease4-get can handle a situation when the query is
/// broken (some required parameters are missing).
void testLease4GetMissingParams();
/// user context.
void testLease4UpdateComment();
+ /// @brief Check that a lease4 can be updated. We're adding relay and
+ /// remote ids.
+ void testLease4UpdateExtendedInfo();
+
/// @brief Check that lease4-del can handle a situation when the query is
/// broken (some required parameters are missing).
void testLease4DelMissingParams();
" \"hw-address\": \"1a:1b:1c:1d:1e:1f\",\n"
" \"comment\": \"a comment\"\n"
" }\n"
- "}";
+ "}";
string exp_rsp = "Lease for address 192.0.2.202, subnet-id 44 added.";
testCommand(txt, CONTROL_RESULT_SUCCESS, exp_rsp);
EXPECT_EQ("{ \"comment\": \"a comment\" }", l->getContext()->str());
}
+void Lease4CmdsTest::testLease4AddExtendedInfo() {
+ // Initialize lease manager (false = v4, false = don't add leases)
+ initLeaseMgr(false, false);
+
+ checkLease4Stats(44, 0, 0);
+
+ checkLease4Stats(88, 0, 0);
+
+ // Now send the command.
+ string txt =
+ "{\n"
+ " \"command\": \"lease4-add\",\n"
+ " \"arguments\": {"
+ " \"subnet-id\": 44,\n"
+ " \"ip-address\": \"192.0.2.202\",\n"
+ " \"hw-address\": \"1a:1b:1c:1d:1e:1f\",\n"
+ " \"user-context\": { \"ISC\": { \"relay-agent-info\": {\n"
+ " \"sub-options\": \"0x02030102030C03AABBCC\",\n"
+ " \"remote-id\": \"010203\",\n"
+ " \"relay-id\": \"AABBCC\"\n"
+ " } } }\n"
+ " }\n"
+ "}";
+ string exp_rsp = "Lease for address 192.0.2.202, subnet-id 44 added.";
+ testCommand(txt, CONTROL_RESULT_SUCCESS, exp_rsp);
+
+ checkLease4Stats(44, 1, 0);
+
+ checkLease4Stats(88, 0, 0);
+
+ // Now check that the lease is really there.
+ Lease4Ptr l = lmptr_->getLease4(IOAddress("192.0.2.202"));
+ ASSERT_TRUE(l);
+
+ // Make sure the lease have proper value set.
+ ASSERT_TRUE(l->hwaddr_);
+ EXPECT_EQ("1a:1b:1c:1d:1e:1f", l->hwaddr_->toText(false));
+ ConstElementPtr ctx = l->getContext();
+ ASSERT_TRUE(ctx);
+ string expected = "{ \"ISC\": { \"relay-agent-info\": ";
+ expected += "{ \"relay-id\": \"AABBCC\", ";
+ expected += "\"remote-id\": \"010203\", ";
+ expected += "\"sub-options\": \"0x02030102030C03AABBCC\" } } }";
+ EXPECT_EQ(expected, ctx->str());
+ const vector<uint8_t> relay_id = { 0xaa, 0xbb, 0xcc };
+ EXPECT_EQ(relay_id, l->relay_id_);
+ const vector<uint8_t> remote_id = { 1, 2, 3 };
+ EXPECT_EQ(remote_id, l->remote_id_);
+}
+
void Lease4CmdsTest::testLease4GetMissingParams() {
// No parameters whatsoever. You want just a lease, any lease?
string cmd =
EXPECT_EQ("true", ctx->get("foobar")->str());
}
+void Lease4CmdsTest::testLease4UpdateExtendedInfo() {
+ // Initialize lease manager (false = v4, true = add leases)
+ initLeaseMgr(false, true);
+
+ checkLease4Stats(44, 2, 0);
+
+ checkLease4Stats(88, 2, 0);
+
+ // Now send the command.
+ string txt =
+ "{\n"
+ " \"command\": \"lease4-update\",\n"
+ " \"arguments\": {"
+ " \"subnet-id\": 44,\n"
+ " \"ip-address\": \"192.0.2.1\",\n"
+ " \"hw-address\": \"42:42:42:42:42:42:42:42\",\n"
+ " \"user-context\": { \"ISC\": { \"relay-agent-info\": {\n"
+ " \"sub-options\": \"0x02030102030C03AABBCC\",\n"
+ " \"remote-id\": \"010203\",\n"
+ " \"relay-id\": \"AABBCC\"\n"
+ " } } }\n"
+ " }\n"
+ "}";
+ string exp_rsp = "IPv4 lease updated.";
+ testCommand(txt, CONTROL_RESULT_SUCCESS, exp_rsp);
+
+ checkLease4Stats(44, 2, 0);
+
+ checkLease4Stats(88, 2, 0);
+
+ // Now check that the lease is still there.
+ Lease4Ptr l = lmptr_->getLease4(IOAddress("192.0.2.1"));
+ ASSERT_TRUE(l);
+
+ // Make sure it's been updated.
+ ASSERT_TRUE(l->hwaddr_);
+ EXPECT_EQ("42:42:42:42:42:42:42:42", l->hwaddr_->toText(false));
+
+ // Check user context.
+ ConstElementPtr ctx = l->getContext();
+ ASSERT_TRUE(ctx);
+ string expected = "{ \"ISC\": { \"relay-agent-info\": ";
+ expected += "{ \"relay-id\": \"AABBCC\", ";
+ expected += "\"remote-id\": \"010203\", ";
+ expected += "\"sub-options\": \"0x02030102030C03AABBCC\" } } }";
+ EXPECT_EQ(expected, ctx->str());
+ const vector<uint8_t> relay_id = { 0xaa, 0xbb, 0xcc };
+ EXPECT_EQ(relay_id, l->relay_id_);
+ const vector<uint8_t> remote_id = { 1, 2, 3 };
+ EXPECT_EQ(remote_id, l->remote_id_);
+}
+
void Lease4CmdsTest::testLease4DelMissingParams() {
// No parameters whatsoever. You want just a lease, any lease?
string cmd =
testLease4AddComment();
}
+TEST_F(Lease4CmdsTest, lease4AddExtendedInfo) {
+ testLease4AddExtendedInfo();
+}
+
+TEST_F(Lease4CmdsTest, lease4AddExtendedInfoMultiThreading) {
+ MultiThreadingTest mt(true);
+ testLease4AddExtendedInfo();
+}
+
TEST_F(Lease4CmdsTest, lease4GetMissingParams) {
testLease4GetMissingParams();
}
testLease4UpdateComment();
}
+TEST_F(Lease4CmdsTest, lease4UpdateExtendedInfo) {
+ testLease4UpdateExtendedInfo();
+}
+
+TEST_F(Lease4CmdsTest, lease4UpdateExtendedInfoMultiThreading) {
+ MultiThreadingTest mt(true);
+ testLease4UpdateExtendedInfo();
+}
+
TEST_F(Lease4CmdsTest, lease4DelMissingParams) {
testLease4DelMissingParams();
}
if (other.getContext()) {
setContext(other.getContext());
+ relay_id_ = other.relay_id_;
+ remote_id_ = other.remote_id_;
}
}
if (other.getContext()) {
setContext(other.getContext());
+ relay_id_ = other.relay_id_;
+ remote_id_ = other.remote_id_;
}
}
return (*this);
-// Copyright (C) 2012-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2023 Internet Systems Consortium, Inc. ("ISC")
//
// 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
#include <dhcpsrv/memfile_lease_mgr.h>
#include <dhcpsrv/testutils/test_utils.h>
#include <dhcpsrv/tests/generic_lease_mgr_unittest.h>
-
-#include <gtest/gtest.h>
+#include <testutils/gtest_utils.h>
#include <iostream>
#include <list>
}
}
+// Verify Lease4 user context extract basic operations.
+TEST(Lease4ExtendedInfoTest, extract) {
+ Lease4Ptr lease;
+
+ // No Lease.
+ ASSERT_FALSE(lease);
+ EXPECT_NO_THROW(LeaseMgr::extractLease4ExtendedInfo(lease));
+ EXPECT_NO_THROW(LeaseMgr::extractLease4ExtendedInfo(lease, false));
+
+ // No user context.
+ lease.reset(new Lease4());
+ ASSERT_TRUE(lease);
+ ASSERT_FALSE(lease->getContext());
+ EXPECT_NO_THROW(LeaseMgr::extractLease4ExtendedInfo(lease));
+ EXPECT_NO_THROW(LeaseMgr::extractLease4ExtendedInfo(lease, false));
+
+ // Not map user context.
+ ElementPtr user_context = Element::createList();
+ lease->setContext(user_context);
+ EXPECT_NO_THROW(LeaseMgr::extractLease4ExtendedInfo(lease));
+
+ // No ISC.
+ user_context = Element::createMap();
+ user_context->set("foo", Element::create(string("bar")));
+ lease->setContext(user_context);
+ EXPECT_NO_THROW(LeaseMgr::extractLease4ExtendedInfo(lease));
+ EXPECT_NO_THROW(LeaseMgr::extractLease4ExtendedInfo(lease, false));
+
+ // Not a map ISC.
+ user_context = Element::createMap();
+ lease->setContext(user_context);
+ ElementPtr isc = Element::create(string("..."));
+ user_context->set("ISC", isc);
+ EXPECT_NO_THROW(LeaseMgr::extractLease4ExtendedInfo(lease));
+
+ // No relay agent info.
+ user_context = Element::createMap();
+ lease->setContext(user_context);
+ isc = Element::createMap();
+ user_context->set("ISC", isc);
+ isc->set("foo", Element::create(string("bar")));
+ EXPECT_NO_THROW(LeaseMgr::extractLease4ExtendedInfo(lease));
+ EXPECT_NO_THROW(LeaseMgr::extractLease4ExtendedInfo(lease, false));
+
+ // Not a map relay agent info.
+ user_context = Element::createMap();
+ lease->setContext(user_context);
+ isc = Element::createMap();
+ user_context->set("ISC", isc);
+ ElementPtr rai = Element::createMap();
+ rai->set("foo", Element::create(string("bar")));
+ isc->set("relay-agent-info", rai);
+ EXPECT_NO_THROW(LeaseMgr::extractLease4ExtendedInfo(lease));
+
+ // No upgraded.
+ user_context = Element::createMap();
+ lease->setContext(user_context);
+ isc = Element::createMap();
+ user_context->set("ISC", isc);
+ rai = Element::create(string("0x02030102030C03AABBCC"));
+ isc->set("relay-agent-info", rai);
+ EXPECT_NO_THROW(LeaseMgr::extractLease4ExtendedInfo(lease));
+ EXPECT_TRUE(lease->relay_id_.empty());
+ EXPECT_TRUE(lease->remote_id_.empty());
+
+ // Upgraded.
+ EXPECT_TRUE(LeaseMgr::upgradeLease4ExtendedInfo(lease));
+ EXPECT_NO_THROW(LeaseMgr::extractLease4ExtendedInfo(lease, false));
+ const vector<uint8_t> relay_id = { 0xaa, 0xbb, 0xcc };
+ EXPECT_EQ(relay_id, lease->relay_id_);
+ const vector<uint8_t> remote_id = { 1, 2, 3 };
+ EXPECT_EQ(remote_id, lease->remote_id_);
+}
+
+// Verify Lease4 user context extract complex operations.
+TEST(Lease4ExtendedInfoTest, extractLease4ExtendedInfo) {
+ struct Scenario {
+ string description_; // test description.
+ string context_; // user context.
+ string msg_; // error message.
+ };
+
+ // Test scenarios.
+ vector<Scenario> scenarios {
+ {
+ "no user context",
+ "",
+ ""
+ },
+ {
+ "user context is not a map",
+ "[ ]",
+ "user context is not a map"
+ },
+ {
+ "no ISC entry",
+ "{ }",
+ ""
+ },
+ {
+ "no ISC entry but not empty",
+ "{ \"foo\": true }",
+ ""
+ },
+ {
+ "ISC entry is not a map",
+ "{ \"ISC\": true }",
+ "ISC entry is not a map"
+ },
+ {
+ "ISC entry is not a map, user context not empty",
+ "{ \"foo\": true, \"ISC\": true }",
+ "ISC entry is not a map"
+ },
+ {
+ "no relay agent info",
+ "{ \"ISC\": { } }",
+ ""
+ },
+ {
+ "no relay agent info, ISC not empty",
+ "{ \"ISC\": { \"foo\": true } }",
+ ""
+ },
+ {
+ "relay agent info is not a string or a map",
+ "{ \"ISC\": { \"relay-agent-info\": false } }",
+ "relay-agent-info is not a map"
+ },
+ {
+ "relay agent info is not a string or a map, ISC not empty",
+ "{ \"ISC\": { \"foo\": true, \"relay-agent-info\": false } }",
+ "relay-agent-info is not a map"
+ },
+ {
+ "relay agent info has a junk value",
+ "{ \"ISC\": { \"relay-agent-info\": \"foobar\" } }",
+ "relay-agent-info is not a map"
+ },
+ {
+ "relay agent info has a junk value, ISC not empty",
+ "{ \"ISC\": { \"foo\": true, \"relay-agent-info\": \"foobar\" } }",
+ "relay-agent-info is not a map"
+ },
+ {
+ "relay agent info has a rai without ids",
+ "{ \"ISC\": { \"relay-agent-info\": { \"sub-options\":"
+ " \"0x0104AABBCCDD\" } } }",
+ ""
+ },
+ {
+ "relay agent info with other entries",
+ "{ \"ISC\": { \"relay-agent-info\": { \"sub-options\":"
+ " \"0x0104AABBCCDD\" }, \"bar\": 456 }, \"foo\": 123 }",
+ ""
+ },
+ {
+ "relay agent info has a rai with ids",
+ "{ \"ISC\": { \"relay-agent-info\": { \"sub-options\":"
+ " \"0x02030102030C03AABBCC\", \"remote-id\": \"010203\","
+ " \"relay-id\": \"AABBCC\" } } }",
+ ""
+ }
+ };
+
+ Lease4Ptr lease(new Lease4());
+ ElementPtr user_context;
+ for (auto scenario : scenarios) {
+ SCOPED_TRACE(scenario.description_);
+
+ // Create the original user context from JSON.
+ if (scenario.context_.empty()) {
+ user_context.reset();
+ } else {
+ ASSERT_NO_THROW(user_context = Element::fromJSON(scenario.context_))
+ << "invalid user context, test " << scenario.description_
+ << " is broken";
+ }
+
+ // Perform the test.
+ lease->setContext(user_context);
+ if (scenario.msg_.empty()) {
+ EXPECT_NO_THROW(LeaseMgr::extractLease4ExtendedInfo(lease, false));
+ } else {
+ EXPECT_NO_THROW(LeaseMgr::extractLease4ExtendedInfo(lease));
+ EXPECT_THROW_MSG(LeaseMgr::extractLease4ExtendedInfo(lease, false),
+ BadValue, scenario.msg_);
+ }
+ }
+ // Last scenario sets relay and remote ids.
+ const vector<uint8_t> relay_id = { 0xaa, 0xbb, 0xcc };
+ EXPECT_EQ(relay_id, lease->relay_id_);
+ const vector<uint8_t> remote_id = { 1, 2, 3 };
+ EXPECT_EQ(remote_id, lease->remote_id_);
+}
+
// Verify Lease6 user context upgrade basic operations.
TEST(Lease6ExtendedInfoTest, basic) {
Lease6Ptr lease;
-// Copyright (C) 2013-2022 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2023 Internet Systems Consortium, Inc. ("ISC")
//
// 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
// This test checks if the Lease4 structure can be instantiated correctly.
TEST_F(Lease4Test, constructor) {
// Get current time for the use in Lease.
- const time_t current_time = time(NULL);
+ const time_t current_time = time(0);
// We want to check that various addresses work, so let's iterate over
// these.
TEST_F(Lease4Test, copyConstructor) {
// Get current time for the use in Lease4.
- const time_t current_time = time(NULL);
+ const time_t current_time = time(0);
// Create the lease
Lease4 lease(0xffffffff, hwaddr_, clientid_, VALID_LIFETIME, current_time,
// Set an user context.
lease.setContext(Element::fromJSON("{ \"foobar\": 1234 }"));
+ // Set relay and remote id.
+ const std::vector<uint8_t> relay_id = { 0xaa, 0xbb, 0xcc };
+ lease.relay_id_ = relay_id;
+ const std::vector<uint8_t> remote_id = { 1, 2, 3 };
+ lease.remote_id_ = remote_id;
+
// Use copy constructor to copy the lease.
Lease4 copied_lease(lease);
EXPECT_TRUE(lease.getContext() == copied_lease.getContext());
EXPECT_TRUE(*lease.getContext() == *copied_lease.getContext());
+ // Relay and remote ids are equal.
+ EXPECT_TRUE(lease.relay_id_ == copied_lease.relay_id_);
+ EXPECT_TRUE(lease.remote_id_ == copied_lease.remote_id_);
+
// Hardware addresses are equal, but they should point to two objects,
// each holding the same data. The content should be equal...
EXPECT_TRUE(*lease.hwaddr_ == *copied_lease.hwaddr_);
// ... but it should point to different objects.
EXPECT_FALSE(lease.hwaddr_ == copied_lease.hwaddr_);
- // Now let's check that the hwaddr pointer is copied even if it's NULL:
+ // Now let's check that the hwaddr pointer is copied even if it's null:
lease.hwaddr_.reset();
Lease4 copied_lease2(lease);
EXPECT_TRUE(lease == copied_lease2);
TEST_F(Lease4Test, operatorAssign) {
// Get the current time for the use in Lease4.
- const time_t current_time = time(NULL);
+ const time_t current_time = time(0);
// Create the lease
Lease4 lease(0xffffffff, hwaddr_, clientid_, VALID_LIFETIME, current_time,
// Set an user context.
lease.setContext(Element::fromJSON("{ \"foobar\": 1234 }"));
+ // Set relay and remote id.
+ const std::vector<uint8_t> relay_id = { 0xaa, 0xbb, 0xcc };
+ lease.relay_id_ = relay_id;
+ const std::vector<uint8_t> remote_id = { 1, 2, 3 };
+ lease.remote_id_ = remote_id;
+
// Create a default lease.
- Lease4 copied_lease;
+ Lease4 assigned_lease;
// Use assignment operator to assign new lease.
- copied_lease = lease;
+ assigned_lease = lease;
// Both leases should be now equal. When doing this check we assume that
// the equality operator works correctly.
- EXPECT_TRUE(lease == copied_lease);
+ EXPECT_TRUE(lease == assigned_lease);
// Client IDs are equal, but they should be in two distinct pointers.
- EXPECT_FALSE(lease.client_id_ == copied_lease.client_id_);
+ EXPECT_FALSE(lease.client_id_ == assigned_lease.client_id_);
// User context are equal and point to the same object.
- ASSERT_TRUE(copied_lease.getContext());
- EXPECT_TRUE(lease.getContext() == copied_lease.getContext());
- EXPECT_TRUE(*lease.getContext() == *copied_lease.getContext());
+ ASSERT_TRUE(assigned_lease.getContext());
+ EXPECT_TRUE(lease.getContext() == assigned_lease.getContext());
+ EXPECT_TRUE(*lease.getContext() == *assigned_lease.getContext());
+
+ // User context are equal and point to the same object.
+ ASSERT_TRUE(assigned_lease.getContext());
+ EXPECT_TRUE(lease.getContext() == assigned_lease.getContext());
+ EXPECT_TRUE(*lease.getContext() == *assigned_lease.getContext());
// Hardware addresses are equal, but they should point to two objects,
// each holding the same data. The content should be equal...
- EXPECT_TRUE(*lease.hwaddr_ == *copied_lease.hwaddr_);
+ EXPECT_TRUE(*lease.hwaddr_ == *assigned_lease.hwaddr_);
// ... but it should point to different objects.
- EXPECT_FALSE(lease.hwaddr_ == copied_lease.hwaddr_);
+ EXPECT_FALSE(lease.hwaddr_ == assigned_lease.hwaddr_);
- // Now let's check that the hwaddr pointer is copied even if it's NULL:
+ // Now let's check that the hwaddr pointer is copied even if it's null:
lease.hwaddr_.reset();
- copied_lease = lease;
- EXPECT_TRUE(lease == copied_lease);
+ assigned_lease = lease;
+ EXPECT_TRUE(lease == assigned_lease);
}
// This test verifies that it is correctly determined when the lease
// Create the lease with MAC address and Client Identifier.
Lease4 lease(IOAddress("192.0.2.1"), matching_hw, matching_client_id,
- 60, time(NULL), 0, 0, 1);
+ 60, time(0), 0, 0, 1);
// Verify cases for lease that has both hw address and client identifier.
EXPECT_TRUE(lease.belongsToClient(matching_hw, matching_client_id));
// Random values for the tests
const uint32_t ADDRESS = 0x01020304;
- const time_t current_time = time(NULL);
+ const time_t current_time = time(0);
// Check when the leases are equal.
Lease4 lease1(ADDRESS, hwaddr_, clientid_, VALID_LIFETIME, current_time,
}
// Verify that the client id can be returned as a vector object and if client
-// id is NULL the empty vector is returned.
+// id is null the empty vector is returned.
TEST_F(Lease4Test, getClientIdVector) {
// Create a lease.
Lease4 lease;
- // By default, the lease should have client id set to NULL. If it doesn't,
+ // By default, the lease should have client id set to null. If it doesn't,
// continuing the test makes no sense.
ASSERT_FALSE(lease.client_id_);
- // When client id is NULL the vector returned should be empty.
+ // When client id is null the vector returned should be empty.
EXPECT_TRUE(lease.getClientIdVector().empty());
// Initialize client identifier to non-null value.
lease.fqdn_fwd_ = true;
lease.fqdn_rev_ = true;
- time_t now = time(NULL);
+ time_t now = time(0);
// Move lease to declined state and set its valid-lifetime to 123 seconds
lease.decline(123);
EXPECT_FALSE(lease->getContext());
}
- // Lease6 must be instantiated with a DUID, not with NULL pointer
+ // Lease6 must be instantiated with a DUID, not with null pointer
IOAddress addr(ADDRESS[0]);
Lease6Ptr lease2;
EXPECT_THROW(lease2.reset(new Lease6(Lease::TYPE_NA, addr,
EXPECT_EQ("host.example.com.", lease->hostname_);
}
- // Lease6 must be instantiated with a DUID, not with NULL pointer
+ // Lease6 must be instantiated with a DUID, not with null pointer
IOAddress addr(ADDRESS[0]);
Lease6Ptr lease2;
EXPECT_THROW(lease2.reset(new Lease6(Lease::TYPE_NA, addr,
lease1.setContext(Element::fromJSON("{ \"foobar\": 1234 }"));
lease2.setContext(Element::fromJSON("{ \"foobar\": 1234 }"));
- // cltt_ constructs with time(NULL), make sure they are always equal
+ // cltt_ constructs with time(0), make sure they are always equal
lease1.cltt_ = lease2.cltt_;
EXPECT_TRUE(lease1 == lease2);
Lease6 lease(Lease::TYPE_NA, addr, duid, iaid, 100, 200, subnet_id);
// Case 1: a second before expiration
- lease.cltt_ = time(NULL) - 100;
+ lease.cltt_ = time(0) - 100;
lease.valid_lft_ = 101;
EXPECT_FALSE(lease.expired());
// Case 2: the lease will expire after this second is concluded
- lease.cltt_ = time(NULL) - 101;
+ lease.cltt_ = time(0) - 101;
EXPECT_FALSE(lease.expired());
// Case 3: the lease is expired
- lease.cltt_ = time(NULL) - 102;
+ lease.cltt_ = time(0) - 102;
EXPECT_TRUE(lease.expired());
// Case 4: the lease is static
EXPECT_FALSE(lease.expired());
}
-// Verify that the DUID can be returned as a vector object and if DUID is NULL
+// Verify that the DUID can be returned as a vector object and if DUID is null
// the empty vector is returned.
TEST(Lease6Test, getDuidVector) {
// Create a lease.
Lease6 lease;
- // By default, the lease should have client id set to NULL. If it doesn't,
+ // By default, the lease should have client id set to null. If it doesn't,
// continuing the test makes no sense.
ASSERT_FALSE(lease.duid_);
- // When client id is NULL the vector returned should be empty.
+ // When client id is null the vector returned should be empty.
EXPECT_TRUE(lease.getDuidVector().empty());
- // Now, let's set the non NULL DUID. Fill it with the 8 bytes, each
+ // Now, let's set the non null DUID. Fill it with the 8 bytes, each
// holding a value of 0x42.
std::vector<uint8_t> duid_vec(8, 0x42);
lease.duid_ = DuidPtr(new DUID(duid_vec));
lease.fqdn_fwd_ = true;
lease.fqdn_rev_ = true;
- time_t now = time(NULL);
+ time_t now = time(0);
// Move the lease to declined state and set probation-period to 123 seconds
lease.decline(123);
EXPECT_EQ("expired-reclaimed", Lease6::statesToText(Lease::STATE_EXPIRED_RECLAIMED));
}
-
-}; // end of anonymous namespace
+} // end of anonymous namespace