Merge remote-tracking branch 'origin/master' into diptiBranch-solidifyingV1

Signed-off-by: Matthew Stidham <stidmatt@protonmail.com>
This commit is contained in:
Matthew Stidham
2021-03-08 15:46:32 -08:00
8 changed files with 84 additions and 35 deletions

View File

@@ -288,7 +288,7 @@ class LFRequest:
print("----- Response: --------------------------------------------------------")
LFUtils.debug_printer.pprint(myresponses[0].reason)
print("------------------------------------------------------------------------")
if die_on_error_ == True:
if (error.code != 404) and (die_on_error_ == True):
traceback.print_stack(limit=15)
exit(1)
except urllib.error.URLError as uerror:

View File

@@ -180,6 +180,8 @@ class Realm(LFCliBase):
debug=debug_)
def rm_port(self, port_eid, check_exists=True, debug_=False):
if port_eid is None:
raise ValueError("realm.rm_port: want a port eid like 1.1.eth1")
debug_ |= self.debug
req_url = "/cli-json/rm_vlan"
eid = self.name_to_eid(port_eid)
@@ -542,14 +544,14 @@ class Realm(LFCliBase):
return LFUtils.name_to_eid(eid)
def wait_for_ip(self, station_list=None, ipv4=True, ipv6=False, timeout_sec=360, debug=False):
if not (ipv4 ^ ipv6):
raise ValueError("wait_for_ip: ipv4 or ipv6 must be set!")
if not (ipv4 or ipv6):
raise ValueError("wait_for_ip: ipv4 and/or ipv6 must be set!")
if timeout_sec >= 0:
print("Waiting for ips, timeout: %i..." % timeout_sec)
else:
print("Determining wait time based on mean station association time of stations. "
"Will not wait more that 60 seconds without single association")
stas_with_ips = []
stas_with_ips = {}
sec_elapsed = 0
time_extended = False
# print(station_list)
@@ -596,7 +598,7 @@ class Realm(LFCliBase):
print("Waiting for port %s to get IPv4 Address." % (sta_eid))
else:
if sta_eid not in stas_with_ips:
stas_with_ips.append(sta_eid)
stas_with_ips[sta_eid] = {'ipv4': v['ip']}
if debug:
print("Found IP: %s on port: %s" % (v['ip'], sta_eid))
@@ -606,7 +608,7 @@ class Realm(LFCliBase):
if v['ipv6 address'] != 'DELETED' and not v['ipv6 address'].startswith('fe80') \
and v['ipv6 address'] != 'AUTO':
if sta_eid not in stas_with_ips:
stas_with_ips.append(sta_eid)
stas_with_ips[sta_eid] = {'ipv6': v['ip']}
if debug:
print("Found IPv6: %s on port: %s" % (v['ipv6 address'], sta_eid))
else:

View File

@@ -403,6 +403,16 @@ class VRProfile(BaseProfile):
debug |= self.debug
used_vrcx_area = self.get_occupied_area(resource=self.vr_eid[1], debug=debug)
def refresh_netsmith(self, resource=0, debug=False):
debug |= self.debug
if (resource is None) or (resource < 1):
raise ValueError("refresh_netsmith requires resource > 0")
self.json_post("/cli-json/apply_vr_cfg", {
"shelf": 1,
"resource": resource
}, debug_=debug, suppress_related_commands_=True)
def create(self,
vr_name=None,
debug=False,