mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-20 12:04:52 +00:00
station_layer3: Fix whitespace
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
@@ -1,15 +1,14 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
'''
|
"""
|
||||||
this script creates 1 station on given arguments
|
this script creates 1 station on given arguments
|
||||||
how to run - [lanforge@LF4-Node2 py-scripts]$ python3 station_banao.py -hst localhost -s TestAP22 -pwd [BLANK] -sec open -rad wiphy0
|
how to run - [lanforge@LF4-Node2 py-scripts]$ python3 station_banao.py -hst localhost -s TestAP22 -pwd [BLANK] -sec open -rad wiphy0
|
||||||
'''
|
"""
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import importlib
|
import importlib
|
||||||
import argparse
|
import argparse
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../")))
|
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../")))
|
||||||
|
|
||||||
LFUtils = importlib.import_module("py-json.LANforge.LFUtils")
|
LFUtils = importlib.import_module("py-json.LANforge.LFUtils")
|
||||||
@@ -20,7 +19,8 @@ Realm = realm.Realm
|
|||||||
|
|
||||||
|
|
||||||
class STATION(LFCliBase):
|
class STATION(LFCliBase):
|
||||||
def __init__(self, lfclient_host, lfclient_port, ssid, paswd, security, radio, sta_list=None, name_prefix="L3Test", upstream="eth2"):
|
def __init__(self, lfclient_host, lfclient_port, ssid, paswd, security, radio, sta_list=None, name_prefix="L3Test",
|
||||||
|
upstream="eth2"):
|
||||||
super().__init__(lfclient_host, lfclient_port)
|
super().__init__(lfclient_host, lfclient_port)
|
||||||
self.host = lfclient_host
|
self.host = lfclient_host
|
||||||
self.port = lfclient_port
|
self.port = lfclient_port
|
||||||
@@ -46,7 +46,6 @@ class STATION(LFCliBase):
|
|||||||
self.cx_profile.side_b_min_bps = 1000000
|
self.cx_profile.side_b_min_bps = 1000000
|
||||||
self.cx_profile.side_b_max_bps = 1000000
|
self.cx_profile.side_b_max_bps = 1000000
|
||||||
|
|
||||||
|
|
||||||
def precleanup(self, sta_list):
|
def precleanup(self, sta_list):
|
||||||
self.cx_profile.cleanup_prefix()
|
self.cx_profile.cleanup_prefix()
|
||||||
for sta in self.sta_list:
|
for sta in self.sta_list:
|
||||||
@@ -62,7 +61,7 @@ class STATION(LFCliBase):
|
|||||||
self.cx_profile.create(endp_type="lf_udp", side_a=self.station_profile.station_names, side_b=self.upstream,
|
self.cx_profile.create(endp_type="lf_udp", side_a=self.station_profile.station_names, side_b=self.upstream,
|
||||||
sleep_time=0)
|
sleep_time=0)
|
||||||
|
|
||||||
def start(self, sta_list):
|
def start(self):
|
||||||
self.station_profile.admin_up()
|
self.station_profile.admin_up()
|
||||||
temp_stas = self.station_profile.station_names.copy()
|
temp_stas = self.station_profile.station_names.copy()
|
||||||
if self.local_realm.wait_for_ip(temp_stas):
|
if self.local_realm.wait_for_ip(temp_stas):
|
||||||
@@ -72,16 +71,12 @@ class STATION(LFCliBase):
|
|||||||
self.exit_fail()
|
self.exit_fail()
|
||||||
self.cx_profile.start_cx()
|
self.cx_profile.start_cx()
|
||||||
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
# Bring stations down
|
# Bring stations down
|
||||||
self.station_profile.admin_down()
|
self.station_profile.admin_down()
|
||||||
self.cx_profile.stop_cx()
|
self.cx_profile.stop_cx()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog='station_layer3.py',
|
prog='station_layer3.py',
|
||||||
@@ -92,7 +87,7 @@ def main():
|
|||||||
parser.add_argument('-pwd', '--passwd', type=str, help='password to connect to ssid')
|
parser.add_argument('-pwd', '--passwd', type=str, help='password to connect to ssid')
|
||||||
parser.add_argument('-sec', '--security', type=str, help='security')
|
parser.add_argument('-sec', '--security', type=str, help='security')
|
||||||
parser.add_argument('-rad', '--radio', type=str, help='radio at which client will be connected')
|
parser.add_argument('-rad', '--radio', type=str, help='radio at which client will be connected')
|
||||||
#parser.add_argument()
|
# parser.add_argument()
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
num_sta = 1
|
num_sta = 1
|
||||||
station_list = LFUtils.port_name_series(prefix="sta",
|
station_list = LFUtils.port_name_series(prefix="sta",
|
||||||
@@ -100,10 +95,12 @@ def main():
|
|||||||
end_id=num_sta - 1,
|
end_id=num_sta - 1,
|
||||||
padding_number=10000,
|
padding_number=10000,
|
||||||
radio=args.radio)
|
radio=args.radio)
|
||||||
obj = STATION(lfclient_host= args.host, lfclient_port=8080, ssid=args.ssid , paswd=args.passwd, security=args.security, radio=args.radio, sta_list=station_list)
|
obj = STATION(lfclient_host=args.host, lfclient_port=8080, ssid=args.ssid, paswd=args.passwd,
|
||||||
|
security=args.security, radio=args.radio, sta_list=station_list)
|
||||||
obj.precleanup(station_list)
|
obj.precleanup(station_list)
|
||||||
obj.build()
|
obj.build()
|
||||||
obj.start(station_list)
|
obj.start()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user