mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 14:05:33 +00:00
[5017] version parameter removed from both Dhcp4 and Dhcp6 parsers
This commit is contained in:
@@ -779,15 +779,6 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
|
||||
}
|
||||
}
|
||||
|
||||
\"version\" {
|
||||
switch(driver.ctx_) {
|
||||
case isc::dhcp::Parser4Context::DHCP4:
|
||||
return isc::dhcp::Dhcp4Parser::make_VERSION(driver.loc_);
|
||||
default:
|
||||
return isc::dhcp::Dhcp4Parser::make_STRING("version", driver.loc_);
|
||||
}
|
||||
}
|
||||
|
||||
\"control-socket\" {
|
||||
switch(driver.ctx_) {
|
||||
case isc::dhcp::Parser4Context::DHCP4:
|
||||
|
@@ -128,7 +128,6 @@ using namespace std;
|
||||
ENTERPRISE_ID "enterprise-id"
|
||||
|
||||
DHCP4O6_PORT "dhcp4o6-port"
|
||||
VERSION "version"
|
||||
|
||||
CONTROL_SOCKET "control-socket"
|
||||
SOCKET_TYPE "socket-type"
|
||||
@@ -186,7 +185,6 @@ using namespace std;
|
||||
%token <bool> BOOLEAN "boolean"
|
||||
|
||||
%type <ElementPtr> value
|
||||
%type <ElementPtr> version_value
|
||||
|
||||
%printer { yyoutput << $$; } <*>;
|
||||
|
||||
@@ -370,7 +368,6 @@ global_param: valid_lifetime
|
||||
| expired_leases_processing
|
||||
| server_id
|
||||
| dhcp4o6_port
|
||||
| version
|
||||
| control_socket
|
||||
| dhcp_ddns
|
||||
| echo_client_id
|
||||
@@ -1350,20 +1347,6 @@ dhcp4o6_port: DHCP4O6_PORT COLON INTEGER {
|
||||
ctx.stack_.back()->set("dhcp4o6-port", time);
|
||||
};
|
||||
|
||||
// code says it is a string, unit test a number
|
||||
version: VERSION {
|
||||
ctx.enter(ctx.NO_KEYWORD);
|
||||
} COLON version_value {
|
||||
ctx.stack_.back()->set("version", $4);
|
||||
ctx.leave();
|
||||
};
|
||||
|
||||
version_value:
|
||||
INTEGER { $$ = ElementPtr(new IntElement($1, ctx.loc2pos(@1))); }
|
||||
| FLOAT { $$ = ElementPtr(new DoubleElement($1, ctx.loc2pos(@1))); }
|
||||
| STRING { $$ = ElementPtr(new StringElement($1, ctx.loc2pos(@1))); }
|
||||
;
|
||||
|
||||
// --- control socket ----------------------------------------
|
||||
|
||||
control_socket: CONTROL_SOCKET {
|
||||
|
@@ -428,8 +428,7 @@ DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id,
|
||||
parser = new OptionDataListParser(config_id, CfgOptionPtr(), AF_INET);
|
||||
} else if (config_id.compare("option-def") == 0) {
|
||||
parser = new OptionDefListParser(config_id, globalContext());
|
||||
} else if ((config_id.compare("version") == 0) ||
|
||||
(config_id.compare("next-server") == 0)) {
|
||||
} else if ((config_id.compare("next-server") == 0)) {
|
||||
parser = new StringParser(config_id,
|
||||
globalContext()->string_values_);
|
||||
} else if (config_id.compare("lease-database") == 0) {
|
||||
|
@@ -598,20 +598,6 @@ public:
|
||||
isc::dhcp::ClientClasses classify_; ///< used in client classification
|
||||
};
|
||||
|
||||
// Goal of this test is a verification if a very simple config update
|
||||
// with just a bumped version number. That's the simplest possible
|
||||
// config update.
|
||||
TEST_F(Dhcp4ParserTest, version) {
|
||||
|
||||
ConstElementPtr json;
|
||||
ASSERT_NO_THROW(json = parseDHCP4("{\"version\": 0}"));
|
||||
|
||||
ConstElementPtr x;
|
||||
EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json));
|
||||
// returned value must be 0 (configuration accepted)
|
||||
checkResult(x, 0);
|
||||
}
|
||||
|
||||
/// The goal of this test is to verify that the code accepts only
|
||||
/// valid commands and malformed or unsupported parameters are rejected.
|
||||
TEST_F(Dhcp4ParserTest, bogusCommand) {
|
||||
|
@@ -853,15 +853,6 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
|
||||
}
|
||||
}
|
||||
|
||||
\"version\" {
|
||||
switch(driver.ctx_) {
|
||||
case isc::dhcp::Parser6Context::DHCP6:
|
||||
return isc::dhcp::Dhcp6Parser::make_VERSION(driver.loc_);
|
||||
default:
|
||||
return isc::dhcp::Dhcp6Parser::make_STRING("version", driver.loc_);
|
||||
}
|
||||
}
|
||||
|
||||
\"control-socket\" {
|
||||
switch(driver.ctx_) {
|
||||
case isc::dhcp::Parser6Context::DHCP6:
|
||||
|
@@ -127,7 +127,6 @@ using namespace std;
|
||||
ENTERPRISE_ID "enterprise-id"
|
||||
|
||||
DHCP4O6_PORT "dhcp4o6-port"
|
||||
VERSION "version"
|
||||
|
||||
CONTROL_SOCKET "control-socket"
|
||||
SOCKET_TYPE "socket-type"
|
||||
@@ -186,7 +185,6 @@ using namespace std;
|
||||
%token <bool> BOOLEAN "boolean"
|
||||
|
||||
%type <ElementPtr> value
|
||||
%type <ElementPtr> version_value
|
||||
|
||||
%printer { yyoutput << $$; } <*>;
|
||||
|
||||
@@ -374,7 +372,6 @@ global_param: preferred_lifetime
|
||||
| expired_leases_processing
|
||||
| server_id
|
||||
| dhcp4o6_port
|
||||
| version
|
||||
| control_socket
|
||||
| dhcp_ddns
|
||||
| unknown_map_entry
|
||||
@@ -1370,20 +1367,6 @@ dhcp4o6_port: DHCP4O6_PORT COLON INTEGER {
|
||||
ctx.stack_.back()->set("dhcp4o6-port", time);
|
||||
};
|
||||
|
||||
// code says it is a string, unit test a number
|
||||
version: VERSION {
|
||||
ctx.enter(ctx.NO_KEYWORD);
|
||||
} COLON version_value {
|
||||
ctx.stack_.back()->set("version", $4);
|
||||
ctx.leave();
|
||||
};
|
||||
|
||||
version_value:
|
||||
INTEGER { $$ = ElementPtr(new IntElement($1, ctx.loc2pos(@1))); }
|
||||
| FLOAT { $$ = ElementPtr(new DoubleElement($1, ctx.loc2pos(@1))); }
|
||||
| STRING { $$ = ElementPtr(new StringElement($1, ctx.loc2pos(@1))); }
|
||||
;
|
||||
|
||||
// --- control socket ----------------------------------------
|
||||
|
||||
control_socket: CONTROL_SOCKET {
|
||||
|
@@ -707,9 +707,6 @@ DhcpConfigParser* createGlobal6DhcpConfigParser(const std::string& config_id,
|
||||
parser = new OptionDataListParser(config_id, CfgOptionPtr(), AF_INET6);
|
||||
} else if (config_id.compare("option-def") == 0) {
|
||||
parser = new OptionDefListParser(config_id, globalContext());
|
||||
} else if (config_id.compare("version") == 0) {
|
||||
parser = new StringParser(config_id,
|
||||
globalContext()->string_values_);
|
||||
} else if (config_id.compare("lease-database") == 0) {
|
||||
parser = new DbAccessParser(config_id, DbAccessParser::LEASE_DB);
|
||||
} else if (config_id.compare("hosts-database") == 0) {
|
||||
|
@@ -732,20 +732,6 @@ public:
|
||||
isc::dhcp::ClientClasses classify_; ///< used in client classification
|
||||
};
|
||||
|
||||
// Goal of this test is a verification if a very simple config update
|
||||
// with just a bumped version number. That's the simplest possible
|
||||
// config update.
|
||||
TEST_F(Dhcp6ParserTest, version) {
|
||||
|
||||
ConstElementPtr json;
|
||||
ASSERT_NO_THROW(json = parseDHCP6("{\"version\": 0}"));
|
||||
|
||||
ConstElementPtr x;
|
||||
EXPECT_NO_THROW(x = configureDhcp6Server(srv_, json));
|
||||
// returned value must be 0 (configuration accepted)
|
||||
checkResult(x, 0);
|
||||
}
|
||||
|
||||
/// The goal of this test is to verify that the code accepts only
|
||||
/// valid commands and malformed or unsupported parameters are rejected.
|
||||
TEST_F(Dhcp6ParserTest, bogusCommand) {
|
||||
|
Reference in New Issue
Block a user