summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2018-11-21 00:04:47 +0100
committerFrancis Dupont <fdupont@isc.org>2018-11-21 00:04:47 +0100
commitfce39cfb406b93ce12f07e45e07b59abad2e671b (patch)
tree57a4356c7a56a139f59fca9555725427ab89d3b2
parent196a77b3d3e5ceaa8cc2ac4428afc525e66d2ddf (diff)
parent14302cff4f5239536c77cfdeb10282afbd9740a4 (diff)
[204-move-models-] Merge model changes204-move-models-base
-rw-r--r--doc/examples/kea4/all-keys.json27
-rw-r--r--doc/examples/kea6/all-keys.json27
-rw-r--r--src/bin/netconf/netconf.cc4
-rw-r--r--src/bin/netconf/tests/netconf_unittests.cc194
-rw-r--r--src/lib/yang/adaptor_config.cc50
-rw-r--r--src/lib/yang/adaptor_config.h20
-rw-r--r--src/lib/yang/models/kea-ctrl-agent.yang14
-rw-r--r--src/lib/yang/models/kea-dhcp-ddns.yang18
-rw-r--r--src/lib/yang/models/kea-dhcp-types.yang92
-rw-r--r--src/lib/yang/models/kea-dhcp4-server.yang273
-rw-r--r--src/lib/yang/models/kea-dhcp6-server.yang327
-rw-r--r--src/lib/yang/models/kea-logging.yang146
-rw-r--r--src/lib/yang/models/kea-types.yang27
-rw-r--r--src/lib/yang/tests/translator_class_unittests.cc22
-rw-r--r--src/lib/yang/tests/translator_database_unittests.cc19
-rw-r--r--src/lib/yang/tests/translator_host_unittests.cc68
-rw-r--r--src/lib/yang/tests/translator_logger_unittests.cc36
-rw-r--r--src/lib/yang/tests/translator_option_data_unittests.cc30
-rw-r--r--src/lib/yang/tests/translator_option_def_unittests.cc30
-rw-r--r--src/lib/yang/tests/translator_pd_pool_unittests.cc64
-rw-r--r--src/lib/yang/tests/translator_pool_unittests.cc50
-rw-r--r--src/lib/yang/tests/translator_shared_network_unittests.cc36
-rw-r--r--src/lib/yang/tests/translator_subnet_unittests.cc57
-rw-r--r--src/lib/yang/tests/yang_configs.h75
-rw-r--r--src/lib/yang/translator_class.cc10
-rw-r--r--src/lib/yang/translator_class.h17
-rw-r--r--src/lib/yang/translator_config.cc146
-rw-r--r--src/lib/yang/translator_config.h161
-rw-r--r--src/lib/yang/translator_database.cc5
-rw-r--r--src/lib/yang/translator_database.h25
-rw-r--r--src/lib/yang/translator_host.cc6
-rw-r--r--src/lib/yang/translator_host.h21
-rw-r--r--src/lib/yang/translator_logger.cc10
-rw-r--r--src/lib/yang/translator_logger.h23
-rw-r--r--src/lib/yang/translator_option_data.cc2
-rw-r--r--src/lib/yang/translator_option_data.h13
-rw-r--r--src/lib/yang/translator_option_def.cc2
-rw-r--r--src/lib/yang/translator_option_def.h13
-rw-r--r--src/lib/yang/translator_pd_pool.cc40
-rw-r--r--src/lib/yang/translator_pd_pool.h26
-rw-r--r--src/lib/yang/translator_pool.cc60
-rw-r--r--src/lib/yang/translator_pool.h30
-rw-r--r--src/lib/yang/translator_shared_network.cc18
-rw-r--r--src/lib/yang/translator_shared_network.h29
-rw-r--r--src/lib/yang/translator_subnet.cc64
-rw-r--r--src/lib/yang/translator_subnet.h51
46 files changed, 1190 insertions, 1288 deletions
diff --git a/doc/examples/kea4/all-keys.json b/doc/examples/kea4/all-keys.json
index 713aa1f6ff..c566cdc3f5 100644
--- a/doc/examples/kea4/all-keys.json
+++ b/doc/examples/kea4/all-keys.json
@@ -659,7 +659,32 @@
"subnet4": [],
// Global valid lifetime value.
- "valid-lifetime": 6000
+ "valid-lifetime": 6000,
+
+ // Configuration control.
+ "config-control":
+ {
+ // Only configuration databases entry is defined.
+ "config-databases": [
+ {
+ // Name of the database to connect to.
+ "name": "config",
+
+ // Type of the database, e.g. "mysql", "pgsql", "cql".
+ "type": "mysql"
+ }
+ ]
+ },
+
+ // Server tag.
+ "server-tag": "my DHCPv4 server",
+
+ // DHCP queue control parameters.
+ "dhcp-queue-control":
+ {
+ // Queue type is mandatory.
+ "queue-type": "kea-ring4"
+ }
},
// Logging configuration begins here.
diff --git a/doc/examples/kea6/all-keys.json b/doc/examples/kea6/all-keys.json
index 52d6d953c0..2274d579f0 100644
--- a/doc/examples/kea6/all-keys.json
+++ b/doc/examples/kea6/all-keys.json
@@ -615,7 +615,32 @@
"subnet6": [],
// Global valid lifetime value.
- "valid-lifetime": 6000
+ "valid-lifetime": 6000,
+
+ // Configuration control.
+ "config-control":
+ {
+ // Only configuration databases entry is defined.
+ "config-databases": [
+ {
+ // Name of the database to connect to.
+ "name": "config",
+
+ // Type of the database, e.g. "mysql", "pgsql", "cql".
+ "type": "mysql"
+ }
+ ]
+ },
+
+ // Server tag.
+ "server-tag": "my DHCPv6 server",
+
+ // DHCP queue control parameters.
+ "dhcp-queue-control":
+ {
+ // Queue type is mandatory.
+ "queue-type": "kea-ring6"
+ }
},
// Logging configuration begins here.
diff --git a/src/bin/netconf/netconf.cc b/src/bin/netconf/netconf.cc
index 4f60d208f6..abdcbc0802 100644
--- a/src/bin/netconf/netconf.cc
+++ b/src/bin/netconf/netconf.cc
@@ -83,10 +83,6 @@ public:
if (NetconfProcess::shut_down) {
return (SR_ERR_DISCONNECT);
}
- NetconfAgent::logChanges(sess, xpath + "logging");
- if (NetconfProcess::shut_down) {
- return (SR_ERR_DISCONNECT);
- }
switch (event) {
case SR_EV_VERIFY:
return (NetconfAgent::validate(sess, service_pair_));
diff --git a/src/bin/netconf/tests/netconf_unittests.cc b/src/bin/netconf/tests/netconf_unittests.cc
index 0e647c8d19..e70b9430e7 100644
--- a/src/bin/netconf/tests/netconf_unittests.cc
+++ b/src/bin/netconf/tests/netconf_unittests.cc
@@ -78,8 +78,6 @@ void clearYang(NakedNetconfAgentPtr agent) {
if (agent && (agent->startup_sess_)) {
string xpath = "/kea-dhcp4-server:config";
EXPECT_NO_THROW(agent->startup_sess_->delete_item(xpath.c_str()));
- xpath = "/kea-dhcp4-server:logging";
- EXPECT_NO_THROW(agent->startup_sess_->delete_item(xpath.c_str()));
EXPECT_NO_THROW(agent->startup_sess_->commit());
}
}
@@ -373,7 +371,6 @@ public:
sr_notif_event_t /*event*/,
void* /*private_ctx*/) {
NetconfAgent::logChanges(sess, "/kea-dhcp4-server:config");
- NetconfAgent::logChanges(sess, "/kea-dhcp4-server:logging");
finished = true;
return (SR_ERR_OK);
}
@@ -389,18 +386,15 @@ TEST_F(NetconfAgentLogTest, logChanges) {
// Initial YANG configuration.
const YRTree tree0 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.0.0/24", SR_STRING_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
// Load initial YANG configuration.
@@ -421,18 +415,15 @@ TEST_F(NetconfAgentLogTest, logChanges) {
// Change configuration (subnet #1 moved from 10.0.0.0/24 to 10.0.1/0/24).
const YRTree tree1 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.1.0/24", SR_STRING_T, true }, // The change is here!
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
EXPECT_NO_THROW(repr.set(tree1, agent_->running_sess_));
@@ -441,9 +432,9 @@ TEST_F(NetconfAgentLogTest, logChanges) {
// Check that the debug output was correct.
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"modified: "
- "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet = "
+ "/kea-dhcp4-server:config/subnet4[id='1']/subnet = "
"10.0.0.0/24 => "
- "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet = "
+ "/kea-dhcp4-server:config/subnet4[id='1']/subnet = "
"10.0.1.0/24");
// logChanges is called in another thread so we can have to wait for it.
@@ -462,18 +453,15 @@ TEST_F(NetconfAgentLogTest, logChanges2) {
// Initial YANG configuration.
const YRTree tree0 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.0.0/24", SR_STRING_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
// Load initial YANG configuration.
@@ -492,22 +480,19 @@ TEST_F(NetconfAgentLogTest, logChanges2) {
thread_.reset(new Thread([this]() { io_service_->run(); }));
// Change configuration (subnet #1 moved to #10).
- string xpath = "/kea-dhcp4-server:config/subnet4/subnet4[id='1']";
+ string xpath = "/kea-dhcp4-server:config/subnet4[id='1']";
EXPECT_NO_THROW(agent_->running_sess_->delete_item(xpath.c_str()));
const YRTree tree1 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='10']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='10']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='10']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='10']/id",
"10", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='10']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='10']/subnet",
"10.0.0.0/24", SR_STRING_T, true }, // The change is here!
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
EXPECT_NO_THROW(repr.set(tree1, agent_->running_sess_));
@@ -516,46 +501,30 @@ TEST_F(NetconfAgentLogTest, logChanges2) {
// Check that the debug output was correct.
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"deleted: "
- "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id = 1");
+ "/kea-dhcp4-server:config/subnet4[id='1']/id = 1");
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"deleted: "
- "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet = "
+ "/kea-dhcp4-server:config/subnet4[id='1']/subnet = "
"10.0.0.0/24");
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"deleted: "
- "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/"
- "reservation-mode = all [default]");
- addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
- "deleted: "
- "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/"
- "match-client-id = true [default]");
- addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
- "deleted: "
- "/kea-dhcp4-server:config/subnet4/subnet4[id='1'] "
+ "/kea-dhcp4-server:config/subnet4[id='1'] "
"(list instance)");
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"created: "
- "/kea-dhcp4-server:config/subnet4/subnet4[id='10'] "
+ "/kea-dhcp4-server:config/subnet4[id='10'] "
"(list instance)");
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"created: "
- "/kea-dhcp4-server:config/subnet4/subnet4[id='10']/id = 10");
+ "/kea-dhcp4-server:config/subnet4[id='10']/id = 10");
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"created: "
- "/kea-dhcp4-server:config/subnet4/subnet4[id='10']/subnet = "
+ "/kea-dhcp4-server:config/subnet4[id='10']/subnet = "
"10.0.0.0/24");
addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
- "created: "
- "/kea-dhcp4-server:config/subnet4/subnet4[id='10']/"
- "reservation-mode = all [default]");
- addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
- "created: "
- "/kea-dhcp4-server:config/subnet4/subnet4[id='10']/"
- "match-client-id = true [default]");
- addString("NETCONF_CONFIG_CHANGED_DETAIL YANG configuration changed: "
"moved: "
- "/kea-dhcp4-server:config/subnet4/subnet4[id='10'] "
- "after /kea-dhcp4-server:config/subnet4/subnet4[id='2']");
+ "/kea-dhcp4-server:config/subnet4[id='10'] "
+ "after /kea-dhcp4-server:config/subnet4[id='2']");
// logChanges is called in another thread so we can have to wait for it.
while (!TestCallback::finished) {
@@ -654,18 +623,15 @@ TEST_F(NetconfAgentTest, yangConfig) {
// YANG configuration.
const YRTree tree = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.0.0/24", SR_STRING_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
// Load YANG configuration.
@@ -818,18 +784,15 @@ TEST_F(NetconfAgentTest, update) {
// Initial YANG configuration.
const YRTree tree0 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.0.0/24", SR_STRING_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
// Load initial YANG configuration.
@@ -891,18 +854,15 @@ TEST_F(NetconfAgentTest, update) {
// Change configuration (subnet #1 moved from 10.0.0.0/24 to 10.0.1/0/24).
const YRTree tree1 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.1.0/24", SR_STRING_T, true }, // The change is here!
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
EXPECT_NO_THROW(repr.set(tree1, agent_->running_sess_));
@@ -958,18 +918,15 @@ TEST_F(NetconfAgentTest, validate) {
// Initial YANG configuration.
const YRTree tree0 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.0.0/24", SR_STRING_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
// Load initial YANG configuration.
@@ -1034,18 +991,15 @@ TEST_F(NetconfAgentTest, validate) {
// Change configuration (subnet #1 moved from 10.0.0.0/24 to 10.0.1/0/24).
const YRTree tree1 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.1.0/24", SR_STRING_T, true }, // The change is here!
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='2']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='2']/id",
"2", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='2']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='2']/subnet",
"10.0.2.0/24", SR_STRING_T, true }
};
EXPECT_NO_THROW(repr.set(tree1, agent_->running_sess_));
@@ -1132,12 +1086,10 @@ TEST_F(NetconfAgentTest, noValidate) {
// Initial YANG configuration.
const YRTree tree0 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.0.0/24", SR_STRING_T, true }
};
// Load initial YANG configuration.
@@ -1191,14 +1143,12 @@ TEST_F(NetconfAgentTest, noValidate) {
// Change configuration (add invalid user context).
const YRTree tree1 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']", "",
- SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='1']", "", SR_LIST_T, true },
+ { "/kea-dhcp4-server:config/subnet4[id='1']/id",
"1", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='1']/subnet",
"10.0.0.0/24", SR_STRING_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='1']/user-context",
+ { "/kea-dhcp4-server:config/subnet4[id='1']/user-context",
"BOGUS", SR_STRING_T, true }
};
EXPECT_NO_THROW(repr.set(tree1, agent_->running_sess_));
diff --git a/src/lib/yang/adaptor_config.cc b/src/lib/yang/adaptor_config.cc
index cca5b7c8be..adca8e27b0 100644
--- a/src/lib/yang/adaptor_config.cc
+++ b/src/lib/yang/adaptor_config.cc
@@ -523,52 +523,6 @@ AdaptorConfig::sanitizeRelaySuppliedOptions(ConstElementPtr dhcp) {
}
void
-AdaptorConfig::removeAuthoritativeSubnets(ConstElementPtr subnets) {
- if (!subnets || subnets->empty()) {
- // nothing to do here.
- return;
- }
-
- for (size_t i = 0; i < subnets->size(); ++i) {
- ElementPtr subnet = subnets->getNonConst(i);
- ConstElementPtr auth = subnet->get("authoritative");
- if (auth) {
- subnet->remove("authoritative");
- }
- }
-}
-
-void
-AdaptorConfig::removeAuthoritativeSharedNetworks(ConstElementPtr networks) {
- if (!networks || networks->empty()) {
- // nothing to do here.
- return;
- }
-
- for (size_t i = 0; i < networks->size(); ++i) {
- ElementPtr network = networks->getNonConst(i);
- ConstElementPtr auth = network->get("authoritative");
- if (auth) {
- network->remove("authoritative");
- }
- removeAuthoritativeSubnets(network->get("subnet4"));
- }
-}
-
-void
-AdaptorConfig::removeAuthoritative(ConstElementPtr dhcp) {
- removeAuthoritativeSubnets(dhcp->get("subnet4"));
- removeAuthoritativeSharedNetworks(dhcp->get("shared-networks"));
- ConstElementPtr auth = dhcp->get("authoritative");
- if (!auth) {
- // Done.
- return;
- }
- ElementPtr mutable_dhcp = boost::const_pointer_cast<Element>(dhcp);
- mutable_dhcp->remove("authoritative");
-}
-
-void
AdaptorConfig::preProcess(ElementPtr dhcp, const string& subsel,
const string& space) {
if (!dhcp) {
@@ -654,9 +608,7 @@ AdaptorConfig::preProcess(ElementPtr dhcp, const string& subsel,
sanitizeDatabase(dhcp);
- if (space == DHCP4_SPACE) {
- removeAuthoritative(dhcp);
- } else if (space == DHCP6_SPACE) {
+ if (space == DHCP6_SPACE) {
sanitizeRelaySuppliedOptions(dhcp);
}
}
diff --git a/src/lib/yang/adaptor_config.h b/src/lib/yang/adaptor_config.h
index 85f5cff635..22c23f15ad 100644
--- a/src/lib/yang/adaptor_config.h
+++ b/src/lib/yang/adaptor_config.h
@@ -275,26 +275,6 @@ protected:
/// @param dhcp The DHCPv6 server.
static void sanitizeRelaySuppliedOptions(isc::data::ConstElementPtr dhcp);
- /// @brief Remove authoritative flag from a subnet list.
- ///
- /// @param subnets The subnet list.
- static void removeAuthoritativeSubnets(isc::data::ConstElementPtr subnets);
-
- /// @brief Remove authoritative flag from a shared network list.
- ///
- /// Remove authoritative flag in each shared network and its
- /// subnet4 children.
- ///
- /// @param networks The shared network list.
- static void removeAuthoritativeSharedNetworks(isc::data::ConstElementPtr networks);
-
- /// @brief Remove authoritative flags.
- ///
- /// Remove global, shared network and subnet4 authoritative flags.
- ///
- /// @param dhcp The DHCPv4 server.
- static void removeAuthoritative(isc::data::ConstElementPtr dhcp);
-
/// @brief Pre process a configuration.
///
/// Assign subnet IDs, check and set default in options, etc.
diff --git a/src/lib/yang/models/kea-ctrl-agent.yang b/src/lib/yang/models/kea-ctrl-agent.yang
index 9d94224925..a51e6bb75c 100644
--- a/src/lib/yang/models/kea-ctrl-agent.yang
+++ b/src/lib/yang/models/kea-ctrl-agent.yang
@@ -8,9 +8,11 @@ module kea-ctrl-agent {
}
import kea-types {
prefix kea;
+ revision-date 2018-11-20;
}
import kea-logging {
prefix logging;
+ revision-date 2018-11-20;
}
organization "Internet Systems Consortium";
@@ -18,7 +20,7 @@ module kea-ctrl-agent {
description "This model defines a YANG data model that can be
used to configure and manage a Kea control agent.";
- revision 2018-09-14 {
+ revision 2018-11-20 {
description "Initial revision";
reference "";
}
@@ -33,13 +35,11 @@ module kea-ctrl-agent {
leaf http-host {
type inet:ip-address;
- default "127.0.0.1";
description "IP address to which HTTP service will be bound.";
}
leaf http-port {
type uint16;
- default 8000;
description "Port to which HTTP service will be bound.";
}
@@ -76,12 +76,8 @@ module kea-ctrl-agent {
type kea:user-context;
description "Control agent user context.";
}
- }
-
- container logging {
- // config true;
- description "Logging";
- uses logging:configuration;
+ // Moved from logging
+ uses logging:loggers;
}
}
diff --git a/src/lib/yang/models/kea-dhcp-ddns.yang b/src/lib/yang/models/kea-dhcp-ddns.yang
index 56f4e54734..3e92fc5b7f 100644
--- a/src/lib/yang/models/kea-dhcp-ddns.yang
+++ b/src/lib/yang/models/kea-dhcp-ddns.yang
@@ -8,9 +8,11 @@ module kea-dhcp-ddns {
}
import kea-types {
prefix kea;
+ revision-date 2018-11-20;
}
import kea-logging {
prefix logging;
+ revision-date 2018-11-20;
}
organization "Internet Systems Consortium";
@@ -18,7 +20,7 @@ module kea-dhcp-ddns {
description "This model defines a YANG data model that can be
used to configure and manage a Kea DHCP-DDNS server.";
- revision 2018-09-14 {
+ revision 2018-11-20 {
description "Initial revision";
reference "";
}
@@ -61,7 +63,6 @@ module kea-dhcp-ddns {
}
leaf port {
type uint16;
- default 53;
description "DNS server port.";
}
leaf user-context {
@@ -88,13 +89,11 @@ module kea-dhcp-ddns {
leaf ip-address {
type inet:ip-address;
- default "127.0.0.1";
description "IP address on which the server listens for requests.";
}
leaf port {
type uint16;
- default 53001;
description "Port on which the server listens for requests.";
}
@@ -114,7 +113,6 @@ module kea-dhcp-ddns {
description "TCP transport";
}
}
- default "UDP";
description "Protocol to use when sending requests to the server.";
}
@@ -124,7 +122,6 @@ module kea-dhcp-ddns {
description "JSON format";
}
}
- default "JSON";
description "Packet format to use when sending requests to the server.";
}
@@ -156,7 +153,6 @@ module kea-dhcp-ddns {
leaf digest-bits {
type uint16;
units "bits";
- default 0;
description "Minimum truncated length. 0 means no truncation.";
}
leaf secret {
@@ -174,12 +170,8 @@ module kea-dhcp-ddns {
type kea:user-context;
description "DHCP-DDNS server user context.";
}
- }
-
- container logging {
- // config true;
- description "Logging";
- uses logging:configuration;
+ // Moved from logging
+ uses logging:loggers;
}
}
diff --git a/src/lib/yang/models/kea-dhcp-types.yang b/src/lib/yang/models/kea-dhcp-types.yang
index 6f6ec5ef91..2bfc96f8e8 100644
--- a/src/lib/yang/models/kea-dhcp-types.yang
+++ b/src/lib/yang/models/kea-dhcp-types.yang
@@ -8,13 +8,14 @@ module kea-dhcp-types {
}
import kea-types {
prefix kea;
+ revision-date 2018-11-20;
}
organization "Internet Systems Consortium";
contact "kea-dev@lists.isc.org";
description "This file defines some commonly used Kea DHCP types and
groupings.";
- revision 2018-09-14 {
+ revision 2018-11-20 {
description "Initial revision";
reference "";
}
@@ -37,7 +38,6 @@ module kea-dhcp-types {
description "Allows only global host reservations.";
}
}
- default "all";
description "Host reservation mode.";
}
@@ -53,7 +53,6 @@ module kea-dhcp-types {
description "Expired-reclaimed";
}
}
- default "default";
description "Defines state of the lease.";
}
@@ -112,7 +111,6 @@ module kea-dhcp-types {
}
leaf persist {
type boolean;
- default true;
description "Write lease to disk file. This parameter applies only to
memfile backend.";
}
@@ -123,12 +121,10 @@ module kea-dhcp-types {
leaf lfc-interval {
type uint32;
units "seconds";
- default 3600;
description "Interval between two lease file cleanups.";
}
leaf readonly {
type boolean;
- default false;
description "If set to true, the database will be connected in
read-only mode. This does not make sense for lease
databases, only for host reservations and possibly
@@ -151,13 +147,11 @@ module kea-dhcp-types {
}
leaf max-reconnect-tries {
type uint32;
- default 0;
description "Maximum of recovery attempts before exit.";
}
leaf reconnect-wait-time {
type uint32;
units "milliseconds";
- default 0;
description "Waiting delay between two recovery attempts.";
}
leaf request-timeout {
@@ -168,12 +162,10 @@ module kea-dhcp-types {
leaf tcp-keepalive {
type uint32;
units "seconds";
- default 0;
description "TCP keepalive for the database connection.";
}
leaf tcp-nodelay {
type boolean;
- default true;
description "TCP nodelay for the database connection.";
}
uses kea:user-context {
@@ -191,13 +183,10 @@ module kea-dhcp-types {
description "Lease database.";
uses database;
}
- container hosts-databases {
- description "Hosts databases.";
- list hosts-database {
- key database-type;
- description "List of databases.";
- uses database;
- }
+ list hosts-database {
+ key database-type;
+ description "List of databases.";
+ uses database;
}
}
@@ -208,35 +197,29 @@ module kea-dhcp-types {
leaf reclaim-timer-wait-time {
type uint32;
units "seconds";
- default 10;
description "Interval between reclamation cycles.";
}
leaf flush-reclaimed-timer-wait-time {
type uint32;
units "seconds";
- default 25;
description "Interval between reclaimed leases collection.";
}
leaf hold-reclaimed-time {
type uint32;
units "seconds";
- default 3600;
description "Hold timer for re-assignment.";
}
leaf max-reclaim-leases {
type uint32;
- default 100;
description "Maximum number of reclaimed leases per cycle.";
}
leaf max-reclaim-time {
type uint32;
units "milliseconds";
- default 250;
description "Maximum duration of a reclamation cycle.";
}
leaf unwarned-reclaim-cycles {
type uint32;
- default 5;
description "Maximum numbers of uncomplete cycles before warning.";
}
}
@@ -257,7 +240,6 @@ module kea-dhcp-types {
description "DHCP-DDNS client setup.";
leaf enable-updates {
type boolean;
- default false;
description "Enable DHCP-DDNS updates.";
}
leaf qualifying-suffix {
@@ -266,12 +248,10 @@ module kea-dhcp-types {
}
leaf server-ip {
type inet:ip-address;
- default "127.0.0.1";
description "DHCP-DDNS server IP address.";
}
leaf server-port {
type uint16;
- default 53001;
description "DHCP-DDNS server port.";
}
leaf sender-ip {
@@ -284,7 +264,6 @@ module kea-dhcp-types {
}
leaf max-queue-size {
type uint32;
- default 1024;
description "Maximum DHCP-DDNS queue size.";
}
leaf ncr-protocol {
@@ -296,7 +275,6 @@ module kea-dhcp-types {
description "TCP transport";
}
}
- default "UDP";
description "Protocol to use for DHCP-DDNS communication.
Currently only UDP is supported.";
}
@@ -306,17 +284,14 @@ module kea-dhcp-types {
description "JSON format";
}
}
- default "JSON";
description "Packet format to use for DHCP-DDNS.";
}
leaf override-no-update {
type boolean;
- default false;
description "Ignore client request and send update.";
}
leaf override-client-update {
type boolean;
- default false;
description "Ignore client delegation.";
}
leaf replace-client-name {
@@ -334,12 +309,10 @@ module kea-dhcp-types {
description "When the client did not send a name.";
}
}
- default "never";
description "Replace the name provided by the client.";
}
leaf generated-prefix {
type string;
- default "myhost";
description "DHCP-DDNS generated prefix.";
}
leaf hostname-char-set {
@@ -386,7 +359,6 @@ module kea-dhcp-types {
description "When a check fails reject the lease.";
}
}
- default "warn";
description "Lease checks: verify subnet-id consistency on memfile
loading.";
}
@@ -550,29 +522,10 @@ module kea-dhcp-types {
}
}
- grouping subnet-reservation-mode {
- description "Reservation mode grouping for a subnet.";
- uses reservation-mode {
- refine reservation-mode {
- description "Subnet host reservation mode.";
- }
- }
- }
-
- grouping network-reservation-mode {
- description "Reservation mode grouping for a shared network.";
- uses reservation-mode {
- refine reservation-mode {
- description "Shared network host reservation mode.";
- }
- }
- }
-
grouping interfaces-re-detect {
description "Interfaces re-detect grouping.";
leaf re-detect {
type boolean;
- default false;
description "Re-detect interfaces at each reconfiguration.";
}
}
@@ -599,7 +552,6 @@ module kea-dhcp-types {
description "Client class only-if-required grouping.";
leaf only-if-required {
type boolean;
- default false;
description "Client class only if required flag.";
}
}
@@ -660,7 +612,6 @@ module kea-dhcp-types {
description "Option data csv-format grouping.";
leaf csv-format {
type boolean;
- default true;
description "If true, the option is specified as comma separated
values. If false, it is expected as a hex string.";
}
@@ -670,7 +621,6 @@ module kea-dhcp-types {
description "Option data always-send grouping.";
leaf always-send {
type boolean;
- default false;
description "Defines whether to always send the option,
regardless if the client requested it or not.";
}
@@ -680,7 +630,6 @@ module kea-dhcp-types {
description "Option data array grouping.";
leaf array {
type boolean;
- default false;
description "Option definition array flag.";
}
}
@@ -690,7 +639,6 @@ module kea-dhcp-types {
leaf decline-probation-period {
type uint32;
units "seconds";
- default 86400;
description "Decline probabation period.";
}
}
@@ -792,4 +740,32 @@ module kea-dhcp-types {
}
}
+ grouping config-control {
+ description "Config control grouping.";
+ container config-control {
+ description "Config control.";
+ list config-database {
+ key database-type;
+ description "List of databases.";
+ uses database;
+ }
+ }
+ }
+
+ grouping server-tag {
+ description "Server tag grouping.";
+ leaf server-tag {
+ type string;
+ description "Server tag.";
+ }
+ }
+
+ grouping dhcp-queue-control {
+ description "DHCP queue control grouping.";
+ leaf dhcp-queue-control {
+ type string;
+ description "DHCP queue control (JSON map).";
+ }
+ }
+
}
diff --git a/src/lib/yang/models/kea-dhcp4-server.yang b/src/lib/yang/models/kea-dhcp4-server.yang
index e997dfbede..fae5328750 100644
--- a/src/lib/yang/models/kea-dhcp4-server.yang
+++ b/src/lib/yang/models/kea-dhcp4-server.yang
@@ -8,12 +8,15 @@ module kea-dhcp4-server {
}
import kea-types {
prefix kea;
+ revision-date 2018-11-20;
}
import kea-dhcp-types {
prefix dhcp;
+ revision-date 2018-11-20;
}
import kea-logging {
prefix logging;
+ revision-date 2018-11-20;
}
organization "Internet Systems Consortium";
@@ -21,7 +24,7 @@ module kea-dhcp4-server {
description "This model defines a YANG data model that can be
used to configure and manage a Kea DHCPv4 server.";
- revision 2018-09-14 {
+ revision 2018-11-20 {
description "Initial revision";
reference "";
}
@@ -57,7 +60,6 @@ module kea-dhcp4-server {
description "Match client ID grouping.";
leaf match-client-id {
type boolean;
- default true;
description "Use client-id for lease lookups. If set to false, client-id
will be ignored.";
}
@@ -88,6 +90,15 @@ module kea-dhcp4-server {
}
}
+ grouping authoritative {
+ description "Authoritative grouping.";
+ leaf authoritative {
+ type boolean;
+ description "NAK requests for unknown clients. If set to false
+ ignore them.";
+ }
+ }
+
grouping relay {
description "Relay grouping.";
leaf-list ip-addresses {
@@ -119,13 +130,10 @@ module kea-dhcp4-server {
grouping reservations {
description "Host reservations grouping.";
- container reservations {
- description "Host reservations container.";
- list host {
- key "identifier-type identifier";
- description "Host reservation entry.";
- uses host;
- }
+ list host {
+ key "identifier-type identifier";
+ description "Host reservation list.";
+ uses host;
}
}
@@ -139,32 +147,29 @@ module kea-dhcp4-server {
uses dhcp:renew-timer;
uses dhcp:rebind-timer;
uses option-data-list;
- container pools {
- description "List of pools.";
- list pool {
- key "start-address end-address";
- ordered-by user;
- description "Pool entry.";
- leaf prefix {
- type inet:ipv4-prefix;
- description "Defines a pool of dynamic IPv4 addresses to be managed
- by the server.";
- }
- leaf start-address {
- type inet:ipv4-address;
- mandatory true;
- description "First IPv4 address in a pool.";
- }
- leaf end-address {
- type inet:ipv4-address;
- mandatory true;
- description "Last IPv4 address in a pool.";
- }
- uses option-data-list;
- uses dhcp:pool-client-class;
- uses dhcp:pool-require-client-classes;
- uses dhcp:pool-user-context;
+ list pool {
+ key "start-address end-address";
+ ordered-by user;
+ description "Pool list.";
+ leaf prefix {
+ type inet:ipv4-prefix;
+ description "Defines a pool of dynamic IPv4 addresses to be managed
+ by the server.";
+ }
+ leaf start-address {
+ type inet:ipv4-address;
+ mandatory true;
+ description "First IPv4 address in a pool.";
+ }
+ leaf end-address {
+ type inet:ipv4-address;
+ mandatory true;
+ description "Last IPv4 address in a pool.";
}
+ uses option-data-list;
+ uses dhcp:pool-client-class;
+ uses dhcp:pool-require-client-classes;
+ uses dhcp:pool-user-context;
}
leaf subnet {
type inet:ipv4-prefix;
@@ -176,11 +181,11 @@ module kea-dhcp4-server {
uses dhcp:subnet-client-class;
uses dhcp:subnet-require-client-classes;
uses reservations {
- refine reservations {
- description "Subnet host reservations.";
+ refine host {
+ description "Subnet host reservations list.";
}
}
- uses dhcp:subnet-reservation-mode;
+ uses dhcp:reservation-mode;
container relay {
description "Optional information about relay agent.";
uses relay;
@@ -201,73 +206,73 @@ module kea-dhcp4-server {
type inet:ipv6-prefix;
description "Subnet DHCPv4-over-DHCPv6 IPv6 prefix.";
}
+ uses authoritative;
uses dhcp:subnet-user-context;
}
}
- grouping client-class {
+ grouping client-classes {
description "Client class grouping.";
- uses dhcp:class-name;
- uses dhcp:class-test;
- uses dhcp:class-only-if-required;
- uses option-def-list;
- uses option-data-list;
- uses next-server;
- uses server-hostname;
- uses boot-file-name;
- uses dhcp:class-user-context;
+ list client-class {
+ key name;
+ ordered-by user;
+ description "List of client classes.";
+ uses dhcp:class-name;
+ uses dhcp:class-test;
+ uses dhcp:class-only-if-required;
+ uses option-def-list;
+ uses option-data-list;
+ uses next-server;
+ uses server-hostname;
+ uses boot-file-name;
+ uses dhcp:class-user-context;
+ }
}
grouping option-def-list {
description "Option definition list grouping.";
- container option-def-list {
- description "List with custom option definitions.";
- list option-def {
- key "code space";
- description "Option definition entry.";
- leaf code {
- type uint8;
- mandatory true;
- description "Option code to be used by the new option definition.";
- }
- leaf space {
- type string;
- mandatory true;
- description "Option space for the new option (typically dhcp4).";
- }
- uses dhcp:option-def-name;
- uses dhcp:option-def-type;
- uses dhcp:option-def-record-types;
- uses dhcp:option-def-encapsulate;
- uses dhcp:option-def-array;
- uses dhcp:option-def-user-context;
+ list option-def {
+ key "code space";
+ description "Option definition entry.";
+ leaf code {
+ type uint8;
+ mandatory true;
+ description "Option code to be used by the new option definition.";
}
- }
+ leaf space {
+ type string;
+ mandatory true;
+ description "Option space for the new option (typically dhcp4).";
+ }
+ uses dhcp:option-def-name;
+ uses dhcp:option-def-type;
+ uses dhcp:option-def-record-types;
+ uses dhcp:option-def-encapsulate;
+ uses dhcp:option-def-array;
+ uses dhcp:option-def-user-context;
+ }
}
grouping option-data-list {
description "Option data list grouping.";
- container option-data-list {
- description "Option data list.";
- list option-data {
- key "code space";
- description "Option data entry.";
- leaf code {
- type uint8;
- mandatory true;
- description "Option code.";
- }
- leaf space {
- type string;
- mandatory true;
- description "Option space.";
- }
- uses dhcp:option-data-name;
- uses dhcp:option-data-data;
- uses dhcp:option-data-csv-format;
- uses dhcp:option-data-always-send;
- uses dhcp:option-data-user-context;
+ list option-data {
+ key "code space";
+ description "Option data entry.";
+ leaf code {
+ type uint8;
+ mandatory true;
+ description "Option code.";
}
+ leaf space {
+ type string;
+ mandatory true;
+ description "Option space.";
+ }
+ uses dhcp:option-data-name;
+ uses dhcp:option-data-data;
+ uses dhcp:option-data-csv-format;
+ uses dhcp:option-data-always-send;
+ uses dhcp:option-data-user-context;
}
}
@@ -283,41 +288,31 @@ module kea-dhcp4-server {
uses dhcp:renew-timer;
uses dhcp:rebind-timer;
uses dhcp:decline-probation-period;
+ uses subnet4-list;
- container subnet4 {
- description "Global list of IPv4 subnets.";
+ list shared-network {
+ key name;
+ description "List of IPv4 shared networks.";
+ uses dhcp:network-name;
uses subnet4-list;
- }
-
- container shared-networks {
- description "Defines a list of IPv4 shared networks.";
- list shared-network {
- key name;
- description "List of IPv4 shared networks.";
- uses dhcp:network-name;
- container subnet4 {
- description "List of IPv4 subnets that belong to this shared
- network.";
- uses subnet4-list;
- }
- uses dhcp:network-interface;
- uses dhcp:renew-timer;
- uses dhcp:rebind-timer;
- uses option-data-list;
- uses match-client-id;
- uses next-server;
- uses server-hostname;
- uses boot-file-name;
- container relay {
- description "Optional information about relay agent.";
- uses relay;
- }
- uses dhcp:network-reservation-mode;
- uses dhcp:network-client-class;
- uses dhcp:network-require-client-classes;
- uses dhcp:valid-lifetime;
- uses dhcp:network-user-context;
+ uses dhcp:network-interface;
+ uses dhcp:renew-timer;
+ uses dhcp:rebind-timer;
+ uses option-data-list;
+ uses match-client-id;
+ uses next-server;
+ uses server-hostname;
+ uses boot-file-name;
+ container relay {
+ description "Optional information about relay agent.";
+ uses relay;
}
+ uses authoritative;
+ uses dhcp:reservation-mode;
+ uses dhcp:network-client-class;
+ uses dhcp:network-require-client-classes;
+ uses dhcp:valid-lifetime;
+ uses dhcp:network-user-context;
}
container interfaces-config {
@@ -336,7 +331,6 @@ module kea-dhcp4-server {
description "DHCP service uses UDP sockets.";
}
}
- default "raw";
description "Type of sockets to use.";
}
leaf outbound-interface {
@@ -349,7 +343,6 @@ module kea-dhcp4-server {
description "Use kernel routing.";
}
}
- default "same-as-inbound";
description "Control the interface used to send a response.";
}
uses dhcp:interfaces-re-detect;
@@ -363,16 +356,7 @@ module kea-dhcp4-server {
description "Host reservation identifiers.";
}
- container client-classes {
- description "Client classes.";
- list client-class {
- key name;
- ordered-by user;
- description "List of client classes.";
- uses client-class;
- }
- }
-
+ uses client-classes;
uses option-def-list;
uses option-data-list;
uses kea:hooks-libraries;
@@ -383,7 +367,6 @@ module kea-dhcp4-server {
leaf echo-client-id {
type boolean;
- default true;
description "Send client-id back when the client sent it. This
is conformant with RFC6842, but some older, buggy
clients have problems with it.";
@@ -393,6 +376,7 @@ module kea-dhcp4-server {
uses next-server;
uses server-hostname;
uses boot-file-name;
+ uses authoritative;
uses kea:user-context {
refine user-context {
description "DHCPv4 server user context. Arbitrary JSON data can
@@ -400,18 +384,17 @@ module kea-dhcp4-server {
}
}
uses dhcp:sanity-checks;
+ uses dhcp:reservation-mode;
uses reservations {
- refine reservations {
- description "Global host reservations.";
+ refine host {
+ description "Global host reservations list.";
}
}
- }
-
- container logging {
- // config true;
- description "Logging";
-
- uses logging:configuration;
+ uses dhcp:config-control;
+ uses dhcp:server-tag;
+ uses dhcp:dhcp-queue-control;
+ // Moved from logging
+ uses logging:loggers;
}
/*
@@ -458,22 +441,18 @@ module kea-dhcp4-server {
}
leaf fqdn-fwd {
type boolean;
- default false;
description "Lease FQDN forward flag.";
}
leaf fqdn-rev {
type boolean;
- default false;
description "Lease FQDN reverse lag.";
}
leaf hostname {
type string;
- default "";
description "Lease hostname.";
}
leaf state {
type dhcp:lease-state;
- default "default";
description "Lease state.";
}
leaf user-context {
diff --git a/src/lib/yang/models/kea-dhcp6-server.yang b/src/lib/yang/models/kea-dhcp6-server.yang
index e398473829..069ef29f48 100644
--- a/src/lib/yang/models/kea-dhcp6-server.yang
+++ b/src/lib/yang/models/kea-dhcp6-server.yang
@@ -8,21 +8,23 @@ module kea-dhcp6-server {
}
import kea-types {
prefix kea;
+ revision-date 2018-11-20;
}
import kea-dhcp-types {
prefix dhcp;
+ revision-date 2018-11-20;
}
import kea-logging {
prefix logging;
+ revision-date 2018-11-20;
}
-
organization "Internet Systems Consortium";
contact "kea-dev@lists.isc.org";
description "This model defines a YANG data model that can be
used to configure and manage a Kea DHCPv6 server.";
- revision 2018-09-14 {
+ revision 2018-11-20 {
description "Initial revision";
reference "";
}
@@ -77,7 +79,6 @@ module kea-dhcp6-server {
description "Rapid commit grouping.";
leaf rapid-commit {
type boolean;
- default false;
description "Rapid commit entry.";
}
}
@@ -106,13 +107,10 @@ module kea-dhcp6-server {
grouping reservations {
description "Host reservations grouping.";
- container reservations {
- description "Host reservations container.";
- list host {
- key "identifier-type identifier";
- description "Host reservation entry.";
- uses host;
- }
+ list host {
+ key "identifier-type identifier";
+ description "Host reservation list.";
+ uses host;
}
}
@@ -127,69 +125,63 @@ module kea-dhcp6-server {
uses dhcp:renew-timer;
uses dhcp:rebind-timer;
uses option-data-list;
- container pools {
- description "List of pools.";
- list pool {
- key "start-address end-address";
- ordered-by user;
- description "Pool entry.";
- leaf prefix {
- type inet:ipv6-prefix;
- description "Pool prefix.";
- }
- leaf start-address {
- type inet:ipv6-address;
- mandatory true;
- description "First IPv6 address in a pool.";
- }
- leaf end-address {
- type inet:ipv6-address;
- mandatory true;
- description "Last IPv6 address in a pool.";
- }
- uses option-data-list;
- uses dhcp:pool-client-class;
- uses dhcp:pool-require-client-classes;
- uses dhcp:pool-user-context;
+ list pool {
+ key "start-address end-address";
+ ordered-by user;
+ description "Pool list.";
+ leaf prefix {
+ type inet:ipv6-prefix;
+ description "Pool prefix.";
}
+ leaf start-address {
+ type inet:ipv6-address;
+ mandatory true;
+ description "First IPv6 address in a pool.";
+ }
+ leaf end-address {
+ type inet:ipv6-address;
+ mandatory true;
+ description "Last IPv6 address in a pool.";
+ }
+ uses option-data-list;
+ uses dhcp:pool-client-class;
+ uses dhcp:pool-require-client-classes;
+ uses dhcp:pool-user-context;
}
- container pd-pools {
- description "List of prefix delegation pools.";
- list pd-pool {
- key prefix;
- ordered-by user;
- description "Prefix delegation pool entry.";
- leaf prefix {
- type inet:ipv6-prefix;
- mandatory true;
- description "IPv6 pool prefix.";
- }
- leaf delegated-len {
- type uint8;
- description "Prefix pool delegated length.";
- }
- uses option-data-list;
- uses dhcp:client-class {
- refine client-class {
- description "Prefix pool client class guard. (only
- clients belonging to this class will be
- allowed in this pool).";
- }
- }
- uses dhcp:require-client-classes {
- refine require-client-classes {
- description "Prefix pool require client classes.";
- }
+ list pd-pool {
+ key prefix;
+ ordered-by user;
+ description "Prefix delegation pool list.";
+ leaf prefix {
+ type inet:ipv6-prefix;
+ mandatory true;
+ description "IPv6 pool prefix.";
+ }
+ leaf delegated-len {
+ type uint8;
+ description "Prefix pool delegated length.";
+ }
+ uses option-data-list;
+ uses dhcp:client-class {
+ refine client-class {
+ description "Prefix pool client class guard. (only
+ clients belonging to this class will be
+ allowed in this pool).";
}
- leaf excluded-prefix {
- type inet:ipv6-prefix;
- description "Prefix pool excluded prefix.";
+ }
+ uses dhcp:require-client-classes {
+ refine require-client-classes {
+ description "Prefix pool require client classes.";
}
- uses kea:user-context {
- refine user-context {
- description "Prefix pool user context. Arbitrary JSON data
- can be stored here.";
- }
+ }
+ leaf excluded-prefix {
+ type inet:ipv6-prefix;
+ description "Prefix pool excluded prefix.";
+ }
+ uses kea:user-context {
+ refine user-context {
+ description "Prefix pool user context. Arbitrary JSON data
+ can be stored here.";
}
}
}
@@ -213,11 +205,11 @@ module kea-dhcp6-server {
uses dhcp:subnet-client-class;
uses dhcp:require-client-classes;
uses reservations {
- refine reservations {
- description "Subnet host reservations.";
+ refine host {
+ description "Subnet host reservations list.";
}
}
- uses dhcp:subnet-reservation-mode;
+ uses dhcp:reservation-mode;
container relay {
description "Optional information about relay agent.";
uses relay;
@@ -226,65 +218,64 @@ module kea-dhcp6-server {
}
}
- grouping client-class {
- description "Client class grouping.";
- uses dhcp:class-name;
- uses dhcp:class-test;
- uses dhcp:class-only-if-required;
- uses option-data-list;
- uses dhcp:class-user-context;
+ grouping client-classes {
+ description "Client classes grouping.";
+ list client-class {
+ key name;
+ ordered-by user;
+ description "List of client classes.";
+ uses dhcp:class-name;
+ uses dhcp:class-test;
+ uses dhcp:class-only-if-required;
+ uses option-data-list;
+ uses dhcp:class-user-context;
+ }
}
grouping option-def-list {
description "Option definition list grouping.";
- container option-def-list {
- description "Option definition list.";
- list option-def {
- key "code space";
- description "Option definition entry.";
- leaf code {
- type uint16;
- mandatory true;
- description "Option code to be used by the new option definition.";
- }
- leaf space {
- type string;
- mandatory true;
- description "Option space for the new option (typically dhcp6).";
- }
- uses dhcp:option-def-name;
- uses dhcp:option-def-type;
- uses dhcp:option-def-record-types;
- uses dhcp:option-def-encapsulate;
- uses dhcp:option-def-array;
- uses dhcp:option-def-user-context;
+ list option-def {
+ key "code space";
+ description "Option definition entry.";
+ leaf code {
+ type uint16;
+ mandatory true;
+ description "Option code to be used by the new option definition.";
}
+ leaf space {
+ type string;
+ mandatory true;
+ description "Option space for the new option (typically dhcp6).";
+ }
+ uses dhcp:option-def-name;
+ uses dhcp:option-def-type;
+ uses dhcp:option-def-record-types;
+ uses dhcp:option-def-encapsulate;
+ uses dhcp:option-def-array;
+ uses dhcp:option-def-user-context;
}
}
grouping option-data-list {
description "Option data list grouping.";
- container option-data-list {
- description "Option data list.";
- list option-data {
- key "code space";
- description "Option data entry.";
- leaf code {
- type uint16;
- mandatory true;
- description "Option code.";
- }
- leaf space {
- type string;
- mandatory true;
- description "Option space.";
- }
- uses dhcp:option-data-name;
- uses dhcp:option-data-data;
- uses dhcp:option-data-csv-format;
- uses dhcp:option-data-always-send;
- uses dhcp:option-data-user-context;
+ list option-data {
+ key "code space";
+ description "Option data entry.";
+ leaf code {
+ type uint16;
+ mandatory true;
+ description "Option code.";
}
+ leaf space {
+ type string;
+ mandatory true;
+ description "Option space.";
+ }
+ uses dhcp:option-data-name;
+ uses dhcp:option-data-data;
+ uses dhcp:option-data-csv-format;
+ uses dhcp:option-data-always-send;
+ uses dhcp:option-data-user-context;
}
}
@@ -301,48 +292,37 @@ module kea-dhcp6-server {
uses dhcp:renew-timer;
uses dhcp:rebind-timer;
uses dhcp:decline-probation-period;
+ uses subnet6-list;
- container subnet6 {
- description "Global subnet6 list.";
+ list shared-network {
+ key name;
+ uses dhcp:network-name;
+ description "List of IPv4 shared networks.";
uses subnet6-list;
- }
-
- container shared-networks {
- description "Defines a list of IPv6 shared networks.";
- list shared-network {
- key name;
- uses dhcp:network-name;
- description "List of IPv4 shared networks.";
- container subnet6 {
- description "List of IPv6 subnets that belong to this shared
- network.";
- uses subnet6-list;
- }
- uses dhcp:network-interface;
- uses interface-id {
- refine interface-id {
- description "Shared network interface-id option.";
- }
+ uses dhcp:network-interface;
+ uses interface-id {
+ refine interface-id {
+ description "Shared network interface-id option.";
}
- uses dhcp:renew-timer;
- uses dhcp:rebind-timer;
- uses option-data-list;
- container relay {
- description "Optional information about relay agent.";
- uses relay;
- }
- uses dhcp:network-reservation-mode;
- uses dhcp:network-client-class;
- uses dhcp:require-client-classes;
- uses preferred-lifetime;
- uses rapid-commit {
- refine rapid-commit {
- description "Shared network rapid commit flag.";
- }
+ }
+ uses dhcp:renew-timer;
+ uses dhcp:rebind-timer;
+ uses option-data-list;
+ container relay {
+ description "Optional information about relay agent.";
+ uses relay;
+ }
+ uses dhcp:reservation-mode;
+ uses dhcp:network-client-class;
+ uses dhcp:require-client-classes;
+ uses preferred-lifetime;
+ uses rapid-commit {
+ refine rapid-commit {
+ description "Shared network rapid commit flag.";
}
- uses dhcp:valid-lifetime;
- uses dhcp:network-user-context;
}
+ uses dhcp:valid-lifetime;
+ uses dhcp:network-user-context;
}
container interfaces-config {
@@ -373,16 +353,7 @@ module kea-dhcp6-server {
description "Host reservation identifiers.";
}
- container client-classes {
- description "Client classes.";
- list client-class {
- key name;
- ordered-by user;
- description "List of client classes.";
- uses client-class;
- }
- }
-
+ uses client-classes;
uses option-def-list;
uses option-data-list;
uses kea:hooks-libraries;
@@ -423,7 +394,6 @@ module kea-dhcp6-server {
}
leaf persist {
type boolean;
- default true;
description "Server DUID persist flag.";
}
leaf user-context {
@@ -442,18 +412,17 @@ module kea-dhcp6-server {
}
}
uses dhcp:sanity-checks;
+ uses dhcp:reservation-mode;
uses reservations {
- refine reservations {
- description "Global host reservations.";
+ refine host {
+ description "Global host reservations list.";
}
}
- }
-
- container logging {
- // config true;
- description "Logging";
-
- uses logging:configuration;
+ uses dhcp:config-control;
+ uses dhcp:server-tag;
+ uses dhcp:dhcp-queue-control;
+ // Moved from logging
+ uses logging:loggers;
}
/*
@@ -528,22 +497,18 @@ module kea-dhcp6-server {
}
leaf fqdn-fwd {
type boolean;
- default false;
description "Lease FQDN forward flag.";
}
leaf fqdn-rev {
type boolean;
- default false;
description "Lease FQDN reverse lag.";
}
leaf hostname {
type string;
- default "";
description "Lease hostname.";
}
leaf state {
type dhcp:lease-state;
- default "default";
description "Lease state.";
}
leaf user-context {
diff --git a/src/lib/yang/models/kea-logging.yang b/src/lib/yang/models/kea-logging.yang
index 31ad29f9db..31dd195176 100644
--- a/src/lib/yang/models/kea-logging.yang
+++ b/src/lib/yang/models/kea-logging.yang
@@ -5,6 +5,7 @@ module kea-logging {
import kea-types {
prefix kea;
+ revision-date 2018-11-20;
}
organization "Internet Systems Consortium";
@@ -12,7 +13,7 @@ module kea-logging {
description "This model defines a YANG data model that can be
used to configure and manage logging of a Kea server.";
- revision 2018-09-14 {
+ revision 2018-11-20 {
description "Initial revision";
reference "";
}
@@ -21,88 +22,83 @@ module kea-logging {
* Groupings
*/
- grouping configuration {
- description "Contains parameters for logging configuration.";
-
- container loggers {
- description "Loggers.";
- list logger {
- key name;
- description "List of loggers.";
- leaf name {
+ grouping loggers {
+ description "Loggers.";
+ list logger {
+ key name;
+ description "List of loggers.";
+ leaf name {
+ type string;
+ mandatory true;
+ description "Name of the logger.";
+ }
+ list output-option {
+ key output;
+ description "List of output options.";
+ leaf output {
type string;
- mandatory true;
- description "Name of the logger.";
+ description "Type of output. Special values are stdout (standard
+ output), stderr (standard error), syslog (syslog using default
+ name), syslog:name (syslog using specified name). Any other
+ value is interpreted as a filename.";
}
- container output-options {
- description "Output options.";
- list option {
- key output;
- description "List of output options.";
- leaf output {
- type string;
- description "Type of output. Special values are stdout (standard
- output), stderr (standard error), syslog (syslog using default
- name), syslog:name (syslog using specified name). Any other
- value is interpreted as a filename.";
- }
- leaf flush {
- type boolean;
- default true;
- description "When true flush buffers after each message.";
- }
- leaf maxsize {
- type uint32;
- default 10240000;
- description "Maximum size of output file before rotation.
- Values below 204800 including 0 disable rotation.";
- }
- leaf maxver {
- type uint32 {
- range 1..max;
- }
- default 1;
- description "Maximum version to keep a rotated output file.";
- }
- }
+ leaf flush {
+ type boolean;
+ description "When true flush buffers after each message.";
}
- leaf debuglevel {
- type uint8 {
- range 0..99;
- }
- description "What level of debug messages should be printed.";
+ leaf maxsize {
+ type uint32;
+ description "Maximum size of output file before rotation.
+ Values below 204800 including 0 disable rotation.";
}
- leaf severity {
- type enumeration {
- enum "FATAL" {
- description "Condition is so serious that the server cannot
- continue executing";
- }
- enum "ERROR" {
- description "Error condition. The server will continue
- executing, but the results may not be as expected.";
- }
- enum "WARN" {
- description "Out of the ordinary condition. However, the server
- will continue executing normally.";
- }
- enum "INFO" {
- description "Information message marking some event.";
- }
- enum "DEBUG" {
- description "For debugging purposes.";
- }
- enum "NONE" {
- description "All messages are inhibited.";
- }
+ leaf maxver {
+ type uint32 {
+ range 1..max;
}
- description "Category of messages logged.";
+ description "Maximum version to keep a rotated output file.";
+ }
+ }
+ leaf debuglevel {
+ type uint8 {
+ range 0..99;
}
- leaf user-context {
- type kea:user-context;
- description "Logger user context.";
+ description "What level of debug messages should be printed.";
+ }
+ leaf severity {
+ type enumeration {
+ enum "FATAL" {
+ description "Condition is so serious that the server cannot
+ continue executing";
+ }
+ enum "ERROR" {
+ description "Error condition. The server will continue
+ executing, but the results may not be as expected.";
+ }
+ enum "WARN" {
+ description "Out of the ordinary condition. However, the server
+ will continue executing normally.";
+ }
+ enum "INFO" {
+ description "Information message marking some event.";
+ }
+ enum "DEBUG" {
+ description "For debugging purposes.";
+ }
+ enum "NONE" {
+ description "All messages are inhibited.";
+ }
}
+ description "Category of messages logged.";
+ }
+ leaf user-context {
+ type kea:user-context;
+ description "Logger user context.";
}
}
}
+
+ grouping configuration {
+ description "Contains parameters for logging configuration.";
+ uses loggers;
+ }
}
diff --git a/src/lib/yang/models/kea-types.yang b/src/lib/yang/models/kea-types.yang
index bfbdac738f..6ac07485a5 100644
--- a/src/lib/yang/models/kea-types.yang
+++ b/src/lib/yang/models/kea-types.yang
@@ -7,7 +7,7 @@ module kea-types {
contact "kea-dev@lists.isc.org";
description "This file defines some commonly used Kea types and groupings.";
- revision 2018-09-14 {
+ revision 2018-11-20 {
description "Initial revision";
reference "";
}
@@ -55,20 +55,17 @@ module kea-types {
grouping hooks-libraries {
description "Hooks libraries grouping.";
- container hooks-libraries {
- description "Hook libraries.";
- list hook-library {
- key library;
- description "List of hook library.";
- leaf library {
- type string;
- mandatory true;
- description "Path to the DSO.";
- }
- leaf parameters {
- type string;
- description "Parameters (JSON value).";
- }
+ list hook-library {
+ key library;
+ description "List of hook library.";
+ leaf library {
+ type string;
+ mandatory true;
+ description "Path to the DSO.";
+ }
+ leaf parameters {
+ type string;
+ description "Parameters (JSON value).";
}
}
}
diff --git a/src/lib/yang/tests/translator_class_unittests.cc b/src/lib/yang/tests/translator_class_unittests.cc
index e299835b57..30191b259c 100644
--- a/src/lib/yang/tests/translator_class_unittests.cc
+++ b/src/lib/yang/tests/translator_class_unittests.cc
@@ -45,7 +45,7 @@ TEST_F(TranslatorClassesTest, getEmpty) {
useModel(KEA_DHCP4_SERVER);
// Get the client class list and check if it is empty.
- const string& xpath = "/kea-dhcp4-server:config/client-classes";
+ const string& xpath = "/kea-dhcp4-server:config";
ConstElementPtr classes;
EXPECT_NO_THROW(classes = t_obj_->getClasses(xpath));
EXPECT_FALSE(classes);
@@ -57,7 +57,7 @@ TEST_F(TranslatorClassesTest, get) {
useModel(KEA_DHCP6_SERVER);
// Create the client class.
- const string& xpath = "/kea-dhcp6-server:config/client-classes";
+ const string& xpath = "/kea-dhcp6-server:config";
const string& xclass = xpath + "/client-class[name='foo']";
const string& xtest = xclass + "/test";
S_Val v_test(new Val("not member('ALL')", SR_STRING_T));
@@ -87,7 +87,7 @@ TEST_F(TranslatorClassesTest, setEmpty) {
useModel(KEA_DHCP4_SERVER);
// Set empty list.
- const string& xpath = "/kea-dhcp4-server:config/client-classes";
+ const string& xpath = "/kea-dhcp4-server:config";
ConstElementPtr classes = Element::createList();
EXPECT_NO_THROW(t_obj_->setClasses(xpath, classes));
@@ -108,7 +108,7 @@ TEST_F(TranslatorClassesTest, set) {
useModel(KEA_DHCP6_SERVER);
// Set one client class.
- const string& xpath = "/kea-dhcp6-server:config/client-classes";
+ const string& xpath = "/kea-dhcp6-server:config";
ElementPtr classes = Element::createList();
ElementPtr cclass = Element::createMap();
cclass->set("name", Element::create(string("foo")));
@@ -132,15 +132,13 @@ TEST_F(TranslatorClassesTest, set) {
string expected =
"kea-dhcp6-server:config (container)\n"
" |\n"
- " -- client-classes (container)\n"
+ " -- client-class (list instance)\n"
" |\n"
- " -- client-class (list instance)\n"
- " |\n"
- " -- name = foo\n"
- " |\n"
- " -- test = ''==''\n"
- " |\n"
- " -- only-if-required = false\n";
+ " -- name = foo\n"
+ " |\n"
+ " -- test = ''==''\n"
+ " |\n"
+ " -- only-if-required = false\n";
EXPECT_EQ(expected, tree->to_string(100));
// Check it validates.
diff --git a/src/lib/yang/tests/translator_database_unittests.cc b/src/lib/yang/tests/translator_database_unittests.cc
index 6c5e552da5..3e8e3c43ce 100644
--- a/src/lib/yang/tests/translator_database_unittests.cc
+++ b/src/lib/yang/tests/translator_database_unittests.cc
@@ -153,7 +153,7 @@ TEST_F(TranslatorDatabasesTest, getEmpty) {
useModel(KEA_DHCP6_SERVER);
// Get empty.
- const string& xpath = "/kea-dhcp6-server:config/hosts-databases";
+ const string& xpath = "/kea-dhcp6-server:config/hosts-database";
ConstElementPtr databases;
EXPECT_NO_THROW(databases = t_obj_->getDatabases(xpath));
EXPECT_FALSE(databases);
@@ -165,9 +165,8 @@ TEST_F(TranslatorDatabasesTest, get) {
useModel(KEA_DHCP4_SERVER);
// Set a value.
- const string& xpath = "/kea-dhcp4-server:config/hosts-databases";
- const string& xdatabase =
- xpath + "/hosts-database[database-type='mysql']";
+ const string& xpath = "/kea-dhcp4-server:config/hosts-database";
+ const string& xdatabase = xpath + "[database-type='mysql']";
const string& xname = xdatabase + "/name";
const string& xuser = xdatabase + "/user";
const string& xpassword = xdatabase + "/password";
@@ -225,7 +224,7 @@ TEST_F(TranslatorDatabasesTest, set) {
useModel(KEA_DHCP6_SERVER);
// Set a value.
- const string& xpath = "/kea-dhcp6-server:config/hosts-databases";
+ const string& xpath = "/kea-dhcp6-server:config/hosts-database";
ElementPtr database = Element::createMap();
database->set("type", Element::create(string("memfile")));
database->set("lfc-interval", Element::create(3600));
@@ -262,9 +261,8 @@ TEST_F(TranslatorDatabasesTest, setEmpty) {
useModel(KEA_DHCP4_SERVER);
// Set a value.
- const string& xpath = "/kea-dhcp4-server:config/hosts-databases";
- const string& xdatabase =
- xpath + "/hosts-database[database-type='mysql']";
+ const string& xpath = "/kea-dhcp4-server:config/hosts-database";
+ const string& xdatabase = xpath + "[database-type='mysql']";
const string& xname = xdatabase + "/name";
const string& xuser = xdatabase + "/user";
const string& xpassword = xdatabase + "/password";
@@ -297,9 +295,8 @@ TEST_F(TranslatorDatabasesTest, setEmpties) {
useModel(KEA_DHCP4_SERVER);
// Set a value.
- const string& xpath = "/kea-dhcp4-server:config/hosts-databases";
- const string& xdatabase =
- xpath + "/hosts-database[database-type='mysql']";
+ const string& xpath = "/kea-dhcp4-server:config/hosts-database";
+ const string& xdatabase = xpath + "[database-type='mysql']";
const string& xname = xdatabase + "/name";
const string& xuser = xdatabase + "/user";
const string& xpassword = xdatabase + "/password";
diff --git a/src/lib/yang/tests/translator_host_unittests.cc b/src/lib/yang/tests/translator_host_unittests.cc
index 4abc8dd7fe..375d775832 100644
--- a/src/lib/yang/tests/translator_host_unittests.cc
+++ b/src/lib/yang/tests/translator_host_unittests.cc
@@ -46,7 +46,7 @@ TEST_F(TranslatorHostsTest, getEmpty) {
// Get the host reservation list and check if it is empty.
const string& xpath =
- "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/reservations";
+ "/kea-dhcp6-server:config/subnet6[id='111']";
ConstElementPtr hosts;
EXPECT_NO_THROW(hosts = t_obj_->getHosts(xpath));
ASSERT_TRUE(hosts);
@@ -60,14 +60,13 @@ TEST_F(TranslatorHostsTest, get) {
useModel(KEA_DHCP6_SERVER);
// Create the subnet 2001:db8::/48 #111.
- const string& subnet =
- "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+ const string& xpath =
+ "/kea-dhcp6-server:config/subnet6[id='111']";
S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
- const string& xsubnet = subnet + "/subnet";
- EXPECT_NO_THROW(sess_->set_item(xsubnet.c_str(), v_subnet));
+ const string& subnet = xpath + "/subnet";
+ EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
// Create the host reservation for 2001:db8::1.
- const string& xpath = subnet + "/reservations";
ostringstream shost;
shost << xpath + "/host[identifier-type='hw-address']"
<< "[identifier='00:01:02:03:04:05']";
@@ -102,14 +101,13 @@ TEST_F(TranslatorHostsTest, setEmpty) {
useModel(KEA_DHCP6_SERVER);
// Create the subnet 2001:db8::/48 #111.
- const string& subnet =
- "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+ const string& xpath =
+ "/kea-dhcp6-server:config/subnet6[id='111']";
S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
- const string& xsubnet = subnet + "/subnet";
- EXPECT_NO_THROW(sess_->set_item(xsubnet.c_str(), v_subnet));
+ const string& subnet = xpath + "/subnet";
+ EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
// Set empty list.
- const string& xpath = subnet + "/reservations";
ConstElementPtr hosts = Element::createList();
EXPECT_NO_THROW(t_obj_->setHosts(xpath, hosts));
@@ -127,14 +125,13 @@ TEST_F(TranslatorHostsTest, set) {
useModel(KEA_DHCP4_SERVER);
// Create the subnet 10.0.0.0/14 #111.
- const string& subnet =
- "/kea-dhcp4-server:config/subnet4/subnet4[id='111']";
+ const string& xpath =
+ "/kea-dhcp4-server:config/subnet4[id='111']";
S_Val v_subnet(new Val("10.0.0.0/24", SR_STRING_T));
- const string& xsubnet = subnet + "/subnet";
- EXPECT_NO_THROW(sess_->set_item(xsubnet.c_str(), v_subnet));
+ const string& subnet = xpath + "/subnet";
+ EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
// Set one host.
- const string& xpath = subnet + "/reservations";
ElementPtr hosts = Element::createList();
ElementPtr host = Element::createMap();
host->set("flex-id", Element::create(string("00:ff")));
@@ -158,25 +155,21 @@ TEST_F(TranslatorHostsTest, set) {
string expected =
"kea-dhcp4-server:config (container)\n"
" |\n"
- " -- subnet4 (container)\n"
+ " -- subnet4 (list instance)\n"
+ " |\n"
+ " -- id = 111\n"
" |\n"
- " -- subnet4 (list instance)\n"
+ " -- subnet = 10.0.0.0/24\n"
+ " |\n"
+ " -- host (list instance)\n"
+ " |\n"
+ " -- identifier-type = flex-id\n"
" |\n"
- " -- id = 111\n"
+ " -- identifier = 00:ff\n"
" |\n"
- " -- subnet = 10.0.0.0/24\n"
+ " -- hostname = foo\n"
" |\n"
- " -- reservations (container)\n"
- " |\n"
- " -- host (list instance)\n"
- " |\n"
- " -- identifier-type = flex-id\n"
- " |\n"
- " -- identifier = 00:ff\n"
- " |\n"
- " -- hostname = foo\n"
- " |\n"
- " -- ip-address = 10.0.0.1\n";
+ " -- ip-address = 10.0.0.1\n";
EXPECT_EQ(expected, tree->to_string(100));
// Check it validates.
@@ -189,14 +182,13 @@ TEST_F(TranslatorHostsTest, getMany) {
useModel(KEA_DHCP6_SERVER);
// Create the subnet 2001:db8::/48 #111.
- const string& subnet =
- "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+ const string& xpath =
+ "/kea-dhcp6-server:config/subnet6[id='111']";
S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
- const string& xsubnet = subnet + "/subnet";
- EXPECT_NO_THROW(sess_->set_item(xsubnet.c_str(), v_subnet));
+ const string& subnet = xpath + "/subnet";
+ EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
// Create the host reservation for 2001:db8::1.
- const string& xpath = subnet + "/reservations";
ostringstream shost;
shost << xpath + "/host[identifier-type='hw-address']"
<< "[identifier='00:01:02:03:04:05']";
@@ -205,7 +197,6 @@ TEST_F(TranslatorHostsTest, getMany) {
EXPECT_NO_THROW(sess_->set_item(xaddr.c_str(), s_addr));
// Create another reservation for 2001:db8::2
- const string xpath2 = subnet + "/reservations";
ostringstream shost2;
shost2 << xpath + "/host[identifier-type='hw-address']"
<< "[identifier='00:01:0a:0b:0c:0d']";
@@ -215,8 +206,7 @@ TEST_F(TranslatorHostsTest, getMany) {
// Get the host.
ConstElementPtr hosts;
- string hosts_path = subnet + "/reservations";
- EXPECT_NO_THROW(hosts = t_obj_->getHosts(hosts_path));
+ EXPECT_NO_THROW(hosts = t_obj_->getHosts(xpath));
ASSERT_TRUE(hosts);
EXPECT_EQ(hosts->str(),
diff --git a/src/lib/yang/tests/translator_logger_unittests.cc b/src/lib/yang/tests/translator_logger_unittests.cc
index a8bc744137..1de5e8f07f 100644
--- a/src/lib/yang/tests/translator_logger_unittests.cc
+++ b/src/lib/yang/tests/translator_logger_unittests.cc
@@ -44,7 +44,7 @@ TEST_F(TranslatorLoggersTest, getEmpty) {
useModel(KEA_DHCP4_SERVER);
// Get empty.
- const string& xpath = "/kea-dhcp4-server:logging/loggers";
+ const string& xpath = "/kea-dhcp4-server:config";
ConstElementPtr loggers;
EXPECT_NO_THROW(loggers = t_obj_->getLoggers(xpath));
ASSERT_TRUE(loggers);
@@ -57,10 +57,10 @@ TEST_F(TranslatorLoggersTest, get) {
useModel(KEA_DHCP6_SERVER);
// Set a value.
- const string& xpath = "/kea-dhcp6-server:logging/loggers";
+ const string& xpath = "/kea-dhcp6-server:config";
const string& xlogger = xpath + "/logger[name='foo']";
const string& xseverity = xlogger + "/severity";
- const string& xoption = xlogger + "/output-options/option[output='/bar']";
+ const string& xoption = xlogger + "/output-option[output='/bar']";
const string& xmaxver = xoption + "/maxver";
S_Val s_severity(new Val("WARN", SR_ENUM_T));
EXPECT_NO_THROW(sess_->set_item(xseverity.c_str(), s_severity));
@@ -106,7 +106,7 @@ TEST_F(TranslatorLoggersTest, set) {
useModel(KEA_DHCP4_SERVER);
// Set a value.
- const string& xpath = "/kea-dhcp4-server:logging/loggers";
+ const string& xpath = "/kea-dhcp4-server:config";
ElementPtr option = Element::createMap();
option->set("output", Element::create(string("/bar")));
option->set("maxver", Element::create(10));
@@ -153,26 +153,22 @@ TEST_F(TranslatorLoggersTest, set) {
// Check the tree representation.
S_Tree tree;
- EXPECT_NO_THROW(tree = sess_->get_subtree("/kea-dhcp4-server:logging"));
+ EXPECT_NO_THROW(tree = sess_->get_subtree("/kea-dhcp4-server:config"));
ASSERT_TRUE(tree);
string expected =
- "kea-dhcp4-server:logging (container)\n"
+ "kea-dhcp4-server:config (container)\n"
" |\n"
- " -- loggers (container)\n"
+ " -- logger (list instance)\n"
" |\n"
- " -- logger (list instance)\n"
- " |\n"
- " -- name = foo\n"
- " |\n"
- " -- output-options (container)\n"
- " | |\n"
- " | -- option (list instance)\n"
- " | |\n"
- " | -- output = /bar\n"
- " | |\n"
- " | -- maxver = 10\n"
- " |\n"
- " -- severity = WARN\n";
+ " -- name = foo\n"
+ " |\n"
+ " -- output-option (list instance)\n"
+ " | |\n"
+ " | -- output = /bar\n"
+ " | |\n"
+ " | -- maxver = 10\n"
+ " |\n"
+ " -- severity = WARN\n";
EXPECT_EQ(expected, tree->to_string(100));
// Check it validates.
diff --git a/src/lib/yang/tests/translator_option_data_unittests.cc b/src/lib/yang/tests/translator_option_data_unittests.cc
index 7067b0fbb0..e95030a763 100644
--- a/src/lib/yang/tests/translator_option_data_unittests.cc
+++ b/src/lib/yang/tests/translator_option_data_unittests.cc
@@ -45,7 +45,7 @@ TEST_F(TranslatorOptionDataListTest, getEmpty) {
useModel(KEA_DHCP4_SERVER);
// Get the option data list and check if it is empty.
- const string& xpath = "/kea-dhcp4-server:config/option-data-list";
+ const string& xpath = "/kea-dhcp4-server:config";
ConstElementPtr options;
EXPECT_NO_THROW(options = t_obj_->getOptionDataList(xpath));
ASSERT_TRUE(options);
@@ -59,7 +59,7 @@ TEST_F(TranslatorOptionDataListTest, get) {
useModel(KEA_DHCP6_SERVER);
// Create the option code 100.
- const string& xpath = "/kea-dhcp6-server:config/option-data-list";
+ const string& xpath = "/kea-dhcp6-server:config";
const string& xoption = xpath + "/option-data[code='100'][space='dns']";
const string& xformat = xoption + "/csv-format";
const string& xdata = xoption + "/data";
@@ -98,7 +98,7 @@ TEST_F(TranslatorOptionDataListTest, setEmpty) {
useModel(KEA_DHCP4_SERVER);
// Set empty list.
- const string& xpath = "/kea-dhcp4-server:config/option-data-list";
+ const string& xpath = "/kea-dhcp4-server:config";
ConstElementPtr options = Element::createList();
EXPECT_NO_THROW(t_obj_->setOptionDataList(xpath, options));
@@ -120,7 +120,7 @@ TEST_F(TranslatorOptionDataListTest, set) {
useModel(KEA_DHCP6_SERVER);
// Set one option data.
- const string& xpath = "/kea-dhcp6-server:config/option-data-list";
+ const string& xpath = "/kea-dhcp6-server:config";
ElementPtr options = Element::createList();
ElementPtr option = Element::createMap();
option->set("code", Element::create(100));
@@ -145,19 +145,17 @@ TEST_F(TranslatorOptionDataListTest, set) {
string expected =
"kea-dhcp6-server:config (container)\n"
" |\n"
- " -- option-data-list (container)\n"
+ " -- option-data (list instance)\n"
" |\n"
- " -- option-data (list instance)\n"
- " |\n"
- " -- code = 100\n"
- " |\n"
- " -- space = dns\n"
- " |\n"
- " -- data = 12121212\n"
- " |\n"
- " -- csv-format = false\n"
- " |\n"
- " -- always-send = false\n";
+ " -- code = 100\n"
+ " |\n"
+ " -- space = dns\n"
+ " |\n"
+ " -- data = 12121212\n"
+ " |\n"
+ " -- csv-format = false\n"
+ " |\n"
+ " -- always-send = false\n";
EXPECT_EQ(expected, tree->to_string(100));
// Check it validates.
diff --git a/src/lib/yang/tests/translator_option_def_unittests.cc b/src/lib/yang/tests/translator_option_def_unittests.cc
index 6daab74493..515d9ec303 100644
--- a/src/lib/yang/tests/translator_option_def_unittests.cc
+++ b/src/lib/yang/tests/translator_option_def_unittests.cc
@@ -45,7 +45,7 @@ TEST_F(TranslatorOptionDefListTest, getEmpty) {
useModel(KEA_DHCP4_SERVER);
// Get the option definition list and check if it is empty.
- const string& xpath = "/kea-dhcp4-server:config/option-def-list";
+ const string& xpath = "/kea-dhcp4-server:config";
ConstElementPtr options;
EXPECT_NO_THROW(options = t_obj_->getOptionDefList(xpath));
ASSERT_TRUE(options);
@@ -59,7 +59,7 @@ TEST_F(TranslatorOptionDefListTest, get) {
useModel(KEA_DHCP6_SERVER);
// Create the option code 100.
- const string& xpath = "/kea-dhcp6-server:config/option-def-list";
+ const string& xpath = "/kea-dhcp6-server:config";
const string& xdef = xpath + "/option-def[code='100'][space='isc']";
const string& xname = xdef + "/name";
const string& xtype = xdef + "/type";
@@ -98,7 +98,7 @@ TEST_F(TranslatorOptionDefListTest, setEmpty) {
useModel(KEA_DHCP4_SERVER);
// Set empty list.
- const string& xpath = "/kea-dhcp4-server:config/option-def-list";
+ const string& xpath = "/kea-dhcp4-server:config";
ConstElementPtr defs = Element::createList();
EXPECT_NO_THROW(t_obj_->setOptionDefList(xpath, defs));
@@ -120,7 +120,7 @@ TEST_F(TranslatorOptionDefListTest, set) {
useModel(KEA_DHCP6_SERVER);
// Set one option def.
- const string& xpath = "/kea-dhcp6-server:config/option-def-list";
+ const string& xpath = "/kea-dhcp6-server:config";
ElementPtr defs = Element::createList();
ElementPtr def = Element::createMap();
def->set("code", Element::create(100));
@@ -145,19 +145,17 @@ TEST_F(TranslatorOptionDefListTest, set) {
string expected =
"kea-dhcp6-server:config (container)\n"
" |\n"
- " -- option-def-list (container)\n"
+ " -- option-def (list instance)\n"
" |\n"
- " -- option-def (list instance)\n"
- " |\n"
- " -- code = 100\n"
- " |\n"
- " -- space = isc\n"
- " |\n"
- " -- name = foo\n"
- " |\n"
- " -- type = string\n"
- " |\n"
- " -- array = false\n";
+ " -- code = 100\n"
+ " |\n"
+ " -- space = isc\n"
+ " |\n"
+ " -- name = foo\n"
+ " |\n"
+ " -- type = string\n"
+ " |\n"
+ " -- array = false\n";
EXPECT_EQ(expected, tree->to_string(100));
// Check it validates.
diff --git a/src/lib/yang/tests/translator_pd_pool_unittests.cc b/src/lib/yang/tests/translator_pd_pool_unittests.cc
index cb9ad3e030..55583296bc 100644
--- a/src/lib/yang/tests/translator_pd_pool_unittests.cc
+++ b/src/lib/yang/tests/translator_pd_pool_unittests.cc
@@ -61,8 +61,7 @@ TEST_F(TranslatorPdPoolsTest, getEmptyKea) {
useModel(KEA_DHCP6_SERVER);
// Get the pd-pool list and check if it is empty.
- const string& xpath =
- "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pd-pools";
+ const string& xpath = "/kea-dhcp6-server:config/subnet6[id='111']";
ConstElementPtr pools;
EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath));
ASSERT_TRUE(pools);
@@ -117,14 +116,13 @@ TEST_F(TranslatorPdPoolsTest, getKea) {
useModel(KEA_DHCP6_SERVER);
// Create the subnet 2001:db8::/48 #111.
- const string& subnet =
- "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+ const string& xpath =
+ "/kea-dhcp6-server:config/subnet6[id='111']";
S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
- const string& subnet_subnet = subnet + "/subnet";
- EXPECT_NO_THROW(sess_->set_item(subnet_subnet.c_str(), v_subnet));
+ const string& subnet = xpath + "/subnet";
+ EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
// Create the pd-pool 2001:db8:0:1000::/64.
- const string& xpath = subnet + "/pd-pools";
const string& prefix = "2001:db8:0:1000::/56";
ostringstream spool;
spool << xpath + "/pd-pool[prefix='" << prefix << "']";
@@ -184,14 +182,13 @@ TEST_F(TranslatorPdPoolsTest, setEmptyKea) {
useModel(KEA_DHCP6_SERVER);
// Create the subnet 2001:db8::/48 #111.
- const string& subnet =
- "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+ const string& xpath =
+ "/kea-dhcp6-server:config/subnet6[id='111']";
S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
- const string& subnet_subnet = subnet + "/subnet";
- EXPECT_NO_THROW(sess_->set_item(subnet_subnet.c_str(), v_subnet));
+ const string& subnet = xpath + "/subnet";
+ EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
// Set empty list.
- const string& xpath = subnet + "/pd-pools";
ConstElementPtr pools = Element::createList();
EXPECT_NO_THROW(t_obj_->setPdPools(xpath, pools));
@@ -270,14 +267,13 @@ TEST_F(TranslatorPdPoolsTest, setKea) {
useModel(KEA_DHCP6_SERVER);
// Create the subnet 2001:db8::/48 #111.
- const string& subnet =
- "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+ const string& xpath =
+ "/kea-dhcp6-server:config/subnet6[id='111']";
S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
- const string& subnet_subnet = subnet + "/subnet";
- EXPECT_NO_THROW(sess_->set_item(subnet_subnet.c_str(), v_subnet));
+ const string& subnet = xpath + "/subnet";
+ EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
// Set one pool.
- const string& xpath = subnet + "/pd-pools";
ElementPtr pools = Element::createList();
ElementPtr pool = Element::createMap();
pool->set("prefix", Element::create(string("2001:db8:0:1000::")));
@@ -301,21 +297,17 @@ TEST_F(TranslatorPdPoolsTest, setKea) {
string expected =
"kea-dhcp6-server:config (container)\n"
" |\n"
- " -- subnet6 (container)\n"
+ " -- subnet6 (list instance)\n"
" |\n"
- " -- subnet6 (list instance)\n"
- " |\n"
- " -- id = 111\n"
+ " -- id = 111\n"
+ " |\n"
+ " -- subnet = 2001:db8::/48\n"
+ " |\n"
+ " -- pd-pool (list instance)\n"
" |\n"
- " -- subnet = 2001:db8::/48\n"
+ " -- prefix = 2001:db8:0:1000::/56\n"
" |\n"
- " -- pd-pools (container)\n"
- " |\n"
- " -- pd-pool (list instance)\n"
- " |\n"
- " -- prefix = 2001:db8:0:1000::/56\n"
- " |\n"
- " -- delegated-len = 64\n";
+ " -- delegated-len = 64\n";
EXPECT_EQ(expected, tree->to_string(100));
// Check it validates.
@@ -328,14 +320,13 @@ TEST_F(TranslatorPdPoolsTest, getListKea) {
useModel(KEA_DHCP6_SERVER);
// Create the subnet 2001:db8::/48 #111.
- const string& subnet =
- "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+ const string& xpath =
+ "/kea-dhcp6-server:config/subnet6[id='111']";
S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
- const string& subnet_subnet = subnet + "/subnet";
- EXPECT_NO_THROW(sess_->set_item(subnet_subnet.c_str(), v_subnet));
+ const string& subnet = xpath + "/subnet";
+ EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
// Create the first pd-pool 2001:db8:0:1000::/56.
- const string& xpath = subnet + "/pd-pools";
const string& prefix = "2001:db8:0:1000::/56";
ostringstream spool;
spool << xpath + "/pd-pool[prefix='" << prefix << "']";
@@ -345,10 +336,9 @@ TEST_F(TranslatorPdPoolsTest, getListKea) {
EXPECT_NO_THROW(sess_->set_item(x_delegated.c_str(), s_delegated));
// Create the second pd-pool 2001:db8:0:2000::/56
- const string& xpath2 = subnet + "/pd-pools";
const string& prefix2 = "2001:db8:0:2000::/56";
ostringstream spool2;
- spool2 << xpath2 + "/pd-pool[prefix='" << prefix2 << "']";
+ spool2 << xpath + "/pd-pool[prefix='" << prefix2 << "']";
const string& x_delegated2 = spool2.str() + "/delegated-len";
uint8_t dl2 = 60;
S_Val s_delegated2(new Val(dl2, SR_UINT8_T));
@@ -357,7 +347,7 @@ TEST_F(TranslatorPdPoolsTest, getListKea) {
// Get the pools list.
ConstElementPtr pools;
- EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath2));
+ EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath));
ASSERT_TRUE(pools);
// Check that both of them are returned properly.
diff --git a/src/lib/yang/tests/translator_pool_unittests.cc b/src/lib/yang/tests/translator_pool_unittests.cc
index 998bf50657..e18f2e1174 100644
--- a/src/lib/yang/tests/translator_pool_unittests.cc
+++ b/src/lib/yang/tests/translator_pool_unittests.cc
@@ -60,8 +60,7 @@ TEST_F(TranslatorPoolsTest, getEmptyKea) {
useModel(KEA_DHCP6_SERVER);
// Get the pool list and check if it is empty.
- const string& xpath =
- "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools";
+ const string& xpath = "/kea-dhcp6-server:config/subnet6[id='111']";
ConstElementPtr pools;
EXPECT_NO_THROW(pools = t_obj_->getPools(xpath));
ASSERT_TRUE(pools);
@@ -108,14 +107,13 @@ TEST_F(TranslatorPoolsTest, getKea) {
useModel(KEA_DHCP6_SERVER);
// Create the subnet 2001:db8::/48 #111.
- const string& subnet =
- "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+ const string& xpath =
+ "/kea-dhcp6-server:config/subnet6[id='111']";
S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
- const string& subnet_subnet = subnet + "/subnet";
- EXPECT_NO_THROW(sess_->set_item(subnet_subnet.c_str(), v_subnet));
+ const string& subnet = xpath + "/subnet";
+ EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
// Create the pool 2001:db8::1:0/112.
- const string& xpath = subnet + "/pools";
const string& prefix = "2001:db8::1:0/112";
string start_addr;
string end_addr;
@@ -178,14 +176,13 @@ TEST_F(TranslatorPoolsTest, setEmptyKea) {
useModel(KEA_DHCP6_SERVER);
// Create the subnet 2001:db8::/48 #111.
- const string& subnet =
- "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+ const string& xpath =
+ "/kea-dhcp6-server:config/subnet6[id='111']";
S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
- const string& subnet_subnet = subnet + "/subnet";
- EXPECT_NO_THROW(sess_->set_item(subnet_subnet.c_str(), v_subnet));
+ const string& subnet = xpath + "/subnet";
+ EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
// Set empty list.
- const string& xpath = subnet + "/pools";
ConstElementPtr pools = Element::createList();
EXPECT_NO_THROW(t_obj_->setPools(xpath, pools));
@@ -264,14 +261,13 @@ TEST_F(TranslatorPoolsTest, setKea) {
useModel(KEA_DHCP6_SERVER);
// Create the subnet 2001:db8::/48 #111.
- const string& subnet =
- "/kea-dhcp6-server:config/subnet6/subnet6[id='111']";
+ const string& xpath =
+ "/kea-dhcp6-server:config/subnet6[id='111']";
S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
- const string& subnet_subnet = subnet + "/subnet";
- EXPECT_NO_THROW(sess_->set_item(subnet_subnet.c_str(), v_subnet));
+ const string& subnet = xpath + "/subnet";
+ EXPECT_NO_THROW(sess_->set_item(subnet.c_str(), v_subnet));
// Set one pool.
- const string& xpath = subnet + "/pools";
ElementPtr pools = Element::createList();
ElementPtr pool = Element::createMap();
pool->set("pool",
@@ -294,21 +290,17 @@ TEST_F(TranslatorPoolsTest, setKea) {
string expected =
"kea-dhcp6-server:config (container)\n"
" |\n"
- " -- subnet6 (container)\n"
+ " -- subnet6 (list instance)\n"
" |\n"
- " -- subnet6 (list instance)\n"
- " |\n"
- " -- id = 111\n"
+ " -- id = 111\n"
+ " |\n"
+ " -- subnet = 2001:db8::/48\n"
+ " |\n"
+ " -- pool (list instance)\n"
" |\n"
- " -- subnet = 2001:db8::/48\n"
+ " -- start-address = 2001:db8::1\n"
" |\n"
- " -- pools (container)\n"
- " |\n"
- " -- pool (list instance)\n"
- " |\n"
- " -- start-address = 2001:db8::1\n"
- " |\n"
- " -- end-address = 2001:db8::100\n";
+ " -- end-address = 2001:db8::100\n";
EXPECT_EQ(expected, tree->to_string(100));
// Check it validates.
diff --git a/src/lib/yang/tests/translator_shared_network_unittests.cc b/src/lib/yang/tests/translator_shared_network_unittests.cc
index 58b44562bf..ad255e75ba 100644
--- a/src/lib/yang/tests/translator_shared_network_unittests.cc
+++ b/src/lib/yang/tests/translator_shared_network_unittests.cc
@@ -44,7 +44,7 @@ TEST_F(TranslatorSharedNetworksTest, getEmpty) {
useModel(KEA_DHCP4_SERVER);
// Get the shared network list and check if it is empty.
- const string& xpath = "/kea-dhcp4-server:config/shared-networks";
+ const string& xpath = "/kea-dhcp4-server:config";
ConstElementPtr networks;
EXPECT_NO_THROW(networks = t_obj_->getSharedNetworks(xpath));
ASSERT_TRUE(networks);
@@ -58,9 +58,9 @@ TEST_F(TranslatorSharedNetworksTest, get) {
useModel(KEA_DHCP6_SERVER);
// Create the subnet 2001:db8::/48 #111 in shared network foo.
- const string& xpath = "/kea-dhcp6-server:config/shared-networks";
+ const string& xpath = "/kea-dhcp6-server:config";
const string& xnetwork = xpath + "/shared-network[name='foo']";
- const string& xsubnet = xnetwork + "/subnet6/subnet6[id='111']/subnet";
+ const string& xsubnet = xnetwork + "/subnet6[id='111']/subnet";
S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
EXPECT_NO_THROW(sess_->set_item(xsubnet.c_str(), v_subnet));
@@ -93,7 +93,7 @@ TEST_F(TranslatorSharedNetworksTest, setEmpty) {
useModel(KEA_DHCP4_SERVER);
// Set empty list.
- const string& xpath = "/kea-dhcp4-server:config/shared-networks";
+ const string& xpath = "/kea-dhcp4-server:config";
ConstElementPtr networks = Element::createList();
EXPECT_NO_THROW(t_obj_->setSharedNetworks(xpath, networks));
@@ -116,7 +116,7 @@ TEST_F(TranslatorSharedNetworksTest, set) {
useModel(KEA_DHCP6_SERVER);
// Set one shared network.
- const string& xpath = "/kea-dhcp6-server:config/shared-networks";
+ const string& xpath = "/kea-dhcp6-server:config";
ElementPtr networks = Element::createList();
ElementPtr share = Element::createMap();
ElementPtr subnets = Element::createList();
@@ -144,19 +144,15 @@ TEST_F(TranslatorSharedNetworksTest, set) {
string expected =
"kea-dhcp6-server:config (container)\n"
" |\n"
- " -- shared-networks (container)\n"
+ " -- shared-network (list instance)\n"
" |\n"
- " -- shared-network (list instance)\n"
+ " -- name = foo\n"
+ " |\n"
+ " -- subnet6 (list instance)\n"
" |\n"
- " -- name = foo\n"
+ " -- id = 123\n"
" |\n"
- " -- subnet6 (container)\n"
- " |\n"
- " -- subnet6 (list instance)\n"
- " |\n"
- " -- id = 123\n"
- " |\n"
- " -- subnet = 2001:db8::/48\n";
+ " -- subnet = 2001:db8::/48\n";
EXPECT_EQ(expected, tree->to_string(100));
// Check it validates.
@@ -175,7 +171,7 @@ TEST_F(TranslatorSharedNetworksTest, set) {
TEST_F(TranslatorSharedNetworksTest, getList) {
useModel(KEA_DHCP6_SERVER);
- const string& xpath = "/kea-dhcp6-server:config/shared-networks";
+ const string& xpath = "/kea-dhcp6-server:config";
// Those two networks will be added.
const string& xnetwork1 = xpath + "/shared-network[name='foo']";
@@ -198,22 +194,22 @@ TEST_F(TranslatorSharedNetworksTest, getList) {
"[ " + exp_net1 + ", " + exp_net2 + " ]";
// Create the subnet1: 2001:db8:1::/48 #1 in shared network foo.
- const string& xsubnet1 = xnetwork1 + "/subnet6/subnet6[id='1']/subnet";
+ const string& xsubnet1 = xnetwork1 + "/subnet6[id='1']/subnet";
S_Val v_subnet1(new Val("2001:db8:1::/48", SR_STRING_T));
EXPECT_NO_THROW(sess_->set_item(xsubnet1.c_str(), v_subnet1));
// Create the subnet2: 2001:db8:2::/48 #2 in shared network foo.
- const string& xsubnet2 = xnetwork1 + "/subnet6/subnet6[id='2']/subnet";
+ const string& xsubnet2 = xnetwork1 + "/subnet6[id='2']/subnet";
S_Val v_subnet2(new Val("2001:db8:2::/48", SR_STRING_T));
EXPECT_NO_THROW(sess_->set_item(xsubnet2.c_str(), v_subnet2));
// Create the subnet1: 2001:db8:101::/48 #101 in shared network foo.
- const string& xsubnet3 = xnetwork2 + "/subnet6/subnet6[id='101']/subnet";
+ const string& xsubnet3 = xnetwork2 + "/subnet6[id='101']/subnet";
S_Val v_subnet(new Val("2001:db8:101::/48", SR_STRING_T));
EXPECT_NO_THROW(sess_->set_item(xsubnet3.c_str(), v_subnet));
// Create the subnet2: 2001:db8:2::/48 #2 in shared network foo.
- const string& xsubnet4 = xnetwork2 + "/subnet6/subnet6[id='102']/subnet";
+ const string& xsubnet4 = xnetwork2 + "/subnet6[id='102']/subnet";
S_Val v_subnet4(new Val("2001:db8:102::/48", SR_STRING_T));
EXPECT_NO_THROW(sess_->set_item(xsubnet4.c_str(), v_subnet4));
diff --git a/src/lib/yang/tests/translator_subnet_unittests.cc b/src/lib/yang/tests/translator_subnet_unittests.cc
index d3adf2f3db..f2d31fd1b4 100644
--- a/src/lib/yang/tests/translator_subnet_unittests.cc
+++ b/src/lib/yang/tests/translator_subnet_unittests.cc
@@ -59,7 +59,7 @@ TEST_F(TranslatorSubnetsTest, getEmptyKea) {
useModel(KEA_DHCP6_SERVER);
// Get the subnet list and check if it is empty.
- const string& xpath = "/kea-dhcp6-server:config/subnet6";
+ const string& xpath = "/kea-dhcp6-server:config";
ConstElementPtr subnets;
EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath));
ASSERT_TRUE(subnets);
@@ -103,7 +103,7 @@ TEST_F(TranslatorSubnetsTest, getKea) {
useModel(KEA_DHCP6_SERVER);
// Create the subnet 2001:db8::/48 #111.
- const string& xpath = "/kea-dhcp6-server:config/subnet6";
+ const string& xpath = "/kea-dhcp6-server:config";
const string& xsub = xpath + "/subnet6[id='111']";
S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
const string& xsubnet = xsub + "/subnet";
@@ -189,21 +189,20 @@ TEST_F(TranslatorSubnetsTest, getPoolsKea) {
useModel(KEA_DHCP6_SERVER);
// Create the subnet 2001:db8::/48 #111.
- const string& xpath = "/kea-dhcp6-server:config/subnet6";
+ const string& xpath = "/kea-dhcp6-server:config";
const string& xsub = xpath + "/subnet6[id='111']";
S_Val v_subnet(new Val("2001:db8::/48", SR_STRING_T));
const string& xsubnet = xsub + "/subnet";
EXPECT_NO_THROW(sess_->set_item(xsubnet.c_str(), v_subnet));
// Create the pool 2001:db8::1:0/112.
- const string& xpool = xsub + "/pools";
- const string& prefix1 = xpool + "/pool[start-address='2001:db8::1:0']" +
+ const string& prefix1 = xsub + "/pool[start-address='2001:db8::1:0']" +
"[end-address='2001:db8::1:ffff']/prefix";
S_Val s_pool1(new Val("2001:db8::1:0/112", SR_STRING_T));
EXPECT_NO_THROW(sess_->set_item(prefix1.c_str(), s_pool1));
// Create the pool 2001:db8::2:0/112.
- const string& prefix2 = xpool + "/pool[start-address='2001:db8::2:0']" +
+ const string& prefix2 = xsub + "/pool[start-address='2001:db8::2:0']" +
"[end-address='2001:db8::2:ffff']";
S_Val s_pool2;
EXPECT_NO_THROW(sess_->set_item(prefix2.c_str(), s_pool2));
@@ -270,7 +269,7 @@ TEST_F(TranslatorSubnetsTest, setEmptyKea) {
useModel(KEA_DHCP4_SERVER);
// Set empty list.
- const string& xpath = "/kea-dhcp4-server:config/subnet4";
+ const string& xpath = "/kea-dhcp4-server:config";
ElementPtr subnets = Element::createList();
EXPECT_NO_THROW(t_obj_->setSubnets(xpath, subnets));
@@ -318,7 +317,7 @@ TEST_F(TranslatorSubnetsTest, setKea) {
useModel(KEA_DHCP4_SERVER);
// Set one subnet.
- const string& xpath = "/kea-dhcp4-server:config/subnet4";
+ const string& xpath = "/kea-dhcp4-server:config";
ElementPtr subnets = Element::createList();
ElementPtr subnet = Element::createMap();
subnet->set("subnet", Element::create(string("10.0.1.0/24")));
@@ -424,7 +423,7 @@ TEST_F(TranslatorSubnetsTest, setTwoKea) {
useModel(KEA_DHCP4_SERVER);
// Set one subnet.
- const string& xpath = "/kea-dhcp4-server:config/subnet4";
+ const string& xpath = "/kea-dhcp4-server:config";
ElementPtr subnets = Element::createList();
ElementPtr subnet = Element::createMap();
subnet->set("subnet", Element::create(string("10.0.1.0/24")));
@@ -459,29 +458,25 @@ TEST_F(TranslatorSubnetsTest, setTwoKea) {
string expected =
"kea-dhcp4-server:config (container)\n"
" |\n"
- " -- subnet4 (container)\n"
+ " -- subnet4 (list instance)\n"
" |\n"
- " -- subnet4 (list instance)\n"
- " |\n"
- " -- id = 123\n"
- " |\n"
- " -- pools (container)\n"
- " | |\n"
- " | -- pool (list instance)\n"
- " | | |\n"
- " | | -- start-address = 10.0.1.0\n"
- " | | |\n"
- " | | -- end-address = 10.0.1.15\n"
- " | | |\n"
- " | | -- prefix = 10.0.1.0/28\n"
- " | |\n"
- " | -- pool (list instance)\n"
- " | |\n"
- " | -- start-address = 10.0.1.200\n"
- " | |\n"
- " | -- end-address = 10.0.1.222\n"
- " |\n"
- " -- subnet = 10.0.1.0/24\n";
+ " -- id = 123\n"
+ " |\n"
+ " -- pool (list instance)\n"
+ " | |\n"
+ " | -- start-address = 10.0.1.0\n"
+ " | |\n"
+ " | -- end-address = 10.0.1.15\n"
+ " | |\n"
+ " | -- prefix = 10.0.1.0/28\n"
+ " |\n"
+ " -- pool (list instance)\n"
+ " | |\n"
+ " | -- start-address = 10.0.1.200\n"
+ " | |\n"
+ " | -- end-address = 10.0.1.222\n"
+ " |\n"
+ " -- subnet = 10.0.1.0/24\n";
EXPECT_EQ(expected, tree->to_string(100));
// Check it validates.
diff --git a/src/lib/yang/tests/yang_configs.h b/src/lib/yang/tests/yang_configs.h
index 8711bfb129..c0b2f845d9 100644
--- a/src/lib/yang/tests/yang_configs.h
+++ b/src/lib/yang/tests/yang_configs.h
@@ -289,45 +289,40 @@ const YRTree validTreeIetf6 = {
const std::string subnetOptionsModelKeaDhcp4 = KEA_DHCP4_SERVER;
const YRTree subnetOptionsTreeKeaDhcp4 = {
{ "/kea-dhcp4-server:config", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4", "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']", "",
+ { "/kea-dhcp4-server:config/subnet4[id='111']", "",
SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/id",
+ { "/kea-dhcp4-server:config/subnet4[id='111']/id",
"111", SR_UINT32_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/option-data-list",
- "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/option-data-list/"
+ { "/kea-dhcp4-server:config/subnet4[id='111']/"
"option-data[code='100'][space='dns']", "", SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/option-data-list/"
+ { "/kea-dhcp4-server:config/subnet4[id='111']/"
"option-data[code='100'][space='dns']/code",
"100", SR_UINT8_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/option-data-list/"
+ { "/kea-dhcp4-server:config/subnet4[id='111']/"
"option-data[code='100'][space='dns']/space",
"dns", SR_STRING_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/option-data-list/"
+ { "/kea-dhcp4-server:config/subnet4[id='111']/"
"option-data[code='100'][space='dns']/data",
"12121212", SR_STRING_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/option-data-list/"
+ { "/kea-dhcp4-server:config/subnet4[id='111']/"
"option-data[code='100'][space='dns']/csv-format",
"false", SR_BOOL_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/option-data-list/"
+ { "/kea-dhcp4-server:config/subnet4[id='111']/"
"option-data[code='100'][space='dns']/always-send",
"false", SR_BOOL_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/pools",
- "", SR_CONTAINER_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/pools/"
+ { "/kea-dhcp4-server:config/subnet4[id='111']/"
"pool[start-address='10.0.1.0'][end-address='10.0.1.255']",
"", SR_LIST_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/pools/"
+ { "/kea-dhcp4-server:config/subnet4[id='111']/"
"pool[start-address='10.0.1.0'][end-address='10.0.1.255']/start-address",
"10.0.1.0", SR_STRING_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/pools/"
+ { "/kea-dhcp4-server:config/subnet4[id='111']/"
"pool[start-address='10.0.1.0'][end-address='10.0.1.255']/end-address",
"10.0.1.255", SR_STRING_T, false },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/pools/"
+ { "/kea-dhcp4-server:config/subnet4[id='111']/"
"pool[start-address='10.0.1.0'][end-address='10.0.1.255']/prefix",
"10.0.1.0/24", SR_STRING_T, true },
- { "/kea-dhcp4-server:config/subnet4/subnet4[id='111']/subnet",
+ { "/kea-dhcp4-server:config/subnet4[id='111']/subnet",
"10.0.0.0/8", SR_STRING_T, true }
};
@@ -336,53 +331,47 @@ const YRTree subnetOptionsTreeKeaDhcp4 = {
const std::string subnetOptionsModelKeaDhcp6 = KEA_DHCP6_SERVER;
const YRTree subnetOptionsTreeKeaDhcp6 = {
{ "/kea-dhcp6-server:config", "", SR_CONTAINER_T, false },
- { "/kea-dhcp6-server:config/subnet6", "", SR_CONTAINER_T, false },
- { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']", "",
+ { "/kea-dhcp6-server:config/subnet6[id='111']", "",
SR_LIST_T, true },
- { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/id",
+ { "/kea-dhcp6-server:config/subnet6[id='111']/id",
"111", SR_UINT32_T, false },
- { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools",
- "", SR_CONTAINER_T, false },
- { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+ { "/kea-dhcp6-server:config/subnet6[id='111']/"
"pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']",
"", SR_LIST_T, true },
- { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+ { "/kea-dhcp6-server:config/subnet6[id='111']/"
"pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
"start-address", "2001:db8::1:0", SR_STRING_T, false },
- { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+ { "/kea-dhcp6-server:config/subnet6[id='111']/"
"pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
"end-address", "2001:db8::1:ffff", SR_STRING_T, false },
- { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+ { "/kea-dhcp6-server:config/subnet6[id='111']/"
"pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
"prefix", "2001:db8::1:0/112", SR_STRING_T, true },
- { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+ { "/kea-dhcp6-server:config/subnet6[id='111']/"
"pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
- "option-data-list", "", SR_CONTAINER_T, false },
- { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
- "pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
- "option-data-list/option-data[code='100'][space='dns']",
+ "option-data[code='100'][space='dns']",
"", SR_LIST_T, true },
- { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+ { "/kea-dhcp6-server:config/subnet6[id='111']/"
"pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
- "option-data-list/option-data[code='100'][space='dns']/code",
+ "option-data[code='100'][space='dns']/code",
"100", SR_UINT16_T, false },
- { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+ { "/kea-dhcp6-server:config/subnet6[id='111']/"
"pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
- "option-data-list/option-data[code='100'][space='dns']/space",
+ "option-data[code='100'][space='dns']/space",
"dns", SR_STRING_T, false },
- { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+ { "/kea-dhcp6-server:config/subnet6[id='111']/"
"pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
- "option-data-list/option-data[code='100'][space='dns']/data",
+ "option-data[code='100'][space='dns']/data",
"12121212", SR_STRING_T, true },
- { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+ { "/kea-dhcp6-server:config/subnet6[id='111']/"
"pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
- "option-data-list/option-data[code='100'][space='dns']/csv-format",
+ "option-data[code='100'][space='dns']/csv-format",
"false", SR_BOOL_T, true },
- { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/"
+ { "/kea-dhcp6-server:config/subnet6[id='111']/"
"pool[start-address='2001:db8::1:0'][end-address='2001:db8::1:ffff']/"
- "option-data-list/option-data[code='100'][space='dns']/always-send",
+ "option-data[code='100'][space='dns']/always-send",
"false", SR_BOOL_T, true },
- { "/kea-dhcp6-server:config/subnet6/subnet6[id='111']/subnet",
+ { "/kea-dhcp6-server:config/subnet6[id='111']/subnet",
"2001:db8::/48", SR_STRING_T, true }
};
diff --git a/src/lib/yang/translator_class.cc b/src/lib/yang/translator_class.cc
index 5774a794b4..88f97cd461 100644
--- a/src/lib/yang/translator_class.cc
+++ b/src/lib/yang/translator_class.cc
@@ -64,12 +64,12 @@ TranslatorClass::getClassKea(const string& xpath) {
if (required) {
result->set("only-if-required", required);
}
- ConstElementPtr options = getOptionDataList(xpath + "/option-data-list");
+ ConstElementPtr options = getOptionDataList(xpath);
if (options && (options->size() > 0)) {
result->set("option-data", options);
}
if (model_ == KEA_DHCP4_SERVER) {
- ConstElementPtr defs = getOptionDefList(xpath +"/option-def-list");
+ ConstElementPtr defs = getOptionDefList(xpath);
if (defs && (defs->size() > 0)) {
result->set("option-def", defs);
}
@@ -126,13 +126,13 @@ TranslatorClass::setClassKea(const string& xpath, ConstElementPtr elem) {
}
ConstElementPtr options = elem->get("option-data");
if (options) {
- setOptionDataList(xpath + "/option-data-list", options);
+ setOptionDataList(xpath, options);
created = true;
}
if (model_ == KEA_DHCP4_SERVER) {
ConstElementPtr defs = elem->get("option-def");
if (defs) {
- setOptionDefList(xpath + "/option-def-list", defs);
+ setOptionDefList(xpath, defs);
created = true;
}
ConstElementPtr next = elem->get("next-server");
@@ -194,7 +194,7 @@ TranslatorClasses::getClasses(const string& xpath) {
ElementPtr
TranslatorClasses::getClassesKea(const string& xpath) {
- S_Iter_Value iter = getIter(xpath + "/*");
+ S_Iter_Value iter = getIter(xpath + "/client-class");
if (!iter) {
// Can't happen.
isc_throw(Unexpected, "getClassesKea: can't get iterator: " << xpath);
diff --git a/src/lib/yang/translator_class.h b/src/lib/yang/translator_class.h
index 15de324531..a027d4a724 100644
--- a/src/lib/yang/translator_class.h
+++ b/src/lib/yang/translator_class.h
@@ -38,8 +38,8 @@ namespace yang {
/// +--rw name string
/// +--rw test? string
/// +--rw only-if-required? boolean
-/// +--rw option-data-list option-data*
-/// +--rw option-def-list option-def*
+/// +--rw option-data*
+/// +--rw option-def*
/// +--rw next-server? inet:ipv4-address
/// +--rw server-hostname? string
/// +--rw boot-file-name? string
@@ -58,15 +58,10 @@ namespace yang {
/// @endcode
/// @code
/// /kea-dhcp6-server:config (container)
-/// /kea-dhcp6-server:config/client-classes (container)
-/// /kea-dhcp6-server:config/client-classes/
-/// client-class[name='foo'] (list instance)
-/// /kea-dhcp6-server:config/client-classes/
-/// client-class[name='foo']/name = foo
-/// /kea-dhcp6-server:config/client-classes/
-/// client-class[name='foo']/test = ''==''
-/// /kea-dhcp6-server:config/client-classes/
-/// client-class[name='foo']/ only-if-required = false
+/// /kea-dhcp6-server:config/client-class[name='foo'] (list instance)
+/// /kea-dhcp6-server:config/client-class[name='foo']/name = foo
+/// /kea-dhcp6-server:config/client-class[name='foo']/test = ''==''
+/// /kea-dhcp6-server:config/client-class[name='foo']/only-if-required = false
/// @endcode
/// @brief A translator class for converting a client class between
diff --git a/src/lib/yang/translator_config.cc b/src/lib/yang/translator_config.cc
index 1f5c2207ef..8f183548a6 100644
--- a/src/lib/yang/translator_config.cc
+++ b/src/lib/yang/translator_config.cc
@@ -71,7 +71,8 @@ TranslatorConfig::getConfigIetf6() {
ElementPtr dhcp6 = Element::createMap();
result->set("Dhcp6", dhcp6);
string xpath = "/" + model_ + ":server/server-config";
- ConstElementPtr ranges = getSubnets(xpath + "/network-ranges");
+ ConstElementPtr ranges =
+ getSubnets(xpath + "/network-ranges");
if (ranges && !ranges->empty()) {
dhcp6->set("subnet6", ranges);
}
@@ -82,9 +83,14 @@ TranslatorConfig::getConfigIetf6() {
ElementPtr
TranslatorConfig::getConfigKea4() {
ElementPtr result = Element::createMap();
- result->set("Dhcp4", getServerKeaDhcp4());
- ConstElementPtr logging = getServerKeaLogging();
- if (logging && !logging->empty()) {
+ ElementPtr dhcp = getServerKeaDhcp4();
+ result->set("Dhcp4", dhcp);
+ ConstElementPtr loggers = dhcp->get("loggers");
+ if (loggers) {
+ dhcp->remove("loggers");
+
+ ElementPtr logging = Element::createMap();
+ logging->set("loggers", loggers);
result->set("Logging", logging);
}
return (result);
@@ -93,9 +99,14 @@ TranslatorConfig::getConfigKea4() {
ElementPtr
TranslatorConfig::getConfigKea6() {
ElementPtr result = Element::createMap();
- result->set("Dhcp6", getServerKeaDhcp6());
- ConstElementPtr logging = getServerKeaLogging();
- if (logging && !logging->empty()) {
+ ElementPtr dhcp = getServerKeaDhcp6();
+ result->set("Dhcp6", dhcp);
+ ConstElementPtr loggers = dhcp->get("loggers");
+ if (loggers) {
+ dhcp->remove("loggers");
+
+ ElementPtr logging = Element::createMap();
+ logging->set("loggers", loggers);
result->set("Logging", logging);
}
return (result);
@@ -111,8 +122,8 @@ TranslatorConfig::getParam(ElementPtr& storage, const std::string& xpath,
}
ElementPtr
-TranslatorConfig::getHooksKea(std::string xpath) {
- S_Iter_Value iter = getIter(xpath + "/*");
+TranslatorConfig::getHooksKea(const std::string& xpath) {
+ S_Iter_Value iter = getIter(xpath + "/hook-library");
if (iter) {
ElementPtr hook_libs = Element::createList();
for (;;) {
@@ -143,7 +154,7 @@ TranslatorConfig::getHooksKea(std::string xpath) {
}
isc::data::ElementPtr
-TranslatorConfig::getExpiredKea(std::string xpath) {
+TranslatorConfig::getExpiredKea(const std::string& xpath) {
ElementPtr expired = Element::createMap();
getParam(expired, xpath, "reclaim-timer-wait-time");
@@ -161,7 +172,7 @@ TranslatorConfig::getExpiredKea(std::string xpath) {
}
isc::data::ElementPtr
-TranslatorConfig::getDdnsKea(std::string xpath) {
+TranslatorConfig::getDdnsKea(const std::string& xpath) {
ElementPtr ddns = Element::createMap();
getParam(ddns, xpath, "enable-updates");
getParam(ddns, xpath, "qualifying-suffix");
@@ -189,7 +200,23 @@ TranslatorConfig::getDdnsKea(std::string xpath) {
return (ddns);
}
- // If not, return null
+ // If not, return null.
+ return (ElementPtr());
+}
+
+ElementPtr
+TranslatorConfig::getConfigControlKea(const string& xpath) {
+ ElementPtr config_ctrl = Element::createMap();
+ ConstElementPtr databases = getDatabases(xpath + "/config-database");
+ if (databases && !databases->empty()) {
+ config_ctrl->set("config-databases", databases);
+ }
+ if (!config_ctrl->empty()) {
+ // If there's something to return, use it.
+ return (config_ctrl);
+ }
+
+ // If not, return null.
return (ElementPtr());
}
@@ -202,11 +229,11 @@ TranslatorConfig::getServerKeaDhcpCommon(const string& xpath) {
getParam(result, xpath, "rebind-timer");
getParam(result, xpath, "decline-probation-period");
- ConstElementPtr networks = getSharedNetworks(xpath + "/shared-networks");
+ ConstElementPtr networks = getSharedNetworks(xpath);
if (networks && !networks->empty()) {
result->set("shared-networks", networks);
}
- ConstElementPtr classes = getClasses(xpath + "/client-classes");
+ ConstElementPtr classes = getClasses(xpath);
if (classes && !classes->empty()) {
result->set("client-classes", classes);
}
@@ -214,7 +241,7 @@ TranslatorConfig::getServerKeaDhcpCommon(const string& xpath) {
if (database) {
result->set("lease-database", database);
}
- ConstElementPtr databases = getDatabases(xpath + "/hosts-databases");
+ ConstElementPtr databases = getDatabases(xpath + "/hosts-database");
if (databases && !databases->empty()) {
result->set("hosts-databases", databases);
}
@@ -223,15 +250,15 @@ TranslatorConfig::getServerKeaDhcpCommon(const string& xpath) {
if (host_ids) {
result->set("host-reservation-identifiers", host_ids);
}
- ConstElementPtr defs = getOptionDefList(xpath + "/option-def-list");
+ ConstElementPtr defs = getOptionDefList(xpath);
if (defs && !defs->empty()) {
result->set("option-def", defs);
}
- ConstElementPtr options = getOptionDataList(xpath + "/option-data-list");
+ ConstElementPtr options = getOptionDataList(xpath);
if (options && !options->empty()) {
result->set("option-data", options);
}
- ConstElementPtr hooks = getHooksKea(xpath + "/hooks-libraries");
+ ConstElementPtr hooks = getHooksKea(xpath);
if (hooks && !hooks->empty()) {
result->set("hooks-libraries", hooks);
}
@@ -259,10 +286,26 @@ TranslatorConfig::getServerKeaDhcpCommon(const string& xpath) {
sanity->set("lease-checks", checks);
result->set("sanity-checks", sanity);
}
- ConstElementPtr hosts = getHosts(xpath + "/reservations");
+ getParam(result, xpath, "reservation-mode");
+ ConstElementPtr hosts = getHosts(xpath);
if (hosts && !hosts->empty()) {
result->set("reservations", hosts);
}
+ ConstElementPtr config_ctrl =
+ getConfigControlKea(xpath + "/config-control");
+ if (config_ctrl) {
+ result->set("config-control", config_ctrl);
+ }
+ getParam(result, xpath, "server-tag");
+ ConstElementPtr queue_ctrl = getItem(xpath + "/dhcp-queue-control");
+ if (queue_ctrl) {
+ result->set("dhcp-queue-control",
+ Element::fromJSON(queue_ctrl->stringValue()));
+ }
+ ConstElementPtr loggers = getLoggers(xpath);
+ if (loggers && !loggers->empty()) {
+ result->set("loggers", loggers);
+ }
return (result);
}
@@ -271,7 +314,7 @@ TranslatorConfig::getServerKeaDhcp4() {
string xpath = "/kea-dhcp4-server:config";
ElementPtr result = getServerKeaDhcpCommon(xpath);
// Handle subnets.
- ConstElementPtr subnets = getSubnets(xpath + "/subnet4");
+ ConstElementPtr subnets = getSubnets(xpath);
if (subnets && !subnets->empty()) {
result->set("subnet4", subnets);
}
@@ -299,6 +342,7 @@ TranslatorConfig::getServerKeaDhcp4() {
getParam(result, xpath, "next-server");
getParam(result, xpath, "server-hostname");
getParam(result, xpath, "boot-file-name");
+ getParam(result, xpath, "authoritative");
return (result);
}
@@ -309,7 +353,7 @@ TranslatorConfig::getServerKeaDhcp6() {
// Handle DHCPv6 specific global parameters.
getParam(result, xpath, "preferred-lifetime");
// Handle subnets.
- ConstElementPtr subnets = getSubnets(xpath + "/subnet6");
+ ConstElementPtr subnets = getSubnets(xpath);
if (subnets && !subnets->empty()) {
result->set("subnet6", subnets);
}
@@ -358,17 +402,6 @@ TranslatorConfig::getServerKeaDhcp6() {
return (result);
}
-ElementPtr
-TranslatorConfig::getServerKeaLogging() {
- string xpath = "/" + model_ + ":logging";
- ElementPtr result = Element::createMap();
- ConstElementPtr loggers = getLoggers(xpath + "/loggers");
- if (loggers && !loggers->empty()) {
- result->set("loggers", loggers);
- }
- return (result);
-}
-
void
TranslatorConfig::setConfig(ConstElementPtr elem) {
try {
@@ -426,7 +459,6 @@ TranslatorConfig::setConfigIetf6(ConstElementPtr elem) {
void
TranslatorConfig::delConfigKea() {
delItem("/" + model_ + ":config");
- delItem("/" + model_ + ":logging");
}
void
@@ -474,11 +506,11 @@ TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
}
ConstElementPtr networks = elem->get("shared-networks");
if (networks) {
- setSharedNetworks(xpath + "/shared-networks", networks);
+ setSharedNetworks(xpath, networks);
}
ConstElementPtr classes = elem->get("client-classes");
if (classes && !classes->empty()) {
- setClasses(xpath + "/client-classes", classes);
+ setClasses(xpath, classes);
}
ConstElementPtr database = elem->get("lease-database");
if (database) {
@@ -486,14 +518,14 @@ TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
}
ConstElementPtr databases = elem->get("hosts-databases");
if (databases && !databases->empty()) {
- setDatabases(xpath + "/hosts-databases", databases);
+ setDatabases(xpath + "/hosts-database", databases);
} else {
// Reuse of database from lease-database.
database = elem->get("hosts-database");
if (database) {
ElementPtr list = Element::createList();
list->add(copy(database));
- setDatabases(xpath + "/hosts-databases", list);
+ setDatabases(xpath + "/hosts-database", list);
}
}
ConstElementPtr host_ids = elem->get("host-reservation-identifiers");
@@ -504,11 +536,11 @@ TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
}
ConstElementPtr defs = elem->get("option-def");
if (defs && !defs->empty()) {
- setOptionDefList(xpath + "/option-def-list", defs);
+ setOptionDefList(xpath, defs);
}
ConstElementPtr options = elem->get("option-data");
if (options && !options->empty()) {
- setOptionDataList(xpath + "/option-data-list", options);
+ setOptionDataList(xpath, options);
}
ConstElementPtr hook_libs = elem->get("hooks-libraries");
if (hook_libs) {
@@ -518,7 +550,7 @@ TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
continue;
}
ostringstream hook_lib;
- hook_lib << xpath << "/hooks-libraries/hook-library[library='"
+ hook_lib << xpath << "/hook-library[library='"
<< name->stringValue() << "']";
ConstElementPtr params = lib->get("parameters");
if (params) {
@@ -661,9 +693,29 @@ TranslatorConfig::setServerKeaDhcpCommon(const string& xpath,
setItem(xpath + "/sanity-checks/lease-checks", checks, SR_ENUM_T);
}
}
+ ConstElementPtr hr_mode = elem->get("reservation-mode");
+ if (hr_mode) {
+ setItem(xpath + "/reservation-mode", hr_mode, SR_ENUM_T);
+ }
ConstElementPtr hosts = elem->get("reservations");
if (hosts && !hosts->empty()) {
- setHosts(xpath + "/reservations", hosts);
+ setHosts(xpath, hosts);
+ }
+ ConstElementPtr config_ctrl = elem->get("config-control");
+ if (config_ctrl && !config_ctrl->empty()) {
+ databases = config_ctrl->get("config-databases");
+ if (databases && !databases->empty()) {
+ setDatabases(xpath + "/config-control/config-database", databases);
+ }
+ }
+ ConstElementPtr server_tag = elem->get("server-tag");
+ if (server_tag) {
+ setItem(xpath + "/server-tag", server_tag, SR_STRING_T);
+ }
+ ConstElementPtr queue_ctrl = elem->get("dhcp-queue-control");
+ if (queue_ctrl) {
+ ConstElementPtr repr = Element::create(queue_ctrl->str());
+ setItem(xpath + "/dhcp-queue-control", repr, SR_STRING_T);
}
}
@@ -673,7 +725,7 @@ TranslatorConfig::setServerKeaDhcp4(ConstElementPtr elem) {
setServerKeaDhcpCommon(xpath, elem);
ConstElementPtr subnets = elem->get("subnet4");
if (subnets) {
- setSubnets(xpath + "/subnet4", subnets);
+ setSubnets(xpath, subnets);
}
ConstElementPtr if_config = elem->get("interfaces-config");
if (if_config) {
@@ -725,6 +777,10 @@ TranslatorConfig::setServerKeaDhcp4(ConstElementPtr elem) {
if (boot) {
setItem(xpath + "/boot-file-name", boot, SR_STRING_T);
}
+ ConstElementPtr auth = elem->get("authoritative");
+ if (auth) {
+ setItem(xpath + "/authoritative", auth, SR_BOOL_T);
+ }
}
void
@@ -737,7 +793,7 @@ TranslatorConfig::setServerKeaDhcp6(ConstElementPtr elem) {
}
ConstElementPtr subnets = elem->get("subnet6");
if (subnets) {
- setSubnets(xpath + "/subnet6", subnets);
+ setSubnets(xpath, subnets);
}
ConstElementPtr if_config = elem->get("interfaces-config");
if (if_config) {
@@ -808,10 +864,10 @@ TranslatorConfig::setServerKeaDhcp6(ConstElementPtr elem) {
void
TranslatorConfig::setServerKeaLogging(ConstElementPtr elem) {
- string xpath = "/" + model_ + ":logging";
+ string xpath = "/" + model_ + ":config";
ConstElementPtr loggers = elem->get("loggers");
if (loggers) {
- setLoggers(xpath + "/loggers", loggers);
+ setLoggers(xpath, loggers);
}
}
diff --git a/src/lib/yang/translator_config.h b/src/lib/yang/translator_config.h
index ead115f006..faaca35bbe 100644
--- a/src/lib/yang/translator_config.h
+++ b/src/lib/yang/translator_config.h
@@ -51,10 +51,15 @@ namespace yang {
/// "next-server": <next server address>,
/// "server-hostname": <server hostname>,
/// "boot-file-name": <boot file name>,
+/// "authoritative": <authoritative flag>,
/// <user-context>,
/// <comment>,
/// "sanity-checks": { <sanity checks> },
-/// "reservations": [ <list of host reservations> ]
+/// "reservation-mode": <host reservation mode>,
+/// "reservations": [ <list of host reservations> ],
+/// <config-control>,
+/// "server-tag": <server tag>,
+/// "dhcp-queue-control": { <DHCP queue control> }
/// },
/// "Logging": <logging>
/// @endcode
@@ -65,8 +70,8 @@ namespace yang {
/// +--rw renew-timer? uint32
/// +--rw rebind-timer? uint32
/// +--rw decline-probation-period? uint32
-/// +--rw subnet4 subnet4*
-/// +--rw shared-networks shared-network*
+/// +--rw subnet4*
+/// +--rw shared-network*
/// +--rw interfaces-config
/// +--rw interfaces* string
/// +--rw dhcp-socket-type? enumeration
@@ -74,11 +79,11 @@ namespace yang {
/// +--rw re-detect? boolean
/// +--rw user-context? string
/// +--rw lease-database! <database>
-/// +--rw hosts-databases hosts-database*
+/// +--rw hosts-database*
/// +--rw host-reservation-identifiers* enumeration
-/// +--rw client-classes client-class*
-/// +--rw option-def-list option-def*
-/// +--rw option-data-list option-data*
+/// +--rw client-class*
+/// +--rw option-def*
+/// +--rw option-data*
/// +--rw hook-library*
/// +--rw library string
/// +--rw parameters? string
@@ -91,9 +96,17 @@ namespace yang {
/// +--rw next-server? inet:ipv4-address
/// +--rw server-hostname? string
/// +--rw boot-file-name? string
+/// +--rw authoritative? boolean
/// +--rw user-context? string
/// +--rw sanity-checks
/// +--rw lease-checks? enumeration
+/// +--rw reservation-mode? enumeration
+/// +--rw host*
+/// +--rw config-control
+/// +--rw config-database*
+/// +--rw server-tag string
+/// +--rw dhcp-queue-control string
+/// +--rw logger*
/// @endcode
///
/// Example of kea-dhcp6 simple configuration:
@@ -130,17 +143,13 @@ namespace yang {
/// @code
/// <config xmlns="urn:ietf:params:xml:ns:yang:kea-dhcp4-server">
/// <subnet4>
-/// <subnet4>
-/// <id>1</id>
-/// <pools>
-/// <pool>
-/// <start-address>10.0.35.64</start-address>
-/// <end-address>10.0.35.95</end-address>
-/// <prefix>10.0.35.64/27</prefix>
-/// </pool>
-/// </pools>
-/// <subnet>10.0.35.0/24</subnet>
-/// </subnet4>
+/// <id>1</id>
+/// <pool>
+/// <start-address>10.0.35.64</start-address>
+/// <end-address>10.0.35.95</end-address>
+/// <prefix>10.0.35.64/27</prefix>
+/// </pool>
+/// <subnet>10.0.35.0/24</subnet>
/// </subnet4>
/// <interfaces-config>
/// <interfaces>eth1</interfaces>
@@ -182,7 +191,11 @@ namespace yang {
/// <user-context>,
/// <comment>
/// "sanity-checks": { <sanity checks> },
-/// "reservations": [ <list of host reservations> ]
+/// "reservation-mode": <host reservation mode>,
+/// "reservations": [ <list of host reservations> ],
+/// <config-control>,
+/// "server-tag": <server tag>,
+/// "dhcp-queue-control": { <DHCP queue control> }
/// },
/// "Logging": <logging>
/// @endcode
@@ -194,20 +207,20 @@ namespace yang {
/// +--rw renew-timer? uint32
/// +--rw rebind-timer? uint32
/// +--rw decline-probation-period? uint32
-/// +--rw subnet6 subnet6*
-/// +--rw shared-networks shared-network*
+/// +--rw subnet6*
+/// +--rw shared-network*
/// +--rw interfaces-config
/// +--rw interfaces* string
/// +--rw re-detect? boolean
/// +--rw user-context? string
/// +--rw lease-database! <database>
-/// +--rw hosts-databases hosts-database*
+/// +--rw hosts-database*
/// +--rw relay-supplied-options* string
/// +--rw mac-sources* string
/// +--rw host-reservation-identifiers* enumeration
-/// +--rw client-classes client-class*
-/// +--rw option-def-list option-def*
-/// +--rw option-data-list option-data*
+/// +--rw client-class*
+/// +--rw option-def*
+/// +--rw option-data*
/// +--rw hook-library*
/// +--rw library string
/// +--rw parameters? string
@@ -220,6 +233,13 @@ namespace yang {
/// +--rw user-context? string
/// +--rw sanity-checks
/// +--rw lease-checks? enumeration
+/// +--rw reservation-mode? enumeration
+/// +--rw host*
+/// +--rw config-control
+/// +--rw config-database*
+/// +--rw server-tag string
+/// +--rw dhcp-queue-control string
+/// +--rw logger*
/// @endcode
///
/// Example of kea-dhcp6 simple configuration:
@@ -255,17 +275,13 @@ namespace yang {
/// @code
/// <config xmlns="urn:ietf:params:xml:ns:yang:kea-dhcp6-server">
/// <subnet6>
-/// <subnet6>
-/// <id>1</id>
-/// <pools>
-/// <pool>
-/// <start-address>2001:db8::1:0</start-address>
-/// <end-address>2001:db8::1:ffff</end-address>
-/// <prefix>2001:db8::1:0/112</prefix>
-/// </pool>
-/// </pools>
-/// <subnet>2001:db8::/64</subnet>
-/// </subnet6>
+/// <id>1</id>
+/// <pool>
+/// <start-address>2001:db8::1:0</start-address>
+/// <end-address>2001:db8::1:ffff</end-address>
+/// <prefix>2001:db8::1:0/112</prefix>
+/// </pool>
+/// <subnet>2001:db8::/64</subnet>
/// </subnet6>
/// <interfaces-config>
/// <interfaces>eth1</interfaces>
@@ -284,15 +300,10 @@ namespace yang {
/// }
/// @endcode
///
-/// YANG syntax for kea-*:logging is:
-/// @code
-/// +--rw logging
-/// +--rw loggers
-/// @endcode
-///
/// Example of Logging simple configuration:
/// @code
/// {
+/// ...
/// "Logging":
/// {
/// "loggers":
@@ -316,23 +327,20 @@ namespace yang {
/// The same configuration wrote into YANG datastore using @c setConfig()
/// with a kea server model and exported to XML format:
/// @code
-/// <logging xmlns="urn:ietf:params:xml:ns:yang:kea-dhcp4-server">
-/// <loggers>
-/// <logger>
-/// <name>kea-dhcp6</name>
-/// <output-options>
-/// <option>
-/// <output>stderr</output>
-/// </option>
-/// </output-options>
-/// <debuglevel>99</debuglevel>
-/// <severity>DEBUG</severity>
-/// </logger>
-/// </loggers>
-/// </logging>
+/// <config xmlns="urn:ietf:params:xml:ns:yang:kea-dhcp4-server">
+/// ...
+/// <logger>
+/// <name>kea-dhcp6</name>
+/// <output-options>
+/// <option>
+/// <output>stderr</output>
+/// </option>
+/// </output-options>
+/// <debuglevel>99</debuglevel>
+/// <severity>DEBUG</severity>
+/// </logger>
+/// </config>
/// @endcode
-///
-/// Note that sysrepo uses one XML document per container in the model.
/// Inheritance graph between translators is:
///
@@ -381,7 +389,6 @@ namespace yang {
/// Currently supports the following models:
/// - kea-dhcp4-server
/// - kea-dhcp6-server
-/// - kea-logging
/// - ietf-dhcpv6-server (partial)
class TranslatorConfig : virtual public TranslatorControlSocket,
virtual public TranslatorDatabases,
@@ -470,12 +477,6 @@ protected:
/// @throw SysrepoError when sysrepo raises an error.
isc::data::ElementPtr getServerKeaDhcp6();
- /// @brief getServer for kea-*:logging.
- ///
- /// @return JSON representation of the config.
- /// @throw SysrepoError when sysrepo raises an error.
- isc::data::ElementPtr getServerKeaLogging();
-
/// @brief delConfig for kea-dhcp[46]-server.
void delConfigKea();
@@ -496,23 +497,29 @@ protected:
void setServerKeaDhcpCommon(const std::string& xpath,
isc::data::ConstElementPtr elem);
- /// @brief Retrieves hooks configuration from sysrepo
+ /// @brief Retrieves hooks configuration from sysrepo.
///
- /// @param xpath path to hooks configuration
- /// @return ElementList with hooks configuration
- isc::data::ElementPtr getHooksKea(std::string xpath);
+ /// @param xpath path to hooks configuration.
+ /// @return ElementList with hooks configuration.
+ isc::data::ElementPtr getHooksKea(const std::string& xpath);
- /// @brief Retrieves expired leases processing parameters from sysrepo
+ /// @brief Retrieves expired leases processing parameters from sysrepo.
///
- /// @param xpath path to expired leases configuration
- /// @return ElementList with expired leases configuration
- isc::data::ElementPtr getExpiredKea(std::string xpath);
+ /// @param xpath path to expired leases configuration.
+ /// @return ElementList with expired leases configuration.
+ isc::data::ElementPtr getExpiredKea(const std::string& xpath);
/// @brief Retrieves DDNS configuration from sysrepo
///
- /// @param xpath path to dhcp-ddns configuration
- /// @return ElementList with dhcp-ddns configuration
- isc::data::ElementPtr getDdnsKea(std::string xpath);
+ /// @param xpath path to dhcp-ddns configuration.
+ /// @return ElementList with dhcp-ddns configuration.
+ isc::data::ElementPtr getDdnsKea(const std::string& xpath);
+
+ /// @brief Retrieves configuration control from sysrepo.
+ ///
+ /// @param xpath path to configuration control.
+ /// @return ElementMap with configuration control.
+ isc::data::ElementPtr getConfigControlKea(const std::string& xpath);
/// @brief setServer for kea-dhcp4-server:config.
///
@@ -524,7 +531,7 @@ protected:
/// @param elem The JSON element.
void setServerKeaDhcp6(isc::data::ConstElementPtr elem);
- /// @brief setServer for kea-*:logging.
+ /// @brief set Logging part for kea-*:config.
///
/// @param elem The JSON element.
void setServerKeaLogging(isc::data::ConstElementPtr elem);
diff --git a/src/lib/yang/translator_database.cc b/src/lib/yang/translator_database.cc
index 5d30503f9d..cea73f9454 100644
--- a/src/lib/yang/translator_database.cc
+++ b/src/lib/yang/translator_database.cc
@@ -255,7 +255,7 @@ TranslatorDatabases::getDatabases(const string& xpath) {
ElementPtr
TranslatorDatabases::getDatabasesKea(const string& xpath) {
- S_Iter_Value iter = getIter(xpath + "/*");
+ S_Iter_Value iter = getIter(xpath);
if (!iter) {
// Can't happen.
isc_throw(Unexpected, "getDatabasesKea can't get iterator: " << xpath);
@@ -297,7 +297,6 @@ void
TranslatorDatabases::setDatabasesKea(const string& xpath,
ConstElementPtr elem) {
if (!elem) {
- delItem(xpath + "/hosts-database");
delItem(xpath);
return;
}
@@ -308,7 +307,7 @@ TranslatorDatabases::setDatabasesKea(const string& xpath,
}
string type = database->get("type")->stringValue();
ostringstream key;
- key << xpath << "/hosts-database[database-type='" << type << "']";
+ key << xpath << "[database-type='" << type << "']";
setDatabase(key.str(), database, true);
}
}
diff --git a/src/lib/yang/translator_database.h b/src/lib/yang/translator_database.h
index fd6573f320..228cbbb2a6 100644
--- a/src/lib/yang/translator_database.h
+++ b/src/lib/yang/translator_database.h
@@ -42,7 +42,7 @@ namespace yang {
///
/// YANG syntax for kea-dhcp[46] is using database-type as the list key:
/// @code
-/// +--rw database container
+/// +--rw database (list)
/// |
/// +--rw database-type? string
/// +--rw user? string
@@ -79,20 +79,19 @@ namespace yang {
/// @endcode
/// @code
/// /kea-dhcp6-server:config (container)
-/// /kea-dhcp6-server:config/hosts-databases (container)
-/// /kea-dhcp6-server:config/hosts-databases/
+/// /kea-dhcp6-server:config/
/// hosts-database[database-type='mysql'] (list instance)
-/// /kea-dhcp6-server:config/hosts-databases/
+/// /kea-dhcp6-server:config/
/// hosts-database[database-type='mysql']/type = mysql
-/// /kea-dhcp6-server:config/hosts-databases/
+/// /kea-dhcp6-server:config/
/// hosts-database[database-type='mysql']/name = kea
-/// /kea-dhcp6-server:config/hosts-databases/
+/// /kea-dhcp6-server:config/
/// hosts-database[database-type='mysql']/user = kea
-/// /kea-dhcp6-server:config/hosts-databases/
+/// /kea-dhcp6-server:config/
/// hosts-database[database-type='mysql']/password = kea
-/// /kea-dhcp6-server:config/hosts-databases/
+/// /kea-dhcp6-server:config/
/// hosts-database[database-type='mysql']/host = localhost
-/// /kea-dhcp6-server:config/hosts-databases/
+/// /kea-dhcp6-server:config/
/// hosts-database[database-type='mysql']/port = 3306
/// @endcode
@@ -177,7 +176,7 @@ public:
/// @brief Get and translate database accesses from YANG to JSON.
///
- /// @param xpath The xpath of databases.
+ /// @param xpath The xpath of databases including the list name.
/// @return JSON representation of databases.
/// @throw SysrepoError when sysrepo raises an error.
isc::data::ConstElementPtr getDatabases(const std::string& xpath);
@@ -186,7 +185,7 @@ public:
///
/// Null elem argument removes the database list.
///
- /// @param xpath The xpath of databases.
+ /// @param xpath The xpath of databases including the list name.
/// @param elem The JSON element.
void setDatabases(const std::string& xpath,
isc::data::ConstElementPtr elem);
@@ -194,14 +193,14 @@ public:
protected:
/// @brief getDatabases JSON for kea-dhcp[46]-server models.
///
- /// @param xpath The xpath of databases.
+ /// @param xpath The xpath of databases including the list name.
/// @return JSON representation of databases.
/// @throw SysrepoError when sysrepo raises an error.
isc::data::ElementPtr getDatabasesKea(const std::string& xpath);
/// @brief setDatabases for kea-dhcp[46]-server models.
///
- /// @param xpath The xpath of databases.
+ /// @param xpath The xpath of databases including the list name.
/// @param elem The JSON element.
/// @throw BadValue on database without tyoe,
void setDatabasesKea(const std::string& xpath,
diff --git a/src/lib/yang/translator_host.cc b/src/lib/yang/translator_host.cc
index 4c4a0ad34f..9b164c8ecb 100644
--- a/src/lib/yang/translator_host.cc
+++ b/src/lib/yang/translator_host.cc
@@ -74,7 +74,7 @@ TranslatorHost::getHostKea(const string& xpath) {
result->set("prefixes", prefixes);
}
}
- ConstElementPtr options = getOptionDataList(xpath + "/option-data-list");
+ ConstElementPtr options = getOptionDataList(xpath);
if (options && (options->size() > 0)) {
result->set("option-data", options);
}
@@ -148,7 +148,7 @@ TranslatorHost::setHostKea(const string& xpath, ConstElementPtr elem) {
}
ConstElementPtr options = elem->get("option-data");
if (options && (options->size() > 0)) {
- setOptionDataList(xpath + "/option-data-list", options);
+ setOptionDataList(xpath, options);
}
ConstElementPtr classes = elem->get("client-classes");
if (classes && (classes->size() > 0)) {
@@ -195,7 +195,7 @@ ElementPtr
TranslatorHosts::getHosts(const string& xpath) {
try {
ElementPtr result = Element::createList();
- S_Iter_Value iter = getIter(xpath + "/*");
+ S_Iter_Value iter = getIter(xpath + "/host");
if (!iter) {
// Can't happen.
isc_throw(Unexpected, "getHosts can't get iterator: " << xpath);
diff --git a/src/lib/yang/translator_host.h b/src/lib/yang/translator_host.h
index e1f6115465..3677f7094b 100644
--- a/src/lib/yang/translator_host.h
+++ b/src/lib/yang/translator_host.h
@@ -57,7 +57,7 @@ namespace yang {
/// +--rw identifier-type enumeration
/// +--rw identifier string
/// +--rw hostname? string
-/// +--rw option-data-list option-data*
+/// +--rw option-data*
/// +--rw client-classes* string
/// +--rw user-context? string
/// (DHCPv4 only)
@@ -82,24 +82,21 @@ namespace yang {
/// @endcode
/// @code
/// /kea-dhcp4-server:config (container)
-/// /kea-dhcp4-server:config/subnet4 (container)
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='111'] (list instance)
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='111']/id = 111
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='111']/subnet = 10.0.0.0/24
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='111']/
-/// reservations (container)
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='111']/reservations/
+/// /kea-dhcp4-server:config/subnet4[id='111'] (list instance)
+/// /kea-dhcp4-server:config/subnet4[id='111']/id = 111
+/// /kea-dhcp4-server:config/subnet4[id='111']/subnet = 10.0.0.0/24
+/// /kea-dhcp4-server:config/subnet4[id='111']/
/// host[identifier-type='flex-id'][identifier='00:ff'] (list instance)
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='111']/reservations/
+/// /kea-dhcp4-server:config/subnet4[id='111']/
/// host[identifier-type='flex-id'][identifier='00:ff']/
/// identifier-type = flex-id
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='111']/reservations/
+/// /kea-dhcp4-server:config/subnet4[id='111']/
/// host[identifier-type='flex-id'][identifier='00:ff']/
/// identifier = 00:ff
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='111']/reservations/
+/// /kea-dhcp4-server:config/subnet4[id='111']/
/// host[identifier-type='flex-id'][identifier='00:ff']/
/// hostname = foo
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='111']/reservations/
+/// /kea-dhcp4-server:config/subnet4[id='111']/
/// host[identifier-type='flex-id'][identifier='00:ff']/
/// ip-address = 10.0.0.1
/// @endcode
diff --git a/src/lib/yang/translator_logger.cc b/src/lib/yang/translator_logger.cc
index c61d55fc01..c0855e9e7f 100644
--- a/src/lib/yang/translator_logger.cc
+++ b/src/lib/yang/translator_logger.cc
@@ -54,7 +54,7 @@ TranslatorLogger::getLoggerKea(const string& xpath) {
}
ElementPtr result = Element::createMap();
result->set("name", name);
- ConstElementPtr options = getOutputOptions(xpath + "/output-options");
+ ConstElementPtr options = getOutputOptions(xpath);
if (options && (options->size() > 0)) {
result->set("output_options", options);
}
@@ -99,7 +99,7 @@ TranslatorLogger::getOutputOption(const string& xpath) {
ElementPtr
TranslatorLogger::getOutputOptions(const string& xpath) {
- S_Iter_Value iter = getIter(xpath + "/*");
+ S_Iter_Value iter = getIter(xpath + "/output-option");
if (!iter) {
// Can't happen.
isc_throw(Unexpected, "getOutputOptions: can't get iterator: "
@@ -140,7 +140,7 @@ TranslatorLogger::setLoggerKea(const string& xpath, ConstElementPtr elem) {
// Skip name as it is the key.
ConstElementPtr options = elem->get("output_options");
if (options && (options->size() > 0)) {
- setOutputOptions(xpath + "/output-options", options);
+ setOutputOptions(xpath, options);
}
ConstElementPtr debuglevel = elem->get("debuglevel");
if (debuglevel) {
@@ -193,7 +193,7 @@ TranslatorLogger::setOutputOptions(const string& xpath, ConstElementPtr elem) {
}
string output = option->get("output")->stringValue();
ostringstream key;
- key << xpath << "/option[output='" << output << "']";
+ key << xpath << "/output-option[output='" << output << "']";
setOutputOption(key.str(), option);
}
}
@@ -226,7 +226,7 @@ TranslatorLoggers::getLoggers(const string& xpath) {
ElementPtr
TranslatorLoggers::getLoggersKea(const string& xpath) {
- S_Iter_Value iter = getIter(xpath + "/*");
+ S_Iter_Value iter = getIter(xpath + "/logger");
if (!iter) {
// Can't happen.
isc_throw(Unexpected, "getLoggersKea: can't get iterator: " << xpath);
diff --git a/src/lib/yang/translator_logger.h b/src/lib/yang/translator_logger.h
index 1b33e5e596..69984c3319 100644
--- a/src/lib/yang/translator_logger.h
+++ b/src/lib/yang/translator_logger.h
@@ -40,11 +40,10 @@ namespace yang {
/// YANG syntax for kea-logging is with name as the logger list key and
/// output as the output option list key.
/// @code
-/// +--rw logger container
+/// +--rw logger (list)
/// |
/// +--rw name? string
-/// +--rw output-options container
-/// | +--rw option* [output]
+/// +--rw output-option*
/// | +--rw output string
/// | +--rw maxver? uint32
/// | +--rw maxsize? uint32
@@ -71,19 +70,17 @@ namespace yang {
/// ]
/// @endcode
/// @code
-/// /kea-dhcp4-server:logging (container)
-/// /kea-dhcp4-server:logging/loggers (container)
-/// /kea-dhcp4-server:logging/loggers/logger[name='foo'] (list instance)
-/// /kea-dhcp4-server:logging/loggers/logger[name='foo']/name = foo
-/// /kea-dhcp4-server:logging/loggers/logger[name='foo']/
-/// output-options (container)
-/// /kea-dhcp4-server:logging/loggers/logger[name='foo']/output-options/
+/// /kea-dhcp4-server:config (container)
+/// /kea-dhcp4-server:config/...
+/// /kea-dhcp4-server:config/logger[name='foo'] (list instance)
+/// /kea-dhcp4-server:config/logger[name='foo']/name = foo
+/// /kea-dhcp4-server:config/logger[name='foo']/
/// option[output='/bar'] (list instance)
-/// /kea-dhcp4-server:logging/loggers/logger[name='foo']/output-options/
+/// /kea-dhcp4-server:config/logger[name='foo']/
/// option[output='/bar']/option = /bar
-/// /kea-dhcp4-server:logging/loggers/logger[name='foo']/output-options/
+/// /kea-dhcp4-server:config/logger[name='foo']/
/// option[output='/bar']/maxver = 10
-/// /kea-dhcp4-server:logging/loggers/logger[name='foo']/severity = WARN
+/// /kea-dhcp4-server:config/logger[name='foo']/severity = WARN
/// @endcode
/// @brief A translator class for converting a logger between
diff --git a/src/lib/yang/translator_option_data.cc b/src/lib/yang/translator_option_data.cc
index 0fb64f445a..644cf79469 100644
--- a/src/lib/yang/translator_option_data.cc
+++ b/src/lib/yang/translator_option_data.cc
@@ -153,7 +153,7 @@ TranslatorOptionDataList::getOptionDataList(const string& xpath) {
ConstElementPtr
TranslatorOptionDataList::getOptionDataListKea(const string& xpath) {
ElementPtr result = Element::createList();
- S_Iter_Value iter = getIter(xpath + "/*");
+ S_Iter_Value iter = getIter(xpath + "/option-data");
if (!iter) {
// Can't happen.
isc_throw(Unexpected, "getOptionDataListKea: can't get iterator: "
diff --git a/src/lib/yang/translator_option_data.h b/src/lib/yang/translator_option_data.h
index eeb104d3cc..69c444e6ac 100644
--- a/src/lib/yang/translator_option_data.h
+++ b/src/lib/yang/translator_option_data.h
@@ -54,18 +54,17 @@ namespace yang {
/// @endcode
/// @code
/// /kea-dhcp6-server:config (container)
-/// /kea-dhcp6-server:config/option-data-list (container)
-/// /kea-dhcp6-server:config/option-data-list/
+/// /kea-dhcp6-server:config/
/// option-data[code='100'][space='dns'] (list instance)
-/// /kea-dhcp6-server:config/option-data-list/
+/// /kea-dhcp6-server:config/
/// option-data[code='100'][space='dns']/code = 100
-/// /kea-dhcp6-server:config/option-data-list/
+/// /kea-dhcp6-server:config/
/// option-data[code='100'][space='dns']/space = dns
-/// /kea-dhcp6-server:config/option-data-list/
+/// /kea-dhcp6-server:config/
/// option-data[code='100'][space='dns']/data = 12121212
-/// /kea-dhcp6-server:config/option-data-list/
+/// /kea-dhcp6-server:config/
/// option-data[code='100'][space='dns']/csv-format = false
-/// /kea-dhcp6-server:config/option-data-list/
+/// /kea-dhcp6-server:config/
/// option-data[code='100'][space='dns']/always-send = false
/// @endcode
diff --git a/src/lib/yang/translator_option_def.cc b/src/lib/yang/translator_option_def.cc
index 83a62febb0..8153859c26 100644
--- a/src/lib/yang/translator_option_def.cc
+++ b/src/lib/yang/translator_option_def.cc
@@ -162,7 +162,7 @@ TranslatorOptionDefList::getOptionDefList(const string& xpath) {
ConstElementPtr
TranslatorOptionDefList::getOptionDefListKea(const string& xpath) {
ElementPtr result = Element::createList();
- S_Iter_Value iter = getIter(xpath + "/*");
+ S_Iter_Value iter = getIter(xpath + "/option-def");
if (!iter) {
// Can't happen.
isc_throw(Unexpected, "getOptionDefListKea: can't get iterator: "
diff --git a/src/lib/yang/translator_option_def.h b/src/lib/yang/translator_option_def.h
index 73eb0229cf..b3332edd25 100644
--- a/src/lib/yang/translator_option_def.h
+++ b/src/lib/yang/translator_option_def.h
@@ -56,18 +56,17 @@ namespace yang {
/// @endcode
/// @code
/// /kea-dhcp6-server:config (container)
-/// /kea-dhcp6-server:config/option-def-list (container)
-/// /kea-dhcp6-server:config/option-def-list/
+/// /kea-dhcp6-server:config/
/// option-def[code='100'][space='isc'] (list instance)
-/// /kea-dhcp6-server:config/option-def-list/
+/// /kea-dhcp6-server:config/
/// option-def[code='100'][space='isc']/code = 100
-/// /kea-dhcp6-server:config/option-def-list/
+/// /kea-dhcp6-server:config/
/// option-def[code='100'][space='isc']/space = isc
-/// /kea-dhcp6-server:config/option-def-list/
+/// /kea-dhcp6-server:config/
/// option-def[code='100'][space='isc']/name = foo
-/// /kea-dhcp6-server:config/option-def-list/
+/// /kea-dhcp6-server:config/
/// option-def[code='100'][space='isc']/type = string
-/// /kea-dhcp6-server:config/option-def-list/
+/// /kea-dhcp6-server:config/
/// option-def[code='100'][space='isc']/array = false
/// @endcode
diff --git a/src/lib/yang/translator_pd_pool.cc b/src/lib/yang/translator_pd_pool.cc
index a93568a324..081558be1f 100644
--- a/src/lib/yang/translator_pd_pool.cc
+++ b/src/lib/yang/translator_pd_pool.cc
@@ -160,7 +160,7 @@ TranslatorPdPool::getPdPoolKea(const string& xpath) {
if (delegated) {
result->set("delegated-len", delegated);
}
- ConstElementPtr options = getOptionDataList(xpath + "/option-data-list");
+ ConstElementPtr options = getOptionDataList(xpath);
if (options && (options->size() > 0)) {
result->set("option-data", options);
}
@@ -258,7 +258,7 @@ TranslatorPdPool::setPdPoolKea(const string& xpath, ConstElementPtr elem) {
}
ConstElementPtr options = elem->get("option-data");
if (options && (options->size() > 0)) {
- setOptionDataList(xpath + "/option-data-list", options);
+ setOptionDataList(xpath, options);
created = true;
}
ConstElementPtr guard = elem->get("client-class");
@@ -299,25 +299,35 @@ TranslatorPdPools::~TranslatorPdPools() {
ElementPtr
TranslatorPdPools::getPdPools(const string& xpath) {
try {
- ElementPtr result = Element::createList();
- S_Iter_Value iter = getIter(xpath + "/*");
- if (!iter) {
- // Can't happen.
- isc_throw(Unexpected, "getPdPools: can't get iterator: " << xpath);
+ if ((model_ == IETF_DHCPV6_SERVER) ||
+ (model_ == KEA_DHCP6_SERVER)) {
+ return (getPdPoolsCommon(xpath));
}
- for (;;) {
- const string& pool = getNext(iter);
- if (pool.empty()) {
- break;
- }
- result->add(getPdPool(pool));
- }
- return (result);
} catch (const sysrepo_exception& ex) {
isc_throw(SysrepoError,
"sysrepo error getting pd-pools at '" << xpath
<< "': " << ex.what());
}
+ isc_throw(NotImplemented,
+ "getPdPools not implemented for the model: " << model_);
+}
+
+ElementPtr
+TranslatorPdPools::getPdPoolsCommon(const string& xpath) {
+ ElementPtr result = Element::createList();
+ S_Iter_Value iter = getIter(xpath + "/pd-pool");
+ if (!iter) {
+ // Can't happen.
+ isc_throw(Unexpected, "getPdPools: can't get iterator: " << xpath);
+ }
+ for (;;) {
+ const string& pool = getNext(iter);
+ if (pool.empty()) {
+ break;
+ }
+ result->add(getPdPool(pool));
+ }
+ return (result);
}
void
diff --git a/src/lib/yang/translator_pd_pool.h b/src/lib/yang/translator_pd_pool.h
index 353049e3e6..fae6bbeda6 100644
--- a/src/lib/yang/translator_pd_pool.h
+++ b/src/lib/yang/translator_pd_pool.h
@@ -52,7 +52,7 @@ namespace yang {
/// +--rw prefix? inet:ipv6-prefix
/// +--rw delegated-len? uint8
/// +--rw excluded-prefix? inet:ipv6-prefix
-/// +--rw option-data-list option-data*
+/// +--rw option-data*
/// +--rw client-class? string
/// +--rw require-client-classes* string
/// +--rw user-context? string
@@ -96,16 +96,14 @@ namespace yang {
/// @endcode
/// @code
/// /kea-dhcp6-server:config (container)
-/// /kea-dhcp6-server:config/subnet6 (container)
-/// /kea-dhcp6-server:config/subnet6/subnet6[id='111'] (list instance)
-/// /kea-dhcp6-server:config/subnet6/subnet6[id='111']/id = 111
-/// /kea-dhcp6-server:config/subnet6/subnet6[id='111']/subnet = 2001:db8::/48
-/// /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pd-pools (container)
-/// /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pd-pools/
+/// /kea-dhcp6-server:config/subnet6[id='111'] (list instance)
+/// /kea-dhcp6-server:config/subnet6[id='111']/id = 111
+/// /kea-dhcp6-server:config/subnet6[id='111']/subnet = 2001:db8::/48
+/// /kea-dhcp6-server:config/subnet6[id='111']/
/// pd-pool[prefix='2001:db8:0:1000::/56' (list instance)
-/// /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pd-pools/
+/// /kea-dhcp6-server:config/subnet6[id='111']/
/// pd-pool[prefix='2001:db8:0:1000::/56'/prefix = 2001:db8:0:1000::/56
-/// /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pd-pools/
+/// /kea-dhcp6-server:config/subnet6[id='111']/
/// pd-pool[prefix='2001:db8:0:1000::/56'/delegated-len = 64
/// @endcode
@@ -161,14 +159,14 @@ protected:
void setPdPoolIetf6(const std::string& xpath,
isc::data::ConstElementPtr elem);
- /// @brief getPdPool for kea-dhcp6.
+ /// @brief getPdPool for kea-dhcp6-server.
///
/// @param xpath The xpath of the pd-pool.
/// @return JSON representation of the pd-pool.
/// @throw SysrepoError when sysrepo raises an error.
isc::data::ElementPtr getPdPoolKea(const std::string& xpath);
- /// @brief setPdPool for kea-dhcp6.
+ /// @brief setPdPool for kea-dhcp6-server.
///
/// @param xpath The xpath of the pd-pool.
/// @param elem The JSON element.
@@ -211,6 +209,12 @@ public:
void setPdPools(const std::string& xpath, isc::data::ConstElementPtr elem);
protected:
+ /// @brief getPdPools common part.
+ ///
+ /// @param xpath The xpath of the pd-pool list.
+ /// @throw SysrepoError when sysrepo raises an error.
+ isc::data::ElementPtr getPdPoolsCommon(const std::string& xpath);
+
/// @brief setPdPools using pool-id.
///
/// @param xpath The xpath of the pd-pool list.
diff --git a/src/lib/yang/translator_pool.cc b/src/lib/yang/translator_pool.cc
index 199487a153..efcd2dcee2 100644
--- a/src/lib/yang/translator_pool.cc
+++ b/src/lib/yang/translator_pool.cc
@@ -108,7 +108,7 @@ TranslatorPool::getPoolKea(const string& xpath) {
<< end_addr->stringValue();
result->set("pool", Element::create(range.str()));
}
- ConstElementPtr options = getOptionDataList(xpath + "/option-data-list");
+ ConstElementPtr options = getOptionDataList(xpath);
if (options && (options->size() > 0)) {
result->set("option-data", options);
}
@@ -217,7 +217,7 @@ TranslatorPool::setPoolKea(const string& xpath, ConstElementPtr elem) {
// Skip start-address and end-address as are the keys.
ConstElementPtr options = elem->get("option-data");
if (options && (options->size() > 0)) {
- setOptionDataList(xpath + "/option-data-list", options);
+ setOptionDataList(xpath, options);
created = true;
}
ConstElementPtr guard = elem->get("client-class");
@@ -279,25 +279,55 @@ TranslatorPools::~TranslatorPools() {
ElementPtr
TranslatorPools::getPools(const string& xpath) {
try {
- ElementPtr result = Element::createList();
- S_Iter_Value iter = getIter(xpath + "/*");
- if (!iter) {
- // Can't happen.
- isc_throw(Unexpected, "getPools can't get iterator: " << xpath);
- }
- for (;;) {
- const string& pool = getNext(iter);
- if (pool.empty()) {
- break;
- }
- result->add(getPool(pool));
+ if (model_ == IETF_DHCPV6_SERVER) {
+ return (getPoolsIetf(xpath));
+ } else if ((model_ == KEA_DHCP4_SERVER) ||
+ (model_ == KEA_DHCP6_SERVER)) {
+ return (getPoolsKea(xpath));
}
- return (result);
} catch (const sysrepo_exception& ex) {
isc_throw(SysrepoError,
"sysrepo error getting pools at '" << xpath
<< "': " << ex.what());
}
+ isc_throw(NotImplemented,
+ "getPools not implemented for the model: " << model_);
+}
+
+ElementPtr
+TranslatorPools::getPoolsIetf(const string& xpath) {
+ ElementPtr result = Element::createList();
+ S_Iter_Value iter = getIter(xpath + "/address-pool");
+ if (!iter) {
+ // Can't happen.
+ isc_throw(Unexpected, "getPoolsIetf can't get iterator: " << xpath);
+ }
+ for (;;) {
+ const string& pool = getNext(iter);
+ if (pool.empty()) {
+ break;
+ }
+ result->add(getPool(pool));
+ }
+ return (result);
+}
+
+ElementPtr
+TranslatorPools::getPoolsKea(const string& xpath) {
+ ElementPtr result = Element::createList();
+ S_Iter_Value iter = getIter(xpath + "/pool");
+ if (!iter) {
+ // Can't happen.
+ isc_throw(Unexpected, "getPoolsKea can't get iterator: " << xpath);
+ }
+ for (;;) {
+ const string& pool = getNext(iter);
+ if (pool.empty()) {
+ break;
+ }
+ result->add(getPool(pool));
+ }
+ return (result);
}
void
diff --git a/src/lib/yang/translator_pool.h b/src/lib/yang/translator_pool.h
index 85ce580ebe..fe4a89d032 100644
--- a/src/lib/yang/translator_pool.h
+++ b/src/lib/yang/translator_pool.h
@@ -52,7 +52,7 @@ namespace yang {
/// +--rw prefix? inet:ipv[46]-prefix
/// +--rw start-address inet:ipv[46]-address
/// +--rw end-address inet:ipv[46]-address
-/// +--rw option-data-list option-data*
+/// +--rw option-data*
/// +--rw client-class? string
/// +--rw require-client-classes* string
/// +--rw user-context? string
@@ -108,18 +108,16 @@ namespace yang {
/// @endcode
/// @code
/// /kea-dhcp6-server:config (container)
-/// /kea-dhcp6-server:config/subnet6 (container)
-/// /kea-dhcp6-server:config/subnet6/subnet6[id='111'] (list instance)
-/// /kea-dhcp6-server:config/subnet6/subnet6[id='111']/id = 111
-/// /kea-dhcp6-server:config/subnet6/subnet6[id='111']/subnet = 2001:db8::/48
-/// /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools (container)
-/// /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/
+/// /kea-dhcp6-server:config/subnet6[id='111'] (list instance)
+/// /kea-dhcp6-server:config/subnet6[id='111']/id = 111
+/// /kea-dhcp6-server:config/subnet6[id='111']/subnet = 2001:db8::/48
+/// /kea-dhcp6-server:config/subnet6[id='111']/
/// pool[start-address='2001:db8::1'][end-address='2001:db8::100']
/// (list instance)
-/// /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/
+/// /kea-dhcp6-server:config/subnet6[id='111']/
/// pool[start-address='2001:db8::1'][end-address='2001:db8::100']/
/// start-address = 2001:db8::1
-/// /kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools/
+/// /kea-dhcp6-server:config/subnet6[id='111']/
/// pool[start-address='2001:db8::1'][end-address='2001:db8::100']/
/// end-address = 2001:db8::100
/// @endcode
@@ -179,14 +177,14 @@ protected:
void setPoolIetf6(const std::string& xpath,
isc::data::ConstElementPtr elem);
- /// @brief getPool for kea-dhcp[46].
+ /// @brief getPool for kea-dhcp[46]-server.
///
/// @param xpath The xpath of the pool.
/// @return JSON representation of the pool.
/// @throw BadValue on a pool without prefix and start or end address.
isc::data::ElementPtr getPoolKea(const std::string& xpath);
- /// @brief setPool for kea-dhcp[46].
+ /// @brief setPool for kea-dhcp[46]-server.
///
/// @param xpath The xpath of the pool.
/// @param elem The JSON element.
@@ -226,6 +224,16 @@ public:
void setPools(const std::string& xpath, isc::data::ConstElementPtr elem);
protected:
+ /// @brief getPools for ietf-dhcpv6-server.
+ ///
+ /// @param xpath The xpath of the pool list.
+ isc::data::ElementPtr getPoolsIetf(const std::string& xpath);
+
+ /// @brief getPools for kea-dhcp[46]-server.
+ ///
+ /// @param xpath The xpath of the pool list.
+ isc::data::ElementPtr getPoolsKea(const std::string& xpath);
+
/// @brief setPools using pool-id.
///
/// @param xpath The xpath of the pool list.
diff --git a/src/lib/yang/translator_shared_network.cc b/src/lib/yang/translator_shared_network.cc
index 0774b8a9ab..73644f581d 100644
--- a/src/lib/yang/translator_shared_network.cc
+++ b/src/lib/yang/translator_shared_network.cc
@@ -65,7 +65,7 @@ TranslatorSharedNetwork::getSharedNetworkKea(const string& xpath,
isc_throw(Unexpected, "getSharedNetworkKea requires name: " << xpath);
}
result->set("name", name);
- ConstElementPtr subnets = getSubnets(xpath + "/" + subsel);
+ ConstElementPtr subnets = getSubnets(xpath);
if (subnets && (subnets->size() > 0)) {
result->set(subsel, subnets);
}
@@ -87,7 +87,7 @@ TranslatorSharedNetwork::getSharedNetworkKea(const string& xpath,
if (rebind) {
result->set("rebind-timer", rebind);
}
- ConstElementPtr options = getOptionDataList(xpath + "/option-data-list");
+ ConstElementPtr options = getOptionDataList(xpath);
if (options && (options->size() > 0)) {
result->set("option-data", options);
}
@@ -128,6 +128,10 @@ TranslatorSharedNetwork::getSharedNetworkKea(const string& xpath,
if (match) {
result->set("match-client-id", match);
}
+ ConstElementPtr auth = getItem(xpath + "/authoritative");
+ if (auth) {
+ result->set("authoritative", auth);
+ }
ConstElementPtr next = getItem(xpath + "/next-server");
if (next) {
result->set("next-server", next);
@@ -175,7 +179,7 @@ TranslatorSharedNetwork::setSharedNetworkKea(const string& xpath,
// Skip name which is the key.
ConstElementPtr subnets = elem->get(subsel);
if (subnets && (subnets->size() > 0)) {
- setSubnets(xpath + "/" + subsel, subnets);
+ setSubnets(xpath, subnets);
}
if (subsel == "subnet6") {
ConstElementPtr preferred = elem->get("preferred-lifetime");
@@ -197,7 +201,7 @@ TranslatorSharedNetwork::setSharedNetworkKea(const string& xpath,
}
ConstElementPtr options = elem->get("option-data");
if (options && (options->size() > 0)) {
- setOptionDataList(xpath + "/option-data-list", options);
+ setOptionDataList(xpath, options);
}
ConstElementPtr interface = elem->get("interface");
if (interface) {
@@ -244,6 +248,10 @@ TranslatorSharedNetwork::setSharedNetworkKea(const string& xpath,
if (match) {
setItem(xpath + "/match-client-id", match, SR_BOOL_T);
}
+ ConstElementPtr auth = elem->get("authoritative");
+ if (auth) {
+ setItem(xpath + "/authoritative", auth, SR_BOOL_T);
+ }
ConstElementPtr next = elem->get("next-server");
if (next) {
setItem(xpath + "/next-server", next, SR_STRING_T);
@@ -287,7 +295,7 @@ ElementPtr
TranslatorSharedNetworks::getSharedNetworks(const string& xpath) {
try {
ElementPtr result = Element::createList();
- S_Iter_Value iter = getIter(xpath + "/*");
+ S_Iter_Value iter = getIter(xpath + "/shared-network");
if (!iter) {
// Can't happen.
isc_throw(Unexpected, "getSharedNetworks: can't get iterator: "
diff --git a/src/lib/yang/translator_shared_network.h b/src/lib/yang/translator_shared_network.h
index f9141125cb..15ced6154e 100644
--- a/src/lib/yang/translator_shared_network.h
+++ b/src/lib/yang/translator_shared_network.h
@@ -34,6 +34,7 @@ namespace yang {
/// "next-server": "<next server>",
/// "server-hostname": "<server hostname>",
/// "boot-file-name": "<boot file name>",
+/// "authoritative": <authoritative flag>,
/// "user-context": { <json map> },
/// "comment": "<comment>"
/// }
@@ -67,7 +68,7 @@ namespace yang {
/// +--rw valid-lifetime? uint32
/// +--rw renew-timer? uint32
/// +--rw rebind-timer? uint32
-/// +--rw option-data-list option-data*
+/// +--rw option-data*
/// +--rw interface? string
/// +--rw client-class? string
/// +--rw require-client-classes* string
@@ -75,13 +76,14 @@ namespace yang {
/// +--rw relay ip-addresses*
/// +--rw user-context? string
/// (DHCPv4 only)
-/// +--rw subnet4 subnet4*
+/// +--rw subnet4*
/// +--rw match-client-id? boolean
/// +--rw next-server? inet:ipv4-address
/// +--rw server-hostname? string
/// +--rw boot-file-name? string
+/// +--rw authoritative? boolean
/// (DHCPv6 only)
-/// +--rw subnet6 subnet6*
+/// +--rw subnet6*
/// +--rw preferred-lifetime? uint32
/// +--rw interface-id? string
/// +--rw rapid-commit? boolean
@@ -104,19 +106,14 @@ namespace yang {
/// @endcode
/// @code
/// /kea-dhcp6-server:config (container)
-/// /kea-dhcp6-server:config/shared-networks (container)
-/// /kea-dhcp6-server:config/shared-networks/
-/// shared-network[name='foo'] (list instance)
-/// /kea-dhcp6-server:config/shared-networks/shared-network[name='foo']/
-/// name = foo
-/// /kea-dhcp6-server:config/shared-networks/shared-network[name='foo']/
-/// subnet6 (container)
-/// /kea-dhcp6-server:config/shared-networks/shared-network[name='foo']/
-/// subnet6/subnet6[id='123'] (list instance)
-/// /kea-dhcp6-server:config/shared-networks/shared-network[name='foo']/
-/// subnet6/subnet6[id='123']/id = 123
-/// /kea-dhcp6-server:config/shared-networks/shared-network[name='foo']/
-/// subnet6/subnet6[id='123']/subnet = 2001:db8::/48
+/// /kea-dhcp6-server:config/shared-network[name='foo'] (list instance)
+/// /kea-dhcp6-server:config/shared-network[name='foo']/name = foo
+/// /kea-dhcp6-server:config/shared-network[name='foo']/
+/// subnet6[id='123'] (list instance)
+/// /kea-dhcp6-server:config/shared-network[name='foo']/
+/// subnet6[id='123']/id = 123
+/// /kea-dhcp6-server:config/shared-network[name='foo']/
+/// subnet6[id='123']/subnet = 2001:db8::/48
/// @endcode
/// @brief A translator class for converting a shared network between
diff --git a/src/lib/yang/translator_subnet.cc b/src/lib/yang/translator_subnet.cc
index c7849edf18..315a6010d9 100644
--- a/src/lib/yang/translator_subnet.cc
+++ b/src/lib/yang/translator_subnet.cc
@@ -112,16 +112,16 @@ TranslatorSubnet::getSubnetKea(const string& xpath) {
if (rebind) {
result->set("rebind-timer", rebind);
}
- ConstElementPtr options = getOptionDataList(xpath + "/option-data-list");
+ ConstElementPtr options = getOptionDataList(xpath);
if (options && (options->size() > 0)) {
result->set("option-data", options);
}
- ConstElementPtr pools = getPools(xpath + "/pools");
+ ConstElementPtr pools = getPools(xpath);
if (pools && (pools->size() > 0)) {
result->set("pools", pools);
}
if (model_ == KEA_DHCP6_SERVER) {
- pools = getPdPools(xpath + "/pd-pools");
+ pools = getPdPools(xpath);
if (pools && (pools->size() > 0)) {
result->set("pd-pools", pools);
}
@@ -160,7 +160,7 @@ TranslatorSubnet::getSubnetKea(const string& xpath) {
if (required && (required->size() > 0)) {
result->set("require-client-classes", required);
}
- ConstElementPtr hosts = getHosts(xpath + "/reservations");
+ ConstElementPtr hosts = getHosts(xpath);
if (hosts && (hosts->size() > 0)) {
result->set("reservations", hosts);
}
@@ -179,6 +179,10 @@ TranslatorSubnet::getSubnetKea(const string& xpath) {
if (match) {
result->set("match-client-id", match);
}
+ ConstElementPtr auth = getItem(xpath + "/authoritative");
+ if (auth) {
+ result->set("authoritative", auth);
+ }
ConstElementPtr next = getItem(xpath + "/next-server");
if (next) {
result->set("next-server", next);
@@ -281,16 +285,16 @@ TranslatorSubnet::setSubnetKea(const string& xpath, ConstElementPtr elem) {
}
ConstElementPtr options = elem->get("option-data");
if (options && (options->size() > 0)) {
- setOptionDataList(xpath + "/option-data-list", options);
+ setOptionDataList(xpath, options);
}
ConstElementPtr pools = elem->get("pools");
if (pools && (pools->size() > 0)) {
- setPools(xpath + "/pools", pools);
+ setPools(xpath, pools);
}
if (model_ == KEA_DHCP6_SERVER) {
pools = elem->get("pd-pools");
if (pools && (pools->size() > 0)) {
- setPdPools(xpath + "/pd-pools", pools);
+ setPdPools(xpath, pools);
}
}
ConstElementPtr subnet = elem->get("subnet");
@@ -326,7 +330,7 @@ TranslatorSubnet::setSubnetKea(const string& xpath, ConstElementPtr elem) {
}
ConstElementPtr hosts = elem->get("reservations");
if (hosts && (hosts->size() > 0)) {
- setHosts(xpath + "/reservations", hosts);
+ setHosts(xpath, hosts);
}
ConstElementPtr mode = elem->get("reservation-mode");
if (mode) {
@@ -349,6 +353,10 @@ TranslatorSubnet::setSubnetKea(const string& xpath, ConstElementPtr elem) {
if (match) {
setItem(xpath + "/match-client-id", match, SR_BOOL_T);
}
+ ConstElementPtr auth = elem->get("authoritative");
+ if (auth) {
+ setItem(xpath + "/authoritative", auth, SR_BOOL_T);
+ }
ConstElementPtr next = elem->get("next-server");
if (next) {
setItem(xpath + "/next-server", next, SR_STRING_T);
@@ -400,25 +408,39 @@ TranslatorSubnets::~TranslatorSubnets() {
ElementPtr
TranslatorSubnets::getSubnets(const string& xpath) {
try {
- ElementPtr result = Element::createList();
- S_Iter_Value iter = getIter(xpath + "/*");
- if (!iter) {
- /// Can't happen.
- isc_throw(Unexpected, "getSubnets: can't get iterator: " << xpath);
- }
- for (;;) {
- const string& subnet = getNext(iter);
- if (subnet.empty()) {
- break;
- }
- result->add(getSubnet(subnet));
+ if (model_ == IETF_DHCPV6_SERVER) {
+ return (getSubnetsCommon(xpath, "network-range"));
+ } else if (model_ == KEA_DHCP4_SERVER) {
+ return (getSubnetsCommon(xpath, "subnet4"));
+ } else if (model_ == KEA_DHCP6_SERVER) {
+ return (getSubnetsCommon(xpath, "subnet6"));
}
- return (result);
} catch (const sysrepo_exception& ex) {
isc_throw(SysrepoError,
"sysrepo error getting subnets at '" << xpath
<< "': " << ex.what());
}
+ isc_throw(NotImplemented,
+ "getSubnets not implemented for the model: " << model_);
+}
+
+ElementPtr
+TranslatorSubnets::getSubnetsCommon(const string& xpath,
+ const std::string& subsel) {
+ ElementPtr result = Element::createList();
+ S_Iter_Value iter = getIter(xpath + "/" + subsel);
+ if (!iter) {
+ /// Can't happen.
+ isc_throw(Unexpected, "getSubnets: can't get iterator: " << xpath);
+ }
+ for (;;) {
+ const string& subnet = getNext(iter);
+ if (subnet.empty()) {
+ break;
+ }
+ result->add(getSubnet(subnet));
+ }
+ return (result);
}
void
diff --git a/src/lib/yang/translator_subnet.h b/src/lib/yang/translator_subnet.h
index f1d5f83540..7023bec5e5 100644
--- a/src/lib/yang/translator_subnet.h
+++ b/src/lib/yang/translator_subnet.h
@@ -41,6 +41,7 @@ namespace yang {
/// "4o6-interface": "<dhpv4-over-dhcpv6 interface>",
/// "4o6-interface-id": "<dhpv4-over-dhcpv6 interface id>",
/// "4o6-subnet": "<dhpv4-over-dhcpv6 subnet>",
+/// "authoritative": <authoritative flag>,
/// "user-context": { <json map> },
/// "comment": "<comment>"
/// }
@@ -78,24 +79,24 @@ namespace yang {
/// +--rw network-prefix inet:ipv4-prefix
/// +--rw option-set-id?
/// /server/server-config/option-sets/option-set/option-set-id
-/// +--rw address-pools address-pool* [pool-id]
-/// +--rw pd-pools pd-pool* [pool-id]
+/// +--rw address-pool* [pool-id]
+/// +--rw pd-pool* [pool-id]
/// +--rw host-reservations host-reservation* [cli-id]
/// @endcode
///
-/// YANG syntax for kea-dhcp[46] is with id as the key:
+/// YANG syntax for kea-dhcp[46]-server is with id as the key:
/// @code
/// +--rw valid-lifetime? uint32
/// +--rw renew-timer? uint32
/// +--rw rebind-timer? uint32
-/// +--rw option-data-list option-data*
-/// +--rw pools pool*
+/// +--rw option-data*
+/// +--rw pool*
/// +--rw subnet inet:ip-prefix
/// +--rw interface? string
/// +--rw id uint32
/// +--rw client-class? string
/// +--rw require-client-classes* string
-/// +--rw reservations host*
+/// +--rw host*
/// +--rw reservation-mode? enumeration
/// +--rw relay ip-addresses*
/// +--rw user-context? string
@@ -107,9 +108,10 @@ namespace yang {
/// +--rw subnet-4o6-interface? string
/// +--rw subnet-4o6-interface-id? string
/// +--rw subnet-4o6-subnet? inet:ipv6-prefix
+/// +--rw authoritative? boolean
/// (DHCPv6 only)
/// +--rw preferred-lifetime? uint32
-/// +--rw pd-pools pd-pool*
+/// +--rw pd-pool*
/// +--rw interface-id? string
/// +--rw rapid-commit? boolean
/// @endcode
@@ -202,31 +204,29 @@ namespace yang {
/// @endcode
/// @code
/// /kea-dhcp4-server:config (container)
-/// /kea-dhcp4-server:config/subnet4 (container)
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='123'] (list instance)
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='123']/id = 123
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools (container)
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools/
+/// /kea-dhcp4-server:config/subnet4[id='123'] (list instance)
+/// /kea-dhcp4-server:config/subnet4[id='123']/id = 123
+/// /kea-dhcp4-server:config/subnet4[id='123']/
/// pool[start-address='10.0.1.0'][end-address='10.0.1.15'] (list instance)
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools/
+/// /kea-dhcp4-server:config/subnet4[id='123']/
/// pool[start-address='10.0.1.0'][end-address='10.0.1.15']/
/// start-address = 10.0.1.0
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools/
+/// /kea-dhcp4-server:config/subnet4[id='123']/
/// pool[start-address='10.0.1.0'][end-address='10.0.1.15']/
/// end-address = 10.0.1.15
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools/
+/// /kea-dhcp4-server:config/subnet4[id='123']/
/// pool[start-address='10.0.1.0'][end-address='10.0.1.15']/
/// prefix = 10.0.1.0/28
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools/
+/// /kea-dhcp4-server:config/subnet4[id='123']/
/// pool[start-address='10.0.1.200'][end-address='10.0.1.222']
/// (list instance)
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools/
+/// /kea-dhcp4-server:config/subnet4[id='123']/
/// pool[start-address='10.0.1.200'][end-address='10.0.1.222']/
/// start-address = 10.0.1.200
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='123']/pools/
+/// /kea-dhcp4-server:config/subnet4[id='123']/
/// pool[start-address='10.0.1.200'][end-address='10.0.1.222']/
/// end-address = 10.0.1.222
-/// /kea-dhcp4-server:config/subnet4/subnet4[id='123']/subnet = 10.0.1.0/24
+/// /kea-dhcp4-server:config/subnet4[id='123']/subnet = 10.0.1.0/24
/// @endcode
/// @brief A translator class for converting a subnet between YANG and JSON.
@@ -278,13 +278,13 @@ protected:
void setSubnetIetf6(const std::string& xpath,
isc::data::ConstElementPtr elem);
- /// @brief getSubnet for kea-dhcp[46].
+ /// @brief getSubnet for kea-dhcp[46]-server.
///
/// @param xpath The xpath of the subnet.
/// @return JSON representation of the subnet.
isc::data::ElementPtr getSubnetKea(const std::string& xpath);
- /// @brief setSubnet for kea-dhcp[46].
+ /// @brief setSubnet for kea-dhcp[46]-server.
///
/// @param xpath The xpath of the subnet.
/// @param elem The JSON element.
@@ -326,6 +326,13 @@ public:
void setSubnets(const std::string& xpath, isc::data::ConstElementPtr elem);
protected:
+ /// @brief getSubnets common part.
+ ///
+ /// @param xpath The xpath of the subnet list.
+ /// @param subsel The subnet list name.
+ isc::data::ElementPtr getSubnetsCommon(const std::string& xpath,
+ const std::string& subsel);
+
/// @brief setSubnets for ietf-dhcpv6-server.
///
/// @param xpath The xpath of the subnet list.
@@ -333,7 +340,7 @@ protected:
void setSubnetsIetf6(const std::string& xpath,
isc::data::ConstElementPtr elem);
- /// @brief setSubnets for kea-dhcp[46].
+ /// @brief setSubnets for kea-dhcp[46]-server.
///
/// @param xpath The xpath of the subnet list.
/// @param elem The JSON element.