run autopep8 on create_station

Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
Matthew Stidham
2021-11-10 12:15:51 -08:00
parent 608f3ab773
commit 2f657666cf

View File

@@ -12,7 +12,7 @@ if sys.version_info[0] != 3:
print("This script requires Python 3") print("This script requires Python 3")
exit(1) exit(1)
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../"))) sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../")))
lfcli_base = importlib.import_module("py-json.LANforge.lfcli_base") lfcli_base = importlib.import_module("py-json.LANforge.lfcli_base")
@@ -74,23 +74,31 @@ class CreateStation(Realm):
def build(self): def build(self):
# Build stations # Build stations
self.station_profile.use_security(self.security, self.ssid, self.password) self.station_profile.use_security(
self.security, self.ssid, self.password)
self.station_profile.set_number_template(self.number_template) self.station_profile.set_number_template(self.number_template)
print("Creating stations") print("Creating stations")
self.station_profile.set_command_flag("add_sta", "create_admin_down", 1) self.station_profile.set_command_flag(
self.station_profile.set_command_param("set_port", "report_timer", 1500) "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.set_command_flag("set_port", "rpt_timer", 1)
if self.set_txo_data is not None: if self.set_txo_data is not None:
self.station_profile.set_wifi_txo(txo_ena=self.set_txo_data["txo_enable"], self.station_profile.set_wifi_txo(
tx_power=self.set_txo_data["txpower"], txo_ena=self.set_txo_data["txo_enable"],
pream=self.set_txo_data["pream"], tx_power=self.set_txo_data["txpower"],
mcs=self.set_txo_data["mcs"], pream=self.set_txo_data["pream"],
nss=self.set_txo_data["nss"], mcs=self.set_txo_data["mcs"],
bw=self.set_txo_data["bw"], nss=self.set_txo_data["nss"],
retries=self.set_txo_data["retries"], bw=self.set_txo_data["bw"],
sgi=self.set_txo_data["sgi"], ) retries=self.set_txo_data["retries"],
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug) sgi=self.set_txo_data["sgi"],
)
self.station_profile.create(
radio=self.radio,
sta_names_=self.sta_list,
debug=self.debug)
if self.up: if self.up:
self.station_profile.admin_up() self.station_profile.admin_up()
@@ -98,7 +106,7 @@ class CreateStation(Realm):
def main(): def main():
parser = LFCliBase.create_basic_argparse( # see create_basic_argparse in ../py-json/LANforge/lfcli_base.py parser = LFCliBase.create_basic_argparse( # see create_basic_argparse in ../py-json/LANforge/lfcli_base.py
prog='create_station.py', prog='create_station.py',
formatter_class=argparse.RawTextHelpFormatter, formatter_class=argparse.RawTextHelpFormatter,
epilog='''\ epilog='''\
@@ -119,21 +127,32 @@ def main():
--debug --debug
''') ''')
required = parser.add_argument_group('required arguments') required = parser.add_argument_group('required arguments')
required.add_argument('--start_id', help='--start_id <value> default 0', default=0) required.add_argument(
'--start_id',
help='--start_id <value> default 0',
default=0)
optional = parser.add_argument_group('Optional arguments') optional = parser.add_argument_group('Optional arguments')
optional.add_argument('--mode', help='Mode for your station (as a number)',default=0) optional.add_argument(
optional.add_argument('--station_flag', help='station flags to add', required=False, default=None, action='append') '--mode',
help='Mode for your station (as a number)',
default=0)
optional.add_argument(
'--station_flag',
help='station flags to add',
required=False,
default=None,
action='append')
args = parser.parse_args() args = parser.parse_args()
# if args.debug: # if args.debug:
# pprint.pprint(args) # pprint.pprint(args)
# time.sleep(5) # time.sleep(5)
if (args.radio is None): if args.radio is None:
raise ValueError("--radio required") raise ValueError("--radio required")
start_id = 0 start_id = 0
if (args.start_id != 0): if args.start_id != 0:
start_id = int(args.start_id) start_id = int(args.start_id)
num_sta = 2 num_sta = 2
@@ -148,7 +167,7 @@ def main():
radio=args.radio) radio=args.radio)
print("station_list {}".format(station_list)) print("station_list {}".format(station_list))
set_txo_data={ set_txo_data = {
"txo_enable": 1, "txo_enable": 1,
"txpower": 255, "txpower": 255,
"pream": 0, "pream": 0,
@@ -175,5 +194,6 @@ def main():
create_station.build() create_station.build()
print('Created %s stations' % num_sta) print('Created %s stations' % num_sta)
if __name__ == "__main__": if __name__ == "__main__":
main() main()