mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-20 20:14:57 +00:00
wait_for_ip: changed stas_with_ips to dict, allowed for ipv4 and ipv6
This commit is contained in:
@@ -542,14 +542,14 @@ class Realm(LFCliBase):
|
|||||||
return LFUtils.name_to_eid(eid)
|
return LFUtils.name_to_eid(eid)
|
||||||
|
|
||||||
def wait_for_ip(self, station_list=None, ipv4=True, ipv6=False, timeout_sec=360, debug=False):
|
def wait_for_ip(self, station_list=None, ipv4=True, ipv6=False, timeout_sec=360, debug=False):
|
||||||
if not (ipv4 ^ ipv6):
|
if not (ipv4 or ipv6):
|
||||||
raise ValueError("wait_for_ip: ipv4 or ipv6 must be set!")
|
raise ValueError("wait_for_ip: ipv4 and/or ipv6 must be set!")
|
||||||
if timeout_sec >= 0:
|
if timeout_sec >= 0:
|
||||||
print("Waiting for ips, timeout: %i..." % timeout_sec)
|
print("Waiting for ips, timeout: %i..." % timeout_sec)
|
||||||
else:
|
else:
|
||||||
print("Determining wait time based on mean station association time of stations. "
|
print("Determining wait time based on mean station association time of stations. "
|
||||||
"Will not wait more that 60 seconds without single association")
|
"Will not wait more that 60 seconds without single association")
|
||||||
stas_with_ips = []
|
stas_with_ips = {}
|
||||||
sec_elapsed = 0
|
sec_elapsed = 0
|
||||||
time_extended = False
|
time_extended = False
|
||||||
# print(station_list)
|
# print(station_list)
|
||||||
@@ -596,7 +596,7 @@ class Realm(LFCliBase):
|
|||||||
print("Waiting for port %s to get IPv4 Address." % (sta_eid))
|
print("Waiting for port %s to get IPv4 Address." % (sta_eid))
|
||||||
else:
|
else:
|
||||||
if sta_eid not in stas_with_ips:
|
if sta_eid not in stas_with_ips:
|
||||||
stas_with_ips.append(sta_eid)
|
stas_with_ips[sta_eid] = {'ipv4': v['ip']}
|
||||||
if debug:
|
if debug:
|
||||||
print("Found IP: %s on port: %s" % (v['ip'], sta_eid))
|
print("Found IP: %s on port: %s" % (v['ip'], sta_eid))
|
||||||
|
|
||||||
@@ -606,7 +606,7 @@ class Realm(LFCliBase):
|
|||||||
if v['ipv6 address'] != 'DELETED' and not v['ipv6 address'].startswith('fe80') \
|
if v['ipv6 address'] != 'DELETED' and not v['ipv6 address'].startswith('fe80') \
|
||||||
and v['ipv6 address'] != 'AUTO':
|
and v['ipv6 address'] != 'AUTO':
|
||||||
if sta_eid not in stas_with_ips:
|
if sta_eid not in stas_with_ips:
|
||||||
stas_with_ips.append(sta_eid)
|
stas_with_ips[sta_eid] = {'ipv6': v['ip']}
|
||||||
if debug:
|
if debug:
|
||||||
print("Found IPv6: %s on port: %s" % (v['ipv6 address'], sta_eid))
|
print("Found IPv6: %s on port: %s" % (v['ipv6 address'], sta_eid))
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user