mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 19:58:03 +00:00
realm: Remove redundant is not None
Signed-off-by: matthew <stidmatt@gmail.com>
This commit is contained in:
@@ -248,7 +248,7 @@ class Realm(LFCliBase):
|
|||||||
eid = self.name_to_eid(port_eid)
|
eid = self.name_to_eid(port_eid)
|
||||||
current_stations = self.json_get("/port/%s/%s/%s?fields=alias" % (eid[0], eid[1], eid[2]),
|
current_stations = self.json_get("/port/%s/%s/%s?fields=alias" % (eid[0], eid[1], eid[2]),
|
||||||
debug_=debug)
|
debug_=debug)
|
||||||
if current_stations is not None:
|
if current_stations:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -321,13 +321,13 @@ class Realm(LFCliBase):
|
|||||||
|
|
||||||
def cleanup_cxe_prefix(self, prefix):
|
def cleanup_cxe_prefix(self, prefix):
|
||||||
cx_list = self.cx_list()
|
cx_list = self.cx_list()
|
||||||
if cx_list is not None:
|
if cx_list:
|
||||||
for cx_name in cx_list:
|
for cx_name in cx_list:
|
||||||
if cx_name.startswith(prefix):
|
if cx_name.startswith(prefix):
|
||||||
self.rm_cx(cx_name)
|
self.rm_cx(cx_name)
|
||||||
|
|
||||||
endp_list = self.json_get("/endp/list")
|
endp_list = self.json_get("/endp/list")
|
||||||
if endp_list is not None:
|
if endp_list:
|
||||||
if 'endpoint' in endp_list:
|
if 'endpoint' in endp_list:
|
||||||
endp_list = list(endp_list['endpoint'])
|
endp_list = list(endp_list['endpoint'])
|
||||||
for idx in range(len(endp_list)):
|
for idx in range(len(endp_list)):
|
||||||
@@ -401,7 +401,7 @@ class Realm(LFCliBase):
|
|||||||
found_endps = {}
|
found_endps = {}
|
||||||
if debug:
|
if debug:
|
||||||
print("Waiting on endpoint endp_list {}".format(endp_list))
|
print("Waiting on endpoint endp_list {}".format(endp_list))
|
||||||
if (endp_list is not None) and ("items" not in endp_list):
|
if endp_list and ("items" not in endp_list):
|
||||||
try:
|
try:
|
||||||
endp_list = list(endp_list['endpoint'])
|
endp_list = list(endp_list['endpoint'])
|
||||||
for idx in range(len(endp_list)):
|
for idx in range(len(endp_list)):
|
||||||
@@ -434,7 +434,7 @@ class Realm(LFCliBase):
|
|||||||
found_cxs = {}
|
found_cxs = {}
|
||||||
cx_list = self.cx_list()
|
cx_list = self.cx_list()
|
||||||
not_cx = ['warnings', 'errors', 'handler', 'uri', 'items']
|
not_cx = ['warnings', 'errors', 'handler', 'uri', 'items']
|
||||||
if cx_list is not None:
|
if cx_list:
|
||||||
for cx_name in cx_list:
|
for cx_name in cx_list:
|
||||||
if cx_name in not_cx:
|
if cx_name in not_cx:
|
||||||
continue
|
continue
|
||||||
@@ -747,7 +747,7 @@ class Realm(LFCliBase):
|
|||||||
if isinstance(time_string, str):
|
if isinstance(time_string, str):
|
||||||
pattern = re.compile("^(\d+)([dhms]$)")
|
pattern = re.compile("^(\d+)([dhms]$)")
|
||||||
td = pattern.match(time_string)
|
td = pattern.match(time_string)
|
||||||
if td is not None:
|
if td:
|
||||||
dur_time = int(td.group(1))
|
dur_time = int(td.group(1))
|
||||||
dur_measure = str(td.group(2))
|
dur_measure = str(td.group(2))
|
||||||
if dur_measure == "d":
|
if dur_measure == "d":
|
||||||
@@ -767,7 +767,7 @@ class Realm(LFCliBase):
|
|||||||
def remove_all_stations(self, resource):
|
def remove_all_stations(self, resource):
|
||||||
port_list = self.station_list()
|
port_list = self.station_list()
|
||||||
sta_list = []
|
sta_list = []
|
||||||
if sta_list is not None:
|
if port_list:
|
||||||
print("Removing all stations")
|
print("Removing all stations")
|
||||||
for item in list(port_list):
|
for item in list(port_list):
|
||||||
if "sta" in list(item)[0]:
|
if "sta" in list(item)[0]:
|
||||||
@@ -786,7 +786,7 @@ class Realm(LFCliBase):
|
|||||||
endp_list = self.json_get("/endp/list")
|
endp_list = self.json_get("/endp/list")
|
||||||
if "items" in endp_list or "empty" in endp_list:
|
if "items" in endp_list or "empty" in endp_list:
|
||||||
return
|
return
|
||||||
if endp_list is not None or endp_list:
|
if endp_list:
|
||||||
print("Removing all endps")
|
print("Removing all endps")
|
||||||
endp_list = list(endp_list['endpoint'])
|
endp_list = list(endp_list['endpoint'])
|
||||||
for endp_name in range(len(endp_list)):
|
for endp_name in range(len(endp_list)):
|
||||||
@@ -805,7 +805,7 @@ class Realm(LFCliBase):
|
|||||||
try:
|
try:
|
||||||
cx_list = list(self.cx_list())
|
cx_list = list(self.cx_list())
|
||||||
not_cx = ['warnings', 'errors', 'handler', 'uri', 'items', 'empty']
|
not_cx = ['warnings', 'errors', 'handler', 'uri', 'items', 'empty']
|
||||||
if cx_list is not None:
|
if cx_list:
|
||||||
print("Removing all cxs")
|
print("Removing all cxs")
|
||||||
for cx_name in cx_list:
|
for cx_name in cx_list:
|
||||||
if cx_name in not_cx:
|
if cx_name in not_cx:
|
||||||
|
|||||||
Reference in New Issue
Block a user