Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
393abcf8
Commit
393abcf8
authored
Feb 03, 2014
by
Tomek Mrugalski
🛰
Browse files
[3274] Support for relay information in parser for DHCPv6 added
parent
a58621d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp6/config_parser.cc
View file @
393abcf8
...
@@ -368,7 +368,7 @@ public:
...
@@ -368,7 +368,7 @@ public:
/// @param ignored first parameter
/// @param ignored first parameter
/// stores global scope parameters, options, option defintions.
/// stores global scope parameters, options, option defintions.
Subnet6ConfigParser
(
const
std
::
string
&
)
Subnet6ConfigParser
(
const
std
::
string
&
)
:
SubnetConfigParser
(
""
,
globalContext
())
{
:
SubnetConfigParser
(
""
,
globalContext
()
,
IOAddress
(
"::"
)
)
{
}
}
/// @brief Adds the created subnet to a server's configuration.
/// @brief Adds the created subnet to a server's configuration.
...
@@ -381,6 +381,12 @@ public:
...
@@ -381,6 +381,12 @@ public:
isc_throw
(
Unexpected
,
isc_throw
(
Unexpected
,
"Invalid cast in Subnet4ConfigParser::commit"
);
"Invalid cast in Subnet4ConfigParser::commit"
);
}
}
// Set relay infomation if it was provided
if
(
relay_info_
)
{
sub6ptr
->
setRelay
(
*
relay_info_
);
}
isc
::
dhcp
::
CfgMgr
::
instance
().
addSubnet6
(
sub6ptr
);
isc
::
dhcp
::
CfgMgr
::
instance
().
addSubnet6
(
sub6ptr
);
}
}
}
}
...
@@ -408,6 +414,8 @@ protected:
...
@@ -408,6 +414,8 @@ protected:
parser
=
new
StringParser
(
config_id
,
string_values_
);
parser
=
new
StringParser
(
config_id
,
string_values_
);
}
else
if
(
config_id
.
compare
(
"pool"
)
==
0
)
{
}
else
if
(
config_id
.
compare
(
"pool"
)
==
0
)
{
parser
=
new
Pool6Parser
(
config_id
,
pools_
);
parser
=
new
Pool6Parser
(
config_id
,
pools_
);
}
else
if
(
config_id
.
compare
(
"relay"
)
==
0
)
{
parser
=
new
RelayInfoParser
(
config_id
,
relay_info_
,
IOAddress
(
"::"
));
}
else
if
(
config_id
.
compare
(
"pd-pools"
)
==
0
)
{
}
else
if
(
config_id
.
compare
(
"pd-pools"
)
==
0
)
{
parser
=
new
PdPoolListParser
(
config_id
,
pools_
);
parser
=
new
PdPoolListParser
(
config_id
,
pools_
);
}
else
if
(
config_id
.
compare
(
"option-data"
)
==
0
)
{
}
else
if
(
config_id
.
compare
(
"option-data"
)
==
0
)
{
...
...
src/bin/dhcp6/tests/config_parser_unittest.cc
View file @
393abcf8
...
@@ -2924,4 +2924,34 @@ TEST_F(Dhcp6ParserTest, allInterfaces) {
...
@@ -2924,4 +2924,34 @@ TEST_F(Dhcp6ParserTest, allInterfaces) {
}
}
// This test checks if it is possible to specify relay information
TEST_F
(
Dhcp6ParserTest
,
subnetRelayInfo
)
{
ConstElementPtr
status
;
// A config with relay information.
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
"
\"
subnet6
\"
: [ { "
"
\"
pool
\"
: [
\"
2001:db8:1::1 - 2001:db8:1::ffff
\"
],"
"
\"
relay
\"
: { "
"
\"
ip-address
\"
:
\"
2001:db8:1::abcd
\"
"
" },"
"
\"
subnet
\"
:
\"
2001:db8:1::/64
\"
} ],"
"
\"
preferred-lifetime
\"
: 3000, "
"
\"
valid-lifetime
\"
: 4000 }"
;
ElementPtr
json
=
Element
::
fromJSON
(
config
);
EXPECT_NO_THROW
(
status
=
configureDhcp6Server
(
srv_
,
json
));
// returned value should be 0 (configuration success)
checkResult
(
status
,
0
);
Subnet6Ptr
subnet
=
CfgMgr
::
instance
().
getSubnet6
(
IOAddress
(
"2001:db8:1::1"
));
ASSERT_TRUE
(
subnet
);
EXPECT_EQ
(
"2001:db8:1::abcd"
,
subnet
->
relay_
.
addr_
.
toText
());
}
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment