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 space = space_;
165 std::string left_space = space;
166 std::string right_space = space;
167 if (left->get(
"space")) {
168 left_space = left->get(
"space")->stringValue();
170 if (right->get(
"space")) {
171 right_space = right->get(
"space")->stringValue();
173 if (left_space == right_space) {
174 if (left->find(
"code") && right->find(
"code")) {
175 return (left->get(
"code")->intValue() == right->get(
"code")->intValue());
176 }
else if (left->find(
"name") && right->find(
"name")) {
177 return (left->get(
"name")->stringValue() == right->get(
"name")->stringValue());
185 auto const& subnet_is_key = [](
const std::string& key) ->
bool {
186 return (key ==
"id" || key ==
"subnet");
191 auto const& pool_is_key = [](
const std::string& key) ->
bool {
192 return (key ==
"pool");
197 auto const& pd_pool_is_key = [](
const std::string& key) ->
bool {
198 return (key ==
"prefix" || key ==
"prefix-len" || key ==
"delegated-len");
203 auto const& option_is_key = [](
const std::string& key) ->
bool {
204 return (key ==
"space" || key ==
"code" || key ==
"name");
207 subnet_hierarchy_any_match_ = {
208 { {
"subnet", { subnet_match, subnet_empty, subnet_is_key } } },
209 { {
"pools", { match_any, pool_empty, pool_is_key } },
210 {
"pd-pools", { match_any, pd_pool_empty, pd_pool_is_key } },
211 {
"option-data", { option_match, option_empty, option_is_key } } },
212 { {
"option-data", { option_match, option_empty, option_is_key } } }
215 subnet_hierarchy_ = {
216 { {
"subnet", { subnet_match, subnet_empty, subnet_is_key } } },
217 { {
"pools", { pool_match, pool_empty, pool_is_key } },
218 {
"pd-pools", { pd_pool_match, pd_pool_empty, pd_pool_is_key } },
219 {
"option-data", { option_match, option_empty, option_is_key } } },
220 { {
"option-data", { option_match, option_empty, option_is_key } } }
243 std::set<std::string> initial_keys;
244 for (
auto const& key : subnet_element->mapValue()) {
245 initial_keys.insert(key.first);
260 ElementPtr extended = boost::const_pointer_cast<Element>(subnet_element);
261 extend(
"option-data",
"data", extended, old_element, subnet_hierarchy_any_match_,
"subnet");
276 SubnetConfigParserType parser;
277 auto new_element = parser.parse(subnet_element)->toElement();
282 std::set<std::string> final_keys;
283 for (
auto const& key : new_element->mapValue()) {
284 if (initial_keys.find(key.first) == initial_keys.end()) {
285 final_keys.insert(key.first);
288 for (
auto const& value : final_keys) {
289 new_element->remove(value);
294 mergeDiffAdd(old_element, new_element, subnet_hierarchy_,
"subnet");
297 mergeDiffDel(old_element, new_element, subnet_hierarchy_,
"subnet");
336 template<
typename CfgType>
338 const std::string& protocol_type)
const {
343 args->set(
"subnets", subnet_list);
346 auto subnets = cfg->getAll();
349 for (
auto const& s : *subnets) {
355 std::ostringstream s;
356 s << subnets->size() <<
" " << protocol_type <<
" subnet";
359 if (subnets->size() != 1) {
365 if (subnets->size() > 0) {
367 .arg(subnets->size())
391 template<
typename SubnetTypePtr,
typename CfgType>
394 const std::string& command_name,
395 const std::string& subnet_parameter,
396 const std::string& protocol_version)
const {
400 << command_name <<
"' command");
405 << command_name <<
"' command are not a map");
409 }
else if (arguments->size() != 1) {
411 <<
" for the '" << command_name <<
"' command. Expecting"
412 " 'id' or 'subnet'");
415 SubnetTypePtr subnet;
427 subnet = cfg->getByPrefix(subnet_param->stringValue());
431 subnet_id_param = arguments->get(
"id");
432 if (subnet_id_param) {
438 subnet = cfg->getBySubnetId(
SubnetID(subnet_id_param->intValue()));
451 subnets_list->add(subnet->toElement());
453 response_arguments->set(subnet_parameter, subnets_list);
455 std::ostringstream s;
456 s <<
"Info about " << protocol_version <<
" subnet " << subnet->toText()
457 <<
" (id " << subnet->getID() <<
") returned";
462 .arg(subnet->toText())
463 .arg(subnet->getID());
469 s <<
"No " << subnet_param->stringValue() <<
" subnet found";
471 s <<
"No subnet with id " << subnet_id_param->intValue() <<
" found";
502 template<
typename SimpleParserType,
typename SubnetConfigParserType,
505 const std::string& command_name,
506 const std::string& subnet_parameter,
507 const std::string& protocol_version) {
512 << command_name <<
"' command");
517 << command_name <<
"' command are not a map");
519 }
else if (arguments->size() != 1) {
521 << arguments->size() <<
" for the '"
522 << command_name <<
"' command. Expecting "
523 "'" << subnet_parameter <<
"' list");
530 " argument for the '" << command_name <<
"' command");
535 " argument specified for the '"
536 << command_name <<
"' command is not a list");
539 }
else if (subnet_list->size() != 1) {
541 " '" << command_name <<
"' command. Expected one subnet");
548 "'" << command_name <<
"' command. Expected a map");
554 }
else if (subnet_element->get(
"reservations")) {
556 << command_name <<
"'. Use 'reservation-add' to add"
557 " a reservation to a subnet");
569 getConfiguredGlobals()->toElement();
571 global_scope->set(subnet_parameter, subnet_list);
575 SimpleParserType::setAllDefaults(global_scope);
576 SimpleParserType::deriveParameters(global_scope);
580 SubnetConfigParserType parser;
581 auto subnet = parser.parse(subnet_list->get(0));
588 cfg->updateStatistics();
592 subnet->initAllocatorsAfterConfigure();
596 subnet_info->set(
"id",
602 subnets_list->add(subnet_info);
607 response_arguments->set(
"subnets", subnets_list);
610 std::ostringstream response_text;
611 response_text << protocol_version <<
" subnet added";
619 .arg(subnet->toText())
620 .arg(subnet->getID());
651 template<
typename SimpleParserType,
typename SubnetConfigParserType,
652 typename SharedNetworkPtrType,
typename SubnetTypePtr,
656 const std::string& command_name,
657 const std::string& subnet_parameter,
658 const std::string& protocol_version,
664 << command_name <<
"' command");
669 << command_name <<
"' command are not a map");
671 }
else if (arguments->size() != 1) {
673 << arguments->size() <<
" for the '"
674 << command_name <<
"' command. Expecting "
675 "'" << subnet_parameter <<
"' list");
682 " argument for the '" << command_name <<
"' command");
687 " argument specified for the '"
688 << command_name <<
"' command is not a list");
691 }
else if (subnet_list->size() != 1) {
693 " '" << command_name <<
"' command. Expected one subnet");
700 "'" << command_name <<
"' command. Expected a map");
704 }
else if (subnet_element->get(
"reservations")) {
706 << command_name <<
"'.");
713 << command_name <<
"' command.");
719 auto old_subnet = cfg->getBySubnetId(subnet_id);
722 "Can't find subnet '" << subnet_id <<
"' to update");
726 auto old_element = old_subnet->toElement();
729 if (subnet_parameter ==
"subnet6") {
735 mgr.processDelta(type, old_element, subnet_element);
738 boost::const_pointer_cast<Element>(subnet_list)->set(0, old_element);
750 getConfiguredGlobals()->toElement();
752 global_scope->set(subnet_parameter, subnet_list);
756 SimpleParserType::setAllDefaults(global_scope);
757 SimpleParserType::deriveParameters(global_scope);
761 SubnetConfigParserType parser;
762 auto subnet = parser.parse(subnet_list->get(0));
766 cfg->removeStatistics();
770 auto old = cfg->replace(subnet);
773 <<
"' in the configuration");
777 SharedNetworkPtrType network;
778 old->getSharedNetwork(network);
780 if (!network->replace(subnet)) {
782 if (!cfg->replace(old)) {
784 << subnet_id <<
"' update. Configuration is "
785 "broken beyond repair.");
788 <<
"' update: update in shared network '"
789 << network->getName() <<
"' failed.");
795 cfg->updateStatistics();
801 cfg->updateStatistics();
805 subnet->initAllocatorsAfterConfigure();
809 subnet_info->set(
"id",
815 subnets_list->add(subnet_info);
820 response_arguments->set(
"subnets", subnets_list);
823 std::ostringstream response_text;
824 response_text << protocol_version <<
" subnet updated";
832 .arg(subnet->toText())
833 .arg(subnet->getID());
852 template<
typename CfgType,
853 typename SharedNetworkPtrType>
855 const std::string& command_name,
856 const std::string& protocol_version) {
860 << command_name <<
"' command");
865 << command_name <<
"' command are not a map");
868 }
else if (arguments->size() != 1) {
870 << command_name <<
" command. Expected subnet identifier");
874 if (!subnet_id_element) {
876 << command_name <<
"' command");
881 << command_name <<
"' is not a number");
884 uint32_t subnet_id =
static_cast<uint32_t
>(subnet_id_element->intValue());
885 auto subnet = cfg->getBySubnetId(
SubnetID(subnet_id));
890 std::stringstream tmp;
891 tmp <<
"no subnet with id " << subnet_id <<
" found";
896 cfg->removeStatistics();
902 SharedNetworkPtrType network;
903 subnet->getSharedNetwork(network);
905 network->del(subnet->getID());
910 if (command_name ==
"subnet4-del") {
911 cfg_hosts->delAll4(subnet_id);
913 cfg_hosts->delAll6(subnet_id);
918 cfg->updateStatistics();
923 cfg->updateStatistics();
925 std::ostringstream response_text;
926 response_text << protocol_version <<
" subnet " << subnet->toText()
927 <<
" (id " << subnet->getID() <<
") deleted";
932 details->set(
"subnets", lst);
936 response_text.str(), details);
939 .arg(subnet->toText())
940 .arg(subnet->getID());
951 subnet_element->set(
"id",
955 if (include_shared_network) {
957 if (!sn_name.empty()) {
965 return (subnet_element);
984 template<
typename CfgType>
986 const std::string& protocol_type)
const {
991 args->set(
"shared-networks", network_list);
994 auto networks = networks_cfg->getAll();
997 for (
auto const& n : *networks) {
1001 network_list->add(json);
1005 std::ostringstream s;
1006 s << networks->size() <<
" " << protocol_type <<
" network";
1008 if (networks->size() != 1) {
1014 if (networks->size() > 0) {
1016 .arg(networks->size())
1017 .arg(protocol_type);
1023 .arg(protocol_type);
1039 template<
typename NetworkTypePtr,
typename CfgType>
1042 const std::string& command_name,
1043 const std::string& protocol_version)
const {
1047 << command_name <<
"' command");
1052 << command_name <<
"' command are not a map");
1059 <<
"': missing mandatory 'name' parameter");
1066 NetworkTypePtr network = cfg->getByName(name->stringValue());
1073 networks_list->add(network->toElement());
1075 response_arguments->set(
"shared-networks", networks_list);
1077 std::ostringstream s;
1078 s <<
"Info about " << protocol_version <<
" shared network '" << network->getName()
1083 .arg(network->getName());
1087 std::stringstream s;
1088 s <<
"No '" << name->stringValue() <<
"' shared network found";
1121 template<
typename SimpleParserType,
typename SharedNetworkParserType,
1122 typename CfgNetworksType,
typename CfgSubnetsType>
1125 const std::string& command_name,
1126 const std::string& protocol_version) {
1131 << command_name <<
"' command");
1136 << command_name <<
"' command are not a map");
1142 if (!network_list) {
1144 " argument for the '" << command_name <<
"' command");
1149 << command_name <<
"' command is not a list");
1152 }
else if (network_list->size() != 1) {
1154 " '" << command_name <<
"' command. Expected one network");
1161 "'" << command_name <<
"' command. Expected a map");
1173 getConfiguredGlobals()->toElement();
1175 global_scope->set(
"shared-networks", network_list);
1179 SimpleParserType::setAllDefaults(global_scope);
1180 SimpleParserType::deriveParameters(global_scope);
1184 SharedNetworkParserType parser;
1185 auto network = parser.parse(network_list->get(0));
1188 networks_cfg->add(network);
1191 auto subnets_list = network->getAllSubnets();
1194 for (
auto const& subnet : *subnets_list) {
1195 subnets_cfg->add(subnet);
1201 subnets_cfg->updateStatistics();
1205 for (
auto const& subnet : *subnets_list) {
1206 subnet->initAllocatorsAfterConfigure();
1215 response_list->add(network_info);
1218 response_arguments->set(
"shared-networks", response_list);
1221 std::ostringstream response_text;
1222 response_text <<
"A new " << protocol_version <<
" shared network '" << network->getName()
1227 response_text.str(),
1228 response_arguments);
1231 .arg(network->getName());
1252 template<
typename CfgNetworksType,
typename CfgSubnetsType>
1255 const std::string& command_name,
1256 const std::string& protocol_version) {
1260 << command_name <<
"' command");
1265 << command_name <<
"' command are not a map");
1272 if (!name_element) {
1274 << command_name <<
"' command");
1277 << command_name <<
"' is not a string");
1282 if (subnet_action) {
1285 <<
" command must be a string. Supported values are: "
1286 <<
"'keep' and 'delete'.");
1288 string tmp = subnet_action->stringValue();
1289 if ( (tmp !=
"keep") && (tmp !=
"delete") ) {
1291 << tmp <<
", Supported values: 'keep' and 'delete'.");
1293 if (tmp ==
"delete") {
1298 std::string name = name_element->stringValue();
1300 auto network = networks_cfg->getByName(name);
1302 std::stringstream tmp;
1303 tmp <<
"no shared network with name '" << name <<
"' found";
1309 subnets_cfg->removeStatistics();
1316 auto network_subs = network->getAllSubnets();
1319 for (
auto const& sub : *network_subs) {
1320 subnets_cfg->del(sub);
1324 if (command_name ==
"network4-del") {
1325 cfg_hosts->delAll4(sub->getID());
1327 }
else if (command_name ==
"network6-del") {
1328 cfg_hosts->delAll6(sub->getID());
1332 networks_cfg->del(name);
1337 subnets_cfg->updateStatistics();
1341 subnets_cfg->updateStatistics();
1343 std::ostringstream response_text;
1344 response_text << protocol_version <<
" shared network '"
1345 << name <<
"' deleted";
1352 details->set(
"shared-networks", lst);
1356 response_text.str(), details);
1383 template<
typename CfgNetworksType,
typename CfgSubnetsType>
1386 const std::string& command_name,
1387 const std::string& protocol_version) {
1392 << command_name <<
"' command");
1397 << command_name <<
"' command are not a map");
1406 " argument for the '" << command_name <<
"' command");
1411 << command_name <<
"' command is not a string");
1413 string name = name_elem->stringValue();
1418 " argument for the '" << command_name <<
"' command");
1423 << command_name <<
"' command is not an integer");
1428 auto network = networks->getByName(name);
1431 std::stringstream tmp;
1432 tmp <<
"no " << protocol_version <<
" shared network with name '" << name <<
"' found";
1436 auto subnet = subnets->getSubnet(
id);
1438 std::stringstream tmp;
1439 tmp <<
"no " << protocol_version <<
" subnet with id '" <<
id <<
"' found";
1445 network->add(subnet);
1448 std::ostringstream response_text;
1449 response_text << protocol_version <<
" subnet " << subnet->toText() <<
" (id " <<
1450 id <<
") is now part of shared network '" << network->getName()
1454 .arg(protocol_version).arg(subnet->toText()).arg(
id).arg(network->getName());
1458 response_text.str());
1479 template<
typename CfgNetworksType>
1482 const std::string& command_name,
1483 const std::string& protocol_version) {
1488 << command_name <<
"' command");
1493 << command_name <<
"' command are not a map");
1502 " argument for the '" << command_name <<
"' command");
1507 << command_name <<
"' command is not a string");
1509 string name = name_elem->stringValue();
1514 " argument for the '" << command_name <<
"' command");
1519 << command_name <<
"' command is not an integer");
1524 auto network = networks->getByName(name);
1527 std::stringstream tmp;
1528 tmp <<
"no " << protocol_version <<
" shared network with name '" << name <<
"' found";
1533 auto subnet = network->getSubnet(
id);
1535 std::stringstream tmp;
1536 tmp <<
"The " << protocol_version <<
" subnet with id " <<
id
1537 <<
" is not part of the shared network with name '" << name <<
"' found";
1545 std::ostringstream response_text;
1546 response_text << protocol_version <<
" subnet " << subnet->toText() <<
" (id " <<
1547 id <<
") is now removed from shared network '" << network->getName()
1551 .arg(protocol_version).arg(subnet->toText()).arg(
id).arg(network->getName());
1555 response_text.str());
1568 return (impl_->getSubnetList(cfg,
"IPv4"));
1574 return (impl_->getSubnetList(cfg,
"IPv6"));
1580 return (impl_->getSubnet<
ConstSubnet4Ptr>(cfg, arguments,
"subnet4-get",
1581 "subnet4",
"IPv4"));
1587 return (impl_->getSubnet<
ConstSubnet6Ptr>(cfg, arguments,
"subnet6-get",
1588 "subnet6",
"IPv6"));
1599 "subnet4",
"IPv4"));
1608 "subnet6",
"IPv6"));
1618 "subnet4",
"IPv4"));
1628 "subnet6",
"IPv6"));
1651 "subnet4-delta-add",
1662 "subnet6-delta-add",
1673 "subnet4-delta-del",
1684 "subnet6-delta-del",
1696 return (impl_->getNetworkList(cfg,
"IPv4"));
1702 return (impl_->getNetworkList(cfg,
"IPv6"));
1708 return (impl_->getNetwork<
SharedNetwork4Ptr>(cfg, arguments,
"network4-get",
"IPv4"));
1714 return (impl_->getNetwork<
SharedNetwork6Ptr>(cfg, arguments,
"network6-get",
"IPv6"));
1725 "network4-add",
"IPv4"));
1734 "network6-add",
"IPv6"));
1742 return (impl_->delNetwork(cfg, subnets, arguments,
"network4-del",
"IPv4"));
1750 return (impl_->delNetwork(cfg, subnets, arguments,
"network6-del",
"IPv6"));
1758 return (impl_->addNetworkSubnet(networks, subnets, arguments,
"network4-subnet-add",
1767 return (impl_->addNetworkSubnet(networks, subnets, arguments,
"network6-subnet-add",
1775 return (impl_->delNetworkSubnet(networks, arguments,
"network4-subnet-del",
"IPv4"));
1782 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