Closed sravichandran-contractor closed 5 years ago
Most of the times expired issue is seen while getting IP address from an interface.
For example in devices/base.py, we are trying to fetch an IP, sometimes expired message is thrown if IP is not present due to delay.
It would be better to have few retries before throwing error message.
def get_interface_ipaddr(self, interface): self.sendline("\nifconfig %s" % interface) self.expect('addr:(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}).*(Bcast|P-t-P):', timeout=5) ipaddr = self.match.group(1) self.expect(self.prompt) return ipaddr
def get_interface_ip6addr(self, interface): self.sendline("\nifconfig %s" % interface) self.expect_exact("ifconfig %s" % interface) self.expect(self.prompt)
for match in re.findall(AllValidIpv6AddressesRegex, self.before): ip6addr = ipaddress.IPv6Address(unicode(match)) if not ip6addr.is_link_local: # TODO: at some point just return ip6addr return match
This commit fixes the above issue -> https://review.gerrithub.io/c/lgirdk/boardfarm/+/458869
http://172.16.1.237:7777/ipuvaqihaq.md
retry() or retry_on_exception() can be used in script to avoid this issue
Most of the times expired issue is seen while getting IP address from an interface.
For example in devices/base.py, we are trying to fetch an IP, sometimes expired message is thrown if IP is not present due to delay.
It would be better to have few retries before throwing error message.
def get_interface_ipaddr(self, interface): self.sendline("\nifconfig %s" % interface) self.expect('addr:(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}).*(Bcast|P-t-P):', timeout=5) ipaddr = self.match.group(1) self.expect(self.prompt) return ipaddr
def get_interface_ip6addr(self, interface): self.sendline("\nifconfig %s" % interface) self.expect_exact("ifconfig %s" % interface) self.expect(self.prompt)