From 14debd3c2fe6f24364b94f808073761ab80dcd4e Mon Sep 17 00:00:00 2001 From: akinross Date: Thu, 19 Dec 2024 09:01:02 +0100 Subject: [PATCH] [minor_change] Add service_bd_routing_disable attribute to aci_bridge_domain resource and datasource --- docs/data-sources/bridge_domain.md | 1 + docs/resources/bridge_domain.md | 4 ++ .../resource-all-attributes.tf | 1 + gen/meta/fvBD.json | 72 ++++++++++++++++--- gen/testvars/fvBD.yaml | 4 ++ .../provider/data_source_aci_bridge_domain.go | 4 ++ .../data_source_aci_bridge_domain_test.go | 2 + .../provider/resource_aci_bridge_domain.go | 21 ++++++ .../resource_aci_bridge_domain_test.go | 16 +++++ 9 files changed, 114 insertions(+), 11 deletions(-) diff --git a/docs/data-sources/bridge_domain.md b/docs/data-sources/bridge_domain.md index dc654d46c..fe4a12a21 100644 --- a/docs/data-sources/bridge_domain.md +++ b/docs/data-sources/bridge_domain.md @@ -69,6 +69,7 @@ data "aci_bridge_domain" "example_tenant" { * `name_alias` (nameAlias) - (string) The name alias of the Bridge Domain object. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `service_bd_routing_disable` (serviceBdRoutingDisable) - (string) Disable Routing on service BD. * `bridge_domain_type` (type) - (string) The domain type of the Bridge Domain object. * `unicast_routing` (unicastRoute) - (string) Enables L3 routing and endpoint IP learning for the Bridge Domain object. * `l2_unknown_unicast_flooding` (unkMacUcastAct) - (string) The forwarding method for unknown layer 2 destinations. diff --git a/docs/resources/bridge_domain.md b/docs/resources/bridge_domain.md index 390af04bf..38c318e25 100644 --- a/docs/resources/bridge_domain.md +++ b/docs/resources/bridge_domain.md @@ -70,6 +70,7 @@ resource "aci_bridge_domain" "full_example_tenant" { name_alias = "name_alias_1" owner_key = "owner_key_1" owner_tag = "owner_tag_1" + service_bd_routing_disable = "no" bridge_domain_type = "fc" unicast_routing = "no" l2_unknown_unicast_flooding = "proxy" @@ -383,6 +384,9 @@ All examples for the Bridge Domain resource can be found in the [examples](https * `name_alias` (nameAlias) - (string) The name alias of the Bridge Domain object. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `service_bd_routing_disable` (serviceBdRoutingDisable) - (string) Disable Routing on service BD. + - Default: `no` + - Valid Values: `no`, `yes`. * `bridge_domain_type` (type) - (string) The domain type of the Bridge Domain object. - Default: `regular` - Valid Values: `fc`, `regular`. diff --git a/examples/resources/aci_bridge_domain/resource-all-attributes.tf b/examples/resources/aci_bridge_domain/resource-all-attributes.tf index 22c91c4ef..dff93def0 100644 --- a/examples/resources/aci_bridge_domain/resource-all-attributes.tf +++ b/examples/resources/aci_bridge_domain/resource-all-attributes.tf @@ -23,6 +23,7 @@ resource "aci_bridge_domain" "full_example_tenant" { name_alias = "name_alias_1" owner_key = "owner_key_1" owner_tag = "owner_tag_1" + service_bd_routing_disable = "no" bridge_domain_type = "fc" unicast_routing = "no" l2_unknown_unicast_flooding = "proxy" diff --git a/gen/meta/fvBD.json b/gen/meta/fvBD.json index 6723a377b..2341aa7eb 100644 --- a/gen/meta/fvBD.json +++ b/gen/meta/fvBD.json @@ -2046,7 +2046,7 @@ "isConfigurable": true, "propGlobalId": "34472", "propLocalId": "8158", - "label": "Optimize Wan Bandwidth between sites", + "label": "Optimize Wan Bandwidth Between Sites", "baseType": "scalar:Bool", "modelType": "scalar:Bool", "needsPropDelimiters": false, @@ -2176,7 +2176,7 @@ "isConfigurable": false, "propGlobalId": "1691", "propLocalId": "859", - "label": "bcastP", + "label": "Broadcast Policy", "baseType": "address:IPv4", "modelType": "mcast:Group", "needsPropDelimiters": false, @@ -2251,7 +2251,7 @@ "isConfigurable": false, "propGlobalId": "26448", "propLocalId": "153", - "label": "configIssues", + "label": "Configuration Issues", "baseType": "scalar:Bitmask64", "modelType": "fv:BDConfIssuesType", "needsPropDelimiters": false, @@ -2606,7 +2606,7 @@ "isConfigurable": true, "propGlobalId": "30545", "propLocalId": "7595", - "label": "Allow BUM traffic between sites", + "label": "Allow BUM Traffic Between Sites", "baseType": "scalar:Bool", "modelType": "scalar:Bool", "needsPropDelimiters": false, @@ -2653,7 +2653,7 @@ "isConfigurable": true, "propGlobalId": "33178", "propLocalId": "7928", - "label": "Allow l2Stretch between sites", + "label": "Allow L2Stretch Between Sites", "baseType": "scalar:Bool", "modelType": "scalar:Bool", "needsPropDelimiters": false, @@ -2697,7 +2697,7 @@ "isConfigurable": true, "propGlobalId": "21254", "propLocalId": "5433", - "label": "Ip Learning", + "label": "IP Learning", "baseType": "scalar:Bool", "modelType": "scalar:Bool", "needsPropDelimiters": false, @@ -2744,7 +2744,7 @@ "isConfigurable": true, "propGlobalId": "47406", "propLocalId": "10834", - "label": "ipv6 Multicast Allow", + "label": "IPv6 Multicast Allow", "baseType": "scalar:Bool", "modelType": "scalar:Bool", "needsPropDelimiters": false, @@ -2854,7 +2854,7 @@ "isConfigurable": true, "propGlobalId": "20851", "propLocalId": "5375", - "label": "Limit IP learning to BD subnets only", + "label": "Limit IP Learning to BD Subnets", "baseType": "scalar:Bool", "modelType": "scalar:Bool", "needsPropDelimiters": false, @@ -3380,7 +3380,7 @@ "isConfigurable": false, "propGlobalId": "1695", "propLocalId": "551", - "label": "pcTag", + "label": "PC Tag", "baseType": "scalar:Uint32", "modelType": "vz:GPCTag", "needsPropDelimiters": false, @@ -3445,7 +3445,7 @@ "isConfigurable": false, "propGlobalId": "1694", "propLocalId": "1", - "label": "scope", + "label": "Scope", "baseType": "scalar:Uint32", "modelType": "fv:ScopeId", "needsPropDelimiters": false, @@ -3503,6 +3503,56 @@ "isDeprecated": false, "isHidden": false }, + "serviceBdRoutingDisable": { + "versions": "6.0(4c)-", + "comment": [ + "Disable Routing on service BD" + ], + "isConfigurable": true, + "propGlobalId": "70465", + "propLocalId": "15461", + "label": "Disable Routing on Service BD", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "boolean", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "no", "localName": "defaultValue", + "platformFlavors": [ + + ], + "comment": [ + "By default, routing is enabled on service BD" + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "no", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, "status": { "versions": "1.0(1e)-", "comment": [ @@ -3689,7 +3739,7 @@ "isConfigurable": true, "propGlobalId": "1696", "propLocalId": "886", - "label": "Unknown Mac Unicast Action", + "label": "Unknown MAC Unicast Action", "baseType": "scalar:Enum8", "modelType": "l2:UnkMacUcastAct", "needsPropDelimiters": false, diff --git a/gen/testvars/fvBD.yaml b/gen/testvars/fvBD.yaml index 2f5a503e7..e9d884c32 100644 --- a/gen/testvars/fvBD.yaml +++ b/gen/testvars/fvBD.yaml @@ -35,6 +35,8 @@ default: pim_ipv6: "no" 5.2(5c): drop_arp_with_multicast_smac: "yes" + 6.0(4c): + service_bd_routing_disable: "no" datasource_non_existing: name: "non_existing_name" @@ -77,6 +79,8 @@ all: pim_ipv6: "no" 5.2(5c): drop_arp_with_multicast_smac: "no" + 6.0(4c): + service_bd_routing_disable: "no" children: legacy_mode: diff --git a/internal/provider/data_source_aci_bridge_domain.go b/internal/provider/data_source_aci_bridge_domain.go index a19d8bd7e..a00905965 100644 --- a/internal/provider/data_source_aci_bridge_domain.go +++ b/internal/provider/data_source_aci_bridge_domain.go @@ -249,6 +249,10 @@ func (d *FvBDDataSource) Schema(ctx context.Context, req datasource.SchemaReques Computed: true, MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, }, + "service_bd_routing_disable": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Disable Routing on service BD.`, + }, "bridge_domain_type": schema.StringAttribute{ Computed: true, MarkdownDescription: `The domain type of the Bridge Domain object.`, diff --git a/internal/provider/data_source_aci_bridge_domain_test.go b/internal/provider/data_source_aci_bridge_domain_test.go index d4d6d3953..119f5a9c6 100644 --- a/internal/provider/data_source_aci_bridge_domain_test.go +++ b/internal/provider/data_source_aci_bridge_domain_test.go @@ -51,6 +51,8 @@ func TestAccDataSourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "pim_ipv6", "no")), composeAggregateTestCheckFuncWithVersion(t, "5.2(5c)", ">=", resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "drop_arp_with_multicast_smac", "yes")), + composeAggregateTestCheckFuncWithVersion(t, "6.0(4c)", ">=", + resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "service_bd_routing_disable", "no")), resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "virtual_mac_address", "not-applicable"), ), }, diff --git a/internal/provider/resource_aci_bridge_domain.go b/internal/provider/resource_aci_bridge_domain.go index 07dd05f4d..982d5c2ab 100644 --- a/internal/provider/resource_aci_bridge_domain.go +++ b/internal/provider/resource_aci_bridge_domain.go @@ -68,6 +68,7 @@ type FvBDResourceModel struct { NameAlias types.String `tfsdk:"name_alias"` OwnerKey types.String `tfsdk:"owner_key"` OwnerTag types.String `tfsdk:"owner_tag"` + ServiceBdRoutingDisable types.String `tfsdk:"service_bd_routing_disable"` Type types.String `tfsdk:"bridge_domain_type"` UnicastRoute types.String `tfsdk:"unicast_routing"` UnkMacUcastAct types.String `tfsdk:"l2_unknown_unicast_flooding"` @@ -145,6 +146,7 @@ func getEmptyFvBDResourceModel() *FvBDResourceModel { NameAlias: basetypes.NewStringNull(), OwnerKey: basetypes.NewStringNull(), OwnerTag: basetypes.NewStringNull(), + ServiceBdRoutingDisable: basetypes.NewStringNull(), Type: basetypes.NewStringNull(), UnicastRoute: basetypes.NewStringNull(), UnkMacUcastAct: basetypes.NewStringNull(), @@ -1633,6 +1635,7 @@ func (r *FvBDResource) UpgradeState(ctx context.Context) map[int64]resource.Stat NameAlias: priorStateData.NameAlias, OwnerKey: basetypes.NewStringNull(), OwnerTag: basetypes.NewStringNull(), + ServiceBdRoutingDisable: basetypes.NewStringNull(), Type: priorStateData.Type, UnicastRoute: priorStateData.UnicastRoute, UnkMacUcastAct: priorStateData.UnkMacUcastAct, @@ -3300,6 +3303,18 @@ func (r *FvBDResource) Schema(ctx context.Context, req resource.SchemaRequest, r }, MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, }, + "service_bd_routing_disable": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Disable Routing on service BD.`, + }, "bridge_domain_type": schema.StringAttribute{ Optional: true, Computed: true, @@ -4944,6 +4959,9 @@ func getAndSetFvBDAttributes(ctx context.Context, diags *diag.Diagnostics, clien if attributeName == "ownerTag" { readData.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) } + if attributeName == "serviceBdRoutingDisable" { + readData.ServiceBdRoutingDisable = basetypes.NewStringValue(attributeValue.(string)) + } if attributeName == "type" { readData.Type = basetypes.NewStringValue(attributeValue.(string)) } @@ -7471,6 +7489,9 @@ func getFvBDCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, crea if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() } + if !data.ServiceBdRoutingDisable.IsNull() && !data.ServiceBdRoutingDisable.IsUnknown() { + payloadMap["attributes"].(map[string]string)["serviceBdRoutingDisable"] = data.ServiceBdRoutingDisable.ValueString() + } if !data.Type.IsNull() && !data.Type.IsUnknown() { payloadMap["attributes"].(map[string]string)["type"] = data.Type.ValueString() } diff --git a/internal/provider/resource_aci_bridge_domain_test.go b/internal/provider/resource_aci_bridge_domain_test.go index dff02c20a..e0900457a 100644 --- a/internal/provider/resource_aci_bridge_domain_test.go +++ b/internal/provider/resource_aci_bridge_domain_test.go @@ -81,6 +81,9 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { composeAggregateTestCheckFuncWithVersion(t, "5.2(5c)", ">=", resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "drop_arp_with_multicast_smac", "yes"), resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "drop_arp_with_multicast_smac", "yes")), + composeAggregateTestCheckFuncWithVersion(t, "6.0(4c)", ">=", + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "service_bd_routing_disable", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "service_bd_routing_disable", "no")), resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "virtual_mac_address", "not-applicable"), resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "virtual_mac_address", "not-applicable"), ), @@ -167,6 +170,9 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { composeAggregateTestCheckFuncWithVersion(t, "5.2(5c)", ">=", resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "drop_arp_with_multicast_smac", "yes"), resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "drop_arp_with_multicast_smac", "yes")), + composeAggregateTestCheckFuncWithVersion(t, "6.0(4c)", ">=", + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "service_bd_routing_disable", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "service_bd_routing_disable", "no")), resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "virtual_mac_address", "not-applicable"), resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "virtual_mac_address", "not-applicable"), ), @@ -213,6 +219,8 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "pim_ipv6", "no")), composeAggregateTestCheckFuncWithVersion(t, "5.2(5c)", ">=", resource.TestCheckResourceAttr("aci_bridge_domain.test", "drop_arp_with_multicast_smac", "yes")), + composeAggregateTestCheckFuncWithVersion(t, "6.0(4c)", ">=", + resource.TestCheckResourceAttr("aci_bridge_domain.test", "service_bd_routing_disable", "no")), resource.TestCheckResourceAttr("aci_bridge_domain.test", "virtual_mac_address", "not-applicable"), ), }, @@ -251,6 +259,8 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "pim_ipv6", "no")), composeAggregateTestCheckFuncWithVersion(t, "5.2(5c)", ">=", resource.TestCheckResourceAttr("aci_bridge_domain.test", "drop_arp_with_multicast_smac", "no")), + composeAggregateTestCheckFuncWithVersion(t, "6.0(4c)", ">=", + resource.TestCheckResourceAttr("aci_bridge_domain.test", "service_bd_routing_disable", "no")), resource.TestCheckResourceAttr("aci_bridge_domain.test", "virtual_mac_address", "00:22:BD:F8:19:FB"), ), }, @@ -297,6 +307,8 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "pim_ipv6", "no")), composeAggregateTestCheckFuncWithVersion(t, "5.2(5c)", ">=", resource.TestCheckResourceAttr("aci_bridge_domain.test", "drop_arp_with_multicast_smac", "yes")), + composeAggregateTestCheckFuncWithVersion(t, "6.0(4c)", ">=", + resource.TestCheckResourceAttr("aci_bridge_domain.test", "service_bd_routing_disable", "no")), resource.TestCheckResourceAttr("aci_bridge_domain.test", "virtual_mac_address", "not-applicable"), ), }, @@ -341,6 +353,8 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "pim_ipv6", "no")), composeAggregateTestCheckFuncWithVersion(t, "5.2(5c)", ">=", resource.TestCheckResourceAttr("aci_bridge_domain.test", "drop_arp_with_multicast_smac", "yes")), + composeAggregateTestCheckFuncWithVersion(t, "6.0(4c)", ">=", + resource.TestCheckResourceAttr("aci_bridge_domain.test", "service_bd_routing_disable", "no")), resource.TestCheckResourceAttr("aci_bridge_domain.test", "virtual_mac_address", "not-applicable"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotations.0.value", "value_1"), @@ -934,6 +948,7 @@ resource "aci_bridge_domain" "test" { ipv6_l3_unknown_multicast_flooding = provider::aci::compare_versions(data.aci_system.version.version,">=","4.1(1i)") ? "flood" : null pim_ipv6 = provider::aci::compare_versions(data.aci_system.version.version,">=","4.2(1i)") ? "no" : null drop_arp_with_multicast_smac = provider::aci::compare_versions(data.aci_system.version.version,">=","5.2(5c)") ? "no" : null + service_bd_routing_disable = provider::aci::compare_versions(data.aci_system.version.version,">=","6.0(4c)") ? "no" : null virtual_mac_address = "00:22:BD:F8:19:FB" } ` @@ -967,6 +982,7 @@ resource "aci_bridge_domain" "test" { ipv6_l3_unknown_multicast_flooding = provider::aci::compare_versions(data.aci_system.version.version,">=","4.1(1i)") ? "flood" : null pim_ipv6 = provider::aci::compare_versions(data.aci_system.version.version,">=","4.2(1i)") ? "no" : null drop_arp_with_multicast_smac = provider::aci::compare_versions(data.aci_system.version.version,">=","5.2(5c)") ? "yes" : null + service_bd_routing_disable = provider::aci::compare_versions(data.aci_system.version.version,">=","6.0(4c)") ? "no" : null virtual_mac_address = "not-applicable" } `