mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 11:48:03 +00:00
argparse groups added
This commit is contained in:
@@ -437,19 +437,20 @@ class LFCliBase:
|
|||||||
description=description)
|
description=description)
|
||||||
else:
|
else:
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
optional = parser.add_argument_group('optional arguments')
|
||||||
parser.add_argument('--mgr', help='hostname for where LANforge GUI is running', default='localhost')
|
required = parser.add_argument_group('required arguments')
|
||||||
parser.add_argument('--mgr_port', help='port LANforge GUI HTTP service is running on', default=8080)
|
optional.add_argument('--mgr', help='hostname for where LANforge GUI is running', default='localhost')
|
||||||
parser.add_argument('-u', '--upstream_port',
|
optional.add_argument('--mgr_port', help='port LANforge GUI HTTP service is running on', default=8080)
|
||||||
|
optional.add_argument('-u', '--upstream_port',
|
||||||
help='non-station port that generates traffic: <resource>.<port>, e.g: 1.eth1',
|
help='non-station port that generates traffic: <resource>.<port>, e.g: 1.eth1',
|
||||||
default='1.eth1')
|
default='1.eth1')
|
||||||
parser.add_argument('--radio', help='radio EID, e.g: 1.wiphy2', default=None)
|
required.add_argument('--radio', help='radio EID, e.g: 1.wiphy2', required=True)
|
||||||
parser.add_argument('--security', help='WiFi Security protocol: <open | wep | wpa | wpa2 | wpa3 >', default=None)
|
required.add_argument('--security', help='WiFi Security protocol: < open | wep | wpa | wpa2 | wpa3 >', required=True)
|
||||||
parser.add_argument('--ssid', help='SSID for stations to associate to', default=None)
|
required.add_argument('--ssid', help='SSID for stations to associate to', required=True)
|
||||||
parser.add_argument('--passwd', help='WiFi passphrase', default=None)
|
required.add_argument('--passwd', '--password' ,'--key', help='WiFi passphrase/password/key', required=True)
|
||||||
parser.add_argument('--num_stations', help='Number of stations to create', default=0)
|
optional.add_argument('--num_stations', help='Number of stations to create', default=0)
|
||||||
parser.add_argument('--test_id', help='Test ID (intended to use for ws events)', default="webconsole")
|
optional.add_argument('--test_id', help='Test ID (intended to use for ws events)', default="webconsole")
|
||||||
parser.add_argument('--debug', help='Enable debugging', default=False, action="store_true")
|
optional.add_argument('--debug', help='Enable debugging', default=False, action="store_true")
|
||||||
|
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ class IPv4Test(LFCliBase):
|
|||||||
ssid,
|
ssid,
|
||||||
security,
|
security,
|
||||||
password,
|
password,
|
||||||
host="localhost",
|
host,
|
||||||
port=8080,
|
port,
|
||||||
sta_list=None,
|
sta_list=None,
|
||||||
number_template="00000",
|
number_template="00000",
|
||||||
radio="wiphy0",
|
radio="wiphy0",
|
||||||
@@ -138,20 +138,19 @@ def main():
|
|||||||
test_ipv4_connection.py
|
test_ipv4_connection.py
|
||||||
--------------------
|
--------------------
|
||||||
Generic command example:
|
Generic command example:
|
||||||
./test_ipv4_connection.py --upstream_port eth1 \\
|
./test_ipv4_connection.py
|
||||||
--radio wiphy0 \\
|
--upstream_port eth1
|
||||||
--num_stations 3 \\
|
--radio wiphy0
|
||||||
--security open {open|wep|wpa|wpa2|wpa3} \\
|
--num_stations 3
|
||||||
--ssid netgear \\
|
--security open
|
||||||
--passwd BLANK \\
|
--ssid netgear
|
||||||
|
--passwd BLANK
|
||||||
--debug
|
--debug
|
||||||
''')
|
''')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if (args.radio is None):
|
if (args.radio is None):
|
||||||
raise ValueError("--radio required")
|
raise ValueError("--radio required")
|
||||||
lfjson_host = args.mgr
|
|
||||||
lfjson_port = args.mgr_port
|
|
||||||
|
|
||||||
num_sta = 2
|
num_sta = 2
|
||||||
if (args.num_stations is not None) and (int(args.num_stations) > 0):
|
if (args.num_stations is not None) and (int(args.num_stations) > 0):
|
||||||
|
|||||||
Reference in New Issue
Block a user