class Dhcp6ParserTest : public ::testing::Test {
public:
- Dhcp6ParserTest()
- :rcode_(-1) {
- // Open port 0 means to not do anything at all. We don't want to
+ Dhcp6ParserTest() :rcode_(-1), srv_(0) {
+ // srv_(0) means to not open any sockets. We don't want to
// deal with sockets here, just check if configuration handling
// is sane.
- srv_ = new Dhcpv6Srv(0);
+
// Create instances of option definitions and put them into storage.
// This is normally initialized by the server when calling run()
// run() function.
}
~Dhcp6ParserTest() {
- delete srv_;
};
/// @brief Create the simple configuration with single option.
ConstElementPtr x;
std::string config = createConfigWithOption(param_value, parameter);
ElementPtr json = Element::fromJSON(config);
- EXPECT_NO_THROW(x = configureDhcp6Server(*srv_, json));
+ EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
ASSERT_TRUE(x);
comment_ = parseAnswer(rcode_, x);
ASSERT_EQ(1, rcode_);
EXPECT_TRUE(memcmp(expected_data, data, expected_data_len));
}
- Dhcpv6Srv* srv_;
+ Dhcpv6Srv srv_;
int rcode_;
ConstElementPtr comment_;
ConstElementPtr x;
- EXPECT_NO_THROW(x = configureDhcp6Server(*srv_,
+ EXPECT_NO_THROW(x = configureDhcp6Server(srv_,
Element::fromJSON("{\"version\": 0}")));
// returned value must be 0 (configuration accepted)
ConstElementPtr x;
- EXPECT_NO_THROW(x = configureDhcp6Server(*srv_,
+ EXPECT_NO_THROW(x = configureDhcp6Server(srv_,
Element::fromJSON("{\"bogus\": 5}")));
// returned value must be 1 (configuration parse error)
ConstElementPtr status;
- EXPECT_NO_THROW(status = configureDhcp6Server(*srv_,
+ EXPECT_NO_THROW(status = configureDhcp6Server(srv_,
Element::fromJSON("{ \"interface\": [ \"all\" ],"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
ElementPtr json = Element::fromJSON(config);
- EXPECT_NO_THROW(status = configureDhcp6Server(*srv_, json));
+ EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
// check if returned status is OK
ASSERT_TRUE(status);
ElementPtr json = Element::fromJSON(config);
- EXPECT_NO_THROW(status = configureDhcp6Server(*srv_, json));
+ EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
// returned value should be 0 (configuration success)
ASSERT_TRUE(status);
ElementPtr json = Element::fromJSON(config);
- EXPECT_NO_THROW(status = configureDhcp6Server(*srv_, json));
+ EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
// returned value must be 2 (values error)
// as the pool does not belong to that subnet
ElementPtr json = Element::fromJSON(config);
- EXPECT_NO_THROW(x = configureDhcp6Server(*srv_, json));
+ EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
// returned value must be 1 (configuration parse error)
ASSERT_TRUE(x);
ElementPtr json = Element::fromJSON(config);
- EXPECT_NO_THROW(x = configureDhcp6Server(*srv_, json));
+ EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
ASSERT_TRUE(x);
comment_ = parseAnswer(rcode_, x);
ASSERT_EQ(0, rcode_);
ElementPtr json = Element::fromJSON(config);
- EXPECT_NO_THROW(x = configureDhcp6Server(*srv_, json));
+ EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
ASSERT_TRUE(x);
comment_ = parseAnswer(rcode_, x);
ASSERT_EQ(0, rcode_);
ElementPtr json = Element::fromJSON(config);
- EXPECT_NO_THROW(x = configureDhcp6Server(*srv_, json));
+ EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
ASSERT_TRUE(x);
comment_ = parseAnswer(rcode_, x);
ASSERT_EQ(0, rcode_);
std::string config = createConfigWithOption("0a0b0C0D", "data");
ElementPtr json = Element::fromJSON(config);
- EXPECT_NO_THROW(x = configureDhcp6Server(*srv_, json));
+ EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
ASSERT_TRUE(x);
comment_ = parseAnswer(rcode_, x);
ASSERT_EQ(0, rcode_);
std::string config = createConfigWithOption(params);
ElementPtr json = Element::fromJSON(config);
- EXPECT_NO_THROW(x = configureDhcp6Server(*srv_, json));
+ EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
ASSERT_TRUE(x);
comment_ = parseAnswer(rcode_, x);
ASSERT_EQ(0, rcode_);