diff --git a/.gitignore b/.gitignore index fd3ad8e1..1b5aeee3 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ website/vendor # Keep windows files with windows line endings *.winfile eol=crlf + +# Compiled provider binary +terraform-provider-nxos \ No newline at end of file diff --git a/docs/data-sources/bgp_route_redistribution.md b/docs/data-sources/bgp_route_redistribution.md new file mode 100644 index 00000000..f56b382d --- /dev/null +++ b/docs/data-sources/bgp_route_redistribution.md @@ -0,0 +1,48 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "nxos_bgp_route_redistribution Data Source - terraform-provider-nxos" +subcategory: "BGP" +description: |- + This data source can read the BGP (VRF) route redistribution configuration. + API Documentation: bgpInterLeakP https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:InterLeakP/ +--- + +# nxos_bgp_route_redistribution (Data Source) + +This data source can read the BGP (VRF) route redistribution configuration. + +- API Documentation: [bgpInterLeakP](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:InterLeakP/) + +## Example Usage + +```terraform +data "nxos_bgp_route_redistribution" "example" { + asn = "65001" + vrf = "default" + address_family = "ipv4-ucast" + protocol = "ospf" + protocol_instance = "OSPF1" +} +``` + + +## Schema + +### Required + +- `address_family` (String) Address Family. +- `asn` (String) Autonomous system number. +- `protocol` (String) The list of protocols to match. +- `protocol_instance` (String) The inter protocol route leak policy instance (Use `none` for `static` and `direct` protocols). +- `vrf` (String) VRF name. + +### Optional + +- `device` (String) A device name from the provider configuration. + +### Read-Only + +- `id` (String) The distinguished name of the object. +- `route_map` (String) The name of the default route leak policy route map. This route map name is used to control distribution. +- `scope` (String) The domain applicable to the capability. +- `srv6_prefix_type` (String) SRv6 Prefix Type; Valid only when proto is srv6. diff --git a/docs/guides/supported_objects.md b/docs/guides/supported_objects.md index 8886b242..9851ba1f 100644 --- a/docs/guides/supported_objects.md +++ b/docs/guides/supported_objects.md @@ -24,6 +24,7 @@ For the following DME objects a corresponding Terraform resource and data source | [bgpPeerAf](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:PeerAf/) | [nxos_bgp_peer_template_address_family](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_peer_template_address_family) | [nxos_bgp_peer_template_address_family](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp_peer_template_address_family) | | [bgpMaxPfxP](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:MaxPfxP/) | [nxos_bgp_peer_template_max_prefix](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_peer_template_max_prefix) | [nxos_bgp_peer_template_max_prefix](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp_peer_template_max_prefix) | | [bgpRtCtrl](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:RtCtrl/) | [nxos_bgp_route_control](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_route_control) | [nxos_bgp_route_control](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp_route_control) | +| [bgpInterLeakP](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:InterLeakP/) | [nxos_bgp_route_redistribution](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_route_redistribution) | [nxos_bgp_route_redistribution](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp_route_redistribution) | | [bgpDom](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:Dom/) | [nxos_bgp_vrf](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_vrf) | [nxos_bgp_vrf](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp_vrf) | | [l2BD](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Layer%202/l2:BD/) | [nxos_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bridge_domain) | [nxos_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bridge_domain) | | [ipqosCMapInst](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Qos/ipqos:CMapInst/) | [nxos_default_qos_class_map](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/default_qos_class_map) | [nxos_default_qos_class_map](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/default_qos_class_map) | diff --git a/docs/resources/bgp_address_family.md b/docs/resources/bgp_address_family.md index 379ba8ca..52030519 100644 --- a/docs/resources/bgp_address_family.md +++ b/docs/resources/bgp_address_family.md @@ -8,7 +8,7 @@ description: |- Parent resources nxosbgpvrf https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_vrf Child resources - nxosbgpadvertised_prefix https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_advertised_prefix + nxosbgpadvertised_prefix https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_advertised_prefixnxosbgproute_redistribution https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_route_redistribution --- # nxos_bgp_address_family (Resource) @@ -24,6 +24,7 @@ This resource can manage the BGP (VRF) address family configuration. ### Child resources - [nxos_bgp_advertised_prefix](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_advertised_prefix) +- [nxos_bgp_route_redistribution](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_route_redistribution) ## Example Usage diff --git a/docs/resources/bgp_route_redistribution.md b/docs/resources/bgp_route_redistribution.md new file mode 100644 index 00000000..e7d04158 --- /dev/null +++ b/docs/resources/bgp_route_redistribution.md @@ -0,0 +1,74 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "nxos_bgp_route_redistribution Resource - terraform-provider-nxos" +subcategory: "BGP" +description: |- + This resource can manage the BGP (VRF) route redistribution configuration. + API Documentation: bgpInterLeakP https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:InterLeakP/ + Parent resources + nxosbgpaddress_family https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_address_family +--- + +# nxos_bgp_route_redistribution (Resource) + +This resource can manage the BGP (VRF) route redistribution configuration. + +- API Documentation: [bgpInterLeakP](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:InterLeakP/) + +### Parent resources + +- [nxos_bgp_address_family](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_address_family) + +## Example Usage + +```terraform +resource "nxos_bgp_route_redistribution" "example" { + asn = "65001" + vrf = "default" + address_family = "ipv4-ucast" + protocol = "ospf" + protocol_instance = "OSPF1" + route_map = "route_map_ospf_1" + scope = "inter" + srv6_prefix_type = "unspecified" +} +``` + + +## Schema + +### Required + +- `address_family` (String) Address Family. + - Choices: `ipv4-ucast`, `ipv4-mcast`, `vpnv4-ucast`, `ipv6-ucast`, `ipv6-mcast`, `vpnv6-ucast`, `vpnv6-mcast`, `l2vpn-evpn`, `ipv4-lucast`, `ipv6-lucast`, `lnkstate`, `ipv4-mvpn`, `ipv6-mvpn`, `l2vpn-vpls`, `ipv4-mdt` + - Default value: `ipv4-ucast` +- `asn` (String) Autonomous system number. +- `protocol` (String) The list of protocols to match. + - Choices: `unspecified`, `static`, `direct`, `bgp`, `isis`, `ospf`, `ospfv3`, `eigrp`, `host`, `rip`, `amt`, `lisp`, `hmm`, `am`, `srv6` + - Default value: `unspecified` +- `protocol_instance` (String) The inter protocol route leak policy instance (Use `none` for `static` and `direct` protocols). + - Default value: `none` +- `vrf` (String) VRF name. + +### Optional + +- `device` (String) A device name from the provider configuration. +- `route_map` (String) The name of the default route leak policy route map. This route map name is used to control distribution. +- `scope` (String) The domain applicable to the capability. + - Choices: `intra`, `inter`, `defrt` + - Default value: `inter` +- `srv6_prefix_type` (String) SRv6 Prefix Type; Valid only when proto is srv6. + - Choices: `unspecified`, `locator` + - Default value: `unspecified` + +### Read-Only + +- `id` (String) The distinguished name of the object. + +## Import + +Import is supported using the following syntax: + +```shell +terraform import nxos_bgp_route_redistribution.example "sys/bgp/inst/dom-[default]/af-[ipv4-ucast]/interleak-[ospf]-interleak-[OSPF1]" +``` diff --git a/examples/data-sources/nxos_bgp_route_redistribution/data-source.tf b/examples/data-sources/nxos_bgp_route_redistribution/data-source.tf new file mode 100644 index 00000000..7aaed1db --- /dev/null +++ b/examples/data-sources/nxos_bgp_route_redistribution/data-source.tf @@ -0,0 +1,7 @@ +data "nxos_bgp_route_redistribution" "example" { + asn = "65001" + vrf = "default" + address_family = "ipv4-ucast" + protocol = "ospf" + protocol_instance = "OSPF1" +} diff --git a/examples/resources/nxos_bgp_route_redistribution/import.sh b/examples/resources/nxos_bgp_route_redistribution/import.sh new file mode 100644 index 00000000..63a1c489 --- /dev/null +++ b/examples/resources/nxos_bgp_route_redistribution/import.sh @@ -0,0 +1 @@ +terraform import nxos_bgp_route_redistribution.example "sys/bgp/inst/dom-[default]/af-[ipv4-ucast]/interleak-[ospf]-interleak-[OSPF1]" diff --git a/examples/resources/nxos_bgp_route_redistribution/resource.tf b/examples/resources/nxos_bgp_route_redistribution/resource.tf new file mode 100644 index 00000000..141e73ab --- /dev/null +++ b/examples/resources/nxos_bgp_route_redistribution/resource.tf @@ -0,0 +1,10 @@ +resource "nxos_bgp_route_redistribution" "example" { + asn = "65001" + vrf = "default" + address_family = "ipv4-ucast" + protocol = "ospf" + protocol_instance = "OSPF1" + route_map = "route_map_ospf_1" + scope = "inter" + srv6_prefix_type = "unspecified" +} diff --git a/gen/definitions/bgp_address_family.yaml b/gen/definitions/bgp_address_family.yaml index 14a7e10c..810dfd5e 100644 --- a/gen/definitions/bgp_address_family.yaml +++ b/gen/definitions/bgp_address_family.yaml @@ -10,6 +10,7 @@ parents: - BGP VRF children: - BGP Advertised Prefix + - BGP Route Redistribution attributes: - nxos_name: asn tf_name: asn diff --git a/gen/definitions/bgp_route_redistribution.yaml b/gen/definitions/bgp_route_redistribution.yaml new file mode 100644 index 00000000..bb733813 --- /dev/null +++ b/gen/definitions/bgp_route_redistribution.yaml @@ -0,0 +1,134 @@ +--- +name: BGP Route Redistribution +class_name: bgpInterLeakP +dn: sys/bgp/inst/dom-[%s]/af-[%s]/interleak-[%s]-interleak-[%s] +ds_description: This data source can read the BGP (VRF) route redistribution configuration. +res_description: This resource can manage the BGP (VRF) route redistribution configuration. +doc_path: Routing%20and%20Forwarding/bgp:InterLeakP/ +doc_category: BGP +parents: + - BGP Address Family +attributes: + - nxos_name: asn + tf_name: asn + type: String + reference_only: true + description: 'Autonomous system number.' + example: '65001' + - nxos_name: name + tf_name: vrf + type: String + id: true + reference_only: true + description: 'VRF name.' + example: default + - nxos_name: type + tf_name: address_family + type: String + id: true + reference_only: true + description: 'Address Family.' + enum_values: + - ipv4-ucast + - ipv4-mcast + - vpnv4-ucast + - ipv6-ucast + - ipv6-mcast + - vpnv6-ucast + - vpnv6-mcast + - l2vpn-evpn + - ipv4-lucast + - ipv6-lucast + - lnkstate + - ipv4-mvpn + - ipv6-mvpn + - l2vpn-vpls + - ipv4-mdt + default_value: 'ipv4-ucast' + example: 'ipv4-ucast' + - nxos_name: proto + tf_name: protocol + type: String + id: true + description: 'The list of protocols to match.' + enum_values: + - unspecified + - static + - direct + - bgp + - isis + - ospf + - ospfv3 + - eigrp + - host + - rip + - amt + - lisp + - hmm + - am + - srv6 + default_value: 'unspecified' + example: 'ospf' + - nxos_name: inst + tf_name: protocol_instance + type: String + id: true + description: 'The inter protocol route leak policy instance (Use `none` for `static` and `direct` protocols).' + default_value: 'none' + example: 'OSPF1' + - nxos_name: rtMap + tf_name: route_map + type: String + description: 'The name of the default route leak policy route map. This route map name is used to control distribution.' + example: 'route_map_ospf_1' + - nxos_name: scope + tf_name: scope + type: String + description: 'The domain applicable to the capability.' + enum_values: + - intra + - inter + - defrt + default_value: 'inter' + example: 'inter' + omit_empty_value: true + - nxos_name: srv6PrefixType + tf_name: srv6_prefix_type + type: String + description: 'SRv6 Prefix Type; Valid only when proto is srv6.' + enum_values: + - unspecified + - locator + default_value: 'unspecified' + example: 'unspecified' + omit_empty_value: true +test_prerequisites: + - dn: sys/fm/bgp + class_name: fmBgp + no_delete: true + attributes: + - name: adminSt + value: enabled + - dn: sys/bgp + class_name: bgpEntity + dependencies: [0] + - dn: sys/bgp/inst + class_name: bgpInst + attributes: + - name: adminSt + value: enabled + - name: asn + value: '65001' + dependencies: [1] + - dn: sys/bgp/inst/dom-[default] + class_name: bgpDom + attributes: + - name: name + value: default + dependencies: [2] + - dn: sys/bgp/inst/dom-[default]/af-[ipv4-ucast] + class_name: bgpDomAf + attributes: + - name: type + value: ipv4-ucast + dependencies: [3] diff --git a/internal/provider/data_source_nxos_bgp_route_redistribution.go b/internal/provider/data_source_nxos_bgp_route_redistribution.go new file mode 100644 index 00000000..b0fb3da2 --- /dev/null +++ b/internal/provider/data_source_nxos_bgp_route_redistribution.go @@ -0,0 +1,136 @@ +// Copyright © 2023 Cisco Systems, Inc. and its affiliates. +// All rights reserved. +// +// Licensed under the Mozilla Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://mozilla.org/MPL/2.0/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by "gen/generator.go"; DO NOT EDIT. + +package provider + +import ( + "context" + "fmt" + + "github.com/CiscoDevNet/terraform-provider-nxos/internal/provider/helpers" + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" + "github.com/netascode/go-nxos" +) + +// Ensure the implementation satisfies the expected interfaces. +var ( + _ datasource.DataSource = &BGPRouteRedistributionDataSource{} + _ datasource.DataSourceWithConfigure = &BGPRouteRedistributionDataSource{} +) + +func NewBGPRouteRedistributionDataSource() datasource.DataSource { + return &BGPRouteRedistributionDataSource{} +} + +type BGPRouteRedistributionDataSource struct { + clients map[string]*nxos.Client +} + +func (d *BGPRouteRedistributionDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_bgp_route_redistribution" +} + +func (d *BGPRouteRedistributionDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: helpers.NewResourceDescription("This data source can read the BGP (VRF) route redistribution configuration.", "bgpInterLeakP", "Routing%20and%20Forwarding/bgp:InterLeakP/").String, + + Attributes: map[string]schema.Attribute{ + "device": schema.StringAttribute{ + MarkdownDescription: "A device name from the provider configuration.", + Optional: true, + }, + "id": schema.StringAttribute{ + MarkdownDescription: "The distinguished name of the object.", + Computed: true, + }, + "asn": schema.StringAttribute{ + MarkdownDescription: "Autonomous system number.", + Required: true, + }, + "vrf": schema.StringAttribute{ + MarkdownDescription: "VRF name.", + Required: true, + }, + "address_family": schema.StringAttribute{ + MarkdownDescription: "Address Family.", + Required: true, + }, + "protocol": schema.StringAttribute{ + MarkdownDescription: "The list of protocols to match.", + Required: true, + }, + "protocol_instance": schema.StringAttribute{ + MarkdownDescription: "The inter protocol route leak policy instance (Use `none` for `static` and `direct` protocols).", + Required: true, + }, + "route_map": schema.StringAttribute{ + MarkdownDescription: "The name of the default route leak policy route map. This route map name is used to control distribution.", + Computed: true, + }, + "scope": schema.StringAttribute{ + MarkdownDescription: "The domain applicable to the capability.", + Computed: true, + }, + "srv6_prefix_type": schema.StringAttribute{ + MarkdownDescription: "SRv6 Prefix Type; Valid only when proto is srv6.", + Computed: true, + }, + }, + } +} + +func (d *BGPRouteRedistributionDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) { + if req.ProviderData == nil { + return + } + + d.clients = req.ProviderData.(map[string]*nxos.Client) +} + +func (d *BGPRouteRedistributionDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + var config BGPRouteRedistribution + + // Read config + diags := req.Config.Get(ctx, &config) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.getDn())) + + queries := []func(*nxos.Req){} + res, err := d.clients[config.Device.ValueString()].GetDn(config.getDn(), queries...) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err)) + return + } + + config.fromBody(res, true) + config.Dn = types.StringValue(config.getDn()) + + tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.getDn())) + + diags = resp.State.Set(ctx, &config) + resp.Diagnostics.Append(diags...) +} diff --git a/internal/provider/data_source_nxos_bgp_route_redistribution_test.go b/internal/provider/data_source_nxos_bgp_route_redistribution_test.go new file mode 100644 index 00000000..1f400d9e --- /dev/null +++ b/internal/provider/data_source_nxos_bgp_route_redistribution_test.go @@ -0,0 +1,115 @@ +// Copyright © 2023 Cisco Systems, Inc. and its affiliates. +// All rights reserved. +// +// Licensed under the Mozilla Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://mozilla.org/MPL/2.0/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by "gen/generator.go"; DO NOT EDIT. + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccDataSourceNxosBGPRouteRedistribution(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceNxosBGPRouteRedistributionPrerequisitesConfig + testAccDataSourceNxosBGPRouteRedistributionConfig, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("data.nxos_bgp_route_redistribution.test", "protocol", "ospf"), + resource.TestCheckResourceAttr("data.nxos_bgp_route_redistribution.test", "protocol_instance", "OSPF1"), + resource.TestCheckResourceAttr("data.nxos_bgp_route_redistribution.test", "route_map", "route_map_ospf_1"), + resource.TestCheckResourceAttr("data.nxos_bgp_route_redistribution.test", "scope", "inter"), + resource.TestCheckResourceAttr("data.nxos_bgp_route_redistribution.test", "srv6_prefix_type", "unspecified"), + ), + }, + }, + }) +} + +const testAccDataSourceNxosBGPRouteRedistributionPrerequisitesConfig = ` +resource "nxos_rest" "PreReq0" { + dn = "sys/fm/bgp" + class_name = "fmBgp" + delete = false + content = { + adminSt = "enabled" + } +} + +resource "nxos_rest" "PreReq1" { + dn = "sys/bgp" + class_name = "bgpEntity" + depends_on = [nxos_rest.PreReq0, ] +} + +resource "nxos_rest" "PreReq2" { + dn = "sys/bgp/inst" + class_name = "bgpInst" + content = { + adminSt = "enabled" + asn = "65001" + } + depends_on = [nxos_rest.PreReq1, ] +} + +resource "nxos_rest" "PreReq3" { + dn = "sys/bgp/inst/dom-[default]" + class_name = "bgpDom" + content = { + name = "default" + } + depends_on = [nxos_rest.PreReq2, ] +} + +resource "nxos_rest" "PreReq4" { + dn = "sys/bgp/inst/dom-[default]/af-[ipv4-ucast]" + class_name = "bgpDomAf" + content = { + type = "ipv4-ucast" + } + depends_on = [nxos_rest.PreReq3, ] +} + +` + +const testAccDataSourceNxosBGPRouteRedistributionConfig = ` + +resource "nxos_bgp_route_redistribution" "test" { + asn = "65001" + vrf = "default" + address_family = "ipv4-ucast" + protocol = "ospf" + protocol_instance = "OSPF1" + route_map = "route_map_ospf_1" + scope = "inter" + srv6_prefix_type = "unspecified" + depends_on = [nxos_rest.PreReq0, nxos_rest.PreReq1, nxos_rest.PreReq2, nxos_rest.PreReq3, nxos_rest.PreReq4, ] +} + +data "nxos_bgp_route_redistribution" "test" { + asn = "65001" + vrf = "default" + address_family = "ipv4-ucast" + protocol = "ospf" + protocol_instance = "OSPF1" + depends_on = [nxos_bgp_route_redistribution.test] +} +` diff --git a/internal/provider/model_nxos_bgp_route_redistribution.go b/internal/provider/model_nxos_bgp_route_redistribution.go new file mode 100644 index 00000000..6a366e6c --- /dev/null +++ b/internal/provider/model_nxos_bgp_route_redistribution.go @@ -0,0 +1,100 @@ +// Copyright © 2023 Cisco Systems, Inc. and its affiliates. +// All rights reserved. +// +// Licensed under the Mozilla Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://mozilla.org/MPL/2.0/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by "gen/generator.go"; DO NOT EDIT. + +package provider + +import ( + "fmt" + + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/netascode/go-nxos" + "github.com/tidwall/gjson" + "github.com/tidwall/sjson" +) + +type BGPRouteRedistribution struct { + Device types.String `tfsdk:"device"` + Dn types.String `tfsdk:"id"` + Asn types.String `tfsdk:"asn"` + Vrf types.String `tfsdk:"vrf"` + AddressFamily types.String `tfsdk:"address_family"` + Protocol types.String `tfsdk:"protocol"` + ProtocolInstance types.String `tfsdk:"protocol_instance"` + RouteMap types.String `tfsdk:"route_map"` + Scope types.String `tfsdk:"scope"` + Srv6PrefixType types.String `tfsdk:"srv6_prefix_type"` +} + +func (data BGPRouteRedistribution) getDn() string { + return fmt.Sprintf("sys/bgp/inst/dom-[%s]/af-[%s]/interleak-[%s]-interleak-[%s]", data.Vrf.ValueString(), data.AddressFamily.ValueString(), data.Protocol.ValueString(), data.ProtocolInstance.ValueString()) +} + +func (data BGPRouteRedistribution) getClassName() string { + return "bgpInterLeakP" +} + +func (data BGPRouteRedistribution) toBody() nxos.Body { + body := "" + body, _ = sjson.Set(body, data.getClassName()+".attributes", map[string]interface{}{}) + if (!data.Protocol.IsUnknown() && !data.Protocol.IsNull()) || true { + body, _ = sjson.Set(body, data.getClassName()+".attributes."+"proto", data.Protocol.ValueString()) + } + if (!data.ProtocolInstance.IsUnknown() && !data.ProtocolInstance.IsNull()) || true { + body, _ = sjson.Set(body, data.getClassName()+".attributes."+"inst", data.ProtocolInstance.ValueString()) + } + if (!data.RouteMap.IsUnknown() && !data.RouteMap.IsNull()) || true { + body, _ = sjson.Set(body, data.getClassName()+".attributes."+"rtMap", data.RouteMap.ValueString()) + } + if (!data.Scope.IsUnknown() && !data.Scope.IsNull()) || false { + body, _ = sjson.Set(body, data.getClassName()+".attributes."+"scope", data.Scope.ValueString()) + } + if (!data.Srv6PrefixType.IsUnknown() && !data.Srv6PrefixType.IsNull()) || false { + body, _ = sjson.Set(body, data.getClassName()+".attributes."+"srv6PrefixType", data.Srv6PrefixType.ValueString()) + } + + return nxos.Body{body} +} + +func (data *BGPRouteRedistribution) fromBody(res gjson.Result, all bool) { + if !data.Protocol.IsNull() || all { + data.Protocol = types.StringValue(res.Get(data.getClassName() + ".attributes.proto").String()) + } else { + data.Protocol = types.StringNull() + } + if !data.ProtocolInstance.IsNull() || all { + data.ProtocolInstance = types.StringValue(res.Get(data.getClassName() + ".attributes.inst").String()) + } else { + data.ProtocolInstance = types.StringNull() + } + if !data.RouteMap.IsNull() || all { + data.RouteMap = types.StringValue(res.Get(data.getClassName() + ".attributes.rtMap").String()) + } else { + data.RouteMap = types.StringNull() + } + if !data.Scope.IsNull() || all { + data.Scope = types.StringValue(res.Get(data.getClassName() + ".attributes.scope").String()) + } else { + data.Scope = types.StringNull() + } + if !data.Srv6PrefixType.IsNull() || all { + data.Srv6PrefixType = types.StringValue(res.Get(data.getClassName() + ".attributes.srv6PrefixType").String()) + } else { + data.Srv6PrefixType = types.StringNull() + } +} diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 7794dc48..fbd0a036 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -285,6 +285,7 @@ func (p *NxosProvider) Resources(ctx context.Context) []func() resource.Resource NewBGPPeerTemplateAddressFamilyResource, NewBGPPeerTemplateMaxPrefixResource, NewBGPRouteControlResource, + NewBGPRouteRedistributionResource, NewBGPVRFResource, NewBridgeDomainResource, NewDefaultQOSClassMapResource, @@ -420,6 +421,7 @@ func (p *NxosProvider) DataSources(ctx context.Context) []func() datasource.Data NewBGPPeerTemplateAddressFamilyDataSource, NewBGPPeerTemplateMaxPrefixDataSource, NewBGPRouteControlDataSource, + NewBGPRouteRedistributionDataSource, NewBGPVRFDataSource, NewBridgeDomainDataSource, NewDefaultQOSClassMapDataSource, diff --git a/internal/provider/resource_nxos_bgp_address_family.go b/internal/provider/resource_nxos_bgp_address_family.go index fcdfffba..f3a8e162 100644 --- a/internal/provider/resource_nxos_bgp_address_family.go +++ b/internal/provider/resource_nxos_bgp_address_family.go @@ -57,7 +57,7 @@ func (r *BGPAddressFamilyResource) Metadata(ctx context.Context, req resource.Me func (r *BGPAddressFamilyResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: helpers.NewResourceDescription("This resource can manage the BGP (VRF) address family configuration.", "bgpDomAf", "Routing%20and%20Forwarding/bgp:DomAf/").AddParents("bgp_vrf").AddChildren("bgp_advertised_prefix").String, + MarkdownDescription: helpers.NewResourceDescription("This resource can manage the BGP (VRF) address family configuration.", "bgpDomAf", "Routing%20and%20Forwarding/bgp:DomAf/").AddParents("bgp_vrf").AddChildren("bgp_advertised_prefix", "bgp_route_redistribution").String, Attributes: map[string]schema.Attribute{ "device": schema.StringAttribute{ diff --git a/internal/provider/resource_nxos_bgp_route_redistribution.go b/internal/provider/resource_nxos_bgp_route_redistribution.go new file mode 100644 index 00000000..5c2adf70 --- /dev/null +++ b/internal/provider/resource_nxos_bgp_route_redistribution.go @@ -0,0 +1,258 @@ +// Copyright © 2023 Cisco Systems, Inc. and its affiliates. +// All rights reserved. +// +// Licensed under the Mozilla Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://mozilla.org/MPL/2.0/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by "gen/generator.go"; DO NOT EDIT. + +package provider + +import ( + "context" + "fmt" + + "github.com/CiscoDevNet/terraform-provider-nxos/internal/provider/helpers" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" + "github.com/netascode/go-nxos" +) + +// Ensure provider defined types fully satisfy framework interfaces +var _ resource.Resource = &BGPRouteRedistributionResource{} +var _ resource.ResourceWithImportState = &BGPRouteRedistributionResource{} + +func NewBGPRouteRedistributionResource() resource.Resource { + return &BGPRouteRedistributionResource{} +} + +type BGPRouteRedistributionResource struct { + clients map[string]*nxos.Client +} + +func (r *BGPRouteRedistributionResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_bgp_route_redistribution" +} + +func (r *BGPRouteRedistributionResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: helpers.NewResourceDescription("This resource can manage the BGP (VRF) route redistribution configuration.", "bgpInterLeakP", "Routing%20and%20Forwarding/bgp:InterLeakP/").AddParents("bgp_address_family").String, + + Attributes: map[string]schema.Attribute{ + "device": schema.StringAttribute{ + MarkdownDescription: "A device name from the provider configuration.", + Optional: true, + }, + "id": schema.StringAttribute{ + MarkdownDescription: "The distinguished name of the object.", + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "asn": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Autonomous system number.").String, + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + "vrf": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("VRF name.").String, + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + "address_family": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Address Family.").AddStringEnumDescription("ipv4-ucast", "ipv4-mcast", "vpnv4-ucast", "ipv6-ucast", "ipv6-mcast", "vpnv6-ucast", "vpnv6-mcast", "l2vpn-evpn", "ipv4-lucast", "ipv6-lucast", "lnkstate", "ipv4-mvpn", "ipv6-mvpn", "l2vpn-vpls", "ipv4-mdt").AddDefaultValueDescription("ipv4-ucast").String, + Required: true, + Validators: []validator.String{ + stringvalidator.OneOf("ipv4-ucast", "ipv4-mcast", "vpnv4-ucast", "ipv6-ucast", "ipv6-mcast", "vpnv6-ucast", "vpnv6-mcast", "l2vpn-evpn", "ipv4-lucast", "ipv6-lucast", "lnkstate", "ipv4-mvpn", "ipv6-mvpn", "l2vpn-vpls", "ipv4-mdt"), + }, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + "protocol": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("The list of protocols to match.").AddStringEnumDescription("unspecified", "static", "direct", "bgp", "isis", "ospf", "ospfv3", "eigrp", "host", "rip", "amt", "lisp", "hmm", "am", "srv6").AddDefaultValueDescription("unspecified").String, + Required: true, + Validators: []validator.String{ + stringvalidator.OneOf("unspecified", "static", "direct", "bgp", "isis", "ospf", "ospfv3", "eigrp", "host", "rip", "amt", "lisp", "hmm", "am", "srv6"), + }, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + "protocol_instance": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("The inter protocol route leak policy instance (Use `none` for `static` and `direct` protocols).").AddDefaultValueDescription("none").String, + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + "route_map": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("The name of the default route leak policy route map. This route map name is used to control distribution.").String, + Optional: true, + }, + "scope": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("The domain applicable to the capability.").AddStringEnumDescription("intra", "inter", "defrt").AddDefaultValueDescription("inter").String, + Optional: true, + Computed: true, + Default: stringdefault.StaticString("inter"), + Validators: []validator.String{ + stringvalidator.OneOf("intra", "inter", "defrt"), + }, + }, + "srv6_prefix_type": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("SRv6 Prefix Type; Valid only when proto is srv6.").AddStringEnumDescription("unspecified", "locator").AddDefaultValueDescription("unspecified").String, + Optional: true, + Computed: true, + Default: stringdefault.StaticString("unspecified"), + Validators: []validator.String{ + stringvalidator.OneOf("unspecified", "locator"), + }, + }, + }, + } +} + +func (r *BGPRouteRedistributionResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + r.clients = req.ProviderData.(map[string]*nxos.Client) +} + +func (r *BGPRouteRedistributionResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + var plan BGPRouteRedistribution + + // Read plan + diags := req.Plan.Get(ctx, &plan) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.getDn())) + + // Post object + body := plan.toBody() + _, err := r.clients[plan.Device.ValueString()].Post(plan.getDn(), body.Str) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to post object, got error: %s", err)) + return + } + + plan.Dn = types.StringValue(plan.getDn()) + + tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.getDn())) + + diags = resp.State.Set(ctx, &plan) + resp.Diagnostics.Append(diags...) +} + +func (r *BGPRouteRedistributionResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + var state BGPRouteRedistribution + + // Read state + diags := req.State.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Dn.ValueString())) + + queries := []func(*nxos.Req){nxos.Query("rsp-prop-include", "config-only")} + res, err := r.clients[state.Device.ValueString()].GetDn(state.Dn.ValueString(), queries...) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err)) + return + } + + state.fromBody(res, false) + + tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Dn.ValueString())) + + diags = resp.State.Set(ctx, &state) + resp.Diagnostics.Append(diags...) +} + +func (r *BGPRouteRedistributionResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + var plan BGPRouteRedistribution + + // Read plan + diags := req.Plan.Get(ctx, &plan) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.getDn())) + + body := plan.toBody() + _, err := r.clients[plan.Device.ValueString()].Post(plan.getDn(), body.Str) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to update object, got error: %s", err)) + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.getDn())) + + diags = resp.State.Set(ctx, &plan) + resp.Diagnostics.Append(diags...) +} + +func (r *BGPRouteRedistributionResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + var state BGPRouteRedistribution + + // Read state + diags := req.State.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Dn.ValueString())) + + res, err := r.clients[state.Device.ValueString()].DeleteDn(state.Dn.ValueString()) + if err != nil { + errCode := res.Get("imdata.0.error.attributes.code").Str + // Ignore errors of type "Cannot delete object" + if errCode != "1" && errCode != "107" { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to update object, got error: %s", err)) + return + } + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Dn.ValueString())) + + resp.State.RemoveResource(ctx) +} + +func (r *BGPRouteRedistributionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) +} diff --git a/internal/provider/resource_nxos_bgp_route_redistribution_test.go b/internal/provider/resource_nxos_bgp_route_redistribution_test.go new file mode 100644 index 00000000..964b8d92 --- /dev/null +++ b/internal/provider/resource_nxos_bgp_route_redistribution_test.go @@ -0,0 +1,128 @@ +// Copyright © 2023 Cisco Systems, Inc. and its affiliates. +// All rights reserved. +// +// Licensed under the Mozilla Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://mozilla.org/MPL/2.0/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: MPL-2.0 + +// Code generated by "gen/generator.go"; DO NOT EDIT. + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccNxosBGPRouteRedistribution(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testAccNxosBGPRouteRedistributionPrerequisitesConfig + testAccNxosBGPRouteRedistributionConfig_all(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("nxos_bgp_route_redistribution.test", "asn", "65001"), + resource.TestCheckResourceAttr("nxos_bgp_route_redistribution.test", "vrf", "default"), + resource.TestCheckResourceAttr("nxos_bgp_route_redistribution.test", "address_family", "ipv4-ucast"), + resource.TestCheckResourceAttr("nxos_bgp_route_redistribution.test", "protocol", "ospf"), + resource.TestCheckResourceAttr("nxos_bgp_route_redistribution.test", "protocol_instance", "OSPF1"), + resource.TestCheckResourceAttr("nxos_bgp_route_redistribution.test", "route_map", "route_map_ospf_1"), + resource.TestCheckResourceAttr("nxos_bgp_route_redistribution.test", "scope", "inter"), + resource.TestCheckResourceAttr("nxos_bgp_route_redistribution.test", "srv6_prefix_type", "unspecified"), + ), + }, + { + ResourceName: "nxos_bgp_route_redistribution.test", + ImportState: true, + ImportStateId: "sys/bgp/inst/dom-[default]/af-[ipv4-ucast]/interleak-[ospf]-interleak-[OSPF1]", + }, + }, + }) +} + +const testAccNxosBGPRouteRedistributionPrerequisitesConfig = ` +resource "nxos_rest" "PreReq0" { + dn = "sys/fm/bgp" + class_name = "fmBgp" + delete = false + content = { + adminSt = "enabled" + } +} + +resource "nxos_rest" "PreReq1" { + dn = "sys/bgp" + class_name = "bgpEntity" + depends_on = [nxos_rest.PreReq0, ] +} + +resource "nxos_rest" "PreReq2" { + dn = "sys/bgp/inst" + class_name = "bgpInst" + content = { + adminSt = "enabled" + asn = "65001" + } + depends_on = [nxos_rest.PreReq1, ] +} + +resource "nxos_rest" "PreReq3" { + dn = "sys/bgp/inst/dom-[default]" + class_name = "bgpDom" + content = { + name = "default" + } + depends_on = [nxos_rest.PreReq2, ] +} + +resource "nxos_rest" "PreReq4" { + dn = "sys/bgp/inst/dom-[default]/af-[ipv4-ucast]" + class_name = "bgpDomAf" + content = { + type = "ipv4-ucast" + } + depends_on = [nxos_rest.PreReq3, ] +} + +` + +func testAccNxosBGPRouteRedistributionConfig_minimum() string { + return ` + resource "nxos_bgp_route_redistribution" "test" { + asn = "65001" + vrf = "default" + address_family = "ipv4-ucast" + protocol = "ospf" + protocol_instance = "OSPF1" + depends_on = [nxos_rest.PreReq0, nxos_rest.PreReq1, nxos_rest.PreReq2, nxos_rest.PreReq3, nxos_rest.PreReq4, ] + } + ` +} + +func testAccNxosBGPRouteRedistributionConfig_all() string { + return ` + resource "nxos_bgp_route_redistribution" "test" { + asn = "65001" + vrf = "default" + address_family = "ipv4-ucast" + protocol = "ospf" + protocol_instance = "OSPF1" + route_map = "route_map_ospf_1" + scope = "inter" + srv6_prefix_type = "unspecified" + depends_on = [nxos_rest.PreReq0, nxos_rest.PreReq1, nxos_rest.PreReq2, nxos_rest.PreReq3, nxos_rest.PreReq4, ] + } + ` +} diff --git a/templates/guides/supported_objects.md.tmpl b/templates/guides/supported_objects.md.tmpl index 8886b242..9851ba1f 100644 --- a/templates/guides/supported_objects.md.tmpl +++ b/templates/guides/supported_objects.md.tmpl @@ -24,6 +24,7 @@ For the following DME objects a corresponding Terraform resource and data source | [bgpPeerAf](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:PeerAf/) | [nxos_bgp_peer_template_address_family](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_peer_template_address_family) | [nxos_bgp_peer_template_address_family](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp_peer_template_address_family) | | [bgpMaxPfxP](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:MaxPfxP/) | [nxos_bgp_peer_template_max_prefix](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_peer_template_max_prefix) | [nxos_bgp_peer_template_max_prefix](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp_peer_template_max_prefix) | | [bgpRtCtrl](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:RtCtrl/) | [nxos_bgp_route_control](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_route_control) | [nxos_bgp_route_control](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp_route_control) | +| [bgpInterLeakP](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:InterLeakP/) | [nxos_bgp_route_redistribution](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_route_redistribution) | [nxos_bgp_route_redistribution](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp_route_redistribution) | | [bgpDom](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Routing%20and%20Forwarding/bgp:Dom/) | [nxos_bgp_vrf](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bgp_vrf) | [nxos_bgp_vrf](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bgp_vrf) | | [l2BD](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Layer%202/l2:BD/) | [nxos_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/bridge_domain) | [nxos_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/bridge_domain) | | [ipqosCMapInst](https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Qos/ipqos:CMapInst/) | [nxos_default_qos_class_map](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/resources/default_qos_class_map) | [nxos_default_qos_class_map](https://registry.terraform.io/providers/CiscoDevNet/nxos/latest/docs/data-sources/default_qos_class_map) |