Add uapsd field to unifi_wlan
This commit is contained in:
@@ -70,6 +70,7 @@ resource "unifi_wlan" "wifi" {
|
||||
- **radius_profile_id** (String) ID of the RADIUS profile to use when security `wpaeap`. You can query this via the `unifi_radius_profile` data source.
|
||||
- **schedule** (Block List) Start and stop schedules for the WLAN (see [below for nested schema](#nestedblock--schedule))
|
||||
- **site** (String) The name of the site to associate the wlan with.
|
||||
- **uapsd** (Boolean) Enable Unscheduled Automatic Power Save Delivery Defaults to `false`.
|
||||
- **vlan_id** (Number, Deprecated) VLAN ID for the network. Set network_id instead of vlan_id for controller version >= 6.
|
||||
- **wlan_band** (String) Radio band your WiFi network will use.
|
||||
- **wlan_group_id** (String, Deprecated) ID of the WLAN group to use for this network. Set ap_group_ids instead of wlan_group_id for controller version >= 6.
|
||||
|
||||
@@ -144,6 +144,12 @@ func resourceWLAN() *schema.Resource {
|
||||
Optional: true,
|
||||
Default: false,
|
||||
},
|
||||
"uapsd": {
|
||||
Description: "Enable Unscheduled Automatic Power Save Delivery",
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: false,
|
||||
},
|
||||
|
||||
// controller v6 fields
|
||||
// TODO: this could be defaulted to "both" once v5 controller support is dropped
|
||||
@@ -277,6 +283,7 @@ func resourceWLANGetResourceData(d *schema.ResourceData, meta interface{}) (*uni
|
||||
DTIMMode: "default",
|
||||
No2GhzOui: d.Get("no2ghz_oui").(bool),
|
||||
L2Isolation: d.Get("l2_isolation").(bool),
|
||||
UapsdEnabled: d.Get("uapsd").(bool),
|
||||
MinrateNgCckRatesEnabled: true,
|
||||
}, nil
|
||||
}
|
||||
@@ -351,6 +358,7 @@ func resourceWLANSetResourceData(resp *unifi.WLAN, d *schema.ResourceData, meta
|
||||
d.Set("wlan_band", resp.WLANBand)
|
||||
d.Set("no2ghz_oui", resp.No2GhzOui)
|
||||
d.Set("l2_isolation", resp.L2Isolation)
|
||||
d.Set("uapsd", resp.UapsdEnabled)
|
||||
|
||||
// switch v := c.ControllerVersion(); {
|
||||
// case v.GreaterThanOrEqual(controllerV6):
|
||||
|
||||
@@ -258,6 +258,33 @@ func TestAccWLAN_no2ghz_oui(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccWLAN_uapsd(t *testing.T) {
|
||||
vlanID := getTestVLAN(t)
|
||||
resource.ParallelTest(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
preCheck(t)
|
||||
preCheckV6Only(t)
|
||||
wlanPreCheck(t)
|
||||
},
|
||||
ProviderFactories: providerFactories,
|
||||
CheckDestroy: func(*terraform.State) error {
|
||||
// TODO: actual CheckDestroy
|
||||
|
||||
<-wlanConcurrency
|
||||
return nil
|
||||
},
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccWLANConfig_uapsd(vlanID),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
// testCheckNetworkExists(t, "name"),
|
||||
),
|
||||
},
|
||||
importStep("unifi_wlan.test"),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccWLANConfig_wpapsk(vlanID int) string {
|
||||
return fmt.Sprintf(`
|
||||
data "unifi_ap_group" "default" {
|
||||
@@ -472,3 +499,31 @@ resource "unifi_wlan" "test" {
|
||||
}
|
||||
`, vlanID)
|
||||
}
|
||||
|
||||
func testAccWLANConfig_uapsd(vlanID int) string {
|
||||
return fmt.Sprintf(`
|
||||
data "unifi_ap_group" "default" {
|
||||
}
|
||||
|
||||
data "unifi_user_group" "default" {
|
||||
}
|
||||
|
||||
resource "unifi_network" "test" {
|
||||
name = "tfacc"
|
||||
purpose = "corporate"
|
||||
|
||||
subnet = cidrsubnet("10.0.0.0/8", 6, %[1]d)
|
||||
vlan_id = %[1]d
|
||||
}
|
||||
|
||||
resource "unifi_wlan" "test" {
|
||||
name = "tfacc-wpapsk"
|
||||
network_id = unifi_network.test.id
|
||||
passphrase = "12345678"
|
||||
ap_group_ids = [data.unifi_ap_group.default.id]
|
||||
user_group_id = data.unifi_user_group.default.id
|
||||
security = "wpapsk"
|
||||
uapsd = true
|
||||
}
|
||||
`, vlanID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user