mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 11:48:03 +00:00
example of forcing AP
This commit is contained in:
@@ -17,7 +17,7 @@ import pprint
|
|||||||
|
|
||||||
|
|
||||||
class IPv4Test(LFCliBase):
|
class IPv4Test(LFCliBase):
|
||||||
def __init__(self, ssid, security, password, sta_list=None, mode = 0, number_template="00000", host="localhost", port=8080,radio = "wiphy0",_debug_on=False,
|
def __init__(self, ssid, security, password, sta_list=None, ap=None, mode = 0, number_template="00000", host="localhost", port=8080,radio = "wiphy0",_debug_on=False,
|
||||||
_exit_on_error=False,
|
_exit_on_error=False,
|
||||||
_exit_on_fail=False):
|
_exit_on_fail=False):
|
||||||
super().__init__(host, port, _debug=_debug_on, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail)
|
super().__init__(host, port, _debug=_debug_on, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail)
|
||||||
@@ -25,6 +25,7 @@ class IPv4Test(LFCliBase):
|
|||||||
self.port = port
|
self.port = port
|
||||||
self.ssid = ssid
|
self.ssid = ssid
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
|
self.ap = ap
|
||||||
self.radio = radio
|
self.radio = radio
|
||||||
self.security = security
|
self.security = security
|
||||||
self.password = password
|
self.password = password
|
||||||
@@ -42,6 +43,8 @@ class IPv4Test(LFCliBase):
|
|||||||
self.station_profile.security = self.security
|
self.station_profile.security = self.security
|
||||||
self.station_profile.number_template_ = self.number_template
|
self.station_profile.number_template_ = self.number_template
|
||||||
self.station_profile.mode = mode
|
self.station_profile.mode = mode
|
||||||
|
if self.ap is not None:
|
||||||
|
self.station_profile.set_command_param("add_sta", "ap",self.ap)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
# Build stations
|
# Build stations
|
||||||
@@ -71,7 +74,6 @@ def main():
|
|||||||
|
|
||||||
parser = LFCliBase.create_basic_argparse(
|
parser = LFCliBase.create_basic_argparse(
|
||||||
prog='example_security_connection.py',
|
prog='example_security_connection.py',
|
||||||
# formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
||||||
formatter_class=argparse.RawTextHelpFormatter,
|
formatter_class=argparse.RawTextHelpFormatter,
|
||||||
epilog='''\
|
epilog='''\
|
||||||
Example flags and command line input to run the script.
|
Example flags and command line input to run the script.
|
||||||
@@ -88,11 +90,26 @@ def main():
|
|||||||
--mgr localhost
|
--mgr localhost
|
||||||
--mgr_port 8080
|
--mgr_port 8080
|
||||||
--num_stations 6
|
--num_stations 6
|
||||||
--mode { 0 - 802.11bgn 40, 1 - 802.11a , 2- 802.11b 20,
|
--mode 1
|
||||||
3 - 802.11bg 20 , 5 - 802.11bgn 40}
|
{"auto" : "0",
|
||||||
|
"a" : "1",
|
||||||
|
"b" : "2",
|
||||||
|
"g" : "3",
|
||||||
|
"abg" : "4",
|
||||||
|
"abgn" : "5",
|
||||||
|
"bgn" : "6",
|
||||||
|
"bg" : "7",
|
||||||
|
"abgnAC" : "8",
|
||||||
|
"anAC" : "9",
|
||||||
|
"an" : "10",
|
||||||
|
"bgnAC" : "11",
|
||||||
|
"abgnAX" : "12",
|
||||||
|
"bgnAX" : "13",
|
||||||
|
"anAX" : "14"}
|
||||||
--radio wiphy2
|
--radio wiphy2
|
||||||
--security {open|wep|wpa|wpa2|wpa3}
|
--security {open|wep|wpa|wpa2|wpa3}
|
||||||
--ssid netgear-wpa3
|
--ssid netgear-wpa3
|
||||||
|
--ap "00:0e:8e:78:e1:76"
|
||||||
--passwd admin123-wpa3
|
--passwd admin123-wpa3
|
||||||
--debug
|
--debug
|
||||||
|
|
||||||
@@ -101,6 +118,7 @@ def main():
|
|||||||
required = parser.add_argument_group('required arguments')
|
required = parser.add_argument_group('required arguments')
|
||||||
required.add_argument('--security', help='WiFi Security protocol: < open | wep | wpa | wpa2 | wpa3 >', required=True)
|
required.add_argument('--security', help='WiFi Security protocol: < open | wep | wpa | wpa2 | wpa3 >', required=True)
|
||||||
optional.add_argument('--mode',help='Used to force mode of stations')
|
optional.add_argument('--mode',help='Used to force mode of stations')
|
||||||
|
optional.add_argument('--ap',help='Used to force a connection to a particular AP')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
num_sta = 2
|
num_sta = 2
|
||||||
@@ -114,7 +132,7 @@ def main():
|
|||||||
padding_number_=10000,
|
padding_number_=10000,
|
||||||
radio=args.radio)
|
radio=args.radio)
|
||||||
ip_test = IPv4Test(host=args.mgr, port=args.mgr_port, ssid=args.ssid, password=args.passwd, radio=args.radio, mode= args.mode,
|
ip_test = IPv4Test(host=args.mgr, port=args.mgr_port, ssid=args.ssid, password=args.passwd, radio=args.radio, mode= args.mode,
|
||||||
security=args.security, sta_list=station_list)
|
security=args.security, sta_list=station_list, ap=args.ap)
|
||||||
ip_test.cleanup(station_list)
|
ip_test.cleanup(station_list)
|
||||||
ip_test.timeout = 60
|
ip_test.timeout = 60
|
||||||
ip_test.build()
|
ip_test.build()
|
||||||
|
|||||||
Reference in New Issue
Block a user