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

fabric Ssid vlan mapping #115

Merged
merged 4 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.11 (unreleased)

- Add `catalystcenter_fabric_vlan_to_ssid` resource and data source

## 0.1.10

- Add `catalystcenter_fabric_l2_handoff` resource and data source
Expand All @@ -12,8 +16,8 @@
- Add `transitPeerNetworkId` as `id` to `catalystcenter_transit_peer_network` resource
- Add `catalystcenter_anycast_gateway` resource and data source, this resource now only works with Catalyst Center version 2.3.7.5+
- BREAKING CHANGE: Modified `catalystcenter_fabric_site` resource to use `/dna/intent/api/v1/sda/fabricSites` API endpoint, this resource now only works with Catalyst Center version 2.3.7.5+
- Fix issue with mandatory attributes in `transit_peer_network` resource, [link](https://github.com/CiscoDevNet/terraform-provider-catalystcenter/issues/92)
- BREAKING CHANGE: Fix `ip_pool` update if more than 25 pools are registered
- Fix issue with mandatory attributes in `catalystcenter_transit_peer_network` resource, [link](https://github.com/CiscoDevNet/terraform-provider-catalystcenter/issues/92)
- BREAKING CHANGE: Fix `catalystcenter_ip_pool` update if more than 25 pools are registered
- BREAKING CHANGE: Rename `radio_type_a_power_treshold_v1` attribute of `catalystcenter_wireless_rf_profile` resource to `radio_type_a_power_threshold_v1`
- BREAKING CHANGE: Rename `radio_type_b_power_treshold_v1` attribute of `catalystcenter_wireless_rf_profile` resource to `radio_type_b_power_threshold_v1`
- BREAKING CHANGE: Rename `radio_type_c_power_treshold_v1` attribute of `catalystcenter_wireless_rf_profile` resource to `radio_type_c_power_threshold_v1`
Expand Down
48 changes: 48 additions & 0 deletions docs/data-sources/fabric_vlan_to_ssid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "catalystcenter_fabric_vlan_to_ssid Data Source - terraform-provider-catalystcenter"
subcategory: "Wireless"
description: |-
This data source can read the Fabric VLAN to SSID.
---

# catalystcenter_fabric_vlan_to_ssid (Data Source)

This data source can read the Fabric VLAN to SSID.

## Example Usage

```terraform
data "catalystcenter_fabric_vlan_to_ssid" "example" {
id = "5e8e3e3e-1b6b-4b6b-8b6b-1b6b4b6b8b6b"
fabric_id = "5e8e3e3e-1b6b-4b6b-8b6b-1b6b4b6b8b6b"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `fabric_id` (String) Fabric ID
- `id` (String) The id of the object

### Read-Only

- `mappings` (Attributes List) List of VLAN to SSID mappings (see [below for nested schema](#nestedatt--mappings))

<a id="nestedatt--mappings"></a>
### Nested Schema for `mappings`

Read-Only:

- `ssid_details` (Attributes List) SSID Details (see [below for nested schema](#nestedatt--mappings--ssid_details))
- `vlan_name` (String) VLAN Name

<a id="nestedatt--mappings--ssid_details"></a>
### Nested Schema for `mappings.ssid_details`

Read-Only:

- `name` (String) Name of the SSID
- `security_group_tag` (String) Represents the name of the Security Group. Example: Auditors, BYOD, Developers, etc.
8 changes: 6 additions & 2 deletions docs/guides/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ description: |-

# Changelog

## 0.1.11 (unreleased)

- Add `catalystcenter_fabric_vlan_to_ssid` resource and data source

## 0.1.10

- Add `catalystcenter_fabric_l2_handoff` resource and data source
Expand All @@ -21,8 +25,8 @@ description: |-
- Add `transitPeerNetworkId` as `id` to `catalystcenter_transit_peer_network` resource
- Add `catalystcenter_anycast_gateway` resource and data source, this resource now only works with Catalyst Center version 2.3.7.5+
- BREAKING CHANGE: Modified `catalystcenter_fabric_site` resource to use `/dna/intent/api/v1/sda/fabricSites` API endpoint, this resource now only works with Catalyst Center version 2.3.7.5+
- Fix issue with mandatory attributes in `transit_peer_network` resource, [link](https://github.com/CiscoDevNet/terraform-provider-catalystcenter/issues/92)
- BREAKING CHANGE: Fix `ip_pool` update if more than 25 pools are registered
- Fix issue with mandatory attributes in `catalystcenter_transit_peer_network` resource, [link](https://github.com/CiscoDevNet/terraform-provider-catalystcenter/issues/92)
- BREAKING CHANGE: Fix `catalystcenter_ip_pool` update if more than 25 pools are registered
- BREAKING CHANGE: Rename `radio_type_a_power_treshold_v1` attribute of `catalystcenter_wireless_rf_profile` resource to `radio_type_a_power_threshold_v1`
- BREAKING CHANGE: Rename `radio_type_b_power_treshold_v1` attribute of `catalystcenter_wireless_rf_profile` resource to `radio_type_b_power_threshold_v1`
- BREAKING CHANGE: Rename `radio_type_c_power_treshold_v1` attribute of `catalystcenter_wireless_rf_profile` resource to `radio_type_c_power_threshold_v1`
Expand Down
69 changes: 69 additions & 0 deletions docs/resources/fabric_vlan_to_ssid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "catalystcenter_fabric_vlan_to_ssid Resource - terraform-provider-catalystcenter"
subcategory: "Wireless"
description: |-
Add, update, or remove SSID mappings to a VLAN. If the payload doesn't contain a 'vlanName' which has SSIDs mapping done earlier then all the mapped SSIDs of the 'vlanName' is cleared. The request must include all SSIDs currently mapped to a VLAN, as determined by the response from the GET operation for the same fabricId used in the request. If an already-mapped SSID is not included in the payload, its mapping will be removed by this API. Conversely, if a new SSID is provided, it will be added to the Mapping. Ensure that any new SSID added is a Fabric SSID. This API can also be used to add a VLAN and associate the relevant SSIDs with it. The 'vlanName' must be 'Fabric Wireless Enabled' and should be part of the Fabric Site representing 'Fabric ID' specified in the API request
---

# catalystcenter_fabric_vlan_to_ssid (Resource)

Add, update, or remove SSID mappings to a VLAN. If the payload doesn't contain a 'vlanName' which has SSIDs mapping done earlier then all the mapped SSIDs of the 'vlanName' is cleared. The request must include all SSIDs currently mapped to a VLAN, as determined by the response from the GET operation for the same fabricId used in the request. If an already-mapped SSID is not included in the payload, its mapping will be removed by this API. Conversely, if a new SSID is provided, it will be added to the Mapping. Ensure that any new SSID added is a Fabric SSID. This API can also be used to add a VLAN and associate the relevant SSIDs with it. The 'vlanName' must be 'Fabric Wireless Enabled' and should be part of the Fabric Site representing 'Fabric ID' specified in the API request

## Example Usage

```terraform
resource "catalystcenter_fabric_vlan_to_ssid" "example" {
fabric_id = "5e8e3e3e-1b6b-4b6b-8b6b-1b6b4b6b8b6b"
mappings = [
{
vlan_name = "VLAN_1"
ssid_details = [
{
name = "mySSID1"
security_group_tag = "Auditors"
}
]
}
]
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `fabric_id` (String) Fabric ID
- `mappings` (Attributes List) List of VLAN to SSID mappings (see [below for nested schema](#nestedatt--mappings))

### Read-Only

- `id` (String) The id of the object

<a id="nestedatt--mappings"></a>
### Nested Schema for `mappings`

Required:

- `vlan_name` (String) VLAN Name

Optional:

- `ssid_details` (Attributes List) SSID Details (see [below for nested schema](#nestedatt--mappings--ssid_details))

<a id="nestedatt--mappings--ssid_details"></a>
### Nested Schema for `mappings.ssid_details`

Optional:

- `name` (String) Name of the SSID
- `security_group_tag` (String) Represents the name of the Security Group. Example: Auditors, BYOD, Developers, etc.

## Import

Import is supported using the following syntax:

```shell
terraform import catalystcenter_fabric_vlan_to_ssid.example "<fabric_id>"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data "catalystcenter_fabric_vlan_to_ssid" "example" {
id = "5e8e3e3e-1b6b-4b6b-8b6b-1b6b4b6b8b6b"
fabric_id = "5e8e3e3e-1b6b-4b6b-8b6b-1b6b4b6b8b6b"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import catalystcenter_fabric_vlan_to_ssid.example "<fabric_id>"
14 changes: 14 additions & 0 deletions examples/resources/catalystcenter_fabric_vlan_to_ssid/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
resource "catalystcenter_fabric_vlan_to_ssid" "example" {
fabric_id = "5e8e3e3e-1b6b-4b6b-8b6b-1b6b4b6b8b6b"
mappings = [
{
vlan_name = "VLAN_1"
ssid_details = [
{
name = "mySSID1"
security_group_tag = "Auditors"
}
]
}
]
}
52 changes: 52 additions & 0 deletions gen/definitions/fabric_vlan_to_ssid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: Fabric VLAN to SSID
rest_endpoint: /dna/intent/api/v1/sda/fabrics/%v/vlanToSsids
res_description:
"Add, update, or remove SSID mappings to a VLAN. If the payload doesn't contain a 'vlanName'
which has SSIDs mapping done earlier then all the mapped SSIDs of the 'vlanName' is cleared.
The request must include all SSIDs currently mapped to a VLAN, as determined by the response
from the GET operation for the same fabricId used in the request.
If an already-mapped SSID is not included in the payload, its mapping will be removed by this API.
Conversely, if a new SSID is provided, it will be added to the Mapping. Ensure that any new SSID added is a Fabric SSID.
This API can also be used to add a VLAN and associate the relevant SSIDs with it.
The 'vlanName' must be 'Fabric Wireless Enabled' and should be part of the Fabric Site representing 'Fabric ID' specified in the API request"
# Manual updates in Delete function to send PUT request with empty body []
get_no_id: true
delete_no_id: true
put_create: true
id_from_attribute: true
root_list: true
skip_minimum_test: true
doc_category: Wireless
test_tags: [WIRELESS]
attributes:
- tf_name: fabric_id
reference: true
id: true
type: String
description: Fabric ID
example: 5e8e3e3e-1b6b-4b6b-8b6b-1b6b4b6b8b6b
- tf_name: mappings
type: List
response_data_path: response
mandatory: true
description: List of VLAN to SSID mappings
attributes:
- model_name: vlanName
type: String
description: VLAN Name
id: true
example: VLAN_1
- model_name: ssidDetails
type: List
description: SSID Details
attributes:
- model_name: name
type: String
description: Name of the SSID
example: mySSID1
- model_name: securityGroupTag
type: String
description: "Represents the name of the Security Group. Example: Auditors, BYOD, Developers, etc."
example: Auditors

14 changes: 14 additions & 0 deletions gen/templates/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,13 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context, state {{camelCase .N

// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
func (data *{{camelCase .Name}}) fromBody(ctx context.Context, res gjson.Result) {
{{- if .RootList}}
{{- range .Attributes}}
{{if .ResponseDataPath}}
res = res.Get("{{.ResponseDataPath}}")
{{- end}}
{{- end}}
{{- end}}
{{- if .DataSourceNoId}}
// Retrieve the 'id' attribute, if Data Source doesn't require id
if value := res.Get("{{if .IdFromQueryPath}}{{if eq .IdFromQueryPath "." }}{{else}}{{.IdFromQueryPath}}.{{end}}{{if .IdFromQueryPathAttribute}}{{.IdFromQueryPathAttribute}}{{else}}id{{end}}{{end}}"); value.Exists() {
Expand Down Expand Up @@ -455,6 +462,13 @@ func (data *{{camelCase .Name}}) fromBody(ctx context.Context, res gjson.Result)

// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
func (data *{{camelCase .Name}}) updateFromBody(ctx context.Context, res gjson.Result) {
{{- if .RootList}}
{{- range .Attributes}}
{{if .ResponseDataPath}}
res = res.Get("{{.ResponseDataPath}}")
{{- end}}
{{- end}}
{{- end}}
{{- range .Attributes}}
{{- if and (not .Value) (not .WriteOnly) (not .Reference) (not .CreateQueryPath) (not .QueryParamNoBody)}}
{{- if or (eq .Type "String") (eq .Type "Int64") (eq .Type "Float64") (eq .Type "Bool")}}
Expand Down
Loading