mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
Merge pull request #108 from rajendra-dendukuri/ll_wait_option
Policy to wait for IPv6 link local address to be available
This commit is contained in:
@ -61,6 +61,14 @@ class dhcp(moduleBase):
|
||||
dhcp_wait = policymanager.policymanager_api.get_attr_default(
|
||||
module_name=self.__class__.__name__, attr='dhcp-wait')
|
||||
wait = not str(dhcp_wait).lower() == "no"
|
||||
dhcp6_ll_wait = policymanager.policymanager_api.get_iface_default(module_name=self.__class__.__name__, \
|
||||
ifname=ifaceobj.name, attr='dhcp6-ll-wait')
|
||||
try:
|
||||
timeout = int(dhcp6_ll_wait)+1
|
||||
except:
|
||||
timeout = 10
|
||||
pass
|
||||
|
||||
vrf = ifaceobj.get_attr_value_first('vrf')
|
||||
if (vrf and self.vrf_exec_cmd_prefix and
|
||||
self.ipcmd.link_exists(vrf)):
|
||||
@ -100,10 +108,10 @@ class dhcp(moduleBase):
|
||||
pass
|
||||
#add delay before starting IPv6 dhclient to
|
||||
#make sure the configured interface/link is up.
|
||||
time.sleep(2)
|
||||
timeout = 10
|
||||
if timeout > 1:
|
||||
time.sleep(1)
|
||||
|
||||
while timeout:
|
||||
timeout -= 2
|
||||
addr_output = utils.exec_command('%s -6 addr show %s'
|
||||
%(utils.ip_cmd, ifaceobj.name))
|
||||
r = re.search('inet6 .* scope link', addr_output)
|
||||
@ -112,7 +120,9 @@ class dhcp(moduleBase):
|
||||
wait=wait,
|
||||
cmd_prefix=dhclient_cmd_prefix)
|
||||
return
|
||||
time.sleep(2)
|
||||
timeout -= 1
|
||||
if timeout:
|
||||
time.sleep(1)
|
||||
|
||||
except Exception, e:
|
||||
self.log_error(str(e), ifaceobj)
|
||||
|
Reference in New Issue
Block a user