Configures RADVD to send managed flag in RA
for DHCP_STATEFUL RADVD process is configured so that it sends managed flag in RA for the subnets with ra_mode set to DHCP_STATEFUL. UT case is updated to check the presence of managed flag in config file of RADVD for DHCP_STATEFUL. Change-Id: If685846c0c0f67bf4c40f4f268b9d03bfa2b1654 Closes-Bug: #1377843
This commit is contained in:
parent
efb1f3db21
commit
1f337c761b
@ -44,6 +44,10 @@ CONFIG_TEMPLATE = jinja2.Template("""interface {{ interface_name }}
|
||||
AdvOtherConfigFlag on;
|
||||
{% endif %}
|
||||
|
||||
{% if ra_mode == constants.DHCPV6_STATEFUL %}
|
||||
AdvManagedFlag on;
|
||||
{% endif %}
|
||||
|
||||
{% if ra_mode in (constants.IPV6_SLAAC, constants.DHCPV6_STATELESS) %}
|
||||
prefix {{ prefix }}
|
||||
{
|
||||
|
@ -2195,13 +2195,17 @@ vrrp_instance VR_1 {
|
||||
self.assertIn(_join('-p', pidfile), cmd)
|
||||
self.assertIn(_join('-m', 'syslog'), cmd)
|
||||
|
||||
def test_generate_radvd_conf_other_flag(self):
|
||||
def test_generate_radvd_conf_other_and_managed_flag(self):
|
||||
_skip_check = object()
|
||||
skip = lambda flag: True if flag is _skip_check else False
|
||||
|
||||
expected = {l3_constants.IPV6_SLAAC: (False, False),
|
||||
l3_constants.DHCPV6_STATELESS: (True, False),
|
||||
# we don't check other flag for stateful since it's redundant
|
||||
# for this mode and can be ignored by clients, as per RFC4861
|
||||
expected = {l3_constants.IPV6_SLAAC: False,
|
||||
l3_constants.DHCPV6_STATELESS: True}
|
||||
l3_constants.DHCPV6_STATEFUL: (_skip_check, True)}
|
||||
|
||||
for ra_mode, flag_set in expected.iteritems():
|
||||
for ra_mode, flags_set in expected.iteritems():
|
||||
router = prepare_router_data()
|
||||
ri = self._process_router_ipv6_interface_added(router,
|
||||
ra_mode=ra_mode)
|
||||
@ -2209,8 +2213,17 @@ vrrp_instance VR_1 {
|
||||
ra._generate_radvd_conf(ri.router['id'],
|
||||
router[l3_constants.INTERFACE_KEY],
|
||||
mock.Mock())
|
||||
asserter = self.assertIn if flag_set else self.assertNotIn
|
||||
asserter('AdvOtherConfigFlag on;',
|
||||
|
||||
def assertFlag(flag):
|
||||
return (self.assertIn if flag else self.assertNotIn)
|
||||
|
||||
other_flag, managed_flag = flags_set
|
||||
if not skip(other_flag):
|
||||
assertFlag(other_flag)('AdvOtherConfigFlag on;',
|
||||
self.utils_replace_file.call_args[0][1])
|
||||
|
||||
if not skip(managed_flag):
|
||||
assertFlag(managed_flag)('AdvManagedFlag on',
|
||||
self.utils_replace_file.call_args[0][1])
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user