Commit 46303ccf authored by Francis Dupont's avatar Francis Dupont

[5097] Added missing user-context map in flex/bison

parent 3e674fda
...@@ -426,6 +426,15 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence} ...@@ -426,6 +426,15 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
} }
} }
\"user-context\" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::POOLS:
return isc::dhcp::Dhcp4Parser::make_USER_CONTEXT(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("user-context", driver.loc_);
}
}
\"subnet\" { \"subnet\" {
switch(driver.ctx_) { switch(driver.ctx_) {
case isc::dhcp::Parser4Context::SUBNET4: case isc::dhcp::Parser4Context::SUBNET4:
......
...@@ -93,6 +93,7 @@ using namespace std; ...@@ -93,6 +93,7 @@ using namespace std;
POOLS "pools" POOLS "pools"
POOL "pool" POOL "pool"
USER_CONTEXT "user-context"
SUBNET "subnet" SUBNET "subnet"
INTERFACE "interface" INTERFACE "interface"
...@@ -193,6 +194,7 @@ using namespace std; ...@@ -193,6 +194,7 @@ using namespace std;
%token <bool> BOOLEAN "boolean" %token <bool> BOOLEAN "boolean"
%type <ElementPtr> value %type <ElementPtr> value
%type <ElementPtr> map_value
%type <ElementPtr> socket_type %type <ElementPtr> socket_type
%printer { yyoutput << $$; } <*>; %printer { yyoutput << $$; } <*>;
...@@ -246,6 +248,8 @@ map2: LCURLY_BRACKET { ...@@ -246,6 +248,8 @@ map2: LCURLY_BRACKET {
// for it. // for it.
}; };
map_value: map2 { $$ = ctx.stack_.back(); ctx.stack_.pop_back(); };
// Assignments rule // Assignments rule
map_content: %empty // empty map map_content: %empty // empty map
| not_empty_map | not_empty_map
...@@ -1106,6 +1110,7 @@ pool_params: pool_param ...@@ -1106,6 +1110,7 @@ pool_params: pool_param
pool_param: pool_entry pool_param: pool_entry
| option_data_list | option_data_list
| user_context
| unknown_map_entry | unknown_map_entry
; ;
...@@ -1117,6 +1122,13 @@ pool_entry: POOL { ...@@ -1117,6 +1122,13 @@ pool_entry: POOL {
ctx.leave(); ctx.leave();
}; };
user_context: USER_CONTEXT {
ctx.enter(ctx.NO_KEYWORD);
} COLON map_value {
ctx.stack_.back()->set("user-context", $4);
ctx.leave();
};
// --- end of pools definition ------------------------------- // --- end of pools definition -------------------------------
// --- reservations ------------------------------------------ // --- reservations ------------------------------------------
......
// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC") // Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -572,8 +572,9 @@ public: ...@@ -572,8 +572,9 @@ public:
void getPool(const std::string& config, size_t subnet_index, void getPool(const std::string& config, size_t subnet_index,
size_t pool_index, PoolPtr& pool) { size_t pool_index, PoolPtr& pool) {
ConstElementPtr status; ConstElementPtr status;
ElementPtr json = Element::fromJSON(config); ConstElementPtr json;
EXPECT_NO_THROW(json = parseDHCP4(config, true));
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
ASSERT_TRUE(status); ASSERT_TRUE(status);
checkResult(status, 0); checkResult(status, 0);
......
...@@ -466,6 +466,16 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence} ...@@ -466,6 +466,16 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
} }
} }
\"user-context\" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::POOLS:
case isc::dhcp::Parser6Context::PD_POOLS:
return isc::dhcp::Dhcp6Parser::make_USER_CONTEXT(driver.loc_);
default:
return isc::dhcp::Dhcp6Parser::make_STRING("user-context", driver.loc_);
}
}
\"subnet\" { \"subnet\" {
switch(driver.ctx_) { switch(driver.ctx_) {
case isc::dhcp::Parser6Context::SUBNET6: case isc::dhcp::Parser6Context::SUBNET6:
......
...@@ -88,6 +88,7 @@ using namespace std; ...@@ -88,6 +88,7 @@ using namespace std;
EXCLUDED_PREFIX "excluded-prefix" EXCLUDED_PREFIX "excluded-prefix"
EXCLUDED_PREFIX_LEN "excluded-prefix-len" EXCLUDED_PREFIX_LEN "excluded-prefix-len"
DELEGATED_LEN "delegated-len" DELEGATED_LEN "delegated-len"
USER_CONTEXT "user-context"
SUBNET "subnet" SUBNET "subnet"
INTERFACE "interface" INTERFACE "interface"
...@@ -194,6 +195,7 @@ using namespace std; ...@@ -194,6 +195,7 @@ using namespace std;
%token <bool> BOOLEAN "boolean" %token <bool> BOOLEAN "boolean"
%type <ElementPtr> value %type <ElementPtr> value
%type <ElementPtr> map_value
%type <ElementPtr> duid_type %type <ElementPtr> duid_type
%printer { yyoutput << $$; } <*>; %printer { yyoutput << $$; } <*>;
...@@ -248,6 +250,8 @@ map2: LCURLY_BRACKET { ...@@ -248,6 +250,8 @@ map2: LCURLY_BRACKET {
// for it. // for it.
}; };
map_value: map2 { $$ = ctx.stack_.back(); ctx.stack_.pop_back(); };
// Assignments rule // Assignments rule
map_content: %empty // empty map map_content: %empty // empty map
| not_empty_map | not_empty_map
...@@ -1083,6 +1087,7 @@ pool_params: pool_param ...@@ -1083,6 +1087,7 @@ pool_params: pool_param
pool_param: pool_entry pool_param: pool_entry
| option_data_list | option_data_list
| user_context
| unknown_map_entry | unknown_map_entry
; ;
...@@ -1094,6 +1099,13 @@ pool_entry: POOL { ...@@ -1094,6 +1099,13 @@ pool_entry: POOL {
ctx.leave(); ctx.leave();
}; };
user_context: USER_CONTEXT {
ctx.enter(ctx.NO_KEYWORD);
} COLON map_value {
ctx.stack_.back()->set("user-context", $4);
ctx.leave();
};
// --- end of pools definition ------------------------------- // --- end of pools definition -------------------------------
// --- pd-pools ---------------------------------------------- // --- pd-pools ----------------------------------------------
...@@ -1143,6 +1155,7 @@ pd_pool_param: pd_prefix ...@@ -1143,6 +1155,7 @@ pd_pool_param: pd_prefix
| option_data_list | option_data_list
| excluded_prefix | excluded_prefix
| excluded_prefix_len | excluded_prefix_len
| user_context
| unknown_map_entry | unknown_map_entry
; ;
......
...@@ -707,8 +707,9 @@ public: ...@@ -707,8 +707,9 @@ public:
void getPool(const std::string& config, size_t subnet_index, void getPool(const std::string& config, size_t subnet_index,
size_t pool_index, Lease::Type type, PoolPtr& pool) { size_t pool_index, Lease::Type type, PoolPtr& pool) {
ConstElementPtr status; ConstElementPtr status;
ElementPtr json = Element::fromJSON(config); ConstElementPtr json;
EXPECT_NO_THROW(json = parseDHCP6(config, true));
EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json)); EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
ASSERT_TRUE(status); ASSERT_TRUE(status);
checkResult(status, 0); checkResult(status, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment