Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restored the old vlan functionality in create_wlan #136

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -2563,14 +2563,15 @@ public function list_wlanconf($wlan_id = null)
* @param string $security optional, security type (open, wep, wpapsk, wpaeap)
* @param string $wpa_mode optional, wpa mode (wpa, wpa2, ..)
* @param string $wpa_enc optional, encryption (auto, ccmp)
* @param boolean $vlan_enabled optional, enable/disable VLAN for this wlan (is ignored as of 1.1.73)
* @param string $vlan_id optional, "_id" value of the VLAN to assign to this WLAN, can be found using
* list_networkconf()
* @param boolean $vlan_enabled optional, enable/disable VLAN for this wlan, only for for UniFi controller
* version 5
* @param string $networkconf_id optional, "_id" value of the VLAN to assign to this WLAN, can be found using
* list_networkconf(), only for for UniFi controller version 6
* @param boolean $uapsd_enabled optional, enable/disable Unscheduled Automatic Power Save Delivery
* @param boolean $schedule_enabled optional, enable/disable wlan schedule
* @param array $schedule optional, schedule rules
* @param array $ap_group_ids optional, array of ap group ids, required for UniFi controller versions 6.0.X
* and higher
* @param array $ap_group_ids optional, array of ap group ids, required for UniFi controller version 6
* @param int $vlan optional, vlan id, only used for for UniFi controller version 5
* @return bool true on success
*/
public function create_wlan(
Expand All @@ -2585,11 +2586,12 @@ public function create_wlan(
$wpa_mode = 'wpa2',
$wpa_enc = 'ccmp',
$vlan_enabled = null,
$vlan_id = null,
$networkconf_id = null,
$uapsd_enabled = false,
$schedule_enabled = false,
$schedule = [],
$ap_group_ids = null
$ap_group_ids = null,
$vlan = null
) {
$payload = [
'name' => trim($name),
Expand All @@ -2601,13 +2603,15 @@ public function create_wlan(
'security' => trim($security),
'wpa_mode' => trim($wpa_mode),
'wpa_enc' => trim($wpa_enc),
'vlan_enabled' => $vlan_enabled,
'vlan' => $vlan,
'uapsd_enabled' => $uapsd_enabled,
'schedule_enabled' => $schedule_enabled,
'schedule' => $schedule,
];

if (!empty($vlan_id)) {
$payload['networkconf_id'] = $vlan_id;
if (!empty($networkconf_id)) {
$payload['networkconf_id'] = $networkconf_id;
}

if (!empty($x_passphrase) && $security !== 'open') {
Expand Down