58template <
typename SubnetConfigParserType>
76 auto const& subnet_empty = [](
ElementPtr& element) {
77 for (
auto const& kv : element->mapValue()) {
78 auto const& key = kv.first;
79 if (key !=
"id" && key !=
"subnet") {
89 auto const& pool_empty = [](
ElementPtr& element) {
90 for (
auto const& kv : element->mapValue()) {
91 auto const& key = kv.first;
93 if (key ==
"option-data") {
94 if (kv.second->size()) {
108 auto const& pd_pool_empty = [](
ElementPtr& element) {
109 for (
auto const& kv : element->mapValue()) {
110 auto const& key = kv.first;
111 if (key !=
"prefix" && key !=
"prefix-len" && key !=
"delegated-len") {
112 if (key ==
"option-data") {
113 if (kv.second->size()) {
127 auto const& option_empty = [](
ElementPtr& element) {
128 for (
auto const& kv : element->mapValue()) {
129 auto const& key = kv.first;
130 if (key !=
"code" && key !=
"name" && key !=
"space") {
144 return (left->get(
"id")->intValue() == right->get(
"id")->intValue());
150 return (left->get(
"pool")->stringValue() == right->get(
"pool")->stringValue());
156 return (left->get(
"prefix")->stringValue() == right->get(
"prefix")->stringValue() &&
157 left->get(
"prefix-len")->intValue() == right->get(
"prefix-len")->intValue() &&
158 left->get(
"delegated-len")->intValue() == right->get(
"delegated-len")->intValue());
164 std::string left_space = space_;
165 std::string right_space = space_;
166 if (left->get(
"space")) {
167 left_space = left->get(
"space")->stringValue();
169 if (right->get(
"space")) {
170 right_space = right->get(
"space")->stringValue();
172 if (left_space == right_space) {
173 if (left->find(
"code") && right->find(
"code")) {
174 return (left->get(
"code")->intValue() == right->get(
"code")->intValue());
175 }
else if (left->find(
"name") && right->find(
"name")) {
176 return (left->get(
"name")->stringValue() == right->get(
"name")->stringValue());
184 auto const& subnet_is_key = [](
const std::string& key) ->
bool {
185 return (key ==
"id" || key ==
"subnet");
190 auto const& pool_is_key = [](
const std::string& key) ->
bool {
191 return (key ==
"pool");
196 auto const& pd_pool_is_key = [](
const std::string& key) ->
bool {
197 return (key ==
"prefix" || key ==
"prefix-len" || key ==
"delegated-len");
202 auto const& option_is_key = [](
const std::string& key) ->
bool {
203 return (key ==
"space" || key ==
"code" || key ==
"name");
206 subnet_hierarchy_any_match_ = {
207 { {
"subnet", { subnet_match, subnet_empty, subnet_is_key } } },
208 { {
"pools", { match_any, pool_empty, pool_is_key } },
209 {
"pd-pools", { match_any, pd_pool_empty, pd_pool_is_key } },
210 {
"option-data", { option_match, option_empty, option_is_key } } },
211 { {
"option-data", { option_match, option_empty, option_is_key } } }
214 subnet_hierarchy_ = {
215 { {
"subnet", { subnet_match, subnet_empty, subnet_is_key } } },
216 { {
"pools", { pool_match, pool_empty, pool_is_key } },
217 {
"pd-pools", { pd_pool_match, pd_pool_empty, pd_pool_is_key } },
218 {
"option-data", { option_match, option_empty, option_is_key } } },
219 { {
"option-data", { option_match, option_empty, option_is_key } } }
242 std::set<std::string> initial_keys;
243 for (
auto const& key : subnet_element->mapValue()) {
244 initial_keys.insert(key.first);
259 ElementPtr extended = boost::const_pointer_cast<Element>(subnet_element);
260 extend(
"option-data",
"data", extended, old_element, subnet_hierarchy_any_match_,
"subnet");
275 SubnetConfigParserType parser;
276 auto new_element = parser.parse(subnet_element)->toElement();
281 std::set<std::string> final_keys;
282 for (
auto const& key : new_element->mapValue()) {
283 if (initial_keys.find(key.first) == initial_keys.end()) {
284 final_keys.insert(key.first);
287 for (
auto const& value : final_keys) {
288 new_element->remove(value);
293 mergeDiffAdd(old_element, new_element, subnet_hierarchy_,
"subnet");
296 mergeDiffDel(old_element, new_element, subnet_hierarchy_,
"subnet");
335 template<
typename CfgType>
337 const std::string& protocol_type)
const {
342 args->set(
"subnets", subnet_list);
345 auto subnets = cfg->getAll();
348 for (
auto const& s : *subnets) {
354 std::ostringstream s;
355 s << subnets->size() <<
" " << protocol_type <<
" subnet";
358 if (subnets->size() != 1) {
364 if (subnets->size() > 0) {
366 .arg(subnets->size())
390 template<
typename SubnetTypePtr,
typename CfgType>
393 const std::string& command_name,
394 const std::string& subnet_parameter,
395 const std::string& protocol_version)
const {
399 << command_name <<
"' command");
404 << command_name <<
"' command are not a map");
408 }
else if (arguments->size() != 1) {
410 <<
" for the '" << command_name <<
"' command. Expecting"
411 " 'id' or 'subnet'");
414 SubnetTypePtr subnet;
426 subnet = cfg->getByPrefix(subnet_param->stringValue());
430 subnet_id_param = arguments->get(
"id");
431 if (subnet_id_param) {
437 subnet = cfg->getBySubnetId(
SubnetID(subnet_id_param->intValue()));
450 subnets_list->add(subnet->toElement());
452 response_arguments->set(subnet_parameter, subnets_list);
454 std::ostringstream s;
455 s <<
"Info about " << protocol_version <<
" subnet " << subnet->toText()
456 <<
" (id " << subnet->getID() <<
") returned";
461 .arg(subnet->toText())
462 .arg(subnet->getID());
468 s <<
"No " << subnet_param->stringValue() <<
" subnet found";
470 s <<
"No subnet with id " << subnet_id_param->intValue() <<
" found";
501 template<
typename SimpleParserType,
typename SubnetConfigParserType,
504 const std::string& command_name,
505 const std::string& subnet_parameter,
506 const std::string& protocol_version) {
511 << command_name <<
"' command");
516 << command_name <<
"' command are not a map");
518 }
else if (arguments->size() != 1) {
520 << arguments->size() <<
" for the '"
521 << command_name <<
"' command. Expecting "
522 "'" << subnet_parameter <<
"' list");
529 " argument for the '" << command_name <<
"' command");
534 " argument specified for the '"
535 << command_name <<
"' command is not a list");
538 }
else if (subnet_list->size() != 1) {
540 " '" << command_name <<
"' command. Expected one subnet");
547 "'" << command_name <<
"' command. Expected a map");
553 }
else if (subnet_element->get(
"reservations")) {
555 << command_name <<
"'. Use 'reservation-add' to add"
556 " a reservation to a subnet");
568 getConfiguredGlobals()->toElement();
570 global_scope->set(subnet_parameter, subnet_list);
574 SimpleParserType::setAllDefaults(global_scope);
575 SimpleParserType::deriveParameters(global_scope);
579 SubnetConfigParserType parser;
580 auto subnet = parser.parse(subnet_list->get(0));
587 cfg->updateStatistics();
591 subnet->initAllocatorsAfterConfigure();
595 subnet_info->set(
"id",
601 subnets_list->add(subnet_info);
606 response_arguments->set(
"subnets", subnets_list);
609 std::ostringstream response_text;
610 response_text << protocol_version <<
" subnet added";
618 .arg(subnet->toText())
619 .arg(subnet->getID());
650 template<
typename SimpleParserType,
typename SubnetConfigParserType,
651 typename SharedNetworkPtrType,
typename SubnetTypePtr,
655 const std::string& command_name,
656 const std::string& subnet_parameter,
657 const std::string& protocol_version,
663 << command_name <<
"' command");
668 << command_name <<
"' command are not a map");
670 }
else if (arguments->size() != 1) {
672 << arguments->size() <<
" for the '"
673 << command_name <<
"' command. Expecting "
674 "'" << subnet_parameter <<
"' list");
681 " argument for the '" << command_name <<
"' command");
686 " argument specified for the '"
687 << command_name <<
"' command is not a list");
690 }
else if (subnet_list->size() != 1) {
692 " '" << command_name <<
"' command. Expected one subnet");
699 "'" << command_name <<
"' command. Expected a map");
703 }
else if (subnet_element->get(
"reservations")) {
705 << command_name <<
"'.");
712 << command_name <<
"' command.");
718 auto old_subnet = cfg->getBySubnetId(subnet_id);
721 "Can't find subnet '" << subnet_id <<
"' to update");
725 auto old_element = old_subnet->toElement();
728 if (subnet_parameter ==
"subnet6") {
734 mgr.processDelta(type, old_element, subnet_element);
737 boost::const_pointer_cast<Element>(subnet_list)->set(0, old_element);
749 getConfiguredGlobals()->toElement();
751 global_scope->set(subnet_parameter, subnet_list);
755 SimpleParserType::setAllDefaults(global_scope);
756 SimpleParserType::deriveParameters(global_scope);
760 SubnetConfigParserType parser;
761 auto subnet = parser.parse(subnet_list->get(0));
765 cfg->removeStatistics();
769 auto old = cfg->replace(subnet);
772 <<
"' in the configuration");
776 SharedNetworkPtrType network;
777 old->getSharedNetwork(network);
779 if (!network->replace(subnet)) {
781 if (!cfg->replace(old)) {
783 << subnet_id <<
"' update. Configuration is "
784 "broken beyond repair.");
787 <<
"' update: update in shared network '"
788 << network->getName() <<
"' failed.");
794 cfg->updateStatistics();
800 cfg->updateStatistics();
804 subnet->initAllocatorsAfterConfigure();
808 subnet_info->set(
"id",
814 subnets_list->add(subnet_info);
819 response_arguments->set(
"subnets", subnets_list);
822 std::ostringstream response_text;
823 response_text << protocol_version <<
" subnet updated";
831 .arg(subnet->toText())
832 .arg(subnet->getID());
851 template<
typename CfgType,
852 typename SharedNetworkPtrType>
854 const std::string& command_name,
855 const std::string& protocol_version) {
859 << command_name <<
"' command");
864 << command_name <<
"' command are not a map");
867 }
else if (arguments->size() != 1) {
869 << command_name <<
" command. Expected subnet identifier");
873 if (!subnet_id_element) {
875 << command_name <<
"' command");
880 << command_name <<
"' is not a number");
883 uint32_t subnet_id =
static_cast<uint32_t
>(subnet_id_element->intValue());
884 auto subnet = cfg->getBySubnetId(
SubnetID(subnet_id));
889 std::stringstream tmp;
890 tmp <<
"no subnet with id " << subnet_id <<
" found";
895 cfg->removeStatistics();
901 SharedNetworkPtrType network;
902 subnet->getSharedNetwork(network);
904 network->del(subnet->getID());
909 if (command_name ==
"subnet4-del") {
910 cfg_hosts->delAll4(subnet_id);
912 cfg_hosts->delAll6(subnet_id);
917 cfg->updateStatistics();
922 cfg->updateStatistics();
924 std::ostringstream response_text;
925 response_text << protocol_version <<
" subnet " << subnet->toText()
926 <<
" (id " << subnet->getID() <<
") deleted";
931 details->set(
"subnets", lst);
935 response_text.str(), details);
938 .arg(subnet->toText())
939 .arg(subnet->getID());
950 subnet_element->set(
"id",
954 if (include_shared_network) {
956 if (!sn_name.empty()) {
964 return (subnet_element);
983 template<
typename CfgType>
985 const std::string& protocol_type)
const {
990 args->set(
"shared-networks", network_list);
993 auto networks = networks_cfg->getAll();
996 for (
auto const& n : *networks) {
1000 network_list->add(json);
1004 std::ostringstream s;
1005 s << networks->size() <<
" " << protocol_type <<
" network";
1007 if (networks->size() != 1) {
1013 if (networks->size() > 0) {
1015 .arg(networks->size())
1016 .arg(protocol_type);
1022 .arg(protocol_type);
1038 template<
typename NetworkTypePtr,
typename CfgType>
1041 const std::string& command_name,
1042 const std::string& protocol_version)
const {
1046 << command_name <<
"' command");
1051 << command_name <<
"' command are not a map");
1058 <<
"': missing mandatory 'name' parameter");
1065 NetworkTypePtr network = cfg->getByName(name->stringValue());
1072 networks_list->add(network->toElement());
1074 response_arguments->set(
"shared-networks", networks_list);
1076 std::ostringstream s;
1077 s <<
"Info about " << protocol_version <<
" shared network '" << network->getName()
1082 .arg(network->getName());
1086 std::stringstream s;
1087 s <<
"No '" << name->stringValue() <<
"' shared network found";
1120 template<
typename SimpleParserType,
typename SharedNetworkParserType,
1121 typename CfgNetworksType,
typename CfgSubnetsType>
1124 const std::string& command_name,
1125 const std::string& protocol_version) {
1130 << command_name <<
"' command");
1135 << command_name <<
"' command are not a map");
1141 if (!network_list) {
1143 " argument for the '" << command_name <<
"' command");
1148 << command_name <<
"' command is not a list");
1151 }
else if (network_list->size() != 1) {
1153 " '" << command_name <<
"' command. Expected one network");
1160 "'" << command_name <<
"' command. Expected a map");
1172 getConfiguredGlobals()->toElement();
1174 global_scope->set(
"shared-networks", network_list);
1178 SimpleParserType::setAllDefaults(global_scope);
1179 SimpleParserType::deriveParameters(global_scope);
1183 SharedNetworkParserType parser;
1184 auto network = parser.parse(network_list->get(0));
1187 networks_cfg->add(network);
1190 auto subnets_list = network->getAllSubnets();
1193 for (
auto const& subnet : *subnets_list) {
1194 subnets_cfg->add(subnet);
1200 subnets_cfg->updateStatistics();
1204 for (
auto const& subnet : *subnets_list) {
1205 subnet->initAllocatorsAfterConfigure();
1214 response_list->add(network_info);
1217 response_arguments->set(
"shared-networks", response_list);
1220 std::ostringstream response_text;
1221 response_text <<
"A new " << protocol_version <<
" shared network '" << network->getName()
1226 response_text.str(),
1227 response_arguments);
1230 .arg(network->getName());
1251 template<
typename CfgNetworksType,
typename CfgSubnetsType>
1254 const std::string& command_name,
1255 const std::string& protocol_version) {
1259 << command_name <<
"' command");
1264 << command_name <<
"' command are not a map");
1271 if (!name_element) {
1273 << command_name <<
"' command");
1276 << command_name <<
"' is not a string");
1281 if (subnet_action) {
1284 <<
" command must be a string. Supported values are: "
1285 <<
"'keep' and 'delete'.");
1287 string tmp = subnet_action->stringValue();
1288 if ( (tmp !=
"keep") && (tmp !=
"delete") ) {
1290 << tmp <<
", Supported values: 'keep' and 'delete'.");
1292 if (tmp ==
"delete") {
1297 std::string name = name_element->stringValue();
1299 auto network = networks_cfg->getByName(name);
1301 std::stringstream tmp;
1302 tmp <<
"no shared network with name '" << name <<
"' found";
1308 subnets_cfg->removeStatistics();
1315 auto network_subs = network->getAllSubnets();
1318 for (
auto const& sub : *network_subs) {
1319 subnets_cfg->del(sub);
1323 if (command_name ==
"network4-del") {
1324 cfg_hosts->delAll4(sub->getID());
1326 }
else if (command_name ==
"network6-del") {
1327 cfg_hosts->delAll6(sub->getID());
1331 networks_cfg->del(name);
1336 subnets_cfg->updateStatistics();
1340 subnets_cfg->updateStatistics();
1342 std::ostringstream response_text;
1343 response_text << protocol_version <<
" shared network '"
1344 << name <<
"' deleted";
1351 details->set(
"shared-networks", lst);
1355 response_text.str(), details);
1382 template<
typename CfgNetworksType,
typename CfgSubnetsType>
1385 const std::string& command_name,
1386 const std::string& protocol_version) {
1391 << command_name <<
"' command");
1396 << command_name <<
"' command are not a map");
1405 " argument for the '" << command_name <<
"' command");
1410 << command_name <<
"' command is not a string");
1412 string name = name_elem->stringValue();
1417 " argument for the '" << command_name <<
"' command");
1422 << command_name <<
"' command is not an integer");
1427 auto network = networks->getByName(name);
1430 std::stringstream tmp;
1431 tmp <<
"no " << protocol_version <<
" shared network with name '" << name <<
"' found";
1435 auto subnet = subnets->getSubnet(
id);
1437 std::stringstream tmp;
1438 tmp <<
"no " << protocol_version <<
" subnet with id '" <<
id <<
"' found";
1444 network->add(subnet);
1447 std::ostringstream response_text;
1448 response_text << protocol_version <<
" subnet " << subnet->toText() <<
" (id " <<
1449 id <<
") is now part of shared network '" << network->getName()
1453 .arg(protocol_version).arg(subnet->toText()).arg(
id).arg(network->getName());
1457 response_text.str());
1478 template<
typename CfgNetworksType>
1481 const std::string& command_name,
1482 const std::string& protocol_version) {
1487 << command_name <<
"' command");
1492 << command_name <<
"' command are not a map");
1501 " argument for the '" << command_name <<
"' command");
1506 << command_name <<
"' command is not a string");
1508 string name = name_elem->stringValue();
1513 " argument for the '" << command_name <<
"' command");
1518 << command_name <<
"' command is not an integer");
1523 auto network = networks->getByName(name);
1526 std::stringstream tmp;
1527 tmp <<
"no " << protocol_version <<
" shared network with name '" << name <<
"' found";
1532 auto subnet = network->getSubnet(
id);
1534 std::stringstream tmp;
1535 tmp <<
"The " << protocol_version <<
" subnet with id " <<
id
1536 <<
" is not part of the shared network with name '" << name <<
"' found";
1544 std::ostringstream response_text;
1545 response_text << protocol_version <<
" subnet " << subnet->toText() <<
" (id " <<
1546 id <<
") is now removed from shared network '" << network->getName()
1550 .arg(protocol_version).arg(subnet->toText()).arg(
id).arg(network->getName());
1554 response_text.str());
1567 return (impl_->getSubnetList(cfg,
"IPv4"));
1573 return (impl_->getSubnetList(cfg,
"IPv6"));
1579 return (impl_->getSubnet<
ConstSubnet4Ptr>(cfg, arguments,
"subnet4-get",
1580 "subnet4",
"IPv4"));
1586 return (impl_->getSubnet<
ConstSubnet6Ptr>(cfg, arguments,
"subnet6-get",
1587 "subnet6",
"IPv6"));
1598 "subnet4",
"IPv4"));
1607 "subnet6",
"IPv6"));
1617 "subnet4",
"IPv4"));
1627 "subnet6",
"IPv6"));
1650 "subnet4-delta-add",
1661 "subnet6-delta-add",
1672 "subnet4-delta-del",
1683 "subnet6-delta-del",
1695 return (impl_->getNetworkList(cfg,
"IPv4"));
1701 return (impl_->getNetworkList(cfg,
"IPv6"));
1707 return (impl_->getNetwork<
SharedNetwork4Ptr>(cfg, arguments,
"network4-get",
"IPv4"));
1713 return (impl_->getNetwork<
SharedNetwork6Ptr>(cfg, arguments,
"network6-get",
"IPv6"));
1724 "network4-add",
"IPv4"));
1733 "network6-add",
"IPv6"));
1741 return (impl_->delNetwork(cfg, subnets, arguments,
"network4-del",
"IPv4"));
1749 return (impl_->delNetwork(cfg, subnets, arguments,
"network6-del",
"IPv6"));
1757 return (impl_->addNetworkSubnet(networks, subnets, arguments,
"network4-subnet-add",
1766 return (impl_->addNetworkSubnet(networks, subnets, arguments,
"network6-subnet-add",
1774 return (impl_->delNetworkSubnet(networks, arguments,
"network4-subnet-del",
"IPv4"));
1781 return (impl_->delNetworkSubnet(networks, arguments,
"network6-subnet-del",
"IPv6"));
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
A generic exception that is thrown when an object can not be found.
A generic exception that is thrown when an unexpected error condition occurs.
static ElementPtr create(const Position &pos=ZERO_POSITION())
static int64_t getInteger(isc::data::ConstElementPtr scope, const std::string &name)
Returns an integer parameter from a scope.
static CfgMgr & instance()
returns a single instance of Configuration Manager
SrvConfigPtr getCurrentCfg()
Returns a pointer to the current configuration.
Implements parser for IPv4 shared networks.
Implements parser for IPv6 shared networks.
A configuration holder for IPv4 subnet.
A configuration holder for IPv6 subnet.
SubnetID getID() const
Returns unique ID for that subnet.
virtual std::string toText() const
Returns textual representation of the subnet (e.g.
std::string getSharedNetworkName() const
Returns shared network name.
Manager which handles the delta (differences) between two subnets serialized as a JSON tree (usually ...
void processDelta(UpdateType type, ElementPtr &old_element, ConstElementPtr &subnet_element)
Process the delta between existing configuration and user provided data.
~ConfigDiffManager()=default
Destructor.
ConfigDiffManager(std::string space)
Constructor.
Implementation of the SubnetCmds class.
ConstElementPtr getNetworkList(const CfgType &networks_cfg, const std::string &protocol_type) const
Returns a response to a 'network4-list' and 'network6-list' command.
ConstElementPtr delNetwork(CfgNetworksType &networks_cfg, CfgSubnetsType &subnets_cfg, const ConstElementPtr &arguments, const std::string &command_name, const std::string &protocol_version)
Provides a response to a 'network4-del' and 'network6-del' command.
ElementPtr subnetToElement(const Subnet &subnet, bool include_shared_network) const
Returns essential subnet parameters in Element format.
ConstElementPtr addNetworkSubnet(CfgNetworksType &networks, CfgSubnetsType &subnets, const ConstElementPtr &arguments, const std::string &command_name, const std::string &protocol_version)
Provides a response to a 'network4-subnet-add' and 'network6-subnet-add' command.
ConstElementPtr addSubnet(CfgType &cfg, const ConstElementPtr &arguments, const std::string &command_name, const std::string &subnet_parameter, const std::string &protocol_version)
Provides a response to a 'subnet4-add' and 'subnet6-add' command.
ConstElementPtr delSubnet(CfgType &cfg, const ConstElementPtr &arguments, const std::string &command_name, const std::string &protocol_version)
Provides a response to a 'subnet4-del' and 'subnet6-del' command.
ConstElementPtr addNetwork(CfgNetworksType &networks_cfg, CfgSubnetsType &subnets_cfg, const ConstElementPtr &arguments, const std::string &command_name, const std::string &protocol_version)
Provides a response to a 'network4-add' and 'network6-add' command.
ConstElementPtr delNetworkSubnet(CfgNetworksType &networks, const ConstElementPtr &arguments, const std::string &command_name, const std::string &protocol_version)
Provides a response to a 'network4-subnet-del' and 'network6-subnet-del' command.
ConstElementPtr getSubnet(const CfgType &cfg, const data::ConstElementPtr &arguments, const std::string &command_name, const std::string &subnet_parameter, const std::string &protocol_version) const
Provides a response to a 'subnet4-get' or 'subnet6-get' command.
ConstElementPtr getSubnetList(const CfgType &cfg, const std::string &protocol_type) const
Returns a response to a 'subnet4-list' and 'subnet6-list' command.
ConstElementPtr getNetwork(const CfgType &cfg, const data::ConstElementPtr &arguments, const std::string &command_name, const std::string &protocol_version) const
Provides a response to a 'network4-get' or 'network6-get' command.
ConstElementPtr updateSubnet(CfgType &cfg, const ConstElementPtr &arguments, const std::string &command_name, const std::string &subnet_parameter, const std::string &protocol_version, UpdateType type=UPDATE_REPLACE)
Provides a response to a 'subnet4-update' and 'subnet6-update' command.
data::ConstElementPtr addNetwork4Subnet(const data::ConstElementPtr &arguments)
Processes and returns a response to 'network4-subnet-add' command.
data::ConstElementPtr addSubnet6Delta(const data::ConstElementPtr &arguments)
Processes and returns a response to 'subnet6-delta-add' command.
data::ConstElementPtr addSubnet4Delta(const data::ConstElementPtr &arguments)
Processes and returns a response to 'subnet4-delta-add' command.
data::ConstElementPtr addSubnet6(const data::ConstElementPtr &arguments)
Processes and returns a response to 'subnet6-add' command.
data::ConstElementPtr delNetwork6Subnet(const data::ConstElementPtr &arguments)
Processes and returns a response to 'network6-subnet-del' command.
data::ConstElementPtr getSubnet6(const data::ConstElementPtr &arguments) const
Returns a response to 'subnet6-get' command.
data::ConstElementPtr getNetwork6(const data::ConstElementPtr &arguments) const
Returns a response to 'network6-get' command.
data::ConstElementPtr updateSubnet6(const data::ConstElementPtr &arguments)
Processes and returns a response to 'subnet6-update' command.
data::ConstElementPtr getSubnet4(const data::ConstElementPtr &arguments) const
Returns a response to 'subnet4-get' command.
data::ConstElementPtr getNetwork4List() const
Returns a response to a 'network4-list' command.
data::ConstElementPtr delNetwork4Subnet(const data::ConstElementPtr &arguments)
Processes and returns a response to 'network4-subnet-del' command.
data::ConstElementPtr getNetwork4(const data::ConstElementPtr &arguments) const
Returns a response to 'network4-get' command.
data::ConstElementPtr getNetwork6List() const
Returns a response to a 'network6-list' command.
data::ConstElementPtr delSubnet6(const data::ConstElementPtr &arguments)
Processes and returns a response to 'subnet6-del' command.
data::ConstElementPtr delNetwork4(const data::ConstElementPtr &arguments)
Processes and returns a response to 'network4-del' command.
data::ConstElementPtr updateSubnet4(const data::ConstElementPtr &arguments)
Processes and returns a response to 'subnet4-update' command.
data::ConstElementPtr getSubnet6List() const
Returns a response to a 'subnet6-list' command.
data::ConstElementPtr addNetwork6(const data::ConstElementPtr &arguments)
Processes and returns a response to 'network6-add' command.
data::ConstElementPtr addNetwork4(const data::ConstElementPtr &arguments)
Processes and returns a response to 'network4-add' command.
data::ConstElementPtr delNetwork6(const data::ConstElementPtr &arguments)
Processes and returns a response to 'network6-del' command.
data::ConstElementPtr addSubnet4(const data::ConstElementPtr &arguments)
Processes and returns a response to 'subnet4-add' command.
data::ConstElementPtr delSubnet4Delta(const data::ConstElementPtr &arguments)
Processes and returns a response to 'subnet4-delta-del' command.
data::ConstElementPtr addNetwork6Subnet(const data::ConstElementPtr &arguments)
Processes and returns a response to 'network6-subnet-add' command.
data::ConstElementPtr delSubnet6Delta(const data::ConstElementPtr &arguments)
Processes and returns a response to 'subnet6-delta-del' command.
data::ConstElementPtr getSubnet4List() const
Returns a response to a 'subnet4-list' command.
data::ConstElementPtr delSubnet4(const data::ConstElementPtr &arguments)
Processes and returns a response to 'subnet4-del' command.
RAII class creating a critical section.
This file contains several functions and constants that are used for handling commands and responses ...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
const int CONTROL_RESULT_EMPTY
Status code indicating that the specified command was completed correctly, but failed to produce any ...
ConstElementPtr createAnswer()
Creates a standard config/command level success answer message (i.e.
const int CONTROL_RESULT_SUCCESS
Status code indicating a successful operation.
void mergeDiffAdd(ElementPtr &element, ElementPtr &other, HierarchyDescriptor &hierarchy, std::string key, size_t idx)
Merges the diff data by adding the missing elements from 'other' to 'element' (recursively).
void mergeDiffDel(ElementPtr &element, ElementPtr &other, HierarchyDescriptor &hierarchy, std::string key, size_t idx)
Merges the diff data by removing the data present in 'other' from 'element' (recursively).
boost::shared_ptr< const Element > ConstElementPtr
void extend(const std::string &container, const std::string &extension, ElementPtr &element, ElementPtr &other, HierarchyDescriptor &hierarchy, std::string key, size_t idx, bool alter)
Extends data by adding the specified 'extension' elements from 'other' inside the 'container' element...
boost::shared_ptr< Element > ElementPtr
std::vector< FunctionMap > HierarchyDescriptor
Hierarchy descriptor of the containers in a specific Element hierarchy tree.
boost::shared_ptr< const Subnet6 > ConstSubnet6Ptr
A const pointer to a Subnet6 object.
boost::shared_ptr< const Subnet4 > ConstSubnet4Ptr
A const pointer to a Subnet4 object.
boost::shared_ptr< CfgSubnets6 > CfgSubnets6Ptr
Non-const pointer.
boost::shared_ptr< SharedNetwork6 > SharedNetwork6Ptr
Pointer to SharedNetwork6 object.
boost::shared_ptr< CfgSharedNetworks6 > CfgSharedNetworks6Ptr
Pointer to the configuration of IPv6 shared networks.
uint32_t SubnetID
Defines unique IPv4 or IPv6 subnet identifier.
boost::shared_ptr< CfgHosts > CfgHostsPtr
Non-const pointer.
boost::shared_ptr< CfgSubnets4 > CfgSubnets4Ptr
Non-const pointer.
boost::shared_ptr< const CfgSubnets4 > ConstCfgSubnets4Ptr
Const pointer.
boost::shared_ptr< const CfgSubnets6 > ConstCfgSubnets6Ptr
Const pointer.
boost::shared_ptr< CfgSharedNetworks4 > CfgSharedNetworks4Ptr
Pointer to the configuration of IPv4 shared networks.
boost::shared_ptr< SharedNetwork4 > SharedNetwork4Ptr
Pointer to SharedNetwork4 object.
const isc::log::MessageID SUBNET_CMDS_NETWORK_LIST
const isc::log::MessageID SUBNET_CMDS_NETWORK_ADD
const isc::log::MessageID SUBNET_CMDS_SUBNET_DEL
const isc::log::MessageID SUBNET_CMDS_SUBNET_ADD
const isc::log::MessageID SUBNET_CMDS_NETWORK_SUBNET_ADD
const isc::log::MessageID SUBNET_CMDS_SUBNET_UPDATE
const isc::log::MessageID SUBNET_CMDS_NETWORK_SUBNET_DEL
const isc::log::MessageID SUBNET_CMDS_SUBNET_LIST_EMPTY
const isc::log::MessageID SUBNET_CMDS_NETWORK_LIST_EMPTY
UpdateType
Type of subnet update.
@ UPDATE_DELTA_DEL
update the old subnet by removing the parameters from the new entry.
@ UPDATE_REPLACE
completely replace old subnet with the new entry.
@ UPDATE_DELTA_ADD
update the old subnet by adding the parameters form the new entry.
const isc::log::MessageID SUBNET_CMDS_SUBNET_GET_EMPTY
const isc::log::MessageID SUBNET_CMDS_NETWORK_GET_EMPTY
const isc::log::MessageID SUBNET_CMDS_SUBNET_GET
const isc::log::MessageID SUBNET_CMDS_NETWORK_DEL
isc::log::Logger subnet_cmds_logger("subnet-cmds-hooks")
const isc::log::MessageID SUBNET_CMDS_NETWORK_GET
const isc::log::MessageID SUBNET_CMDS_SUBNET_LIST
Defines the logger used by the top-level component of kea-lfc.
#define DHCP4_OPTION_SPACE
global std option spaces
#define DHCP6_OPTION_SPACE