mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +00:00
create_l3_stations autopep8
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
@@ -26,15 +26,28 @@ from realm import Realm
|
||||
|
||||
|
||||
class CreateL3(Realm):
|
||||
def __init__(self,
|
||||
ssid, security, password, sta_list, name_prefix, upstream, radio,
|
||||
host="localhost", port=8080, mode=0, ap=None,
|
||||
side_a_min_rate=56, side_a_max_rate=0,
|
||||
side_b_min_rate=56, side_b_max_rate=0,
|
||||
number_template="00000", use_ht160=False,
|
||||
_debug_on=False,
|
||||
_exit_on_error=False,
|
||||
_exit_on_fail=False):
|
||||
def __init__(
|
||||
self,
|
||||
ssid,
|
||||
security,
|
||||
password,
|
||||
sta_list,
|
||||
name_prefix,
|
||||
upstream,
|
||||
radio,
|
||||
host="localhost",
|
||||
port=8080,
|
||||
mode=0,
|
||||
ap=None,
|
||||
side_a_min_rate=56,
|
||||
side_a_max_rate=0,
|
||||
side_b_min_rate=56,
|
||||
side_b_max_rate=0,
|
||||
number_template="00000",
|
||||
use_ht160=False,
|
||||
_debug_on=False,
|
||||
_exit_on_error=False,
|
||||
_exit_on_fail=False):
|
||||
super().__init__(host, port)
|
||||
self.upstream = upstream
|
||||
self.host = host
|
||||
@@ -63,7 +76,9 @@ class CreateL3(Realm):
|
||||
self.station_profile.mode = mode
|
||||
if self.ap is not None:
|
||||
self.station_profile.set_command_param("add_sta", "ap", self.ap)
|
||||
# self.station_list= LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=2, padding_number_=10000, radio='wiphy0') #Make radio a user defined variable from terminal.
|
||||
# self.station_list= LFUtils.portNameSeries(prefix_="sta", start_id_=0,
|
||||
# end_id_=2, padding_number_=10000, radio='wiphy0') #Make radio a user
|
||||
# defined variable from terminal.
|
||||
|
||||
self.cx_profile.host = self.host
|
||||
self.cx_profile.port = self.port
|
||||
@@ -85,8 +100,10 @@ class CreateL3(Realm):
|
||||
self.password)
|
||||
self.station_profile.set_number_template(self.number_template)
|
||||
print("Creating stations")
|
||||
self.station_profile.set_command_flag("add_sta", "create_admin_down", 1)
|
||||
self.station_profile.set_command_param("set_port", "report_timer", 1500)
|
||||
self.station_profile.set_command_flag(
|
||||
"add_sta", "create_admin_down", 1)
|
||||
self.station_profile.set_command_param(
|
||||
"set_port", "report_timer", 1500)
|
||||
self.station_profile.set_command_flag("set_port", "rpt_timer", 1)
|
||||
self.station_profile.create(radio=self.radio,
|
||||
sta_names_=self.sta_list,
|
||||
@@ -110,7 +127,7 @@ def main():
|
||||
create_l3_stations.py:
|
||||
--------------------
|
||||
Generic command layout:
|
||||
|
||||
|
||||
python3 ./create_l3_stations.py
|
||||
--upstream_port eth1
|
||||
--radio wiphy0
|
||||
@@ -138,7 +155,7 @@ def main():
|
||||
--ap "00:0e:8e:78:e1:76"
|
||||
--number_template 0000
|
||||
--debug
|
||||
|
||||
|
||||
python3 ./create_l3_stations.py
|
||||
--upstream_port eth1
|
||||
--radio wiphy0
|
||||
@@ -174,8 +191,14 @@ def main():
|
||||
required_args = group
|
||||
break
|
||||
if required_args is not None:
|
||||
required_args.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000)
|
||||
required_args.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000)
|
||||
required_args.add_argument(
|
||||
'--a_min',
|
||||
help='--a_min bps rate minimum for side_a',
|
||||
default=256000)
|
||||
required_args.add_argument(
|
||||
'--b_min',
|
||||
help='--b_min bps rate minimum for side_b',
|
||||
default=256000)
|
||||
|
||||
optional_args = None
|
||||
for group in parser._action_groups:
|
||||
@@ -183,14 +206,23 @@ def main():
|
||||
optional_args = group
|
||||
break
|
||||
if optional_args:
|
||||
optional_args.add_argument('--mode', help='Used to force mode of stations')
|
||||
optional_args.add_argument('--ap', help='Used to force a connection to a particular AP')
|
||||
optional_args.add_argument('--number_template',
|
||||
help='Start the station numbering with a particular number. Default is 0000',
|
||||
default=0000)
|
||||
optional_args.add_argument('--station_list', help='Optional: User defined station names, can be a comma or space separated list', nargs='+',
|
||||
default=None)
|
||||
optional_args.add_argument('--no_cleanup', help="Optional: Don't cleanup existing stations", action='store_true')
|
||||
optional_args.add_argument(
|
||||
'--mode', help='Used to force mode of stations')
|
||||
optional_args.add_argument(
|
||||
'--ap', help='Used to force a connection to a particular AP')
|
||||
optional_args.add_argument(
|
||||
'--number_template',
|
||||
help='Start the station numbering with a particular number. Default is 0000',
|
||||
default=0000)
|
||||
optional_args.add_argument(
|
||||
'--station_list',
|
||||
help='Optional: User defined station names, can be a comma or space separated list',
|
||||
nargs='+',
|
||||
default=None)
|
||||
optional_args.add_argument(
|
||||
'--no_cleanup',
|
||||
help="Optional: Don't cleanup existing stations",
|
||||
action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
num_sta = 2
|
||||
@@ -198,9 +230,10 @@ def main():
|
||||
num_sta = int(args.num_stations)
|
||||
|
||||
if not args.station_list:
|
||||
station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=int(args.number_template),
|
||||
end_id_=num_sta + int(args.number_template) - 1, padding_number_=10000,
|
||||
radio=args.radio)
|
||||
station_list = LFUtils.portNameSeries(
|
||||
prefix_="sta", start_id_=int(
|
||||
args.number_template), end_id_=num_sta + int(
|
||||
args.number_template) - 1, padding_number_=10000, radio=args.radio)
|
||||
else:
|
||||
if ',' in args.station_list[0]:
|
||||
station_list = args.station_list[0].split(',')
|
||||
|
||||
Reference in New Issue
Block a user