Kea: translator_config.cc Source File

| Kea 2.2.0

translator_config.cc
Go to the documentation of this file.
1// Copyright (C) 2018-2022 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#include <config.h>
8
9#include <yang/translator_config.h>
10#include <yang/adaptor_config.h>
11#include <yang/yang_models.h>
12#include <sstream>
13
14using namespace std;
15using namespace isc::data;
16using namespace sysrepo;
17
18namespace isc {
19namespace yang {
20
21TranslatorConfig::TranslatorConfig(S_Session session, const string& model)
22 : TranslatorBasic(session, model),
23 TranslatorControlSocket(session, model),
24 TranslatorDatabase(session, model),
25 TranslatorDatabases(session, model),
26 TranslatorOptionData(session, model),
27 TranslatorOptionDataList(session, model),
28 TranslatorOptionDef(session, model),
29 TranslatorOptionDefList(session, model),
30 TranslatorClass(session, model),
31 TranslatorClasses(session, model),
32 TranslatorPool(session, model),
33 TranslatorPools(session, model),
34 TranslatorPdPool(session, model),
35 TranslatorPdPools(session, model),
36 TranslatorHost(session, model),
37 TranslatorHosts(session, model),
38 TranslatorSubnet(session, model),
39 TranslatorSubnets(session, model),
40 TranslatorSharedNetwork(session, model),
41 TranslatorSharedNetworks(session, model),
42 TranslatorLogger(session, model),
43 TranslatorLoggers(session, model) {
44}
45
46TranslatorConfig::~TranslatorConfig() {
47}
48
49 ElementPtr
50TranslatorConfig::getConfig() {
51 try {
52 if (model_ == IETF_DHCPV6_SERVER) {
53 return (getConfigIetf6());
54 } else if (model_ == KEA_DHCP4_SERVER) {
55 return (getConfigKea4());
56 } else if (model_ == KEA_DHCP6_SERVER) {
57 return (getConfigKea6());
58 }
59 } catch (const sysrepo_exception& ex) {
60 isc_throw(SysrepoError, "sysrepo error getting config: " << ex.what());
61 }
62 isc_throw(NotImplemented,
63 "getConfig not implemented for the model: " << model_);
64}
65
66 ElementPtr
67TranslatorConfig::getConfigIetf6() {
68 ElementPtr result = Element::createMap();
69 ElementPtr dhcp6 = Element::createMap();
70 result->set("Dhcp6", dhcp6);
71 string xpath = "/" + model_ + ":server/server-config";
72 ConstElementPtr ranges =
73 getSubnets(xpath + "/network-ranges");
74 if (ranges && !ranges->empty()) {
75 dhcp6->set("subnet6", ranges);
76 }
77 // Skip everything else.
78 return (result);
79}
80
81 ElementPtr
82TranslatorConfig::getConfigKea4() {
83 ElementPtr result = Element::createMap();
84 ElementPtr dhcp = getServerKeaDhcp4();
85 result->set("Dhcp4", dhcp);
86 return (result);
87}
88
89 ElementPtr
90TranslatorConfig::getConfigKea6() {
91 ElementPtr result = Element::createMap();
92 ElementPtr dhcp = getServerKeaDhcp6();
93 result->set("Dhcp6", dhcp);
94 return (result);
95}
96
97 ElementPtr TranslatorConfig::getHook(string const& xpath) {
98 ElementPtr const& hook_library(Element::createMap());
99 ElementPtr const& name(getItem(xpath + "/library"));
100 if (name) {
101 hook_library->set("library", name);
102 ElementPtr const& parameters(getItem(xpath + "/parameters"));
103 if (parameters) {
104 hook_library->set("parameters",
105 Element::fromJSON(parameters->stringValue()));
106 }
107 }
108 return hook_library;
109}
110
111 ElementPtr
112TranslatorConfig::getHooksKea(const std::string& xpath) {
113 return getList(xpath + "/hook-library", *this, &TranslatorConfig::getHook);
114}
115
116 isc::data::ElementPtr
117TranslatorConfig::getExpiredKea(const std::string& xpath) {
118 ElementPtr expired = Element::createMap();
119
120 checkAndGetLeaf(expired, xpath, "reclaim-timer-wait-time");
121 checkAndGetLeaf(expired, xpath, "flush-reclaimed-timer-wait-time");
122 checkAndGetLeaf(expired, xpath, "hold-reclaimed-time");
123 checkAndGetLeaf(expired, xpath, "max-reclaim-leases");
124 checkAndGetLeaf(expired, xpath, "max-reclaim-time");
125 checkAndGetLeaf(expired, xpath, "unwarned-reclaim-cycles");
126
127 if (!expired->empty()) {
128 return (expired);
129 }
130
131 return (ElementPtr());
132}
133
134 isc::data::ElementPtr
135TranslatorConfig::getDdnsKea(const std::string& xpath) {
136 ElementPtr ddns = Element::createMap();
137 checkAndGetLeaf(ddns, xpath, "enable-updates");
138 checkAndGetLeaf(ddns, xpath, "qualifying-suffix");
139 checkAndGetLeaf(ddns, xpath, "server-ip");
140 checkAndGetLeaf(ddns, xpath, "server-port");
141 checkAndGetLeaf(ddns, xpath, "sender-ip");
142 checkAndGetLeaf(ddns, xpath, "sender-port");
143 checkAndGetLeaf(ddns, xpath, "max-queue-size");
144 checkAndGetLeaf(ddns, xpath, "ncr-protocol");
145 checkAndGetLeaf(ddns, xpath, "ncr-format");
146 checkAndGetLeaf(ddns, xpath, "override-no-update");
147 checkAndGetLeaf(ddns, xpath, "override-client-update");
148 checkAndGetLeaf(ddns, xpath, "replace-client-name");
149 checkAndGetLeaf(ddns, xpath, "generated-prefix");
150 checkAndGetLeaf(ddns, xpath, "hostname-char-set");
151 checkAndGetLeaf(ddns, xpath, "hostname-char-replacement");
152
153 ConstElementPtr context = getItem(xpath + "/user-context");
154 if (context) {
155 ddns->set("user-context", Element::fromJSON(context->stringValue()));
156 }
157
158 if (!ddns->empty()) {
159 // If there's something to return, use it.
160 return (ddns);
161 }
162
163 // If not, return null.
164 return (ElementPtr());
165}
166
167 ElementPtr
168TranslatorConfig::getConfigControlKea(const string& xpath) {
169 ElementPtr config_ctrl = Element::createMap();
170 checkAndGetLeaf(config_ctrl, xpath, "config-fetch-wait-time");
171 ConstElementPtr databases = getDatabases(xpath + "/config-database");
172 if (databases && !databases->empty()) {
173 config_ctrl->set("config-databases", databases);
174 }
175 if (!config_ctrl->empty()) {
176 // If there's something to return, use it.
177 return (config_ctrl);
178 }
179
180 // If not, return null.
181 return (ElementPtr());
182}
183
184 ElementPtr
185TranslatorConfig::getServerKeaDhcpCommon(const string& xpath) {
186 ElementPtr result = Element::createMap();
187
188 checkAndGetLeaf(result, xpath, "valid-lifetime");
189 checkAndGetLeaf(result, xpath, "min-valid-lifetime");
190 checkAndGetLeaf(result, xpath, "max-valid-lifetime");
191 checkAndGetLeaf(result, xpath, "renew-timer");
192 checkAndGetLeaf(result, xpath, "rebind-timer");
193 checkAndGetLeaf(result, xpath, "calculate-tee-times");
194 checkAndGetLeaf(result, xpath, "t1-percent");
195 checkAndGetLeaf(result, xpath, "t2-percent");
196 checkAndGetLeaf(result, xpath, "decline-probation-period");
197 checkAndGetLeaf(result, xpath, "hostname-char-set");
198 checkAndGetLeaf(result, xpath, "hostname-char-replacement");
199
200 ConstElementPtr networks = getSharedNetworks(xpath);
201 if (networks && !networks->empty()) {
202 result->set("shared-networks", networks);
203 }
204 ConstElementPtr classes = getClasses(xpath);
205 if (classes && !classes->empty()) {
206 result->set("client-classes", classes);
207 }
208 ConstElementPtr database = getDatabase(xpath + "/lease-database");
209 if (database) {
210 result->set("lease-database", database);
211 }
212 ConstElementPtr databases = getDatabases(xpath + "/hosts-database");
213 if (databases && !databases->empty()) {
214 result->set("hosts-databases", databases);
215 }
216 ConstElementPtr host_ids =
217 getItems(xpath + "/host-reservation-identifiers");
218 if (host_ids) {
219 result->set("host-reservation-identifiers", host_ids);
220 }
221 ConstElementPtr defs = getOptionDefList(xpath);
222 if (defs && !defs->empty()) {
223 result->set("option-def", defs);
224 }
225 ConstElementPtr options = getOptionDataList(xpath);
226 if (options && !options->empty()) {
227 result->set("option-data", options);
228 }
229 ConstElementPtr hooks = getHooksKea(xpath);
230 if (hooks && !hooks->empty()) {
231 result->set("hooks-libraries", hooks);
232 }
233 ConstElementPtr expired =
234 getExpiredKea(xpath + "/expired-leases-processing");
235 if (expired) {
236 result->set("expired-leases-processing", expired);
237 }
238 checkAndGetLeaf(result, xpath, "dhcp4o6-port");
239 ConstElementPtr socket = getControlSocket(xpath + "/control-socket");
240 if (socket) {
241 result->set("control-socket", socket);
242 }
243 ConstElementPtr ddns = getDdnsKea(xpath + "/dhcp-ddns");
244 if (ddns) {
245 result->set("dhcp-ddns", ddns);
246 }
247 ConstElementPtr context = getItem(xpath + "/user-context");
248 if (context) {
249 result->set("user-context", Element::fromJSON(context->stringValue()));
250 }
251 ConstElementPtr checks = getItem(xpath + "/sanity-checks/lease-checks");
252 if (checks) {
253 ElementPtr sanity = Element::createMap();
254 sanity->set("lease-checks", checks);
255 result->set("sanity-checks", sanity);
256 }
257 checkAndGetLeaf(result, xpath, "reservation-mode");
258 ConstElementPtr hosts = getHosts(xpath);
259 if (hosts && !hosts->empty()) {
260 result->set("reservations", hosts);
261 }
262 ConstElementPtr config_ctrl =
263 getConfigControlKea(xpath + "/config-control");
264 if (config_ctrl) {
265 result->set("config-control", config_ctrl);
266 }
267 checkAndGetLeaf(result, xpath, "server-tag");
268 ConstElementPtr queue_ctrl = getItem(xpath + "/dhcp-queue-control");
269 if (queue_ctrl) {
270 result->set("dhcp-queue-control",
271 Element::fromJSON(queue_ctrl->stringValue()));
272 }
273 ConstElementPtr loggers = getLoggers(xpath);
274 if (loggers && !loggers->empty()) {
275 result->set("loggers", loggers);
276 }
277 checkAndGetLeaf(result, xpath, "cache-max-age");
278 checkAndGetLeaf(result, xpath, "cache-threshold");
279 ElementPtr compatibility = Element::createMap();
280 checkAndGetLeaf(compatibility, xpath + "/compatibility", "lenient-option-parsing");
281 if (!compatibility->empty()) {
282 result->set("compatibility", compatibility);
283 }
284 checkAndGetLeaf(result, xpath, "ddns-generated-prefix");
285 checkAndGetLeaf(result, xpath, "ddns-override-client-update");
286 checkAndGetLeaf(result, xpath, "ddns-override-no-update");
287 checkAndGetLeaf(result, xpath, "ddns-qualifying-suffix");
288 checkAndGetLeaf(result, xpath, "ddns-replace-client-name");
289 checkAndGetLeaf(result, xpath, "ddns-send-updates");
290 checkAndGetLeaf(result, xpath, "ddns-update-on-renew");
291 checkAndGetLeaf(result, xpath, "ddns-use-conflict-resolution");
292 checkAndGetLeaf(result, xpath, "ip-reservations-unique");
293 checkAndGetLeaf(result, xpath, "early-global-reservations-lookup");
294 checkAndGetLeaf(result, xpath, "reservations-lookup-first");
295 ElementPtr multi_threading = Element::createMap();
296 string mt_xpath = xpath + "/multi-threading";
297 checkAndGetLeaf(multi_threading, mt_xpath, "enable-multi-threading");
298 checkAndGetLeaf(multi_threading, mt_xpath, "packet-queue-size");
299 checkAndGetLeaf(multi_threading, mt_xpath, "thread-pool-size");
300 if (!multi_threading->empty()) {
301 result->set("multi-threading", multi_threading);
302 }
303 checkAndGetLeaf(result, xpath, "parked-packet-limit");
304 checkAndGetLeaf(result, xpath, "reservations-global");
305 checkAndGetLeaf(result, xpath, "reservations-in-subnet");
306 checkAndGetLeaf(result, xpath, "reservations-out-of-pool");
307 checkAndGetLeaf(result, xpath, "statistic-default-sample-age");
308 checkAndGetLeaf(result, xpath, "statistic-default-sample-count");
309 checkAndGetLeaf(result, xpath, "store-extended-info");
310 return (result);
311}
312
313 ElementPtr
314TranslatorConfig::getServerKeaDhcp4() {
315 string xpath = "/kea-dhcp4-server:config";
316 ElementPtr result = getServerKeaDhcpCommon(xpath);
317 // Handle subnets.
318 ConstElementPtr subnets = getSubnets(xpath);
319 if (subnets && !subnets->empty()) {
320 result->set("subnet4", subnets);
321 }
322 // Handle interfaces.
323 ElementPtr if_config = Element::createMap();
324 ConstElementPtr ifs = getItems(xpath + "/interfaces-config/interfaces");
325 if (ifs && !ifs->empty()) {
326 if_config->set("interfaces", ifs);
327 }
328 string if_cfg_xpath = xpath + "/interfaces-config";
329 checkAndGetLeaf(if_config, if_cfg_xpath, "dhcp-socket-type");
330 checkAndGetLeaf(if_config, if_cfg_xpath, "outbound-interface");
331 checkAndGetLeaf(if_config, if_cfg_xpath, "service-sockets-require-all");
332 checkAndGetLeaf(if_config, if_cfg_xpath, "service-sockets-max-retries");
333 checkAndGetLeaf(if_config, if_cfg_xpath, "service-sockets-retry-wait-time");
334 checkAndGetLeaf(if_config, if_cfg_xpath, "re-detect");
335 ConstElementPtr context =
336 getItem(xpath + "/interfaces-config/user-context");
337 if (context) {
338 if_config->set("user-context",
339 Element::fromJSON(context->stringValue()));
340 }
341 if (!if_config->empty()) {
342 result->set("interfaces-config", if_config);
343 }
344 // Handle DHCPv4 specific global parameters.
345 checkAndGetLeaf(result, xpath, "echo-client-id");
346 checkAndGetLeaf(result, xpath, "match-client-id");
347 checkAndGetLeaf(result, xpath, "next-server");
348 checkAndGetLeaf(result, xpath, "server-hostname");
349 checkAndGetLeaf(result, xpath, "boot-file-name");
350 checkAndGetLeaf(result, xpath, "authoritative");
351 return (result);
352}
353
354 ElementPtr
355TranslatorConfig::getServerKeaDhcp6() {
356 string xpath = "/kea-dhcp6-server:config";
357 ElementPtr result = getServerKeaDhcpCommon(xpath);
358 // Handle DHCPv6 specific global parameters.
359 checkAndGetLeaf(result, xpath, "data-directory");
360 checkAndGetLeaf(result, xpath, "preferred-lifetime");
361 checkAndGetLeaf(result, xpath, "min-preferred-lifetime");
362 checkAndGetLeaf(result, xpath, "max-preferred-lifetime");
363 // Handle subnets.
364 ConstElementPtr subnets = getSubnets(xpath);
365 if (subnets && !subnets->empty()) {
366 result->set("subnet6", subnets);
367 }
368 // Handle interfaces.
369 ElementPtr if_config = Element::createMap();
370 ConstElementPtr ifs = getItems(xpath + "/interfaces-config/interfaces");
371 if (ifs && !ifs->empty()) {
372 if_config->set("interfaces", ifs);
373 }
374 string if_cfg_xpath = xpath + "/interfaces-config";
375 checkAndGetLeaf(if_config, if_cfg_xpath, "service-sockets-require-all");
376 checkAndGetLeaf(if_config, if_cfg_xpath, "service-sockets-max-retries");
377 checkAndGetLeaf(if_config, if_cfg_xpath, "service-sockets-retry-wait-time");
378 checkAndGetLeaf(if_config, if_cfg_xpath, "re-detect");
379 ConstElementPtr context =
380 getItem(xpath + "/interfaces-config/user-context");
381 if (context) {
382 if_config->set("user-context",
383 Element::fromJSON(context->stringValue()));
384 }
385 if (!if_config->empty()) {
386 result->set("interfaces-config", if_config);
387 }
388 // Handle DHCPv6 specific global entries.
389 ConstElementPtr relay = getItems(xpath + "/relay-supplied-options");
390 if (relay) {
391 result->set("relay-supplied-options", relay);
392 }
393 ConstElementPtr macs = getItems(xpath + "/mac-sources");
394 if (macs) {
395 result->set("mac-sources", macs);
396 }
397 // Handle server-id.
398 // @todo: move to a DUID translator.
399 ElementPtr server_id = Element::createMap();
400 string srv_id_xpath = xpath + "/server-id";
401 checkAndGetLeaf(server_id, srv_id_xpath, "type");
402 checkAndGetLeaf(server_id, srv_id_xpath, "identifier");
403 checkAndGetLeaf(server_id, srv_id_xpath, "time");
404 checkAndGetLeaf(server_id, srv_id_xpath, "htype");
405 checkAndGetLeaf(server_id, srv_id_xpath, "enterprise-id");
406 checkAndGetLeaf(server_id, srv_id_xpath, "persist");
407 context = getItem(xpath + "/server-id/user-context");
408 if (context) {
409 server_id->set("user-context",
410 Element::fromJSON(context->stringValue()));
411 }
412 if (!server_id->empty()) {
413 result->set("server-id", server_id);
414 }
415 return (result);
416}
417
418void
419TranslatorConfig::setConfig(ConstElementPtr elem) {
420 try {
421 if (model_ == IETF_DHCPV6_SERVER) {
422 if (elem) {
423 AdaptorConfig::preProcess6(elem);
424 setConfigIetf6(elem);
425 } else {
426 delConfigIetf6();
427 }
428 } else if (model_ == KEA_DHCP4_SERVER) {
429 if (elem) {
430 AdaptorConfig::preProcess4(elem);
431 setConfigKea4(elem);
432 } else {
433 delConfigKea();
434 }
435 } else if (model_ == KEA_DHCP6_SERVER) {
436 if (elem) {
437 AdaptorConfig::preProcess6(elem);
438 setConfigKea6(elem);
439 } else {
440 delConfigKea();
441 }
442 } else {
443 isc_throw(NotImplemented,
444 "setConfig not implemented for the model: " << model_);
445 }
446 } catch (const sysrepo_exception& ex) {
447 isc_throw(SysrepoError,
448 "sysrepo error setting config '" << elem->str()
449 << "': " << ex.what());
450 }
451}
452
453void
454TranslatorConfig::delConfigIetf6() {
455 delItem("/" + model_ + ":server");
456}
457
458void
459TranslatorConfig::setConfigIetf6(ConstElementPtr elem) {
460 string xpath = "/" + model_ + ":server/server-config";
461 ConstElementPtr dhcp6 = elem->get("Dhcp6");
462 if (!dhcp6) {
463 isc_throw(BadValue, "no Dhcp6 entry in " << elem->str());
464 }
465 ConstElementPtr ranges = dhcp6->get("subnet6");
466 if (ranges && !ranges->empty()) {
467 setSubnets(xpath + "/network-ranges", ranges);
468 }
469 // Skip everything else.
470}
471
472void
473TranslatorConfig::delConfigKea() {
474 delItem("/" + model_ + ":config");
475}
476
477void
478TranslatorConfig::setConfigKea4(ConstElementPtr elem) {
479 ConstElementPtr dhcp = elem->get("Dhcp4");
480 if (dhcp) {
481 setServerKeaDhcp4(dhcp);
482 }
483}
484
485void
486TranslatorConfig::setConfigKea6(ConstElementPtr elem) {
487 ConstElementPtr dhcp = elem->get("Dhcp6");
488 if (dhcp) {
489 setServerKeaDhcp6(dhcp);
490 }
491}
492
493void
494TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
495 ConstElementPtr elem) {
496 checkAndSetLeaf(elem, xpath, "valid-lifetime", SR_UINT32_T);
497 checkAndSetLeaf(elem, xpath, "min-valid-lifetime", SR_UINT32_T);
498 checkAndSetLeaf(elem, xpath, "max-valid-lifetime", SR_UINT32_T);
499 checkAndSetLeaf(elem, xpath, "renew-timer", SR_UINT32_T);
500 checkAndSetLeaf(elem, xpath, "rebind-timer", SR_UINT32_T);
501 checkAndSetLeaf(elem, xpath, "calculate-tee-times", SR_BOOL_T);
502 checkAndSetLeaf(elem, xpath, "t1-percent", SR_DECIMAL64_T);
503 checkAndSetLeaf(elem, xpath, "t2-percent", SR_DECIMAL64_T);
504 checkAndSetLeaf(elem, xpath, "decline-probation-period", SR_UINT32_T);
505 ConstElementPtr networks = elem->get("shared-networks");
506 if (networks) {
507 setSharedNetworks(xpath, networks);
508 }
509 ConstElementPtr classes = elem->get("client-classes");
510 if (classes && !classes->empty()) {
511 setClasses(xpath, classes);
512 }
513 ConstElementPtr database = elem->get("lease-database");
514 if (database) {
515 setDatabase(xpath + "/lease-database", database);
516 }
517 ConstElementPtr databases = elem->get("hosts-databases");
518 if (databases && !databases->empty()) {
519 setDatabases(xpath + "/hosts-database", databases);
520 } else {
521 // Reuse of database from lease-database.
522 database = elem->get("hosts-database");
523 if (database) {
524 ElementPtr list = Element::createList();
525 list->add(copy(database));
526 setDatabases(xpath + "/hosts-database", list);
527 }
528 }
529 ConstElementPtr host_ids = elem->get("host-reservation-identifiers");
530 if (host_ids) {
531 for (ConstElementPtr id : host_ids->listValue()) {
532 setItem(xpath + "/host-reservation-identifiers", id, SR_ENUM_T);
533 }
534 }
535 ConstElementPtr defs = elem->get("option-def");
536 if (defs && !defs->empty()) {
537 setOptionDefList(xpath, defs);
538 }
539 ConstElementPtr options = elem->get("option-data");
540 if (options && !options->empty()) {
541 setOptionDataList(xpath, options);
542 }
543 ConstElementPtr hook_libs = elem->get("hooks-libraries");
544 if (hook_libs) {
545 for (ConstElementPtr lib : hook_libs->listValue()) {
546 ConstElementPtr name = lib->get("library");
547 if (!name) {
548 continue;
549 }
550 ostringstream hook_lib;
551 hook_lib << xpath << "/hook-library[library='"
552 << name->stringValue() << "']";
553 ConstElementPtr params = lib->get("parameters");
554 if (params) {
555 hook_lib << "/parameters";
556 setItem(hook_lib.str(), Element::create(params->str()),
557 SR_STRING_T);
558 } else {
559 ConstElementPtr list = Element::createList();
560 setItem(hook_lib.str(), list, SR_LIST_T);
561 }
562 }
563 }
564 ConstElementPtr expired = elem->get("expired-leases-processing");
565 if (expired) {
566 string expired_xpath = xpath + "/expired-leases-processing";
567 checkAndSetLeaf(expired, expired_xpath, "reclaim-timer-wait-time", SR_UINT32_T);
568 checkAndSetLeaf(expired, expired_xpath, "flush-reclaimed-timer-wait-time", SR_UINT32_T);
569 checkAndSetLeaf(expired, expired_xpath, "hold-reclaimed-time", SR_UINT32_T);
570 checkAndSetLeaf(expired, expired_xpath, "max-reclaim-leases", SR_UINT32_T);
571 checkAndSetLeaf(expired, expired_xpath, "max-reclaim-time", SR_UINT32_T);
572 checkAndSetLeaf(expired, expired_xpath, "unwarned-reclaim-cycles", SR_UINT32_T);
573 }
574 checkAndSetLeaf(elem, xpath, "dhcp4o6-port", SR_UINT16_T);
575 ConstElementPtr socket = elem->get("control-socket");
576 if (socket) {
577 setControlSocket(xpath + "/control-socket", socket);
578 }
579 checkAndSetLeaf(elem, xpath, "hostname-char-set", SR_STRING_T);
580 checkAndSetLeaf(elem, xpath, "hostname-char-replacement", SR_STRING_T);
581 ConstElementPtr ddns = elem->get("dhcp-ddns");
582 if (ddns) {
583 string ddns_xpath = xpath + "/dhcp-ddns";
584 checkAndSetLeaf(ddns, ddns_xpath, "enable-updates", SR_BOOL_T);
585 checkAndSetLeaf(ddns, ddns_xpath, "qualifying-suffix", SR_STRING_T);
586 checkAndSetLeaf(ddns, ddns_xpath, "server-ip", SR_STRING_T);
587 checkAndSetLeaf(ddns, ddns_xpath, "server-port", SR_UINT16_T);
588 checkAndSetLeaf(ddns, ddns_xpath, "sender-ip", SR_STRING_T);
589 checkAndSetLeaf(ddns, ddns_xpath, "sender-port", SR_UINT16_T);
590 checkAndSetLeaf(ddns, ddns_xpath, "max-queue-size", SR_UINT32_T);
591 checkAndSetLeaf(ddns, ddns_xpath, "ncr-protocol", SR_ENUM_T);
592 checkAndSetLeaf(ddns, ddns_xpath, "ncr-format", SR_ENUM_T);
593 checkAndSetLeaf(ddns, ddns_xpath, "override-no-update", SR_BOOL_T);
594 checkAndSetLeaf(ddns, ddns_xpath, "override-client-update", SR_BOOL_T);
595 checkAndSetLeaf(ddns, ddns_xpath, "replace-client-name", SR_ENUM_T);
596 checkAndSetLeaf(ddns, ddns_xpath, "generated-prefix", SR_STRING_T);
597 checkAndSetLeaf(ddns, ddns_xpath, "hostname-char-set", SR_STRING_T);
598 checkAndSetLeaf(ddns, ddns_xpath, "hostname-char-replacement", SR_STRING_T);
599 ConstElementPtr context = Adaptor::getContext(ddns);
600 if (context) {
601 ConstElementPtr repr = Element::create(context->str());
602 setItem(xpath + "/dhcp-ddns/user-context", repr, SR_STRING_T);
603 }
604 }
605 ConstElementPtr context = Adaptor::getContext(elem);
606 if (context) {
607 ConstElementPtr repr = Element::create(context->str());
608 setItem(xpath + "/user-context", repr, SR_STRING_T);
609 }
610 ConstElementPtr sanity = elem->get("sanity-checks");
611 if (sanity) {
612 checkAndSetLeaf(sanity, xpath + "/sanity-checks", "lease-checks", SR_ENUM_T);
613 }
614 checkAndSetLeaf(elem, xpath, "reservation-mode", SR_ENUM_T);
615 ConstElementPtr hosts = elem->get("reservations");
616 if (hosts && !hosts->empty()) {
617 setHosts(xpath, hosts);
618 }
619 ConstElementPtr config_ctrl = elem->get("config-control");
620 if (config_ctrl && !config_ctrl->empty()) {
621 checkAndSetLeaf(config_ctrl, xpath + "/config-control", "config-fetch-wait-time", SR_UINT32_T);
622 databases = config_ctrl->get("config-databases");
623 if (databases && !databases->empty()) {
624 setDatabases(xpath + "/config-control/config-database", databases);
625 }
626 }
627 checkAndSetLeaf(elem, xpath, "server-tag", SR_STRING_T);
628 ConstElementPtr queue_ctrl = elem->get("dhcp-queue-control");
629 if (queue_ctrl) {
630 ConstElementPtr repr = Element::create(queue_ctrl->str());
631 setItem(xpath + "/dhcp-queue-control", repr, SR_STRING_T);
632 }
633 ConstElementPtr loggers = elem->get("loggers");
634 if (loggers) {
635 setLoggers(xpath, loggers);
636 }
637 checkAndSetLeaf(elem, xpath, "cache-max-age", SR_UINT32_T);
638 checkAndSetLeaf(elem, xpath, "cache-threshold", SR_DECIMAL64_T);
639 ConstElementPtr compatibility(elem->get("compatibility"));
640 if (compatibility) {
641 checkAndSetLeaf(compatibility, xpath + "/compatibility", "lenient-option-parsing", SR_BOOL_T);
642 }
643 checkAndSetLeaf(elem, xpath, "ddns-generated-prefix", SR_STRING_T);
644 checkAndSetLeaf(elem, xpath, "ddns-override-client-update", SR_BOOL_T);
645 checkAndSetLeaf(elem, xpath, "ddns-override-no-update", SR_BOOL_T);
646 checkAndSetLeaf(elem, xpath, "ddns-qualifying-suffix", SR_STRING_T);
647 checkAndSetLeaf(elem, xpath, "ddns-replace-client-name", SR_STRING_T);
648 checkAndSetLeaf(elem, xpath, "ddns-send-updates", SR_BOOL_T);
649 checkAndSetLeaf(elem, xpath, "ddns-update-on-renew", SR_BOOL_T);
650 checkAndSetLeaf(elem, xpath, "ddns-use-conflict-resolution", SR_BOOL_T);
651 checkAndSetLeaf(elem, xpath, "ip-reservations-unique", SR_BOOL_T);
652 checkAndSetLeaf(elem, xpath, "early-global-reservations-lookup", SR_BOOL_T);
653 checkAndSetLeaf(elem, xpath, "reservations-lookup-first", SR_BOOL_T);
654 ConstElementPtr multi_threading(elem->get("multi-threading"));
655 if (multi_threading) {
656 string mt_xpath = xpath + "/multi-threading";
657 checkAndSetLeaf(multi_threading, mt_xpath, "enable-multi-threading", SR_BOOL_T);
658 checkAndSetLeaf(multi_threading, mt_xpath, "packet-queue-size", SR_UINT32_T);
659 checkAndSetLeaf(multi_threading, mt_xpath, "thread-pool-size", SR_UINT32_T);
660 }
661 checkAndSetLeaf(elem, xpath, "parked-packet-limit", SR_UINT32_T);
662 checkAndSetLeaf(elem, xpath, "reservations-global", SR_BOOL_T);
663 checkAndSetLeaf(elem, xpath, "reservations-in-subnet", SR_BOOL_T);
664 checkAndSetLeaf(elem, xpath, "reservations-out-of-pool", SR_BOOL_T);
665 checkAndSetLeaf(elem, xpath, "statistic-default-sample-age", SR_UINT32_T);
666 checkAndSetLeaf(elem, xpath, "statistic-default-sample-count", SR_UINT32_T);
667 checkAndSetLeaf(elem, xpath, "store-extended-info", SR_BOOL_T);
668}
669
670void
671TranslatorConfig::setServerKeaDhcp4(ConstElementPtr elem) {
672 string xpath = "/kea-dhcp4-server:config";
673 setServerKeaDhcpCommon(xpath, elem);
674 ConstElementPtr subnets = elem->get("subnet4");
675 if (subnets) {
676 setSubnets(xpath, subnets);
677 }
678 ConstElementPtr if_config = elem->get("interfaces-config");
679 if (if_config) {
680 ConstElementPtr ifs = if_config->get("interfaces");
681 if (ifs && !ifs->empty()) {
682 for (ConstElementPtr intf : ifs->listValue()) {
683 setItem(xpath + "/interfaces-config/interfaces",
684 intf, SR_STRING_T);
685 }
686 }
687 string if_cfg_xpath = xpath + "/interfaces-config";
688 checkAndSetLeaf(if_config, if_cfg_xpath, "dhcp-socket-type", SR_ENUM_T);
689 checkAndSetLeaf(if_config, if_cfg_xpath, "outbound-interface", SR_ENUM_T);
690 checkAndSetLeaf(if_config, if_cfg_xpath, "service-sockets-require-all", SR_BOOL_T);
691 checkAndSetLeaf(if_config, if_cfg_xpath, "service-sockets-max-retries", SR_UINT32_T);
692 checkAndSetLeaf(if_config, if_cfg_xpath, "service-sockets-retry-wait-time", SR_UINT32_T);
693 checkAndSetLeaf(if_config, if_cfg_xpath, "re-detect", SR_BOOL_T);
694 ConstElementPtr context = Adaptor::getContext(if_config);
695 if (context) {
696 setItem(xpath + "/interfaces-config/user-context",
697 Element::create(context->str()), SR_STRING_T);
698 }
699 }
700 checkAndSetLeaf(elem, xpath, "echo-client-id", SR_BOOL_T);
701 checkAndSetLeaf(elem, xpath, "match-client-id", SR_BOOL_T);
702 checkAndSetLeaf(elem, xpath, "next-server", SR_STRING_T);
703 checkAndSetLeaf(elem, xpath, "server-hostname", SR_STRING_T);
704 checkAndSetLeaf(elem, xpath, "boot-file-name", SR_STRING_T);
705 checkAndSetLeaf(elem, xpath, "authoritative", SR_BOOL_T);
706}
707
708void
709TranslatorConfig::setServerKeaDhcp6(ConstElementPtr elem) {
710 string xpath = "/kea-dhcp6-server:config";
711 setServerKeaDhcpCommon(xpath, elem);
712 checkAndSetLeaf(elem, xpath, "data-directory", SR_STRING_T);
713 checkAndSetLeaf(elem, xpath, "preferred-lifetime", SR_UINT32_T);
714 checkAndSetLeaf(elem, xpath, "min-preferred-lifetime", SR_UINT32_T);
715 checkAndSetLeaf(elem, xpath, "max-preferred-lifetime", SR_UINT32_T);
716 ConstElementPtr subnets = elem->get("subnet6");
717 if (subnets) {
718 setSubnets(xpath, subnets);
719 }
720 ConstElementPtr if_config = elem->get("interfaces-config");
721 if (if_config) {
722 ConstElementPtr ifs = if_config->get("interfaces");
723 if (ifs && !ifs->empty()) {
724 for (ConstElementPtr intf : ifs->listValue()) {
725 setItem(xpath + "/interfaces-config/interfaces",
726 intf, SR_STRING_T);
727 }
728 }
729 string if_cfg_xpath = xpath + "/interfaces-config";
730 checkAndSetLeaf(if_config, if_cfg_xpath, "service-sockets-require-all", SR_BOOL_T);
731 checkAndSetLeaf(if_config, if_cfg_xpath, "service-sockets-max-retries", SR_UINT32_T);
732 checkAndSetLeaf(if_config, if_cfg_xpath, "service-sockets-retry-wait-time", SR_UINT32_T);
733 checkAndSetLeaf(if_config, if_cfg_xpath, "re-detect", SR_BOOL_T);
734 ConstElementPtr context = Adaptor::getContext(if_config);
735 if (context) {
736 setItem(xpath + "/interfaces-config/user-context",
737 Element::create(context->str()), SR_STRING_T);
738 }
739 }
740 ConstElementPtr relay = elem->get("relay-supplied-options");
741 if (relay) {
742 for (ConstElementPtr addr : relay->listValue()) {
743 setItem(xpath + "/relay-supplied-options", addr, SR_STRING_T);
744 }
745 }
746 ConstElementPtr macs = elem->get("mac-sources");
747 if (macs) {
748 for (ConstElementPtr source : macs->listValue()) {
749 setItem(xpath + "/mac-sources", source, SR_STRING_T);
750 }
751 }
752 ConstElementPtr server_id = elem->get("server-id");
753 if (server_id) {
754 string srv_id_xpath = xpath + "/server-id";
755 checkAndSetLeaf(server_id, srv_id_xpath, "type", SR_ENUM_T);
756 checkAndSetLeaf(server_id, srv_id_xpath, "identifier", SR_STRING_T);
757 checkAndSetLeaf(server_id, srv_id_xpath, "time", SR_UINT32_T);
758 checkAndSetLeaf(server_id, srv_id_xpath, "htype", SR_UINT16_T);
759 checkAndSetLeaf(server_id, srv_id_xpath, "enterprise-id", SR_UINT32_T);
760 checkAndSetLeaf(server_id, srv_id_xpath, "persist", SR_BOOL_T);
761 ConstElementPtr context = Adaptor::getContext(server_id);
762 if (context) {
763 ConstElementPtr repr = Element::create(context->str());
764 setItem(xpath + "/server-id/user-context", repr, SR_STRING_T);
765 }
766 }
767}
768
769} // namespace yang
770} // namespace isc
adaptor_config.h
isc::BadValue
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
Definition: exceptions/exceptions.h:132
isc::Exception::what
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Definition: exceptions/exceptions.cc:32
isc::NotImplemented
A generic exception that is thrown when a function is not implemented.
Definition: exceptions/exceptions.h:166
isc::yang::AdaptorConfig::preProcess4
static void preProcess4(isc::data::ConstElementPtr config)
Pre process a DHCPv4 configuration.
Definition: adaptor_config.cc:620
isc::yang::AdaptorConfig::preProcess6
static void preProcess6(isc::data::ConstElementPtr config)
Pre process a DHCPv6 configuration.
Definition: adaptor_config.cc:639
isc::yang::Adaptor::getContext
static isc::data::ConstElementPtr getContext(isc::data::ConstElementPtr parent)
Get user context.
Definition: adaptor.cc:27
isc::yang::SysrepoError
Sysrepo error.
Definition: sysrepo_error.h:16
isc::yang::TranslatorBasic
Between YANG and JSON translator class for basic values.
Definition: translator.h:19
isc::yang::TranslatorBasic::getItem
isc::data::ElementPtr getItem(const std::string &xpath)
Get and translate basic value from YANG to JSON.
Definition: translator.cc:105
isc::yang::TranslatorBasic::model_
std::string model_
The model.
Definition: translator.h:171
isc::yang::TranslatorBasic::checkAndGetLeaf
void checkAndGetLeaf(isc::data::ElementPtr &storage, const std::string &xpath, const std::string &name)
Retrieves an item and stores it in the specified storage.
Definition: translator.cc:274
isc::yang::TranslatorBasic::getList
isc::data::ElementPtr getList(std::string const &xpath, T &t, isc::data::ElementPtr(T::*f)(std::string const &xpath))
Retrieve a list as ElementPtr from sysrepo from a certain xpath.
Definition: translator.h:147
isc::yang::TranslatorBasic::delItem
void delItem(const std::string &xpath)
Delete basic value from YANG.
Definition: translator.cc:294
isc::yang::TranslatorBasic::setItem
void setItem(const std::string &xpath, isc::data::ConstElementPtr elem, sr_type_t type)
Translate and set basic value from JSON to YANG.
Definition: translator.cc:260
isc::yang::TranslatorBasic::getItems
isc::data::ElementPtr getItems(const std::string &xpath)
Get and translate a list of basic values from YANG to JSON.
Definition: translator.cc:124
isc::yang::TranslatorBasic::checkAndSetLeaf
void checkAndSetLeaf(isc::data::ConstElementPtr const &from, std::string const &xpath, std::string const &name, sr_type_t const type)
Get an element from given ElementPtr node and set it in sysrepo at given xpath.
Definition: translator.cc:283
isc::yang::TranslatorClass
Client class translation between YANG and JSON.
Definition: translator_class.h:77
isc::yang::TranslatorClasses
A translator class for converting a client class list between YANG and JSON.
Definition: translator_class.h:123
isc::yang::TranslatorClasses::getClasses
isc::data::ConstElementPtr getClasses(const std::string &xpath)
Get and translate client classes from YANG to JSON.
Definition: translator_class.cc:192
isc::yang::TranslatorClasses::setClasses
void setClasses(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set client classes from JSON to YANG.
Definition: translator_class.cc:214
isc::yang::TranslatorConfig::getConfigKea4
isc::data::ElementPtr getConfigKea4()
getConfig for kea-dhcp4-server.
Definition: translator_config.cc:82
isc::yang::TranslatorConfig::getExpiredKea
isc::data::ElementPtr getExpiredKea(const std::string &xpath)
Retrieves expired leases processing parameters from sysrepo.
Definition: translator_config.cc:117
isc::yang::TranslatorConfig::setServerKeaDhcpCommon
void setServerKeaDhcpCommon(const std::string &xpath, isc::data::ConstElementPtr elem)
setServer common part for kea-dhcp[46]-server:config.
Definition: translator_config.cc:494
isc::yang::TranslatorConfig::delConfigKea
void delConfigKea()
delConfig for kea-dhcp[46]-server.
Definition: translator_config.cc:473
isc::yang::TranslatorConfig::getServerKeaDhcp4
isc::data::ElementPtr getServerKeaDhcp4()
getServer for kea-dhcp4-server:config.
Definition: translator_config.cc:314
isc::yang::TranslatorConfig::setConfigKea6
void setConfigKea6(isc::data::ConstElementPtr elem)
setConfig for kea-dhcp6-server.
Definition: translator_config.cc:486
isc::yang::TranslatorConfig::getHooksKea
isc::data::ElementPtr getHooksKea(const std::string &xpath)
Retrieves hooks configuration from sysrepo.
Definition: translator_config.cc:112
isc::yang::TranslatorConfig::getServerKeaDhcpCommon
isc::data::ElementPtr getServerKeaDhcpCommon(const std::string &xpath)
getServer common part for kea-dhcp[46]-server:config.
Definition: translator_config.cc:185
isc::yang::TranslatorConfig::setConfigIetf6
void setConfigIetf6(isc::data::ConstElementPtr elem)
setConfig for ietf-dhcpv6-server.
Definition: translator_config.cc:459
isc::yang::TranslatorConfig::getDdnsKea
isc::data::ElementPtr getDdnsKea(const std::string &xpath)
Retrieves DDNS configuration from sysrepo.
Definition: translator_config.cc:135
isc::yang::TranslatorConfig::setConfigKea4
void setConfigKea4(isc::data::ConstElementPtr elem)
setConfig for kea-dhcp[46]-server.
Definition: translator_config.cc:478
isc::yang::TranslatorConfig::getConfigControlKea
isc::data::ElementPtr getConfigControlKea(const std::string &xpath)
Retrieves configuration control from sysrepo.
Definition: translator_config.cc:168
isc::yang::TranslatorConfig::setServerKeaDhcp6
void setServerKeaDhcp6(isc::data::ConstElementPtr elem)
setServer for kea-dhcp6-server:config.
Definition: translator_config.cc:709
isc::yang::TranslatorConfig::setConfig
void setConfig(isc::data::ConstElementPtr elem)
Translate and sets the DHCP server configuration from JSON to YANG.
Definition: translator_config.cc:419
isc::yang::TranslatorConfig::getConfigKea6
isc::data::ElementPtr getConfigKea6()
getConfig for kea-dhcp6-server.
Definition: translator_config.cc:90
isc::yang::TranslatorConfig::getConfigIetf6
isc::data::ElementPtr getConfigIetf6()
getConfig for ietf-dhcpv6-server.
Definition: translator_config.cc:67
isc::yang::TranslatorConfig::setServerKeaDhcp4
void setServerKeaDhcp4(isc::data::ConstElementPtr elem)
setServer for kea-dhcp4-server:config.
Definition: translator_config.cc:671
isc::yang::TranslatorConfig::TranslatorConfig
TranslatorConfig(sysrepo::S_Session session, const std::string &model)
Constructor.
Definition: translator_config.cc:21
isc::yang::TranslatorConfig::getServerKeaDhcp6
isc::data::ElementPtr getServerKeaDhcp6()
getServer for kea-dhcp6-server:config.
Definition: translator_config.cc:355
isc::yang::TranslatorConfig::getHook
isc::data::ElementPtr getHook(const std::string &xpath)
Definition: translator_config.cc:97
isc::yang::TranslatorConfig::delConfigIetf6
void delConfigIetf6()
delConfig for ietf-dhcpv6-server.
Definition: translator_config.cc:454
isc::yang::TranslatorConfig::~TranslatorConfig
virtual ~TranslatorConfig()
Destructor.
Definition: translator_config.cc:46
isc::yang::TranslatorConfig::getConfig
isc::data::ElementPtr getConfig()
Get and translate the whole DHCP server configuration from YANG to JSON.
Definition: translator_config.cc:50
isc::yang::TranslatorControlSocket
Control socket translation between YANG and JSON.
Definition: translator_control_socket.h:69
isc::yang::TranslatorControlSocket::setControlSocket
void setControlSocket(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set control socket from JSON to YANG.
Definition: translator_control_socket.cc:66
isc::yang::TranslatorControlSocket::getControlSocket
isc::data::ConstElementPtr getControlSocket(const std::string &xpath)
Get and translate a control socket from YANG to JSON.
Definition: translator_control_socket.cc:30
isc::yang::TranslatorDatabase
Database access translation between YANG and JSON.
Definition: translator_database.h:104
isc::yang::TranslatorDatabase::setDatabase
void setDatabase(const std::string &xpath, isc::data::ConstElementPtr elem, bool skip=false)
Translate and set database access from JSON to YANG.
Definition: translator_database.cc:77
isc::yang::TranslatorDatabase::getDatabase
isc::data::ElementPtr getDatabase(const std::string &xpath)
Get and translate a database access from YANG to JSON.
Definition: translator_database.cc:29
isc::yang::TranslatorDatabases
A translator class for converting a database access list between YANG and JSON.
Definition: translator_database.h:157
isc::yang::TranslatorDatabases::setDatabases
void setDatabases(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set database accesses from JSON to YANG.
Definition: translator_database.cc:167
isc::yang::TranslatorDatabases::getDatabases
isc::data::ConstElementPtr getDatabases(const std::string &xpath)
Get and translate database accesses from YANG to JSON.
Definition: translator_database.cc:145
isc::yang::TranslatorHost
Translation between YANG and JSON for a single host reservation.
Definition: translator_host.h:114
isc::yang::TranslatorHosts
A translator class for converting host reservations list between YANG and JSON.
Definition: translator_host.h:161
isc::yang::TranslatorHosts::getHosts
isc::data::ElementPtr getHosts(const std::string &xpath)
Get and translate host reservations from YANG to JSON.
Definition: translator_host.cc:193
isc::yang::TranslatorHosts::setHosts
void setHosts(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set (address) host reservations from JSON to YANG.
Definition: translator_host.cc:199
isc::yang::TranslatorLogger
Logger translation between YANG and JSON.
Definition: translator_logger.h:94
isc::yang::TranslatorLoggers
A translator class for converting a logger list between YANG and JSON.
Definition: translator_logger.h:168
isc::yang::TranslatorLoggers::setLoggers
void setLoggers(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set loggeres from JSON to YANG.
Definition: translator_logger.cc:228
isc::yang::TranslatorLoggers::getLoggers
isc::data::ConstElementPtr getLoggers(const std::string &xpath)
Get and translate loggeres from YANG to JSON.
Definition: translator_logger.cc:204
isc::yang::TranslatorOptionDataList
A translator class for converting an option data list between YANG and JSON.
Definition: translator_option_data.h:123
isc::yang::TranslatorOptionDataList::getOptionDataList
isc::data::ConstElementPtr getOptionDataList(const std::string &xpath)
Get and translate option data list from YANG to JSON.
Definition: translator_option_data.cc:136
isc::yang::TranslatorOptionDataList::setOptionDataList
void setOptionDataList(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set option data list from JSON to YANG.
Definition: translator_option_data.cc:158
isc::yang::TranslatorOptionData
Option data translation between YANG and JSON.
Definition: translator_option_data.h:76
isc::yang::TranslatorOptionDefList
Currently supports kea-dhcp[46]-server models.
Definition: translator_option_def.h:128
isc::yang::TranslatorOptionDefList::setOptionDefList
void setOptionDefList(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set option definition list from JSON to YANG.
Definition: translator_option_def.cc:167
isc::yang::TranslatorOptionDefList::getOptionDefList
isc::data::ConstElementPtr getOptionDefList(const std::string &xpath)
Get and translate option definition list from YANG to JSON.
Definition: translator_option_def.cc:145
isc::yang::TranslatorOptionDef
Option definition translation between YANG and JSON.
Definition: translator_option_def.h:79
isc::yang::TranslatorPdPool
Prefix delegation pool translation between YANG and JSON.
Definition: translator_pd_pool.h:117
isc::yang::TranslatorPdPools
A translator class for converting a pd-pool list between YANG and JSON.
Definition: translator_pd_pool.h:180
isc::yang::TranslatorPool
A translator class for converting a pool between YANG and JSON.
Definition: translator_pool.h:125
isc::yang::TranslatorPools
A translator class for converting pools between YANG and JSON.
Definition: translator_pool.h:195
isc::yang::TranslatorSharedNetwork
Shared network translation between YANG and JSON.
Definition: translator_shared_network.h:166
isc::yang::TranslatorSharedNetworks
A translator class for converting a shared network list between YANG and JSON.
Definition: translator_shared_network.h:220
isc::yang::TranslatorSharedNetworks::getSharedNetworks
isc::data::ElementPtr getSharedNetworks(const std::string &xpath)
Get and translate shared networks from YANG to JSON.
Definition: translator_shared_network.cc:381
isc::yang::TranslatorSharedNetworks::setSharedNetworks
void setSharedNetworks(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set shared networks from JSON to YANG.
Definition: translator_shared_network.cc:387
isc::yang::TranslatorSubnet
Subnet (aka network range) translation between YANG and JSON.
Definition: translator_subnet.h:274
isc::yang::TranslatorSubnets
A translator class for converting a subnet list between YANG and JSON.
Definition: translator_subnet.h:333
isc::yang::TranslatorSubnets::setSubnets
void setSubnets(const std::string &xpath, isc::data::ConstElementPtr elem)
Translate and set subnets from JSON to YANG.
Definition: translator_subnet.cc:525
isc::yang::TranslatorSubnets::getSubnets
isc::data::ElementPtr getSubnets(const std::string &xpath)
Get and translate subnets from YANG to JSON.
Definition: translator_subnet.cc:499
isc_throw
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Definition: exceptions/exceptions.h:210
isc::data
Definition: base_stamped_element.cc:12
isc::data::copy
ElementPtr copy(ConstElementPtr from, int level)
Copy the data up to a nesting level.
Definition: data.cc:1360
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
isc::data::ElementPtr
boost::shared_ptr< Element > ElementPtr
Definition: data.h:24
isc
Defines the logger used by the top-level component of kea-lfc.
Definition: agent_parser.cc:143
translator_config.h
yang_models.h