|
@@ -30,48 +30,48 @@ using namespace boost::posix_time;
|
|
|
|
|
|
TEST(LeaseTypeTest, defaultConstructor) {
|
|
|
CommandOptions::LeaseType lease_type;
|
|
|
- EXPECT_TRUE(lease_type.is(CommandOptions::LeaseType::ADDRESS_ONLY));
|
|
|
+ EXPECT_TRUE(lease_type.is(CommandOptions::LeaseType::ADDRESS));
|
|
|
}
|
|
|
|
|
|
TEST(LeaseTypeTest, constructor) {
|
|
|
CommandOptions::LeaseType
|
|
|
- lease_type1(CommandOptions::LeaseType::ADDRESS_ONLY);
|
|
|
- EXPECT_TRUE(lease_type1.is(CommandOptions::LeaseType::ADDRESS_ONLY));
|
|
|
+ lease_type1(CommandOptions::LeaseType::ADDRESS);
|
|
|
+ EXPECT_TRUE(lease_type1.is(CommandOptions::LeaseType::ADDRESS));
|
|
|
|
|
|
CommandOptions::LeaseType
|
|
|
- lease_type2(CommandOptions::LeaseType::PREFIX_ONLY);
|
|
|
- EXPECT_TRUE(lease_type2.is(CommandOptions::LeaseType::PREFIX_ONLY));
|
|
|
+ lease_type2(CommandOptions::LeaseType::PREFIX);
|
|
|
+ EXPECT_TRUE(lease_type2.is(CommandOptions::LeaseType::PREFIX));
|
|
|
}
|
|
|
|
|
|
TEST(LeaseTypeTest, set) {
|
|
|
CommandOptions::LeaseType
|
|
|
- lease_type(CommandOptions::LeaseType::ADDRESS_ONLY);
|
|
|
- EXPECT_TRUE(lease_type.is(CommandOptions::LeaseType::ADDRESS_ONLY));
|
|
|
+ lease_type(CommandOptions::LeaseType::ADDRESS);
|
|
|
+ EXPECT_TRUE(lease_type.is(CommandOptions::LeaseType::ADDRESS));
|
|
|
|
|
|
- lease_type.set(CommandOptions::LeaseType::PREFIX_ONLY);
|
|
|
- EXPECT_TRUE(lease_type.is(CommandOptions::LeaseType::PREFIX_ONLY));
|
|
|
+ lease_type.set(CommandOptions::LeaseType::PREFIX);
|
|
|
+ EXPECT_TRUE(lease_type.is(CommandOptions::LeaseType::PREFIX));
|
|
|
}
|
|
|
|
|
|
TEST(LeaseTypeTest, includes) {
|
|
|
CommandOptions::LeaseType
|
|
|
- lease_type(CommandOptions::LeaseType::ADDRESS_ONLY);
|
|
|
- ASSERT_TRUE(lease_type.is(CommandOptions::LeaseType::ADDRESS_ONLY));
|
|
|
- EXPECT_TRUE(lease_type.includes(CommandOptions::LeaseType::ADDRESS_ONLY));
|
|
|
- EXPECT_FALSE(lease_type.includes(CommandOptions::LeaseType::PREFIX_ONLY));
|
|
|
+ lease_type(CommandOptions::LeaseType::ADDRESS);
|
|
|
+ ASSERT_TRUE(lease_type.is(CommandOptions::LeaseType::ADDRESS));
|
|
|
+ EXPECT_TRUE(lease_type.includes(CommandOptions::LeaseType::ADDRESS));
|
|
|
+ EXPECT_FALSE(lease_type.includes(CommandOptions::LeaseType::PREFIX));
|
|
|
EXPECT_FALSE(
|
|
|
lease_type.includes(CommandOptions::LeaseType::ADDRESS_AND_PREFIX)
|
|
|
);
|
|
|
|
|
|
- lease_type.set(CommandOptions::LeaseType::PREFIX_ONLY);
|
|
|
- EXPECT_FALSE(lease_type.includes(CommandOptions::LeaseType::ADDRESS_ONLY));
|
|
|
- EXPECT_TRUE(lease_type.includes(CommandOptions::LeaseType::PREFIX_ONLY));
|
|
|
+ lease_type.set(CommandOptions::LeaseType::PREFIX);
|
|
|
+ EXPECT_FALSE(lease_type.includes(CommandOptions::LeaseType::ADDRESS));
|
|
|
+ EXPECT_TRUE(lease_type.includes(CommandOptions::LeaseType::PREFIX));
|
|
|
EXPECT_FALSE(
|
|
|
lease_type.includes(CommandOptions::LeaseType::ADDRESS_AND_PREFIX)
|
|
|
);
|
|
|
|
|
|
lease_type.set(CommandOptions::LeaseType::ADDRESS_AND_PREFIX);
|
|
|
- EXPECT_TRUE(lease_type.includes(CommandOptions::LeaseType::ADDRESS_ONLY));
|
|
|
- EXPECT_TRUE(lease_type.includes(CommandOptions::LeaseType::PREFIX_ONLY));
|
|
|
+ EXPECT_TRUE(lease_type.includes(CommandOptions::LeaseType::ADDRESS));
|
|
|
+ EXPECT_TRUE(lease_type.includes(CommandOptions::LeaseType::PREFIX));
|
|
|
EXPECT_TRUE(
|
|
|
lease_type.includes(CommandOptions::LeaseType::ADDRESS_AND_PREFIX)
|
|
|
);
|
|
@@ -81,14 +81,14 @@ TEST(LeaseTypeTest, includes) {
|
|
|
|
|
|
TEST(LeaseTypeTest, fromCommandLine) {
|
|
|
CommandOptions::LeaseType
|
|
|
- lease_type(CommandOptions::LeaseType::ADDRESS_ONLY);
|
|
|
- ASSERT_TRUE(lease_type.is(CommandOptions::LeaseType::ADDRESS_ONLY));
|
|
|
+ lease_type(CommandOptions::LeaseType::ADDRESS);
|
|
|
+ ASSERT_TRUE(lease_type.is(CommandOptions::LeaseType::ADDRESS));
|
|
|
|
|
|
lease_type.fromCommandLine("prefix-only");
|
|
|
- ASSERT_TRUE(lease_type.is(CommandOptions::LeaseType::PREFIX_ONLY));
|
|
|
+ ASSERT_TRUE(lease_type.is(CommandOptions::LeaseType::PREFIX));
|
|
|
|
|
|
lease_type.fromCommandLine("address-only");
|
|
|
- EXPECT_TRUE(lease_type.is(CommandOptions::LeaseType::ADDRESS_ONLY));
|
|
|
+ EXPECT_TRUE(lease_type.is(CommandOptions::LeaseType::ADDRESS));
|
|
|
|
|
|
EXPECT_THROW(lease_type.fromCommandLine("bogus-parameter"),
|
|
|
isc::InvalidParameter);
|
|
@@ -97,11 +97,11 @@ TEST(LeaseTypeTest, fromCommandLine) {
|
|
|
|
|
|
TEST(LeaseTypeTest, toText) {
|
|
|
CommandOptions::LeaseType lease_type;
|
|
|
- ASSERT_TRUE(lease_type.is(CommandOptions::LeaseType::ADDRESS_ONLY));
|
|
|
+ ASSERT_TRUE(lease_type.is(CommandOptions::LeaseType::ADDRESS));
|
|
|
EXPECT_EQ("address-only (IA_NA option added to the client's request)",
|
|
|
lease_type.toText());
|
|
|
|
|
|
- lease_type.set(CommandOptions::LeaseType::PREFIX_ONLY);
|
|
|
+ lease_type.set(CommandOptions::LeaseType::PREFIX);
|
|
|
EXPECT_EQ("prefix-only (IA_PD option added to the client's request)",
|
|
|
lease_type.toText());
|
|
|
}
|
|
@@ -138,8 +138,7 @@ protected:
|
|
|
EXPECT_NO_THROW(process("perfdhcp 192.168.0.1"));
|
|
|
EXPECT_EQ(4, opt.getIpVersion());
|
|
|
EXPECT_EQ(CommandOptions::DORA_SARR, opt.getExchangeMode());
|
|
|
- EXPECT_TRUE(opt.getLeaseType()
|
|
|
- .is(CommandOptions::LeaseType::ADDRESS_ONLY));
|
|
|
+ EXPECT_TRUE(opt.getLeaseType().is(CommandOptions::LeaseType::ADDRESS));
|
|
|
EXPECT_EQ(0, opt.getRate());
|
|
|
EXPECT_EQ(0, opt.getReportDelay());
|
|
|
EXPECT_EQ(0, opt.getClientsNum());
|
|
@@ -267,17 +266,17 @@ TEST_F(CommandOptionsTest, LeaseType) {
|
|
|
ASSERT_NO_THROW(process("perfdhcp -6 -l etx -e address-only all"));
|
|
|
EXPECT_EQ(6, opt.getIpVersion());
|
|
|
EXPECT_EQ("etx", opt.getLocalName());
|
|
|
- EXPECT_TRUE(opt.getLeaseType().is(CommandOptions::LeaseType::ADDRESS_ONLY));
|
|
|
+ EXPECT_TRUE(opt.getLeaseType().is(CommandOptions::LeaseType::ADDRESS));
|
|
|
// Check that the -e address-only works for IPv4.
|
|
|
ASSERT_NO_THROW(process("perfdhcp -4 -l etx -e address-only all"));
|
|
|
EXPECT_EQ(4, opt.getIpVersion());
|
|
|
EXPECT_EQ("etx", opt.getLocalName());
|
|
|
- EXPECT_TRUE(opt.getLeaseType().is(CommandOptions::LeaseType::ADDRESS_ONLY));
|
|
|
+ EXPECT_TRUE(opt.getLeaseType().is(CommandOptions::LeaseType::ADDRESS));
|
|
|
// Check that the -e prefix-only works.
|
|
|
ASSERT_NO_THROW(process("perfdhcp -6 -l etx -e prefix-only all"));
|
|
|
EXPECT_EQ(6, opt.getIpVersion());
|
|
|
EXPECT_EQ("etx", opt.getLocalName());
|
|
|
- EXPECT_TRUE(opt.getLeaseType().is(CommandOptions::LeaseType::PREFIX_ONLY));
|
|
|
+ EXPECT_TRUE(opt.getLeaseType().is(CommandOptions::LeaseType::PREFIX));
|
|
|
// Check that -e prefix-only must not coexist with -4 option.
|
|
|
EXPECT_THROW(process("perfdhcp -4 -l ethx -e prefix-only all"),
|
|
|
InvalidParameter);
|