mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-31 18:58:01 +00:00 
			
		
		
		
	run autopep8 on create_vap
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
		| @@ -55,7 +55,10 @@ class CreateVAP(Realm): | |||||||
|         self.vap_list = _vap_list |         self.vap_list = _vap_list | ||||||
|         self.resource = _resource |         self.resource = _resource | ||||||
|         if _vap_flags is None: |         if _vap_flags is None: | ||||||
|             self.vap_flags = ["wpa2_enable", "80211u_enable", "create_admin_down"] |             self.vap_flags = [ | ||||||
|  |                 "wpa2_enable", | ||||||
|  |                 "80211u_enable", | ||||||
|  |                 "create_admin_down"] | ||||||
|         else: |         else: | ||||||
|             self.vap_flags = _vap_flags |             self.vap_flags = _vap_flags | ||||||
|         self.mode = _mode |         self.mode = _mode | ||||||
| @@ -74,8 +77,10 @@ class CreateVAP(Realm): | |||||||
|         self.vap_profile.ssid_pass = self.password |         self.vap_profile.ssid_pass = self.password | ||||||
|         self.vap_profile.dhcp = self.dhcp |         self.vap_profile.dhcp = self.dhcp | ||||||
|         self.vap_profile.mode = self.mode |         self.vap_profile.mode = self.mode | ||||||
|         self.vap_profile.desired_add_vap_flags = self.vap_flags + ["wpa2_enable", "80211u_enable", "create_admin_down"] |         self.vap_profile.desired_add_vap_flags = self.vap_flags + \ | ||||||
|         self.vap_profile.desired_add_vap_flags_mask = self.vap_flags + ["wpa2_enable", "80211u_enable", "create_admin_down"] |             ["wpa2_enable", "80211u_enable", "create_admin_down"] | ||||||
|  |         self.vap_profile.desired_add_vap_flags_mask = self.vap_flags + \ | ||||||
|  |             ["wpa2_enable", "80211u_enable", "create_admin_down"] | ||||||
|         if self.debug: |         if self.debug: | ||||||
|             print("----- VAP List ----- ----- ----- ----- ----- ----- \n") |             print("----- VAP List ----- ----- ----- ----- ----- ----- \n") | ||||||
|             pprint.pprint(self.vap_list) |             pprint.pprint(self.vap_list) | ||||||
| @@ -83,18 +88,19 @@ class CreateVAP(Realm): | |||||||
|  |  | ||||||
|     def build(self): |     def build(self): | ||||||
|         # Build VAPs |         # Build VAPs | ||||||
|         self.vap_profile.use_security(self.security, self.ssid, passwd=self.password) |         self.vap_profile.use_security( | ||||||
|  |             self.security, self.ssid, passwd=self.password) | ||||||
|  |  | ||||||
|         print("Creating VAPs") |         print("Creating VAPs") | ||||||
|         self.vap_profile.create(resource = self.resource, |         self.vap_profile.create(resource=self.resource, | ||||||
|                                 radio = self.radio, |                                 radio=self.radio, | ||||||
|                                 channel = self.channel, |                                 channel=self.channel, | ||||||
|                                 up_ = True, |                                 up_=True, | ||||||
|                                 debug = False, |                                 debug=False, | ||||||
|                                 use_ht40=True, |                                 use_ht40=True, | ||||||
|                                 use_ht80=True, |                                 use_ht80=True, | ||||||
|                                 use_ht160=False, |                                 use_ht160=False, | ||||||
|                                 suppress_related_commands_ = True, |                                 suppress_related_commands_=True, | ||||||
|                                 use_radius=False, |                                 use_radius=False, | ||||||
|                                 hs20_enable=False, |                                 hs20_enable=False, | ||||||
|                                 bridge=self.bridge) |                                 bridge=self.bridge) | ||||||
| @@ -124,57 +130,73 @@ Command example: | |||||||
|             ''') |             ''') | ||||||
|  |  | ||||||
|     optional = parser.add_argument_group('optional arguments') |     optional = parser.add_argument_group('optional arguments') | ||||||
|     optional.add_argument('--num_vaps', help='Number of VAPs to Create', required=False, default=1) |     optional.add_argument( | ||||||
|     optional.add_argument('--vap_flag', help='VAP flags to add', required=False, default=None, action='append') |         '--num_vaps', | ||||||
|     optional.add_argument('--bridge', help='Create a bridge connecting the VAP to a port', required=False, default=False) |         help='Number of VAPs to Create', | ||||||
|     optional.add_argument('--mac', help='Custom mac address', default="xx:xx:xx:xx:*:xx") |         required=False, | ||||||
|  |         default=1) | ||||||
|  |     optional.add_argument( | ||||||
|  |         '--vap_flag', | ||||||
|  |         help='VAP flags to add', | ||||||
|  |         required=False, | ||||||
|  |         default=None, | ||||||
|  |         action='append') | ||||||
|  |     optional.add_argument( | ||||||
|  |         '--bridge', | ||||||
|  |         help='Create a bridge connecting the VAP to a port', | ||||||
|  |         required=False, | ||||||
|  |         default=False) | ||||||
|  |     optional.add_argument( | ||||||
|  |         '--mac', | ||||||
|  |         help='Custom mac address', | ||||||
|  |         default="xx:xx:xx:xx:*:xx") | ||||||
|     optional.add_argument('--mode', default='AUTO') |     optional.add_argument('--mode', default='AUTO') | ||||||
|     optional.add_argument('--channel', default=36) |     optional.add_argument('--channel', default=36) | ||||||
|     optional.add_argument('--country_code', default=0) |     optional.add_argument('--country_code', default=0) | ||||||
|     optional.add_argument('--nss', default=False) |     optional.add_argument('--nss', default=False) | ||||||
|     optional.add_argument('--resource', default=1) |     optional.add_argument('--resource', default=1) | ||||||
|     optional.add_argument('--start_id', default=0) |     optional.add_argument('--start_id', default=0) | ||||||
|     optional.add_argument('--vap_name',default=None) |     optional.add_argument('--vap_name', default=None) | ||||||
|     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") | ||||||
|  |  | ||||||
|     num_vap = int(args.num_vaps) |     num_vap = int(args.num_vaps) | ||||||
|  |  | ||||||
|     vap_list = LFUtils.port_name_series(prefix="vap", |     vap_list = LFUtils.port_name_series(prefix="vap", | ||||||
|                            start_id=int(args.start_id), |                                         start_id=int(args.start_id), | ||||||
|                            end_id=num_vap-1, |                                         end_id=num_vap - 1, | ||||||
|                            padding_number=10000, |                                         padding_number=10000, | ||||||
|                            radio=args.radio) |                                         radio=args.radio) | ||||||
|     #print(args.passwd) |     # print(args.passwd) | ||||||
|     #print(args.ssid) |     # print(args.ssid) | ||||||
|  |  | ||||||
|     if args.vap_name is None: |     if args.vap_name is None: | ||||||
|         for vap in vap_list: |         for vap in vap_list: | ||||||
|             create_vap = CreateVAP(_host=args.mgr, |             create_vap = CreateVAP(_host=args.mgr, | ||||||
|                            _port=args.mgr_port, |                                    _port=args.mgr_port, | ||||||
|                            _ssid=args.ssid, |                                    _ssid=args.ssid, | ||||||
|                            _password=args.passwd, |                                    _password=args.passwd, | ||||||
|                            _security=args.security, |                                    _security=args.security, | ||||||
|                                    _mode=args.mode, |                                    _mode=args.mode, | ||||||
|                            _vap_list=vap, |                                    _vap_list=vap, | ||||||
|                                    _resource=args.resource, |                                    _resource=args.resource, | ||||||
|                                    _vap_flags=args.vap_flag, |                                    _vap_flags=args.vap_flag, | ||||||
|                            _radio=args.radio, |                                    _radio=args.radio, | ||||||
|                                    _channel=args.channel, |                                    _channel=args.channel, | ||||||
|                                    _country_code=args.country_code, |                                    _country_code=args.country_code, | ||||||
|                                    _nss=args.nss, |                                    _nss=args.nss, | ||||||
|                            _proxy_str=args.proxy, |                                    _proxy_str=args.proxy, | ||||||
|                                    _bridge=args.bridge, |                                    _bridge=args.bridge, | ||||||
|                            _debug_on=args.debug) |                                    _debug_on=args.debug) | ||||||
|             print('Creating VAP') |             print('Creating VAP') | ||||||
|  |  | ||||||
|             create_vap.build() |             create_vap.build() | ||||||
|     else: |     else: | ||||||
|         vap_name = "vap"+args.vap_name |         vap_name = "vap" + args.vap_name | ||||||
|         create_vap = CreateVAP(_host=args.mgr, |         create_vap = CreateVAP(_host=args.mgr, | ||||||
|                                _port=args.mgr_port, |                                _port=args.mgr_port, | ||||||
|                                _ssid=args.ssid, |                                _ssid=args.ssid, | ||||||
| @@ -195,5 +217,6 @@ Command example: | |||||||
|  |  | ||||||
|         create_vap.build() |         create_vap.build() | ||||||
|  |  | ||||||
|  |  | ||||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||||
|     main() |     main() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Matthew Stidham
					Matthew Stidham