Skip to content

Commit e61a5e4

Browse files
add catalystcenter_fabric_l3_handoff_sda_transit resource and data source (#210)
1 parent e81f8d8 commit e61a5e4

15 files changed

+1037
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## 0.2.5 (unreleased)
22

3+
- Add `catalystcenter_fabric_l3_handoff_sda_transit` resource and data source
34
- Modify `catalystcenter_lan_automation` to use V2 LAN Automation Start API, which supports optional auto-stop processing feature based on the provided timeout or a specific device list, or both.
45
- Add `catalystcenter_assign_device_to_site` resource. This resource only works with Catalyst Center version 2.3.7.9+
56
- Improve delete operations to treat `404 Not Found` responses as successful, ensuring idempotent behavior when resources are already removed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "catalystcenter_fabric_l3_handoff_sda_transit Data Source - terraform-provider-catalystcenter"
4+
subcategory: "SDA"
5+
description: |-
6+
This data source can read the Fabric L3 Handoff SDA Transit.
7+
---
8+
9+
# catalystcenter_fabric_l3_handoff_sda_transit (Data Source)
10+
11+
This data source can read the Fabric L3 Handoff SDA Transit.
12+
13+
## Example Usage
14+
15+
```terraform
16+
data "catalystcenter_fabric_l3_handoff_sda_transit" "example" {
17+
network_device_id = "a144a086-750c-4af1-ac57-feab33a69851"
18+
fabric_id = "c4b85bb2-ce3f-4db9-a32b-e439a388ac2f"
19+
}
20+
```
21+
22+
<!-- schema generated by tfplugindocs -->
23+
## Schema
24+
25+
### Required
26+
27+
- `fabric_id` (String) ID of the fabric this device is assigned to
28+
- `network_device_id` (String) Network device ID of the fabric device
29+
30+
### Read-Only
31+
32+
- `affinity_id_decider` (Number) Affinity id decider value of the border node. When the affinity id prime value is the same on multiple devices, the affinity id decider value is used as a tiebreaker.
33+
- `affinity_id_prime` (Number) Affinity id prime value of the border node. It supersedes the border priority to determine border node preference.
34+
- `connected_to_internet` (Boolean) Set this true to allow associated site to provide internet access to other sites through sd-access.
35+
- `id` (String) The id of the object
36+
- `is_multicast_over_transit_enabled` (Boolean) Set this true to configure native multicast over multiple sites that are connected to an sd-access transit.
37+
- `transit_network_id` (String) ID of the transit network of the layer 3 handoff sda transit

docs/guides/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ description: |-
99

1010
## 0.2.5 (unreleased)
1111

12+
- Add `catalystcenter_fabric_l3_handoff_sda_transit` resource and data source
1213
- Modify `catalystcenter_lan_automation` to use V2 LAN Automation Start API, which supports optional auto-stop processing feature based on the provided timeout or a specific device list, or both.
1314
- Add `catalystcenter_assign_device_to_site` resource. This resource only works with Catalyst Center version 2.3.7.9+
1415
- Improve delete operations to treat `404 Not Found` responses as successful, ensuring idempotent behavior when resources are already removed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "catalystcenter_fabric_l3_handoff_sda_transit Resource - terraform-provider-catalystcenter"
4+
subcategory: "SDA"
5+
description: |-
6+
Manages Layer 3 Handoffs with SDA Transit in Fabric Devices
7+
---
8+
9+
# catalystcenter_fabric_l3_handoff_sda_transit (Resource)
10+
11+
Manages Layer 3 Handoffs with SDA Transit in Fabric Devices
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "catalystcenter_fabric_l3_handoff_sda_transit" "example" {
17+
network_device_id = "a144a086-750c-4af1-ac57-feab33a69851"
18+
fabric_id = "c4b85bb2-ce3f-4db9-a32b-e439a388ac2f"
19+
transit_network_id = "d71c847b-e9c2-4f13-928c-223372b72b06"
20+
affinity_id_prime = 100
21+
affinity_id_decider = 100
22+
connected_to_internet = false
23+
is_multicast_over_transit_enabled = false
24+
}
25+
```
26+
27+
<!-- schema generated by tfplugindocs -->
28+
## Schema
29+
30+
### Required
31+
32+
- `fabric_id` (String) ID of the fabric this device is assigned to
33+
- `network_device_id` (String) Network device ID of the fabric device
34+
- `transit_network_id` (String) ID of the transit network of the layer 3 handoff sda transit
35+
36+
### Optional
37+
38+
- `affinity_id_decider` (Number) Affinity id decider value of the border node. When the affinity id prime value is the same on multiple devices, the affinity id decider value is used as a tiebreaker.
39+
- Range: `0`-`2147483647`
40+
- `affinity_id_prime` (Number) Affinity id prime value of the border node. It supersedes the border priority to determine border node preference.
41+
- Range: `0`-`2147483647`
42+
- `connected_to_internet` (Boolean) Set this true to allow associated site to provide internet access to other sites through sd-access.
43+
- `is_multicast_over_transit_enabled` (Boolean) Set this true to configure native multicast over multiple sites that are connected to an sd-access transit.
44+
45+
### Read-Only
46+
47+
- `id` (String) The id of the object
48+
49+
## Import
50+
51+
Import is supported using the following syntax:
52+
53+
```shell
54+
terraform import catalystcenter_fabric_l3_handoff_sda_transit.example "<network_device_id>,<fabric_id>"
55+
```
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
data "catalystcenter_fabric_l3_handoff_sda_transit" "example" {
2+
network_device_id = "a144a086-750c-4af1-ac57-feab33a69851"
3+
fabric_id = "c4b85bb2-ce3f-4db9-a32b-e439a388ac2f"
4+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform import catalystcenter_fabric_l3_handoff_sda_transit.example "<network_device_id>,<fabric_id>"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
resource "catalystcenter_fabric_l3_handoff_sda_transit" "example" {
2+
network_device_id = "a144a086-750c-4af1-ac57-feab33a69851"
3+
fabric_id = "c4b85bb2-ce3f-4db9-a32b-e439a388ac2f"
4+
transit_network_id = "d71c847b-e9c2-4f13-928c-223372b72b06"
5+
affinity_id_prime = 100
6+
affinity_id_decider = 100
7+
connected_to_internet = false
8+
is_multicast_over_transit_enabled = false
9+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
name: Fabric L3 Handoff SDA Transit
3+
rest_endpoint: /dna/intent/api/v1/sda/fabricDevices/layer3Handoffs/sdaTransits
4+
res_description: Manages Layer 3 Handoffs with SDA Transit in Fabric Devices
5+
id_from_attribute: true
6+
data_source_no_id: true
7+
put_no_id: true
8+
device_unreachability_warning: true
9+
doc_category: SDA
10+
mutex: true
11+
test_tags: [SDA]
12+
attributes:
13+
- model_name: networkDeviceId
14+
query_param: true
15+
delete_query_param: true
16+
requires_replace: true
17+
id: true
18+
data_path: '0'
19+
response_data_path: response.0.networkDeviceId
20+
mandatory: true
21+
description: Network device ID of the fabric device
22+
type: String
23+
example: a144a086-750c-4af1-ac57-feab33a69851
24+
- model_name: fabricId
25+
requires_replace: true
26+
query_param: true
27+
delete_query_param: true
28+
data_path: '0'
29+
response_data_path: response.0.fabricId
30+
type: String
31+
mandatory: true
32+
description: ID of the fabric this device is assigned to
33+
example: c4b85bb2-ce3f-4db9-a32b-e439a388ac2f
34+
test_value: catalystcenter_fabric_site.test.id
35+
- model_name: transitNetworkId
36+
requires_replace: true
37+
data_path: '0'
38+
response_data_path: response.0.transitNetworkId
39+
type: String
40+
mandatory: true
41+
description: ID of the transit network of the layer 3 handoff sda transit
42+
example: d71c847b-e9c2-4f13-928c-223372b72b06
43+
test_value: catalystcenter_transit_network.test.id
44+
- model_name: affinityIdPrime
45+
data_path: '0'
46+
response_data_path: response.0.affinityIdPrime
47+
type: Int64
48+
min_int: 0
49+
max_int: 2147483647
50+
description: Affinity id prime value of the border node. It supersedes the border priority to determine border node preference.
51+
example: 100
52+
- model_name: affinityIdDecider
53+
data_path: '0'
54+
response_data_path: response.0.affinityIdDecider
55+
type: Int64
56+
min_int: 0
57+
max_int: 2147483647
58+
description: Affinity id decider value of the border node. When the affinity id prime value is the same on multiple devices, the affinity id decider value is used as a tiebreaker.
59+
example: 100
60+
- model_name: connectedToInternet
61+
data_path: '0'
62+
response_data_path: response.0.connectedToInternet
63+
type: Bool
64+
description: Set this true to allow associated site to provide internet access to other sites through sd-access.
65+
example: false
66+
- model_name: isMulticastOverTransitEnabled
67+
data_path: '0'
68+
response_data_path: response.0.isMulticastOverTransitEnabled
69+
type: Bool
70+
description: Set this true to configure native multicast over multiple sites that are connected to an sd-access transit.
71+
example: false
72+
test_prerequisites: |
73+
resource "catalystcenter_area" "test" {
74+
name = "Area1"
75+
parent_name = "Global"
76+
}
77+
resource "catalystcenter_fabric_site" "test" {
78+
site_id = catalystcenter_area.test.id
79+
pub_sub_enabled = true
80+
authentication_profile_name = "No Authentication"
81+
depends_on = [catalystcenter_area.test]
82+
}
83+
resource "catalystcenter_transit_network" "test" {
84+
name = "SDA_TRANSIT_1"
85+
type = "SDA_LISP_BGP_TRANSIT"
86+
control_plane_network_device_ids = ["12345678-1234-1234-1234-123456789012"]
87+
}
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
2+
// All rights reserved.
3+
//
4+
// Licensed under the Mozilla Public License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// https://mozilla.org/MPL/2.0/
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//
16+
// SPDX-License-Identifier: MPL-2.0
17+
18+
package provider
19+
20+
// Section below is generated&owned by "gen/generator.go". //template:begin imports
21+
import (
22+
"context"
23+
"fmt"
24+
"net/url"
25+
26+
"github.com/hashicorp/terraform-plugin-framework/datasource"
27+
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
28+
"github.com/hashicorp/terraform-plugin-log/tflog"
29+
cc "github.com/netascode/go-catalystcenter"
30+
)
31+
32+
// End of section. //template:end imports
33+
34+
// Section below is generated&owned by "gen/generator.go". //template:begin model
35+
36+
// Ensure the implementation satisfies the expected interfaces.
37+
var (
38+
_ datasource.DataSource = &FabricL3HandoffSDATransitDataSource{}
39+
_ datasource.DataSourceWithConfigure = &FabricL3HandoffSDATransitDataSource{}
40+
)
41+
42+
func NewFabricL3HandoffSDATransitDataSource() datasource.DataSource {
43+
return &FabricL3HandoffSDATransitDataSource{}
44+
}
45+
46+
type FabricL3HandoffSDATransitDataSource struct {
47+
client *cc.Client
48+
}
49+
50+
func (d *FabricL3HandoffSDATransitDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
51+
resp.TypeName = req.ProviderTypeName + "_fabric_l3_handoff_sda_transit"
52+
}
53+
54+
func (d *FabricL3HandoffSDATransitDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
55+
resp.Schema = schema.Schema{
56+
// This description is used by the documentation generator and the language server.
57+
MarkdownDescription: "This data source can read the Fabric L3 Handoff SDA Transit.",
58+
59+
Attributes: map[string]schema.Attribute{
60+
"id": schema.StringAttribute{
61+
MarkdownDescription: "The id of the object",
62+
Computed: true,
63+
},
64+
"network_device_id": schema.StringAttribute{
65+
MarkdownDescription: "Network device ID of the fabric device",
66+
Required: true,
67+
},
68+
"fabric_id": schema.StringAttribute{
69+
MarkdownDescription: "ID of the fabric this device is assigned to",
70+
Required: true,
71+
},
72+
"transit_network_id": schema.StringAttribute{
73+
MarkdownDescription: "ID of the transit network of the layer 3 handoff sda transit",
74+
Computed: true,
75+
},
76+
"affinity_id_prime": schema.Int64Attribute{
77+
MarkdownDescription: "Affinity id prime value of the border node. It supersedes the border priority to determine border node preference.",
78+
Computed: true,
79+
},
80+
"affinity_id_decider": schema.Int64Attribute{
81+
MarkdownDescription: "Affinity id decider value of the border node. When the affinity id prime value is the same on multiple devices, the affinity id decider value is used as a tiebreaker.",
82+
Computed: true,
83+
},
84+
"connected_to_internet": schema.BoolAttribute{
85+
MarkdownDescription: "Set this true to allow associated site to provide internet access to other sites through sd-access.",
86+
Computed: true,
87+
},
88+
"is_multicast_over_transit_enabled": schema.BoolAttribute{
89+
MarkdownDescription: "Set this true to configure native multicast over multiple sites that are connected to an sd-access transit.",
90+
Computed: true,
91+
},
92+
},
93+
}
94+
}
95+
96+
func (d *FabricL3HandoffSDATransitDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
97+
if req.ProviderData == nil {
98+
return
99+
}
100+
101+
d.client = req.ProviderData.(*CcProviderData).Client
102+
}
103+
104+
// End of section. //template:end model
105+
106+
// Section below is generated&owned by "gen/generator.go". //template:begin read
107+
func (d *FabricL3HandoffSDATransitDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
108+
var config FabricL3HandoffSDATransit
109+
110+
// Read config
111+
diags := req.Config.Get(ctx, &config)
112+
resp.Diagnostics.Append(diags...)
113+
if resp.Diagnostics.HasError() {
114+
return
115+
}
116+
117+
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
118+
119+
params := ""
120+
params += "?networkDeviceId=" + url.QueryEscape(config.NetworkDeviceId.ValueString()) + "&fabricId=" + url.QueryEscape(config.FabricId.ValueString())
121+
res, err := d.client.Get(config.getPath() + params)
122+
if err != nil {
123+
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
124+
return
125+
}
126+
127+
config.fromBody(ctx, res)
128+
129+
tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Id.ValueString()))
130+
131+
diags = resp.State.Set(ctx, &config)
132+
resp.Diagnostics.Append(diags...)
133+
}
134+
135+
// End of section. //template:end read

0 commit comments

Comments
 (0)