Commit 44c02f59 authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[5314] Suppress excluded_prefix when blank in Pool6::toElement()

    Pool6::toElement() will only include excluded-prefix if it isn't
    blank.
parent fb98f142
...@@ -657,6 +657,7 @@ Subnet6::toElement() const { ...@@ -657,6 +657,7 @@ Subnet6::toElement() const {
uint8_t len = pdpool->getLength(); uint8_t len = pdpool->getLength();
pool_map->set("delegated-len", pool_map->set("delegated-len",
Element::create(static_cast<int>(len))); Element::create(static_cast<int>(len)));
// Set excluded prefix // Set excluded prefix
const Option6PDExcludePtr& xopt = const Option6PDExcludePtr& xopt =
pdpool->getPrefixExcludeOption(); pdpool->getPrefixExcludeOption();
...@@ -668,11 +669,8 @@ Subnet6::toElement() const { ...@@ -668,11 +669,8 @@ Subnet6::toElement() const {
uint8_t xlen = xopt->getExcludedPrefixLength(); uint8_t xlen = xopt->getExcludedPrefixLength();
pool_map->set("excluded-prefix-len", pool_map->set("excluded-prefix-len",
Element::create(static_cast<int>(xlen))); Element::create(static_cast<int>(xlen)));
} else {
pool_map->set("excluded-prefix",
Element::create(std::string("::")));
pool_map->set("excluded-prefix-len", Element::create(0));
} }
// Set user-context // Set user-context
ConstElementPtr context = pdpool->getContext(); ConstElementPtr context = pdpool->getContext();
if (!isNull(context)) { if (!isNull(context)) {
......
...@@ -545,8 +545,6 @@ TEST(CfgSubnets6Test, unparsePdPool) { ...@@ -545,8 +545,6 @@ TEST(CfgSubnets6Test, unparsePdPool) {
" \"prefix\": \"2001:db8:2::\",\n" " \"prefix\": \"2001:db8:2::\",\n"
" \"prefix-len\": 48,\n" " \"prefix-len\": 48,\n"
" \"delegated-len\": 64,\n" " \"delegated-len\": 64,\n"
" \"excluded-prefix\": \"::\",\n"
" \"excluded-prefix-len\": 0,\n"
" \"option-data\": [ ]\n" " \"option-data\": [ ]\n"
" },{\n" " },{\n"
" \"prefix\": \"2001:db8:3::\",\n" " \"prefix\": \"2001:db8:3::\",\n"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment