Commit c1862585 authored by Francis Dupont's avatar Francis Dupont Committed by Tomek Mrugalski

[fdunparse2] Snapshot for 4o6-subnet fix

parent 0beffc6e
...@@ -95,6 +95,7 @@ dhcp4_unittests_SOURCES += decline_unittest.cc ...@@ -95,6 +95,7 @@ dhcp4_unittests_SOURCES += decline_unittest.cc
dhcp4_unittests_SOURCES += kea_controller_unittest.cc dhcp4_unittests_SOURCES += kea_controller_unittest.cc
dhcp4_unittests_SOURCES += dhcp4to6_ipc_unittest.cc dhcp4_unittests_SOURCES += dhcp4to6_ipc_unittest.cc
dhcp4_unittests_SOURCES += simple_parser4_unittest.cc dhcp4_unittests_SOURCES += simple_parser4_unittest.cc
dhcp4_unittests_SOURCES += get_config_unittest.cc get_config_unittest.h
nodist_dhcp4_unittests_SOURCES = marker_file.h test_libraries.h nodist_dhcp4_unittests_SOURCES = marker_file.h test_libraries.h
......
</
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "test_libraries.h" #include "test_libraries.h"
#include "test_data_files_config.h" #include "test_data_files_config.h"
#include "dhcp4_test_utils.h" #include "dhcp4_test_utils.h"
#include "get_config_unittest.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
...@@ -628,12 +629,15 @@ TEST_F(Dhcp4ParserTest, bogusCommand) { ...@@ -628,12 +629,15 @@ TEST_F(Dhcp4ParserTest, bogusCommand) {
/// pool definition. /// pool definition.
TEST_F(Dhcp4ParserTest, emptySubnet) { TEST_F(Dhcp4ParserTest, emptySubnet) {
std::string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ ], "
"\"valid-lifetime\": 4000 }";
ConstElementPtr json; ConstElementPtr json;
EXPECT_NO_THROW(json = parseDHCP4("{ " + genIfaceConfig() + "," + EXPECT_NO_THROW(json = parseDHCP4(config));
"\"rebind-timer\": 2000, " extractConfig(config);
"\"renew-timer\": 1000, "
"\"subnet4\": [ ], "
"\"valid-lifetime\": 4000 }"));
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -655,6 +659,7 @@ TEST_F(Dhcp4ParserTest, unspecifiedRenewTimer) { ...@@ -655,6 +659,7 @@ TEST_F(Dhcp4ParserTest, unspecifiedRenewTimer) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -689,6 +694,7 @@ TEST_F(Dhcp4ParserTest, unspecifiedRebindTimer) { ...@@ -689,6 +694,7 @@ TEST_F(Dhcp4ParserTest, unspecifiedRebindTimer) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -723,6 +729,7 @@ TEST_F(Dhcp4ParserTest, subnetGlobalDefaults) { ...@@ -723,6 +729,7 @@ TEST_F(Dhcp4ParserTest, subnetGlobalDefaults) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -774,6 +781,7 @@ TEST_F(Dhcp4ParserTest, multipleSubnets) { ...@@ -774,6 +781,7 @@ TEST_F(Dhcp4ParserTest, multipleSubnets) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
int cnt = 0; // Number of reconfigurations int cnt = 0; // Number of reconfigurations
...@@ -832,6 +840,7 @@ TEST_F(Dhcp4ParserTest, multipleSubnetsExplicitIDs) { ...@@ -832,6 +840,7 @@ TEST_F(Dhcp4ParserTest, multipleSubnetsExplicitIDs) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
int cnt = 0; // Number of reconfigurations int cnt = 0; // Number of reconfigurations
do { do {
...@@ -1040,6 +1049,7 @@ TEST_F(Dhcp4ParserTest, nextServerGlobal) { ...@@ -1040,6 +1049,7 @@ TEST_F(Dhcp4ParserTest, nextServerGlobal) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -1070,6 +1080,7 @@ TEST_F(Dhcp4ParserTest, nextServerSubnet) { ...@@ -1070,6 +1080,7 @@ TEST_F(Dhcp4ParserTest, nextServerSubnet) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -1168,6 +1179,7 @@ TEST_F(Dhcp4ParserTest, nextServerOverride) { ...@@ -1168,6 +1179,7 @@ TEST_F(Dhcp4ParserTest, nextServerOverride) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -1206,8 +1218,10 @@ TEST_F(Dhcp4ParserTest, echoClientId) { ...@@ -1206,8 +1218,10 @@ TEST_F(Dhcp4ParserTest, echoClientId) {
ConstElementPtr json_false; ConstElementPtr json_false;
ASSERT_NO_THROW(json_false = parseDHCP4(config_false)); ASSERT_NO_THROW(json_false = parseDHCP4(config_false));
extractConfig(config_false);
ConstElementPtr json_true; ConstElementPtr json_true;
ASSERT_NO_THROW(json_true = parseDHCP4(config_true)); ASSERT_NO_THROW(json_true = parseDHCP4(config_true));
extractConfig(config_true);
// Let's check the default. It should be true // Let's check the default. It should be true
ASSERT_TRUE(CfgMgr::instance().getStagingCfg()->getEchoClientId()); ASSERT_TRUE(CfgMgr::instance().getStagingCfg()->getEchoClientId());
...@@ -1248,6 +1262,7 @@ TEST_F(Dhcp4ParserTest, matchClientIdNoGlobal) { ...@@ -1248,6 +1262,7 @@ TEST_F(Dhcp4ParserTest, matchClientIdNoGlobal) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
ASSERT_NO_THROW(status = configureDhcp4Server(*srv_, json)); ASSERT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -1285,6 +1300,7 @@ TEST_F(Dhcp4ParserTest, matchClientIdGlobal) { ...@@ -1285,6 +1300,7 @@ TEST_F(Dhcp4ParserTest, matchClientIdGlobal) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
ASSERT_NO_THROW(status = configureDhcp4Server(*srv_, json)); ASSERT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -1317,6 +1333,7 @@ TEST_F(Dhcp4ParserTest, subnetLocal) { ...@@ -1317,6 +1333,7 @@ TEST_F(Dhcp4ParserTest, subnetLocal) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -1357,6 +1374,7 @@ TEST_F(Dhcp4ParserTest, multiplePools) { ...@@ -1357,6 +1374,7 @@ TEST_F(Dhcp4ParserTest, multiplePools) {
"\"valid-lifetime\": 4000 }"; "\"valid-lifetime\": 4000 }";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
ASSERT_NO_THROW(status = configureDhcp4Server(*srv_, json)); ASSERT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -1429,6 +1447,7 @@ TEST_F(Dhcp4ParserTest, poolPrefixLen) { ...@@ -1429,6 +1447,7 @@ TEST_F(Dhcp4ParserTest, poolPrefixLen) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -1585,6 +1604,7 @@ TEST_F(Dhcp4ParserTest, optionDefIpv4Address) { ...@@ -1585,6 +1604,7 @@ TEST_F(Dhcp4ParserTest, optionDefIpv4Address) {
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config, true)); ASSERT_NO_THROW(json = parseOPTION_DEF(config, true));
extractConfig(config);
// Make sure that the particular option definition does not exist. // Make sure that the particular option definition does not exist.
OptionDefinitionPtr def = CfgMgr::instance().getStagingCfg()-> OptionDefinitionPtr def = CfgMgr::instance().getStagingCfg()->
...@@ -1651,6 +1671,7 @@ TEST_F(Dhcp4ParserTest, optionDefRecord) { ...@@ -1651,6 +1671,7 @@ TEST_F(Dhcp4ParserTest, optionDefRecord) {
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEF(config));
extractConfig(config);
// Make sure that the particular option definition does not exist. // Make sure that the particular option definition does not exist.
OptionDefinitionPtr def = CfgMgr::instance().getStagingCfg()-> OptionDefinitionPtr def = CfgMgr::instance().getStagingCfg()->
...@@ -1705,6 +1726,7 @@ TEST_F(Dhcp4ParserTest, optionDefMultiple) { ...@@ -1705,6 +1726,7 @@ TEST_F(Dhcp4ParserTest, optionDefMultiple) {
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEF(config));
extractConfig(config);
// Make sure that the option definitions do not exist yet. // Make sure that the option definitions do not exist yet.
ASSERT_FALSE(CfgMgr::instance().getStagingCfg()-> ASSERT_FALSE(CfgMgr::instance().getStagingCfg()->
...@@ -1813,6 +1835,7 @@ TEST_F(Dhcp4ParserTest, optionDefArray) { ...@@ -1813,6 +1835,7 @@ TEST_F(Dhcp4ParserTest, optionDefArray) {
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEF(config));
extractConfig(config);
// Make sure that the particular option definition does not exist. // Make sure that the particular option definition does not exist.
OptionDefinitionPtr def = CfgMgr::instance().getStagingCfg()-> OptionDefinitionPtr def = CfgMgr::instance().getStagingCfg()->
...@@ -1855,6 +1878,7 @@ TEST_F(Dhcp4ParserTest, optionDefEncapsulate) { ...@@ -1855,6 +1878,7 @@ TEST_F(Dhcp4ParserTest, optionDefEncapsulate) {
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEF(config));
extractConfig(config);
// Make sure that the particular option definition does not exist. // Make sure that the particular option definition does not exist.
OptionDefinitionPtr def = CfgMgr::instance().getStagingCfg()-> OptionDefinitionPtr def = CfgMgr::instance().getStagingCfg()->
...@@ -2056,6 +2080,7 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) { ...@@ -2056,6 +2080,7 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) {
"}"; "}";
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEF(config));
extractConfig(config);
OptionDefinitionPtr def = CfgMgr::instance().getStagingCfg()-> OptionDefinitionPtr def = CfgMgr::instance().getStagingCfg()->
getCfgOptionDef()->get(DHCP4_OPTION_SPACE, 109); getCfgOptionDef()->get(DHCP4_OPTION_SPACE, 109);
...@@ -2112,6 +2137,7 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) { ...@@ -2112,6 +2137,7 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) {
" } ]" " } ]"
"}"; "}";
ASSERT_NO_THROW(json = parseOPTION_DEF(config)); ASSERT_NO_THROW(json = parseOPTION_DEF(config));
extractConfig(config);
// Use the configuration string to create new option definition. // Use the configuration string to create new option definition.
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -2155,6 +2181,7 @@ TEST_F(Dhcp4ParserTest, optionDataDefaultsGlobal) { ...@@ -2155,6 +2181,7 @@ TEST_F(Dhcp4ParserTest, optionDataDefaultsGlobal) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json));
checkResult(x, 0); checkResult(x, 0);
...@@ -2225,6 +2252,7 @@ TEST_F(Dhcp4ParserTest, optionDataDefaultsSubnet) { ...@@ -2225,6 +2252,7 @@ TEST_F(Dhcp4ParserTest, optionDataDefaultsSubnet) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json));
checkResult(x, 0); checkResult(x, 0);
...@@ -2306,6 +2334,7 @@ TEST_F(Dhcp4ParserTest, optionDataTwoSpaces) { ...@@ -2306,6 +2334,7 @@ TEST_F(Dhcp4ParserTest, optionDataTwoSpaces) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -2381,6 +2410,7 @@ TEST_F(Dhcp4ParserTest, optionDataEncapsulate) { ...@@ -2381,6 +2410,7 @@ TEST_F(Dhcp4ParserTest, optionDataEncapsulate) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -2437,6 +2467,7 @@ TEST_F(Dhcp4ParserTest, optionDataEncapsulate) { ...@@ -2437,6 +2467,7 @@ TEST_F(Dhcp4ParserTest, optionDataEncapsulate) {
"}"; "}";
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
ASSERT_TRUE(status); ASSERT_TRUE(status);
...@@ -2498,6 +2529,7 @@ TEST_F(Dhcp4ParserTest, optionDataInSingleSubnet) { ...@@ -2498,6 +2529,7 @@ TEST_F(Dhcp4ParserTest, optionDataInSingleSubnet) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json));
checkResult(x, 0); checkResult(x, 0);
...@@ -2646,6 +2678,7 @@ TEST_F(Dhcp4ParserTest, optionDataInMultipleSubnets) { ...@@ -2646,6 +2678,7 @@ TEST_F(Dhcp4ParserTest, optionDataInMultipleSubnets) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json));
checkResult(x, 0); checkResult(x, 0);
...@@ -2920,6 +2953,7 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) { ...@@ -2920,6 +2953,7 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -2976,6 +3010,7 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) { ...@@ -2976,6 +3010,7 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) {
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
ASSERT_TRUE(status); ASSERT_TRUE(status);
...@@ -3055,6 +3090,7 @@ TEST_F(Dhcp4ParserTest, vendorOptionsHex) { ...@@ -3055,6 +3090,7 @@ TEST_F(Dhcp4ParserTest, vendorOptionsHex) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -3110,6 +3146,7 @@ TEST_F(Dhcp4ParserTest, vendorOptionsCsv) { ...@@ -3110,6 +3146,7 @@ TEST_F(Dhcp4ParserTest, vendorOptionsCsv) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -3287,6 +3324,7 @@ TEST_F(Dhcp4ParserTest, selectedInterfaces) { ...@@ -3287,6 +3324,7 @@ TEST_F(Dhcp4ParserTest, selectedInterfaces) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
...@@ -3326,6 +3364,7 @@ TEST_F(Dhcp4ParserTest, allInterfaces) { ...@@ -3326,6 +3364,7 @@ TEST_F(Dhcp4ParserTest, allInterfaces) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
...@@ -3424,6 +3463,7 @@ TEST_F(Dhcp4ParserTest, d2ClientConfig) { ...@@ -3424,6 +3463,7 @@ TEST_F(Dhcp4ParserTest, d2ClientConfig) {
// Convert the JSON string to configuration elements. // Convert the JSON string to configuration elements.
ConstElementPtr config; ConstElementPtr config;
ASSERT_NO_THROW(config = parseDHCP4(config_str, true)); ASSERT_NO_THROW(config = parseDHCP4(config_str, true));
extractConfig(config_str);
// Pass the configuration in for parsing. // Pass the configuration in for parsing.
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, config)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, config));
...@@ -3523,6 +3563,7 @@ TEST_F(Dhcp4ParserTest, subnetRelayInfo) { ...@@ -3523,6 +3563,7 @@ TEST_F(Dhcp4ParserTest, subnetRelayInfo) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -3710,6 +3751,7 @@ TEST_F(Dhcp4ParserTest, reservations) { ...@@ -3710,6 +3751,7 @@ TEST_F(Dhcp4ParserTest, reservations) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json));
checkResult(x, 0); checkResult(x, 0);
...@@ -3861,6 +3903,7 @@ TEST_F(Dhcp4ParserTest, reservationWithOptionDefinition) { ...@@ -3861,6 +3903,7 @@ TEST_F(Dhcp4ParserTest, reservationWithOptionDefinition) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config, true)); ASSERT_NO_THROW(json = parseDHCP4(config, true));
extractConfig(config);
EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json));
checkResult(x, 0); checkResult(x, 0);
...@@ -4045,6 +4088,7 @@ TEST_F(Dhcp4ParserTest, hostReservationPerSubnet) { ...@@ -4045,6 +4088,7 @@ TEST_F(Dhcp4ParserTest, hostReservationPerSubnet) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(hr_config)); ASSERT_NO_THROW(json = parseDHCP4(hr_config));
extractConfig(hr_config);
ConstElementPtr result; ConstElementPtr result;
EXPECT_NO_THROW(result = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(result = configureDhcp4Server(*srv_, json));
...@@ -4092,6 +4136,7 @@ TEST_F(Dhcp4ParserTest, declineTimerDefault) { ...@@ -4092,6 +4136,7 @@ TEST_F(Dhcp4ParserTest, declineTimerDefault) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -4113,6 +4158,7 @@ TEST_F(Dhcp4ParserTest, dhcp4o6portDefault) { ...@@ -4113,6 +4158,7 @@ TEST_F(Dhcp4ParserTest, dhcp4o6portDefault) {
"}"; "}";
ConstElementPtr config; ConstElementPtr config;
ASSERT_NO_THROW(config = parseDHCP4(config_txt)); ASSERT_NO_THROW(config = parseDHCP4(config_txt));
extractConfig(config_txt);
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, config)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, config));
...@@ -4138,6 +4184,7 @@ TEST_F(Dhcp4ParserTest, declineTimer) { ...@@ -4138,6 +4184,7 @@ TEST_F(Dhcp4ParserTest, declineTimer) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -4193,6 +4240,7 @@ TEST_F(Dhcp4ParserTest, expiredLeasesProcessing) { ...@@ -4193,6 +4240,7 @@ TEST_F(Dhcp4ParserTest, expiredLeasesProcessing) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
ConstElementPtr status; ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -4263,6 +4311,7 @@ TEST_F(Dhcp4ParserTest, 4o6default) { ...@@ -4263,6 +4311,7 @@ TEST_F(Dhcp4ParserTest, 4o6default) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -4297,6 +4346,7 @@ TEST_F(Dhcp4ParserTest, 4o6subnet) { ...@@ -4297,6 +4346,7 @@ TEST_F(Dhcp4ParserTest, 4o6subnet) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -4393,6 +4443,7 @@ TEST_F(Dhcp4ParserTest, 4o6iface) { ...@@ -4393,6 +4443,7 @@ TEST_F(Dhcp4ParserTest, 4o6iface) {
ConstElementPtr json; ConstElementPtr json;
ASSERT_NO_THROW(json = parseDHCP4(config)); ASSERT_NO_THROW(json = parseDHCP4(config));
extractConfig(config);
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
...@@ -4429,6 +4480,7 @@ TEST_F(Dhcp4ParserTest, 4o6subnetIface) { ...@@ -4429,6 +4480,7 @@ TEST_F(Dhcp4ParserTest, 4o6subnetIface) {