From 313cdfdd5410a847f3681b691d8632ed06dd3ae0 Mon Sep 17 00:00:00 2001 From: Tomek Mrugalski Date: Tue, 20 Dec 2016 16:25:01 +0100 Subject: [PATCH] [5017] version parameter removed from both Dhcp4 and Dhcp6 parsers --- src/bin/dhcp4/dhcp4_lexer.ll | 9 --------- src/bin/dhcp4/dhcp4_parser.yy | 17 ----------------- src/bin/dhcp4/json_config_parser.cc | 3 +-- src/bin/dhcp4/tests/config_parser_unittest.cc | 14 -------------- src/bin/dhcp6/dhcp6_lexer.ll | 9 --------- src/bin/dhcp6/dhcp6_parser.yy | 17 ----------------- src/bin/dhcp6/json_config_parser.cc | 3 --- src/bin/dhcp6/tests/config_parser_unittest.cc | 14 -------------- 8 files changed, 1 insertion(+), 85 deletions(-) diff --git a/src/bin/dhcp4/dhcp4_lexer.ll b/src/bin/dhcp4/dhcp4_lexer.ll index b993b645f2..0063c5ddb5 100644 --- a/src/bin/dhcp4/dhcp4_lexer.ll +++ b/src/bin/dhcp4/dhcp4_lexer.ll @@ -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: diff --git a/src/bin/dhcp4/dhcp4_parser.yy b/src/bin/dhcp4/dhcp4_parser.yy index fc25124598..579adb158f 100644 --- a/src/bin/dhcp4/dhcp4_parser.yy +++ b/src/bin/dhcp4/dhcp4_parser.yy @@ -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 BOOLEAN "boolean" %type value -%type 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 { diff --git a/src/bin/dhcp4/json_config_parser.cc b/src/bin/dhcp4/json_config_parser.cc index 52b554972b..b27ee09f3c 100644 --- a/src/bin/dhcp4/json_config_parser.cc +++ b/src/bin/dhcp4/json_config_parser.cc @@ -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) { diff --git a/src/bin/dhcp4/tests/config_parser_unittest.cc b/src/bin/dhcp4/tests/config_parser_unittest.cc index 17e8ec74c9..79083e2683 100644 --- a/src/bin/dhcp4/tests/config_parser_unittest.cc +++ b/src/bin/dhcp4/tests/config_parser_unittest.cc @@ -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) { diff --git a/src/bin/dhcp6/dhcp6_lexer.ll b/src/bin/dhcp6/dhcp6_lexer.ll index 44721c32f6..47235057da 100644 --- a/src/bin/dhcp6/dhcp6_lexer.ll +++ b/src/bin/dhcp6/dhcp6_lexer.ll @@ -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: diff --git a/src/bin/dhcp6/dhcp6_parser.yy b/src/bin/dhcp6/dhcp6_parser.yy index 78ce2764c4..d3a460ace7 100644 --- a/src/bin/dhcp6/dhcp6_parser.yy +++ b/src/bin/dhcp6/dhcp6_parser.yy @@ -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 BOOLEAN "boolean" %type value -%type 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 { diff --git a/src/bin/dhcp6/json_config_parser.cc b/src/bin/dhcp6/json_config_parser.cc index 995390f4cc..7d219913bf 100644 --- a/src/bin/dhcp6/json_config_parser.cc +++ b/src/bin/dhcp6/json_config_parser.cc @@ -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) { diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc index fe282e7806..051486c3c4 100644 --- a/src/bin/dhcp6/tests/config_parser_unittest.cc +++ b/src/bin/dhcp6/tests/config_parser_unittest.cc @@ -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) {