mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +00:00
Add VAP arguments to create_vap.py including set_WIFI_RADIO integration
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
from LANforge.lfcli_base import LFCliBase
|
from LANforge.lfcli_base import LFCliBase
|
||||||
from LANforge import LFRequest
|
from LANforge import LFRequest
|
||||||
from LANforge import add_vap
|
from LANforge import add_vap, set_wifi_radio
|
||||||
from LANforge import set_port
|
from LANforge import set_port
|
||||||
from LANforge import LFUtils
|
from LANforge import LFUtils
|
||||||
import pprint
|
import pprint
|
||||||
@@ -212,7 +212,7 @@ class VAPProfile(LFCliBase):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def create(self, resource, radio, channel=None, up_=None, debug=False, use_ht40=True, use_ht80=True,
|
def create(self, resource, radio, channel=None, up_=None, debug=False, use_ht40=True, use_ht80=True,
|
||||||
use_ht160=False,
|
use_ht160=False, country=0,
|
||||||
suppress_related_commands_=True, use_radius=False, hs20_enable=False, bridge=True):
|
suppress_related_commands_=True, use_radius=False, hs20_enable=False, bridge=True):
|
||||||
port_list = self.local_realm.json_get("port/1/1/list")
|
port_list = self.local_realm.json_get("port/1/1/list")
|
||||||
if port_list is not None:
|
if port_list is not None:
|
||||||
@@ -249,11 +249,11 @@ class VAPProfile(LFCliBase):
|
|||||||
raise ValueError("No radio %s.%s found" % (resource, radio))
|
raise ValueError("No radio %s.%s found" % (resource, radio))
|
||||||
|
|
||||||
eid = "1.%s.%s" % (resource, radio)
|
eid = "1.%s.%s" % (resource, radio)
|
||||||
frequency = 0
|
|
||||||
country = 0
|
|
||||||
if eid in jr:
|
if eid in jr:
|
||||||
country = jr[eid]["country"]
|
country = jr[eid]["country"]
|
||||||
|
|
||||||
|
self.mode = set_wifi_radio.set_radio_mode[self.mode]
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"shelf": 1,
|
"shelf": 1,
|
||||||
"resource": resource,
|
"resource": resource,
|
||||||
@@ -263,6 +263,7 @@ class VAPProfile(LFCliBase):
|
|||||||
"country": country,
|
"country": country,
|
||||||
"frequency": self.local_realm.channel_freq(channel_=channel)
|
"frequency": self.local_realm.channel_freq(channel_=channel)
|
||||||
}
|
}
|
||||||
|
print(data)
|
||||||
self.local_realm.json_post("/cli-json/set_wifi_radio", _data=data)
|
self.local_realm.json_post("/cli-json/set_wifi_radio", _data=data)
|
||||||
if up_ is not None:
|
if up_ is not None:
|
||||||
self.up = up_
|
self.up = up_
|
||||||
|
|||||||
@@ -33,8 +33,12 @@ class CreateVAP(Realm):
|
|||||||
_port=None,
|
_port=None,
|
||||||
_vap_list=None,
|
_vap_list=None,
|
||||||
_vap_flags=None,
|
_vap_flags=None,
|
||||||
|
_mode=None,
|
||||||
_number_template="00000",
|
_number_template="00000",
|
||||||
_radio=None,
|
_radio=None,
|
||||||
|
_channel=36,
|
||||||
|
_country_code=0,
|
||||||
|
_nss=False,
|
||||||
_bridge=False,
|
_bridge=False,
|
||||||
_proxy_str=None,
|
_proxy_str=None,
|
||||||
_debug_on=False,
|
_debug_on=False,
|
||||||
@@ -53,7 +57,10 @@ class CreateVAP(Realm):
|
|||||||
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.radio = _radio
|
self.radio = _radio
|
||||||
|
self.channel = _channel
|
||||||
|
self.country_code = _country_code
|
||||||
self.timeout = 120
|
self.timeout = 120
|
||||||
self.number_template = _number_template
|
self.number_template = _number_template
|
||||||
self.debug = _debug_on
|
self.debug = _debug_on
|
||||||
@@ -65,6 +72,7 @@ class CreateVAP(Realm):
|
|||||||
self.vap_profile.security = self.security
|
self.vap_profile.security = self.security
|
||||||
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.desired_add_vap_flags = self.vap_flags + ["wpa2_enable", "80211u_enable", "create_admin_down"]
|
self.vap_profile.desired_add_vap_flags = self.vap_flags + ["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"]
|
self.vap_profile.desired_add_vap_flags_mask = self.vap_flags + ["wpa2_enable", "80211u_enable", "create_admin_down"]
|
||||||
if self.debug:
|
if self.debug:
|
||||||
@@ -79,7 +87,8 @@ class CreateVAP(Realm):
|
|||||||
print("Creating VAPs")
|
print("Creating VAPs")
|
||||||
self.vap_profile.create(resource = 1,
|
self.vap_profile.create(resource = 1,
|
||||||
radio = self.radio,
|
radio = self.radio,
|
||||||
channel = 36,
|
channel = self.channel,
|
||||||
|
country=self.country_code,
|
||||||
up_ = True,
|
up_ = True,
|
||||||
debug = False,
|
debug = False,
|
||||||
use_ht40=True,
|
use_ht40=True,
|
||||||
@@ -119,6 +128,10 @@ Command example:
|
|||||||
optional.add_argument('--vap_flag', help='VAP flags to add', required=False, default=None, action='append')
|
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('--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('--mac', help='Custom mac address', default="xx:xx:xx:xx:*:xx")
|
||||||
|
optional.add_argument('--mode', default='AUTO')
|
||||||
|
optional.add_argument('--channel', default=36)
|
||||||
|
optional.add_argument('--country_code', default=0)
|
||||||
|
optional.add_argument('--nss', default=False)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
#if args.debug:
|
#if args.debug:
|
||||||
# pprint.pprint(args)
|
# pprint.pprint(args)
|
||||||
@@ -145,12 +158,17 @@ Command example:
|
|||||||
_ssid=args.ssid,
|
_ssid=args.ssid,
|
||||||
_password=args.passwd,
|
_password=args.passwd,
|
||||||
_security=args.security,
|
_security=args.security,
|
||||||
|
_mode=args.mode,
|
||||||
_vap_list=vap,
|
_vap_list=vap,
|
||||||
_vap_flags=args.vap_flag,
|
_vap_flags=args.vap_flag,
|
||||||
_radio=args.radio,
|
_radio=args.radio,
|
||||||
|
_channel=args.channel,
|
||||||
|
_country_code=args.country_code,
|
||||||
|
_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')
|
||||||
|
|
||||||
create_vap.build()
|
create_vap.build()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user