mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 19:28:00 +00:00
lf_cleanup.py : pep8 cleanup
Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
@@ -63,12 +63,12 @@ class lf_clean(Realm):
|
|||||||
}
|
}
|
||||||
super().json_post(req_url, data)
|
super().json_post(req_url, data)
|
||||||
time.sleep(.5)
|
time.sleep(.5)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
else:
|
else:
|
||||||
print("No cross connects found to cleanup")
|
print("No cross connects found to cleanup")
|
||||||
still_looking_cxs = False
|
still_looking_cxs = False
|
||||||
print("clean_cxs still_looking_cxs {cxs_looking}".format(cxs_looking=still_looking_cxs))
|
print("clean_cxs still_looking_cxs {cxs_looking}".format(cxs_looking=still_looking_cxs))
|
||||||
if not still_looking_cxs:
|
if not still_looking_cxs:
|
||||||
self.cxs_done = True
|
self.cxs_done = True
|
||||||
return still_looking_cxs
|
return still_looking_cxs
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ class lf_clean(Realm):
|
|||||||
print("No endpoints found to cleanup")
|
print("No endpoints found to cleanup")
|
||||||
still_looking_endp = False
|
still_looking_endp = False
|
||||||
print("clean_endp still_looking_endp {ednp_looking}".format(ednp_looking=still_looking_endp))
|
print("clean_endp still_looking_endp {ednp_looking}".format(ednp_looking=still_looking_endp))
|
||||||
if not still_looking_endp:
|
if not still_looking_endp:
|
||||||
self.endp_done = True
|
self.endp_done = True
|
||||||
return still_looking_endp
|
return still_looking_endp
|
||||||
|
|
||||||
@@ -167,29 +167,30 @@ class lf_clean(Realm):
|
|||||||
time.sleep(.5)
|
time.sleep(.5)
|
||||||
if ('Unknown' not in alias) and ('wlan' not in alias) and ('sta' not in alias):
|
if ('Unknown' not in alias) and ('wlan' not in alias) and ('sta' not in alias):
|
||||||
still_looking_sta = False
|
still_looking_sta = False
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("No stations found to cleanup")
|
print("No stations found to cleanup")
|
||||||
still_looking_sta = False
|
still_looking_sta = False
|
||||||
print("clean_sta still_looking_sta {sta_looking}".format(sta_looking=still_looking_sta))
|
print("clean_sta still_looking_sta {sta_looking}".format(sta_looking=still_looking_sta))
|
||||||
if not still_looking_sta:
|
if not still_looking_sta:
|
||||||
self.sta_done = True
|
self.sta_done = True
|
||||||
return still_looking_sta
|
return still_looking_sta
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
1: delete cx
|
1: delete cx
|
||||||
2: delete endp
|
2: delete endp
|
||||||
3: delete sta
|
3: delete sta
|
||||||
when deleting sta first, you will end up with phantom CX
|
when deleting sta first, you will end up with phantom CX
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
if self.clean_cxs:
|
if self.clean_cxs:
|
||||||
# also clean the endp when cleaning cxs
|
# also clean the endp when cleaning cxs
|
||||||
still_looking_cxs = self.cxs_clean()
|
still_looking_cxs = self.cxs_clean()
|
||||||
still_looking_endp = self.endp_clean()
|
still_looking_endp = self.endp_clean()
|
||||||
print("clean_cxs: still_looking_cxs {looking_cxs} still_looking_endp {looking_endp}".format(looking_cxs=still_looking_cxs,looking_endp=still_looking_endp))
|
print("clean_cxs: still_looking_cxs {looking_cxs} still_looking_endp {looking_endp}".format(
|
||||||
|
looking_cxs=still_looking_cxs, looking_endp=still_looking_endp))
|
||||||
if self.clean_endp and not self.clean_cxs:
|
if self.clean_endp and not self.clean_cxs:
|
||||||
still_looking_endp = self.endp_clean()
|
still_looking_endp = self.endp_clean()
|
||||||
print("clean_endp: still_looking_endp {looking_endp}".format(looking_endp=still_looking_endp))
|
print("clean_endp: still_looking_endp {looking_endp}".format(looking_endp=still_looking_endp))
|
||||||
@@ -198,6 +199,7 @@ class lf_clean(Realm):
|
|||||||
still_looking_sta = self.sta_clean()
|
still_looking_sta = self.sta_clean()
|
||||||
print("clean_sta: still_looking_sta {looking_sta}".format(looking_sta=still_looking_sta))
|
print("clean_sta: still_looking_sta {looking_sta}".format(looking_sta=still_looking_sta))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
@@ -239,8 +241,8 @@ python3 ./lf_clean.py --mgr MGR
|
|||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if args.cxs or args.endp or args.sta:
|
if args.cxs or args.endp or args.sta:
|
||||||
clean = lf_clean(host=args.mgr,clean_cxs=args.cxs,clean_endp=args.endp,clean_sta=args.sta )
|
clean = lf_clean(host=args.mgr, clean_cxs=args.cxs, clean_endp=args.endp, clean_sta=args.sta)
|
||||||
print("cleaning cxs: {cxs} endpoints: {endp} stations: {sta} start".format(cxs=args.cxs,endp=args.endp,sta=args.sta))
|
print("cleaning cxs: {cxs} endpoints: {endp} stations: {sta} start".format(cxs=args.cxs, endp=args.endp, sta=args.sta))
|
||||||
if args.cxs:
|
if args.cxs:
|
||||||
print("cleaning cxs will also clean endp")
|
print("cleaning cxs will also clean endp")
|
||||||
clean.cxs_clean()
|
clean.cxs_clean()
|
||||||
@@ -253,7 +255,8 @@ python3 ./lf_clean.py --mgr MGR
|
|||||||
# print("Clean cxs_done {cxs_done} endp_done {endp_done} sta_done {sta_done}"
|
# print("Clean cxs_done {cxs_done} endp_done {endp_done} sta_done {sta_done}"
|
||||||
# .format(cxs_done=clean.cxs_done,endp_done=clean.endp_done,sta_done=clean.sta_done))
|
# .format(cxs_done=clean.cxs_done,endp_done=clean.endp_done,sta_done=clean.sta_done))
|
||||||
else:
|
else:
|
||||||
print("please add option of --cxs ,--endp, or --sta to clean")
|
print("please add option of --cxs ,--endp, or --sta to clean")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user