TEST_F(TranslatorHostsTest, getEmpty) {
useModel(KEA_DHCP6_SERVER);
- // Get the host reservation list and checks it is empty.
+ // Get the host reservation list and check if it is empty.
const string& xpath =
"/kea-dhcp6-server:config/subnet6/subnet6[id='111']/reservations";
ConstElementPtr hosts;
expected->set("ip-addresses", addresses);
EXPECT_TRUE(expected->equals(*host));
- // Get the host reservation list and checks the host reservation is in it.
+ // Get the host reservation list and check if the host reservation
+ // is in it.
ConstElementPtr hosts;
EXPECT_NO_THROW(hosts = t_obj_->getHosts(xpath));
ASSERT_TRUE(hosts);
TEST_F(TranslatorOptionDataListTest, getEmpty) {
useModel(KEA_DHCP4_SERVER);
- // Get the option data list and checks it is empty.
+ // Get the option data list and check if it is empty.
const string& xpath = "/kea-dhcp4-server:config/option-data-list";
ConstElementPtr options;
EXPECT_NO_THROW(options = t_obj_->getOptionDataList(xpath));
TEST_F(TranslatorOptionDefListTest, getEmpty) {
useModel(KEA_DHCP4_SERVER);
- // Get the option definition list and checks it is empty.
+ // Get the option definition list and check if it is empty.
const string& xpath = "/kea-dhcp4-server:config/option-def-list";
ConstElementPtr options;
EXPECT_NO_THROW(options = t_obj_->getOptionDefList(xpath));
TEST_F(TranslatorPdPoolsTest, getEmptyIetf) {
useModel(IETF_DHCPV6_SERVER);
- // Get the pd-pool list and checks it is empty.
+ // Get the pd-pool list and check if it is empty.
const string& xpath =
"/ietf-dhcpv6-server:server/server-config/network-ranges"
"/network-range[network-range-id='111']/pd-pools";
TEST_F(TranslatorPdPoolsTest, getEmptyKea) {
useModel(KEA_DHCP6_SERVER);
- // Get the pd-pool list and checks it is empty.
+ // Get the pd-pool list and check if it is empty.
const string& xpath =
"/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pd-pools";
ConstElementPtr pools;
expected->set("prefix-len", Element::create(56));
EXPECT_TRUE(expected->equals(*pool));
- // Get the pd-pool list and checks the pd-pool is in it.
+ // Get the pd-pool list and check if the pd-pool is in it.
ConstElementPtr pools;
EXPECT_NO_THROW(pools = t_obj_->getPdPools(subnet + "/pd-pools"));
ASSERT_TRUE(pools);
expected->set("delegated-len", Element::create(64));
EXPECT_TRUE(expected->equals(*pool));
- // Get the pd-pool list and checks the pd-pool is in it.
+ // Get the pd-pool list and check if the pd-pool is in it.
ConstElementPtr pools;
EXPECT_NO_THROW(pools = t_obj_->getPdPools(xpath));
ASSERT_TRUE(pools);
TEST_F(TranslatorPoolsTest, getEmptyIetf) {
useModel(IETF_DHCPV6_SERVER);
- // Get the pool list and checks it is empty.
+ // Get the pool list and check if it is empty.
const string& xpath = "/ietf-dhcpv6-server:server/server-config/"
"network-ranges/network-range[network-range-id='111']/address-pools";
ConstElementPtr pools;
TEST_F(TranslatorPoolsTest, getEmptyKea) {
useModel(KEA_DHCP6_SERVER);
- // Get the pool list and checks it is empty.
+ // Get the pool list and check if it is empty.
const string& xpath =
"/kea-dhcp6-server:config/subnet6/subnet6[id='111']/pools";
ConstElementPtr pools;
ASSERT_TRUE(pool);
EXPECT_EQ("{ \"pool\": \"2001:db8::1:0/112\" }", pool->str());
- // Get the pool list and checks the pool is in it.
+ // Get the pool list and check if the pool is in it.
ConstElementPtr pools;
EXPECT_NO_THROW(pools = t_obj_->getPools(xpath));
ASSERT_TRUE(pools);
expected->set("pool", Element::create(string("2001:db8::1:0/112")));
EXPECT_TRUE(expected->equals(*pool));
- // Get the pool list and checks the pool is in it.
+ // Get the pool list and check if the pool is in it.
ConstElementPtr pools;
EXPECT_NO_THROW(pools = t_obj_->getPools(xpath));
ASSERT_TRUE(pools);
TEST_F(TranslatorSubnetsTest, getEmptyIetf) {
useModel(IETF_DHCPV6_SERVER);
- // Get the subnet list and checks it is empty.
+ // Get the subnet list and check if it is empty.
const string& xpath =
"/ietf-dhcpv6-server:server/server-config/network-ranges";
ConstElementPtr subnets;
TEST_F(TranslatorSubnetsTest, getEmptyKea) {
useModel(KEA_DHCP6_SERVER);
- // Get the subnet list and checks it is empty.
+ // Get the subnet list and check if it is empty.
const string& xpath = "/kea-dhcp6-server:config/subnet6";
ConstElementPtr subnets;
EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath));
"\"subnet\": \"2001:db8::/48\" }",
subnet->str());
- // Get the subnet list and checks the subnet is in it.
+ // Get the subnet list and check if the subnet is in it.
ConstElementPtr subnets;
EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath));
ASSERT_TRUE(subnets);
expected->set("subnet", Element::create(string("2001:db8::/48")));
EXPECT_TRUE(expected->equals(*subnet));
- // Get the subnet list and checks the subnet is in it.
+ // Get the subnet list and check if the subnet is in it.
ConstElementPtr subnets;
EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath));
ASSERT_TRUE(subnets);
"}";
EXPECT_EQ(expected, prettyPrint(subnet));
- // Get the subnet list and checks the subnet is in it.
+ // Get the subnet list and check if the subnet is in it.
ConstElementPtr subnets;
EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath));
ASSERT_TRUE(subnets);
"}";
EXPECT_EQ(expected, prettyPrint(subnet));
- // Get the subnet list and checks the subnet is in it.
+ // Get the subnet list and check if the subnet is in it.
ConstElementPtr subnets;
EXPECT_NO_THROW(subnets = t_obj_->getSubnets(xpath));
ASSERT_TRUE(subnets);
ElementPtr
TranslatorSubnet::getSubnetIetf6(const string& xpath) {
ElementPtr result = Element::createMap();
- // @todo timers
- // @todo: option-data
+ /// @todo timers
+ /// @todo: option-data
ConstElementPtr pools = getPools(xpath + "/address-pools");
if (pools) {
- // Set empty list too.
+ /// Set empty list too.
result->set("pools", pools);
}
pools = getPdPools(xpath + "/pd-pools");
isc_throw(BadValue, "getSubnetIetf6 requires network range id");
}
result->set("id", id);
- // @todo: reservations
- // missing a lot of things
+ /// @todo: reservations
+ /// missing a lot of things
ConstElementPtr description = getItem(xpath + "/network-description");
- // Adding description if exists.
+ /// Adding description if exists.
if (description) {
ElementPtr context = Element::createMap();
context->set("description", description);
result->set("user-context", context);
}
- // missing a lot of things
+ /// missing a lot of things
AdaptorPool::toSubnet(model_, result, result->get("pools"));
return (result);
}
void
TranslatorSubnet::setSubnetIetf6(const string& xpath, ConstElementPtr elem) {
- // Skip id as it is the key.
+ /// Skip id as it is the key.
AdaptorPool::fromSubnet(model_, elem, elem->get("pools"));
ConstElementPtr context = elem->get("user-context");
if (context && context->contains("description")) {
isc_throw(BadValue, "setSubnetIetf6 requires subnet: " << elem->str());
}
setItem(xpath + "/network-prefix", subnet, SR_STRING_T);
- // @todo option-data
+ /// @todo option-data
ConstElementPtr pools = elem->get("pools");
if (pools && (pools->size() > 0)) {
setPools(xpath + "/address-pools", pools);
if (pools && (pools->size() > 0)) {
setPdPools(xpath + "/pd-pools", pools);
}
- // @todo reservations
+ /// @todo reservations
}
void
TranslatorSubnet::setSubnetKea(const string& xpath, ConstElementPtr elem) {
- // Skip id as it is the key.
+ /// Skip id as it is the key.
if (model_ == KEA_DHCP6_SERVER) {
ConstElementPtr preferred = elem->get("preferred-lifetime");
if (preferred) {
ElementPtr result = Element::createList();
S_Iter_Value iter = getIter(xpath + "/*");
if (!iter) {
- // Can't happen.
+ /// Can't happen.
isc_throw(Unexpected, "getSubnets: can't get iterator: " << xpath);
}
for (;;) {
/// "renew-timer": <renew timer>,
/// "rebind-timer": <rebind timer>,
/// "option-data": [ <list of option data> ],
-/// "pools": [ <list of pool> ],
+/// "pools": [ <list of pools> ],
/// "subnet": "<subnet prefix>",
/// "interface": "<interface>",
/// "id": <id>,
/// "renew-timer": <renew timer>,
/// "rebind-timer": <rebind timer>,
/// "option-data": [ <list of option data> ],
-/// "pools": [ <list of pool> ],
+/// "pools": [ <list of pools> ],
/// "pd-pools": [ <list of prefix delegation pools> ],
/// "subnet": "<subnet prefix>",
/// "interface": "<interface>",
@c isc::yang::TranslatorPool is the standard example of a translator
for a structured value. Its constructor takes a model name: the code
implements some variants to accommodate the model with shared code
-moved into a common private routine.
+moved into a common private routine. When called with an unsupported
+model, generic methods of all structure translators throw
+@c isc::NotImplemented.
@c isc::yang::TranslatorPools deals with a list of pools. The getPools
method iterates over the list in both ways. Look at examples in unit