From c4335f6b31b622c5e00ae4ddac1594229887fdae Mon Sep 17 00:00:00 2001 From: danischm Date: Mon, 18 Dec 2023 09:22:55 +0100 Subject: [PATCH] Add bgp default originate attributes --- CHANGELOG.md | 1 + .../data-sources/bgp_ipv4_unicast_neighbor.md | 2 + .../bgp_ipv4_unicast_vrf_neighbor.md | 2 + .../data-sources/bgp_ipv6_unicast_neighbor.md | 2 + docs/guides/changelog.md | 1 + docs/resources/bgp_ipv4_unicast_neighbor.md | 16 ++-- .../bgp_ipv4_unicast_vrf_neighbor.md | 4 + docs/resources/bgp_ipv6_unicast_neighbor.md | 16 ++-- .../resource.tf | 14 +-- .../resource.tf | 2 + .../resource.tf | 14 +-- .../bgp_ipv4_unicast_neighbor.yaml | 4 + .../bgp_ipv4_unicast_vrf_neighbor.yaml | 4 + .../bgp_ipv6_unicast_neighbor.yaml | 4 + ..._source_iosxe_bgp_ipv4_unicast_neighbor.go | 8 ++ ...ce_iosxe_bgp_ipv4_unicast_neighbor_test.go | 4 + ...rce_iosxe_bgp_ipv4_unicast_vrf_neighbor.go | 8 ++ ...osxe_bgp_ipv4_unicast_vrf_neighbor_test.go | 4 + ..._source_iosxe_bgp_ipv6_unicast_neighbor.go | 8 ++ ...ce_iosxe_bgp_ipv6_unicast_neighbor_test.go | 4 + .../model_iosxe_bgp_ipv4_unicast_neighbor.go | 87 +++++++++++++++---- ...del_iosxe_bgp_ipv4_unicast_vrf_neighbor.go | 49 +++++++++++ .../model_iosxe_bgp_ipv6_unicast_neighbor.go | 87 +++++++++++++++---- ...esource_iosxe_bgp_ipv4_unicast_neighbor.go | 8 ++ ...ce_iosxe_bgp_ipv4_unicast_neighbor_test.go | 4 + ...rce_iosxe_bgp_ipv4_unicast_vrf_neighbor.go | 8 ++ ...osxe_bgp_ipv4_unicast_vrf_neighbor_test.go | 4 + ...esource_iosxe_bgp_ipv6_unicast_neighbor.go | 8 ++ ...ce_iosxe_bgp_ipv6_unicast_neighbor_test.go | 4 + templates/guides/changelog.md.tmpl | 1 + 30 files changed, 320 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b6e846d..56a99156 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Add `soft_reconfiguration` attribute to `iosxe_bgp_ipv4_unicast_neighbor`, `iosxe_bgp_ipv4_unicast_vrf_neighbor`, `iosxe_bgp_ipv6_unicast_neighbor` and `iosxe_bgp_l2vpn_evpn_neighbor` resources and data sources - Add `fall_over_bfd` attribute to `iosxe_bgp_neighbor` and `iosxe_bgp_ipv4_unicast_vrf_neighbor` resources and data sources - Add `iosxe_as_path_access_list` resource and data source +- Add `default_originate` and `default_originate_route_map` attributes to `iosxe_bgp_ipv4_unicast_neighbor`, `iosxe_bgp_ipv4_unicast_vrf_neighbor` and `iosxe_bgp_ipv6_unicast_neighbor` resources and data sources ## 0.5.1 diff --git a/docs/data-sources/bgp_ipv4_unicast_neighbor.md b/docs/data-sources/bgp_ipv4_unicast_neighbor.md index a4c8fa20..bc43d156 100644 --- a/docs/data-sources/bgp_ipv4_unicast_neighbor.md +++ b/docs/data-sources/bgp_ipv4_unicast_neighbor.md @@ -34,6 +34,8 @@ data "iosxe_bgp_ipv4_unicast_neighbor" "example" { ### Read-Only - `activate` (Boolean) Enable the address family for this neighbor +- `default_originate` (Boolean) Originate default route to this neighbor +- `default_originate_route_map` (String) Route-map to specify criteria to originate default - `id` (String) The path of the retrieved object. - `route_maps` (Attributes List) Apply route map to neighbor (see [below for nested schema](#nestedatt--route_maps)) - `route_reflector_client` (Boolean) Configure a neighbor as Route Reflector client diff --git a/docs/data-sources/bgp_ipv4_unicast_vrf_neighbor.md b/docs/data-sources/bgp_ipv4_unicast_vrf_neighbor.md index 5d13bda4..cc04f841 100644 --- a/docs/data-sources/bgp_ipv4_unicast_vrf_neighbor.md +++ b/docs/data-sources/bgp_ipv4_unicast_vrf_neighbor.md @@ -37,6 +37,8 @@ data "iosxe_bgp_ipv4_unicast_vrf_neighbor" "example" { - `activate` (Boolean) Enable the address family for this neighbor - `cluster_id` (String) +- `default_originate` (Boolean) Originate default route to this neighbor +- `default_originate_route_map` (String) Route-map to specify criteria to originate default - `description` (String) Neighbor specific description - `disable_connected_check` (Boolean) one-hop away EBGP peer using loopback address - `ebgp_multihop` (Boolean) Allow EBGP neighbors not on directly connected networks. For single-hop ebgp peers, delete ebgp-multihop directly. diff --git a/docs/data-sources/bgp_ipv6_unicast_neighbor.md b/docs/data-sources/bgp_ipv6_unicast_neighbor.md index 314cadab..c23fdebd 100644 --- a/docs/data-sources/bgp_ipv6_unicast_neighbor.md +++ b/docs/data-sources/bgp_ipv6_unicast_neighbor.md @@ -34,6 +34,8 @@ data "iosxe_bgp_ipv6_unicast_neighbor" "example" { ### Read-Only - `activate` (Boolean) Enable the address family for this neighbor +- `default_originate` (Boolean) Originate default route to this neighbor +- `default_originate_route_map` (String) Route-map to specify criteria to originate default - `id` (String) The path of the retrieved object. - `route_maps` (Attributes List) Apply route map to neighbor (see [below for nested schema](#nestedatt--route_maps)) - `route_reflector_client` (Boolean) Configure a neighbor as Route Reflector client diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index 7847a187..e185c368 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -15,6 +15,7 @@ description: |- - Add `soft_reconfiguration` attribute to `iosxe_bgp_ipv4_unicast_neighbor`, `iosxe_bgp_ipv4_unicast_vrf_neighbor`, `iosxe_bgp_ipv6_unicast_neighbor` and `iosxe_bgp_l2vpn_evpn_neighbor` resources and data sources - Add `fall_over_bfd` attribute to `iosxe_bgp_neighbor` and `iosxe_bgp_ipv4_unicast_vrf_neighbor` resources and data sources - Add `iosxe_as_path_access_list` resource and data source +- Add `default_originate` and `default_originate_route_map` attributes to `iosxe_bgp_ipv4_unicast_neighbor`, `iosxe_bgp_ipv4_unicast_vrf_neighbor` and `iosxe_bgp_ipv6_unicast_neighbor` resources and data sources ## 0.5.1 diff --git a/docs/resources/bgp_ipv4_unicast_neighbor.md b/docs/resources/bgp_ipv4_unicast_neighbor.md index 2ab92829..140ae23a 100644 --- a/docs/resources/bgp_ipv4_unicast_neighbor.md +++ b/docs/resources/bgp_ipv4_unicast_neighbor.md @@ -14,12 +14,14 @@ This resource can manage the BGP IPv4 Unicast Neighbor configuration. ```terraform resource "iosxe_bgp_ipv4_unicast_neighbor" "example" { - asn = "65000" - ip = "3.3.3.3" - activate = true - send_community = "both" - route_reflector_client = false - soft_reconfiguration = "inbound" + asn = "65000" + ip = "3.3.3.3" + activate = true + send_community = "both" + route_reflector_client = false + soft_reconfiguration = "inbound" + default_originate = true + default_originate_route_map = "RM1" route_maps = [ { in_out = "in" @@ -41,6 +43,8 @@ resource "iosxe_bgp_ipv4_unicast_neighbor" "example" { - `activate` (Boolean) Enable the address family for this neighbor - Default value: `true` +- `default_originate` (Boolean) Originate default route to this neighbor +- `default_originate_route_map` (String) Route-map to specify criteria to originate default - `delete_mode` (String) Configure behavior when deleting/destroying the resource. Either delete the entire object (YANG container) being managed, or only delete the individual resource attributes configured explicitly and leave everything else as-is. Default value is `all`. - Choices: `all`, `attributes` - `device` (String) A device name from the provider configuration. diff --git a/docs/resources/bgp_ipv4_unicast_vrf_neighbor.md b/docs/resources/bgp_ipv4_unicast_vrf_neighbor.md index 2d74ecd8..28652555 100644 --- a/docs/resources/bgp_ipv4_unicast_vrf_neighbor.md +++ b/docs/resources/bgp_ipv4_unicast_vrf_neighbor.md @@ -39,6 +39,8 @@ resource "iosxe_bgp_ipv4_unicast_vrf_neighbor" "example" { send_community = "both" route_reflector_client = false soft_reconfiguration = "inbound" + default_originate = true + default_originate_route_map = "RM1" route_maps = [ { in_out = "in" @@ -62,6 +64,8 @@ resource "iosxe_bgp_ipv4_unicast_vrf_neighbor" "example" { - `activate` (Boolean) Enable the address family for this neighbor - Default value: `true` - `cluster_id` (String) +- `default_originate` (Boolean) Originate default route to this neighbor +- `default_originate_route_map` (String) Route-map to specify criteria to originate default - `delete_mode` (String) Configure behavior when deleting/destroying the resource. Either delete the entire object (YANG container) being managed, or only delete the individual resource attributes configured explicitly and leave everything else as-is. Default value is `all`. - Choices: `all`, `attributes` - `description` (String) Neighbor specific description diff --git a/docs/resources/bgp_ipv6_unicast_neighbor.md b/docs/resources/bgp_ipv6_unicast_neighbor.md index 0d102d4f..401d6dcb 100644 --- a/docs/resources/bgp_ipv6_unicast_neighbor.md +++ b/docs/resources/bgp_ipv6_unicast_neighbor.md @@ -14,12 +14,14 @@ This resource can manage the BGP IPv6 Unicast Neighbor configuration. ```terraform resource "iosxe_bgp_ipv6_unicast_neighbor" "example" { - asn = "65000" - ip = "3.3.3.3" - activate = true - send_community = "both" - route_reflector_client = false - soft_reconfiguration = "inbound" + asn = "65000" + ip = "3.3.3.3" + activate = true + send_community = "both" + route_reflector_client = false + soft_reconfiguration = "inbound" + default_originate = true + default_originate_route_map = "RM1" route_maps = [ { in_out = "in" @@ -41,6 +43,8 @@ resource "iosxe_bgp_ipv6_unicast_neighbor" "example" { - `activate` (Boolean) Enable the address family for this neighbor - Default value: `true` +- `default_originate` (Boolean) Originate default route to this neighbor +- `default_originate_route_map` (String) Route-map to specify criteria to originate default - `delete_mode` (String) Configure behavior when deleting/destroying the resource. Either delete the entire object (YANG container) being managed, or only delete the individual resource attributes configured explicitly and leave everything else as-is. Default value is `all`. - Choices: `all`, `attributes` - `device` (String) A device name from the provider configuration. diff --git a/examples/resources/iosxe_bgp_ipv4_unicast_neighbor/resource.tf b/examples/resources/iosxe_bgp_ipv4_unicast_neighbor/resource.tf index f9278b0a..c168afe1 100644 --- a/examples/resources/iosxe_bgp_ipv4_unicast_neighbor/resource.tf +++ b/examples/resources/iosxe_bgp_ipv4_unicast_neighbor/resource.tf @@ -1,10 +1,12 @@ resource "iosxe_bgp_ipv4_unicast_neighbor" "example" { - asn = "65000" - ip = "3.3.3.3" - activate = true - send_community = "both" - route_reflector_client = false - soft_reconfiguration = "inbound" + asn = "65000" + ip = "3.3.3.3" + activate = true + send_community = "both" + route_reflector_client = false + soft_reconfiguration = "inbound" + default_originate = true + default_originate_route_map = "RM1" route_maps = [ { in_out = "in" diff --git a/examples/resources/iosxe_bgp_ipv4_unicast_vrf_neighbor/resource.tf b/examples/resources/iosxe_bgp_ipv4_unicast_vrf_neighbor/resource.tf index a80e1d70..38ed9810 100644 --- a/examples/resources/iosxe_bgp_ipv4_unicast_vrf_neighbor/resource.tf +++ b/examples/resources/iosxe_bgp_ipv4_unicast_vrf_neighbor/resource.tf @@ -24,6 +24,8 @@ resource "iosxe_bgp_ipv4_unicast_vrf_neighbor" "example" { send_community = "both" route_reflector_client = false soft_reconfiguration = "inbound" + default_originate = true + default_originate_route_map = "RM1" route_maps = [ { in_out = "in" diff --git a/examples/resources/iosxe_bgp_ipv6_unicast_neighbor/resource.tf b/examples/resources/iosxe_bgp_ipv6_unicast_neighbor/resource.tf index 0c53c116..fc8b80d0 100644 --- a/examples/resources/iosxe_bgp_ipv6_unicast_neighbor/resource.tf +++ b/examples/resources/iosxe_bgp_ipv6_unicast_neighbor/resource.tf @@ -1,10 +1,12 @@ resource "iosxe_bgp_ipv6_unicast_neighbor" "example" { - asn = "65000" - ip = "3.3.3.3" - activate = true - send_community = "both" - route_reflector_client = false - soft_reconfiguration = "inbound" + asn = "65000" + ip = "3.3.3.3" + activate = true + send_community = "both" + route_reflector_client = false + soft_reconfiguration = "inbound" + default_originate = true + default_originate_route_map = "RM1" route_maps = [ { in_out = "in" diff --git a/gen/definitions/bgp_ipv4_unicast_neighbor.yaml b/gen/definitions/bgp_ipv4_unicast_neighbor.yaml index 9784dda8..1a7cc696 100644 --- a/gen/definitions/bgp_ipv4_unicast_neighbor.yaml +++ b/gen/definitions/bgp_ipv4_unicast_neighbor.yaml @@ -22,6 +22,10 @@ attributes: example: false - yang_name: soft-reconfiguration example: inbound + - yang_name: default-originate + example: true + - yang_name: default-originate/route-map + example: RM1 - yang_name: route-map tf_name: route_maps type: List diff --git a/gen/definitions/bgp_ipv4_unicast_vrf_neighbor.yaml b/gen/definitions/bgp_ipv4_unicast_vrf_neighbor.yaml index e48de2e7..30c35136 100644 --- a/gen/definitions/bgp_ipv4_unicast_vrf_neighbor.yaml +++ b/gen/definitions/bgp_ipv4_unicast_vrf_neighbor.yaml @@ -109,6 +109,10 @@ attributes: example: false - yang_name: soft-reconfiguration example: inbound + - yang_name: default-originate + example: true + - yang_name: default-originate/route-map + example: RM1 - yang_name: route-map tf_name: route_maps type: List diff --git a/gen/definitions/bgp_ipv6_unicast_neighbor.yaml b/gen/definitions/bgp_ipv6_unicast_neighbor.yaml index ebea1c80..f8fff687 100644 --- a/gen/definitions/bgp_ipv6_unicast_neighbor.yaml +++ b/gen/definitions/bgp_ipv6_unicast_neighbor.yaml @@ -22,6 +22,10 @@ attributes: example: false - yang_name: soft-reconfiguration example: inbound + - yang_name: default-originate + example: true + - yang_name: default-originate/route-map + example: RM1 - yang_name: route-map tf_name: route_maps type: List diff --git a/internal/provider/data_source_iosxe_bgp_ipv4_unicast_neighbor.go b/internal/provider/data_source_iosxe_bgp_ipv4_unicast_neighbor.go index aabf6480..dd8d8ce4 100644 --- a/internal/provider/data_source_iosxe_bgp_ipv4_unicast_neighbor.go +++ b/internal/provider/data_source_iosxe_bgp_ipv4_unicast_neighbor.go @@ -87,6 +87,14 @@ func (d *BGPIPv4UnicastNeighborDataSource) Schema(ctx context.Context, req datas MarkdownDescription: "Per neighbor soft reconfiguration", Computed: true, }, + "default_originate": schema.BoolAttribute{ + MarkdownDescription: "Originate default route to this neighbor", + Computed: true, + }, + "default_originate_route_map": schema.StringAttribute{ + MarkdownDescription: "Route-map to specify criteria to originate default", + Computed: true, + }, "route_maps": schema.ListNestedAttribute{ MarkdownDescription: "Apply route map to neighbor", Computed: true, diff --git a/internal/provider/data_source_iosxe_bgp_ipv4_unicast_neighbor_test.go b/internal/provider/data_source_iosxe_bgp_ipv4_unicast_neighbor_test.go index 1fbeceb3..21665c40 100644 --- a/internal/provider/data_source_iosxe_bgp_ipv4_unicast_neighbor_test.go +++ b/internal/provider/data_source_iosxe_bgp_ipv4_unicast_neighbor_test.go @@ -31,6 +31,8 @@ func TestAccDataSourceIosxeBGPIPv4UnicastNeighbor(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv4_unicast_neighbor.test", "send_community", "both")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv4_unicast_neighbor.test", "route_reflector_client", "false")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv4_unicast_neighbor.test", "soft_reconfiguration", "inbound")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv4_unicast_neighbor.test", "default_originate", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv4_unicast_neighbor.test", "default_originate_route_map", "RM1")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv4_unicast_neighbor.test", "route_maps.0.in_out", "in")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv4_unicast_neighbor.test", "route_maps.0.route_map_name", "RM1")) resource.Test(t, resource.TestCase{ @@ -88,6 +90,8 @@ func testAccDataSourceIosxeBGPIPv4UnicastNeighborConfig() string { config += ` send_community = "both"` + "\n" config += ` route_reflector_client = false` + "\n" config += ` soft_reconfiguration = "inbound"` + "\n" + config += ` default_originate = true` + "\n" + config += ` default_originate_route_map = "RM1"` + "\n" config += ` route_maps = [{` + "\n" config += ` in_out = "in"` + "\n" config += ` route_map_name = "RM1"` + "\n" diff --git a/internal/provider/data_source_iosxe_bgp_ipv4_unicast_vrf_neighbor.go b/internal/provider/data_source_iosxe_bgp_ipv4_unicast_vrf_neighbor.go index 9997a5c6..a8be7111 100644 --- a/internal/provider/data_source_iosxe_bgp_ipv4_unicast_vrf_neighbor.go +++ b/internal/provider/data_source_iosxe_bgp_ipv4_unicast_vrf_neighbor.go @@ -191,6 +191,14 @@ func (d *BGPIPv4UnicastVRFNeighborDataSource) Schema(ctx context.Context, req da MarkdownDescription: "Per neighbor soft reconfiguration", Computed: true, }, + "default_originate": schema.BoolAttribute{ + MarkdownDescription: "Originate default route to this neighbor", + Computed: true, + }, + "default_originate_route_map": schema.StringAttribute{ + MarkdownDescription: "Route-map to specify criteria to originate default", + Computed: true, + }, "route_maps": schema.ListNestedAttribute{ MarkdownDescription: "Apply route map to neighbor", Computed: true, diff --git a/internal/provider/data_source_iosxe_bgp_ipv4_unicast_vrf_neighbor_test.go b/internal/provider/data_source_iosxe_bgp_ipv4_unicast_vrf_neighbor_test.go index 08846356..0a524239 100644 --- a/internal/provider/data_source_iosxe_bgp_ipv4_unicast_vrf_neighbor_test.go +++ b/internal/provider/data_source_iosxe_bgp_ipv4_unicast_vrf_neighbor_test.go @@ -49,6 +49,8 @@ func TestAccDataSourceIosxeBGPIPv4UnicastVRFNeighbor(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv4_unicast_vrf_neighbor.test", "send_community", "both")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv4_unicast_vrf_neighbor.test", "route_reflector_client", "false")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv4_unicast_vrf_neighbor.test", "soft_reconfiguration", "inbound")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv4_unicast_vrf_neighbor.test", "default_originate", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv4_unicast_vrf_neighbor.test", "default_originate_route_map", "RM1")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv4_unicast_vrf_neighbor.test", "route_maps.0.in_out", "in")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv4_unicast_vrf_neighbor.test", "route_maps.0.route_map_name", "RM1")) resource.Test(t, resource.TestCase{ @@ -137,6 +139,8 @@ func testAccDataSourceIosxeBGPIPv4UnicastVRFNeighborConfig() string { config += ` send_community = "both"` + "\n" config += ` route_reflector_client = false` + "\n" config += ` soft_reconfiguration = "inbound"` + "\n" + config += ` default_originate = true` + "\n" + config += ` default_originate_route_map = "RM1"` + "\n" config += ` route_maps = [{` + "\n" config += ` in_out = "in"` + "\n" config += ` route_map_name = "RM1"` + "\n" diff --git a/internal/provider/data_source_iosxe_bgp_ipv6_unicast_neighbor.go b/internal/provider/data_source_iosxe_bgp_ipv6_unicast_neighbor.go index 9f30009d..9e3600a4 100644 --- a/internal/provider/data_source_iosxe_bgp_ipv6_unicast_neighbor.go +++ b/internal/provider/data_source_iosxe_bgp_ipv6_unicast_neighbor.go @@ -87,6 +87,14 @@ func (d *BGPIPv6UnicastNeighborDataSource) Schema(ctx context.Context, req datas MarkdownDescription: "Per neighbor soft reconfiguration", Computed: true, }, + "default_originate": schema.BoolAttribute{ + MarkdownDescription: "Originate default route to this neighbor", + Computed: true, + }, + "default_originate_route_map": schema.StringAttribute{ + MarkdownDescription: "Route-map to specify criteria to originate default", + Computed: true, + }, "route_maps": schema.ListNestedAttribute{ MarkdownDescription: "Apply route map to neighbor", Computed: true, diff --git a/internal/provider/data_source_iosxe_bgp_ipv6_unicast_neighbor_test.go b/internal/provider/data_source_iosxe_bgp_ipv6_unicast_neighbor_test.go index 8ff262f5..befd7590 100644 --- a/internal/provider/data_source_iosxe_bgp_ipv6_unicast_neighbor_test.go +++ b/internal/provider/data_source_iosxe_bgp_ipv6_unicast_neighbor_test.go @@ -31,6 +31,8 @@ func TestAccDataSourceIosxeBGPIPv6UnicastNeighbor(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv6_unicast_neighbor.test", "send_community", "both")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv6_unicast_neighbor.test", "route_reflector_client", "false")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv6_unicast_neighbor.test", "soft_reconfiguration", "inbound")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv6_unicast_neighbor.test", "default_originate", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv6_unicast_neighbor.test", "default_originate_route_map", "RM1")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv6_unicast_neighbor.test", "route_maps.0.in_out", "in")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_bgp_ipv6_unicast_neighbor.test", "route_maps.0.route_map_name", "RM1")) resource.Test(t, resource.TestCase{ @@ -95,6 +97,8 @@ func testAccDataSourceIosxeBGPIPv6UnicastNeighborConfig() string { config += ` send_community = "both"` + "\n" config += ` route_reflector_client = false` + "\n" config += ` soft_reconfiguration = "inbound"` + "\n" + config += ` default_originate = true` + "\n" + config += ` default_originate_route_map = "RM1"` + "\n" config += ` route_maps = [{` + "\n" config += ` in_out = "in"` + "\n" config += ` route_map_name = "RM1"` + "\n" diff --git a/internal/provider/model_iosxe_bgp_ipv4_unicast_neighbor.go b/internal/provider/model_iosxe_bgp_ipv4_unicast_neighbor.go index 15641793..4597bb82 100644 --- a/internal/provider/model_iosxe_bgp_ipv4_unicast_neighbor.go +++ b/internal/provider/model_iosxe_bgp_ipv4_unicast_neighbor.go @@ -35,28 +35,32 @@ import ( ) type BGPIPv4UnicastNeighbor struct { - Device types.String `tfsdk:"device"` - Id types.String `tfsdk:"id"` - DeleteMode types.String `tfsdk:"delete_mode"` - Asn types.String `tfsdk:"asn"` - Ip types.String `tfsdk:"ip"` - Activate types.Bool `tfsdk:"activate"` - SendCommunity types.String `tfsdk:"send_community"` - RouteReflectorClient types.Bool `tfsdk:"route_reflector_client"` - SoftReconfiguration types.String `tfsdk:"soft_reconfiguration"` - RouteMaps []BGPIPv4UnicastNeighborRouteMaps `tfsdk:"route_maps"` + Device types.String `tfsdk:"device"` + Id types.String `tfsdk:"id"` + DeleteMode types.String `tfsdk:"delete_mode"` + Asn types.String `tfsdk:"asn"` + Ip types.String `tfsdk:"ip"` + Activate types.Bool `tfsdk:"activate"` + SendCommunity types.String `tfsdk:"send_community"` + RouteReflectorClient types.Bool `tfsdk:"route_reflector_client"` + SoftReconfiguration types.String `tfsdk:"soft_reconfiguration"` + DefaultOriginate types.Bool `tfsdk:"default_originate"` + DefaultOriginateRouteMap types.String `tfsdk:"default_originate_route_map"` + RouteMaps []BGPIPv4UnicastNeighborRouteMaps `tfsdk:"route_maps"` } type BGPIPv4UnicastNeighborData struct { - Device types.String `tfsdk:"device"` - Id types.String `tfsdk:"id"` - Asn types.String `tfsdk:"asn"` - Ip types.String `tfsdk:"ip"` - Activate types.Bool `tfsdk:"activate"` - SendCommunity types.String `tfsdk:"send_community"` - RouteReflectorClient types.Bool `tfsdk:"route_reflector_client"` - SoftReconfiguration types.String `tfsdk:"soft_reconfiguration"` - RouteMaps []BGPIPv4UnicastNeighborRouteMaps `tfsdk:"route_maps"` + Device types.String `tfsdk:"device"` + Id types.String `tfsdk:"id"` + Asn types.String `tfsdk:"asn"` + Ip types.String `tfsdk:"ip"` + Activate types.Bool `tfsdk:"activate"` + SendCommunity types.String `tfsdk:"send_community"` + RouteReflectorClient types.Bool `tfsdk:"route_reflector_client"` + SoftReconfiguration types.String `tfsdk:"soft_reconfiguration"` + DefaultOriginate types.Bool `tfsdk:"default_originate"` + DefaultOriginateRouteMap types.String `tfsdk:"default_originate_route_map"` + RouteMaps []BGPIPv4UnicastNeighborRouteMaps `tfsdk:"route_maps"` } type BGPIPv4UnicastNeighborRouteMaps struct { InOut types.String `tfsdk:"in_out"` @@ -103,6 +107,14 @@ func (data BGPIPv4UnicastNeighbor) toBody(ctx context.Context) string { if !data.SoftReconfiguration.IsNull() && !data.SoftReconfiguration.IsUnknown() { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"soft-reconfiguration", data.SoftReconfiguration.ValueString()) } + if !data.DefaultOriginate.IsNull() && !data.DefaultOriginate.IsUnknown() { + if data.DefaultOriginate.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"default-originate", map[string]string{}) + } + } + if !data.DefaultOriginateRouteMap.IsNull() && !data.DefaultOriginateRouteMap.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"default-originate.route-map", data.DefaultOriginateRouteMap.ValueString()) + } if len(data.RouteMaps) > 0 { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"route-map", []interface{}{}) for index, item := range data.RouteMaps { @@ -155,6 +167,20 @@ func (data *BGPIPv4UnicastNeighbor) updateFromBody(ctx context.Context, res gjso } else { data.SoftReconfiguration = types.StringNull() } + if value := res.Get(prefix + "default-originate"); !data.DefaultOriginate.IsNull() { + if value.Exists() { + data.DefaultOriginate = types.BoolValue(true) + } else { + data.DefaultOriginate = types.BoolValue(false) + } + } else { + data.DefaultOriginate = types.BoolNull() + } + if value := res.Get(prefix + "default-originate.route-map"); value.Exists() && !data.DefaultOriginateRouteMap.IsNull() { + data.DefaultOriginateRouteMap = types.StringValue(value.String()) + } else { + data.DefaultOriginateRouteMap = types.StringNull() + } for i := range data.RouteMaps { keys := [...]string{"inout"} keyValues := [...]string{data.RouteMaps[i].InOut.ValueString()} @@ -212,6 +238,14 @@ func (data *BGPIPv4UnicastNeighborData) fromBody(ctx context.Context, res gjson. if value := res.Get(prefix + "soft-reconfiguration"); value.Exists() { data.SoftReconfiguration = types.StringValue(value.String()) } + if value := res.Get(prefix + "default-originate"); value.Exists() { + data.DefaultOriginate = types.BoolValue(true) + } else { + data.DefaultOriginate = types.BoolValue(false) + } + if value := res.Get(prefix + "default-originate.route-map"); value.Exists() { + data.DefaultOriginateRouteMap = types.StringValue(value.String()) + } if value := res.Get(prefix + "route-map"); value.Exists() { data.RouteMaps = make([]BGPIPv4UnicastNeighborRouteMaps, 0) value.ForEach(func(k, v gjson.Result) bool { @@ -239,6 +273,12 @@ func (data *BGPIPv4UnicastNeighbor) getDeletedItems(ctx context.Context, state B if !state.SoftReconfiguration.IsNull() && data.SoftReconfiguration.IsNull() { deletedItems = append(deletedItems, fmt.Sprintf("%v/soft-reconfiguration", state.getPath())) } + if !state.DefaultOriginate.IsNull() && data.DefaultOriginate.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/default-originate", state.getPath())) + } + if !state.DefaultOriginateRouteMap.IsNull() && data.DefaultOriginateRouteMap.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/default-originate/route-map", state.getPath())) + } for i := range state.RouteMaps { stateKeyValues := [...]string{state.RouteMaps[i].InOut.ValueString()} @@ -278,6 +318,9 @@ func (data *BGPIPv4UnicastNeighbor) getEmptyLeafsDelete(ctx context.Context) []s if !data.RouteReflectorClient.IsNull() && !data.RouteReflectorClient.ValueBool() { emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/route-reflector-client", data.getPath())) } + if !data.DefaultOriginate.IsNull() && !data.DefaultOriginate.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/default-originate", data.getPath())) + } return emptyLeafsDelete } @@ -293,6 +336,12 @@ func (data *BGPIPv4UnicastNeighbor) getDeletePaths(ctx context.Context) []string if !data.SoftReconfiguration.IsNull() { deletePaths = append(deletePaths, fmt.Sprintf("%v/soft-reconfiguration", data.getPath())) } + if !data.DefaultOriginate.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/default-originate", data.getPath())) + } + if !data.DefaultOriginateRouteMap.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/default-originate/route-map", data.getPath())) + } for i := range data.RouteMaps { keyValues := [...]string{data.RouteMaps[i].InOut.ValueString()} diff --git a/internal/provider/model_iosxe_bgp_ipv4_unicast_vrf_neighbor.go b/internal/provider/model_iosxe_bgp_ipv4_unicast_vrf_neighbor.go index 44946056..03ac2a0e 100644 --- a/internal/provider/model_iosxe_bgp_ipv4_unicast_vrf_neighbor.go +++ b/internal/provider/model_iosxe_bgp_ipv4_unicast_vrf_neighbor.go @@ -70,6 +70,8 @@ type BGPIPv4UnicastVRFNeighbor struct { SendCommunity types.String `tfsdk:"send_community"` RouteReflectorClient types.Bool `tfsdk:"route_reflector_client"` SoftReconfiguration types.String `tfsdk:"soft_reconfiguration"` + DefaultOriginate types.Bool `tfsdk:"default_originate"` + DefaultOriginateRouteMap types.String `tfsdk:"default_originate_route_map"` RouteMaps []BGPIPv4UnicastVRFNeighborRouteMaps `tfsdk:"route_maps"` EbgpMultihop types.Bool `tfsdk:"ebgp_multihop"` EbgpMultihopMaxHop types.Int64 `tfsdk:"ebgp_multihop_max_hop"` @@ -110,6 +112,8 @@ type BGPIPv4UnicastVRFNeighborData struct { SendCommunity types.String `tfsdk:"send_community"` RouteReflectorClient types.Bool `tfsdk:"route_reflector_client"` SoftReconfiguration types.String `tfsdk:"soft_reconfiguration"` + DefaultOriginate types.Bool `tfsdk:"default_originate"` + DefaultOriginateRouteMap types.String `tfsdk:"default_originate_route_map"` RouteMaps []BGPIPv4UnicastVRFNeighborRouteMaps `tfsdk:"route_maps"` EbgpMultihop types.Bool `tfsdk:"ebgp_multihop"` EbgpMultihopMaxHop types.Int64 `tfsdk:"ebgp_multihop_max_hop"` @@ -256,6 +260,14 @@ func (data BGPIPv4UnicastVRFNeighbor) toBody(ctx context.Context) string { if !data.SoftReconfiguration.IsNull() && !data.SoftReconfiguration.IsUnknown() { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"soft-reconfiguration", data.SoftReconfiguration.ValueString()) } + if !data.DefaultOriginate.IsNull() && !data.DefaultOriginate.IsUnknown() { + if data.DefaultOriginate.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"default-originate", map[string]string{}) + } + } + if !data.DefaultOriginateRouteMap.IsNull() && !data.DefaultOriginateRouteMap.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"default-originate.route-map", data.DefaultOriginateRouteMap.ValueString()) + } if !data.EbgpMultihop.IsNull() && !data.EbgpMultihop.IsUnknown() { if data.EbgpMultihop.ValueBool() { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"ebgp-multihop", map[string]string{}) @@ -485,6 +497,20 @@ func (data *BGPIPv4UnicastVRFNeighbor) updateFromBody(ctx context.Context, res g } else { data.SoftReconfiguration = types.StringNull() } + if value := res.Get(prefix + "default-originate"); !data.DefaultOriginate.IsNull() { + if value.Exists() { + data.DefaultOriginate = types.BoolValue(true) + } else { + data.DefaultOriginate = types.BoolValue(false) + } + } else { + data.DefaultOriginate = types.BoolNull() + } + if value := res.Get(prefix + "default-originate.route-map"); value.Exists() && !data.DefaultOriginateRouteMap.IsNull() { + data.DefaultOriginateRouteMap = types.StringValue(value.String()) + } else { + data.DefaultOriginateRouteMap = types.StringNull() + } for i := range data.RouteMaps { keys := [...]string{"inout"} keyValues := [...]string{data.RouteMaps[i].InOut.ValueString()} @@ -653,6 +679,14 @@ func (data *BGPIPv4UnicastVRFNeighborData) fromBody(ctx context.Context, res gjs if value := res.Get(prefix + "soft-reconfiguration"); value.Exists() { data.SoftReconfiguration = types.StringValue(value.String()) } + if value := res.Get(prefix + "default-originate"); value.Exists() { + data.DefaultOriginate = types.BoolValue(true) + } else { + data.DefaultOriginate = types.BoolValue(false) + } + if value := res.Get(prefix + "default-originate.route-map"); value.Exists() { + data.DefaultOriginateRouteMap = types.StringValue(value.String()) + } if value := res.Get(prefix + "route-map"); value.Exists() { data.RouteMaps = make([]BGPIPv4UnicastVRFNeighborRouteMaps, 0) value.ForEach(func(k, v gjson.Result) bool { @@ -760,6 +794,12 @@ func (data *BGPIPv4UnicastVRFNeighbor) getDeletedItems(ctx context.Context, stat if !state.SoftReconfiguration.IsNull() && data.SoftReconfiguration.IsNull() { deletedItems = append(deletedItems, fmt.Sprintf("%v/soft-reconfiguration", state.getPath())) } + if !state.DefaultOriginate.IsNull() && data.DefaultOriginate.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/default-originate", state.getPath())) + } + if !state.DefaultOriginateRouteMap.IsNull() && data.DefaultOriginateRouteMap.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/default-originate/route-map", state.getPath())) + } for i := range state.RouteMaps { stateKeyValues := [...]string{state.RouteMaps[i].InOut.ValueString()} @@ -838,6 +878,9 @@ func (data *BGPIPv4UnicastVRFNeighbor) getEmptyLeafsDelete(ctx context.Context) if !data.RouteReflectorClient.IsNull() && !data.RouteReflectorClient.ValueBool() { emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/route-reflector-client", data.getPath())) } + if !data.DefaultOriginate.IsNull() && !data.DefaultOriginate.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/default-originate", data.getPath())) + } if !data.EbgpMultihop.IsNull() && !data.EbgpMultihop.ValueBool() { emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/ebgp-multihop", data.getPath())) @@ -928,6 +971,12 @@ func (data *BGPIPv4UnicastVRFNeighbor) getDeletePaths(ctx context.Context) []str if !data.SoftReconfiguration.IsNull() { deletePaths = append(deletePaths, fmt.Sprintf("%v/soft-reconfiguration", data.getPath())) } + if !data.DefaultOriginate.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/default-originate", data.getPath())) + } + if !data.DefaultOriginateRouteMap.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/default-originate/route-map", data.getPath())) + } for i := range data.RouteMaps { keyValues := [...]string{data.RouteMaps[i].InOut.ValueString()} diff --git a/internal/provider/model_iosxe_bgp_ipv6_unicast_neighbor.go b/internal/provider/model_iosxe_bgp_ipv6_unicast_neighbor.go index 94ae3556..2262af19 100644 --- a/internal/provider/model_iosxe_bgp_ipv6_unicast_neighbor.go +++ b/internal/provider/model_iosxe_bgp_ipv6_unicast_neighbor.go @@ -35,28 +35,32 @@ import ( ) type BGPIPv6UnicastNeighbor struct { - Device types.String `tfsdk:"device"` - Id types.String `tfsdk:"id"` - DeleteMode types.String `tfsdk:"delete_mode"` - Asn types.String `tfsdk:"asn"` - Ip types.String `tfsdk:"ip"` - Activate types.Bool `tfsdk:"activate"` - SendCommunity types.String `tfsdk:"send_community"` - RouteReflectorClient types.Bool `tfsdk:"route_reflector_client"` - SoftReconfiguration types.String `tfsdk:"soft_reconfiguration"` - RouteMaps []BGPIPv6UnicastNeighborRouteMaps `tfsdk:"route_maps"` + Device types.String `tfsdk:"device"` + Id types.String `tfsdk:"id"` + DeleteMode types.String `tfsdk:"delete_mode"` + Asn types.String `tfsdk:"asn"` + Ip types.String `tfsdk:"ip"` + Activate types.Bool `tfsdk:"activate"` + SendCommunity types.String `tfsdk:"send_community"` + RouteReflectorClient types.Bool `tfsdk:"route_reflector_client"` + SoftReconfiguration types.String `tfsdk:"soft_reconfiguration"` + DefaultOriginate types.Bool `tfsdk:"default_originate"` + DefaultOriginateRouteMap types.String `tfsdk:"default_originate_route_map"` + RouteMaps []BGPIPv6UnicastNeighborRouteMaps `tfsdk:"route_maps"` } type BGPIPv6UnicastNeighborData struct { - Device types.String `tfsdk:"device"` - Id types.String `tfsdk:"id"` - Asn types.String `tfsdk:"asn"` - Ip types.String `tfsdk:"ip"` - Activate types.Bool `tfsdk:"activate"` - SendCommunity types.String `tfsdk:"send_community"` - RouteReflectorClient types.Bool `tfsdk:"route_reflector_client"` - SoftReconfiguration types.String `tfsdk:"soft_reconfiguration"` - RouteMaps []BGPIPv6UnicastNeighborRouteMaps `tfsdk:"route_maps"` + Device types.String `tfsdk:"device"` + Id types.String `tfsdk:"id"` + Asn types.String `tfsdk:"asn"` + Ip types.String `tfsdk:"ip"` + Activate types.Bool `tfsdk:"activate"` + SendCommunity types.String `tfsdk:"send_community"` + RouteReflectorClient types.Bool `tfsdk:"route_reflector_client"` + SoftReconfiguration types.String `tfsdk:"soft_reconfiguration"` + DefaultOriginate types.Bool `tfsdk:"default_originate"` + DefaultOriginateRouteMap types.String `tfsdk:"default_originate_route_map"` + RouteMaps []BGPIPv6UnicastNeighborRouteMaps `tfsdk:"route_maps"` } type BGPIPv6UnicastNeighborRouteMaps struct { InOut types.String `tfsdk:"in_out"` @@ -103,6 +107,14 @@ func (data BGPIPv6UnicastNeighbor) toBody(ctx context.Context) string { if !data.SoftReconfiguration.IsNull() && !data.SoftReconfiguration.IsUnknown() { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"soft-reconfiguration", data.SoftReconfiguration.ValueString()) } + if !data.DefaultOriginate.IsNull() && !data.DefaultOriginate.IsUnknown() { + if data.DefaultOriginate.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"default-originate", map[string]string{}) + } + } + if !data.DefaultOriginateRouteMap.IsNull() && !data.DefaultOriginateRouteMap.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"default-originate.route-map", data.DefaultOriginateRouteMap.ValueString()) + } if len(data.RouteMaps) > 0 { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"route-map", []interface{}{}) for index, item := range data.RouteMaps { @@ -155,6 +167,20 @@ func (data *BGPIPv6UnicastNeighbor) updateFromBody(ctx context.Context, res gjso } else { data.SoftReconfiguration = types.StringNull() } + if value := res.Get(prefix + "default-originate"); !data.DefaultOriginate.IsNull() { + if value.Exists() { + data.DefaultOriginate = types.BoolValue(true) + } else { + data.DefaultOriginate = types.BoolValue(false) + } + } else { + data.DefaultOriginate = types.BoolNull() + } + if value := res.Get(prefix + "default-originate.route-map"); value.Exists() && !data.DefaultOriginateRouteMap.IsNull() { + data.DefaultOriginateRouteMap = types.StringValue(value.String()) + } else { + data.DefaultOriginateRouteMap = types.StringNull() + } for i := range data.RouteMaps { keys := [...]string{"inout"} keyValues := [...]string{data.RouteMaps[i].InOut.ValueString()} @@ -212,6 +238,14 @@ func (data *BGPIPv6UnicastNeighborData) fromBody(ctx context.Context, res gjson. if value := res.Get(prefix + "soft-reconfiguration"); value.Exists() { data.SoftReconfiguration = types.StringValue(value.String()) } + if value := res.Get(prefix + "default-originate"); value.Exists() { + data.DefaultOriginate = types.BoolValue(true) + } else { + data.DefaultOriginate = types.BoolValue(false) + } + if value := res.Get(prefix + "default-originate.route-map"); value.Exists() { + data.DefaultOriginateRouteMap = types.StringValue(value.String()) + } if value := res.Get(prefix + "route-map"); value.Exists() { data.RouteMaps = make([]BGPIPv6UnicastNeighborRouteMaps, 0) value.ForEach(func(k, v gjson.Result) bool { @@ -239,6 +273,12 @@ func (data *BGPIPv6UnicastNeighbor) getDeletedItems(ctx context.Context, state B if !state.SoftReconfiguration.IsNull() && data.SoftReconfiguration.IsNull() { deletedItems = append(deletedItems, fmt.Sprintf("%v/soft-reconfiguration", state.getPath())) } + if !state.DefaultOriginate.IsNull() && data.DefaultOriginate.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/default-originate", state.getPath())) + } + if !state.DefaultOriginateRouteMap.IsNull() && data.DefaultOriginateRouteMap.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/default-originate/route-map", state.getPath())) + } for i := range state.RouteMaps { stateKeyValues := [...]string{state.RouteMaps[i].InOut.ValueString()} @@ -278,6 +318,9 @@ func (data *BGPIPv6UnicastNeighbor) getEmptyLeafsDelete(ctx context.Context) []s if !data.RouteReflectorClient.IsNull() && !data.RouteReflectorClient.ValueBool() { emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/route-reflector-client", data.getPath())) } + if !data.DefaultOriginate.IsNull() && !data.DefaultOriginate.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/default-originate", data.getPath())) + } return emptyLeafsDelete } @@ -293,6 +336,12 @@ func (data *BGPIPv6UnicastNeighbor) getDeletePaths(ctx context.Context) []string if !data.SoftReconfiguration.IsNull() { deletePaths = append(deletePaths, fmt.Sprintf("%v/soft-reconfiguration", data.getPath())) } + if !data.DefaultOriginate.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/default-originate", data.getPath())) + } + if !data.DefaultOriginateRouteMap.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/default-originate/route-map", data.getPath())) + } for i := range data.RouteMaps { keyValues := [...]string{data.RouteMaps[i].InOut.ValueString()} diff --git a/internal/provider/resource_iosxe_bgp_ipv4_unicast_neighbor.go b/internal/provider/resource_iosxe_bgp_ipv4_unicast_neighbor.go index e7540ad9..20024e8b 100644 --- a/internal/provider/resource_iosxe_bgp_ipv4_unicast_neighbor.go +++ b/internal/provider/resource_iosxe_bgp_ipv4_unicast_neighbor.go @@ -111,6 +111,14 @@ func (r *BGPIPv4UnicastNeighborResource) Schema(ctx context.Context, req resourc stringvalidator.OneOf("inbound"), }, }, + "default_originate": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Originate default route to this neighbor").String, + Optional: true, + }, + "default_originate_route_map": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Route-map to specify criteria to originate default").String, + Optional: true, + }, "route_maps": schema.ListNestedAttribute{ MarkdownDescription: helpers.NewAttributeDescription("Apply route map to neighbor").String, Optional: true, diff --git a/internal/provider/resource_iosxe_bgp_ipv4_unicast_neighbor_test.go b/internal/provider/resource_iosxe_bgp_ipv4_unicast_neighbor_test.go index 3877d2e5..afc1bbe4 100644 --- a/internal/provider/resource_iosxe_bgp_ipv4_unicast_neighbor_test.go +++ b/internal/provider/resource_iosxe_bgp_ipv4_unicast_neighbor_test.go @@ -32,6 +32,8 @@ func TestAccIosxeBGPIPv4UnicastNeighbor(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv4_unicast_neighbor.test", "send_community", "both")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv4_unicast_neighbor.test", "route_reflector_client", "false")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv4_unicast_neighbor.test", "soft_reconfiguration", "inbound")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv4_unicast_neighbor.test", "default_originate", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv4_unicast_neighbor.test", "default_originate_route_map", "RM1")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv4_unicast_neighbor.test", "route_maps.0.in_out", "in")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv4_unicast_neighbor.test", "route_maps.0.route_map_name", "RM1")) resource.Test(t, resource.TestCase{ @@ -105,6 +107,8 @@ func testAccIosxeBGPIPv4UnicastNeighborConfig_all() string { config += ` send_community = "both"` + "\n" config += ` route_reflector_client = false` + "\n" config += ` soft_reconfiguration = "inbound"` + "\n" + config += ` default_originate = true` + "\n" + config += ` default_originate_route_map = "RM1"` + "\n" config += ` route_maps = [{` + "\n" config += ` in_out = "in"` + "\n" config += ` route_map_name = "RM1"` + "\n" diff --git a/internal/provider/resource_iosxe_bgp_ipv4_unicast_vrf_neighbor.go b/internal/provider/resource_iosxe_bgp_ipv4_unicast_vrf_neighbor.go index 17d9a21f..5172fe2c 100644 --- a/internal/provider/resource_iosxe_bgp_ipv4_unicast_vrf_neighbor.go +++ b/internal/provider/resource_iosxe_bgp_ipv4_unicast_vrf_neighbor.go @@ -242,6 +242,14 @@ func (r *BGPIPv4UnicastVRFNeighborResource) Schema(ctx context.Context, req reso stringvalidator.OneOf("inbound"), }, }, + "default_originate": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Originate default route to this neighbor").String, + Optional: true, + }, + "default_originate_route_map": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Route-map to specify criteria to originate default").String, + Optional: true, + }, "route_maps": schema.ListNestedAttribute{ MarkdownDescription: helpers.NewAttributeDescription("Apply route map to neighbor").String, Optional: true, diff --git a/internal/provider/resource_iosxe_bgp_ipv4_unicast_vrf_neighbor_test.go b/internal/provider/resource_iosxe_bgp_ipv4_unicast_vrf_neighbor_test.go index 4e332660..00880502 100644 --- a/internal/provider/resource_iosxe_bgp_ipv4_unicast_vrf_neighbor_test.go +++ b/internal/provider/resource_iosxe_bgp_ipv4_unicast_vrf_neighbor_test.go @@ -50,6 +50,8 @@ func TestAccIosxeBGPIPv4UnicastVRFNeighbor(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv4_unicast_vrf_neighbor.test", "send_community", "both")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv4_unicast_vrf_neighbor.test", "route_reflector_client", "false")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv4_unicast_vrf_neighbor.test", "soft_reconfiguration", "inbound")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv4_unicast_vrf_neighbor.test", "default_originate", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv4_unicast_vrf_neighbor.test", "default_originate_route_map", "RM1")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv4_unicast_vrf_neighbor.test", "route_maps.0.in_out", "in")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv4_unicast_vrf_neighbor.test", "route_maps.0.route_map_name", "RM1")) resource.Test(t, resource.TestCase{ @@ -152,6 +154,8 @@ func testAccIosxeBGPIPv4UnicastVRFNeighborConfig_all() string { config += ` send_community = "both"` + "\n" config += ` route_reflector_client = false` + "\n" config += ` soft_reconfiguration = "inbound"` + "\n" + config += ` default_originate = true` + "\n" + config += ` default_originate_route_map = "RM1"` + "\n" config += ` route_maps = [{` + "\n" config += ` in_out = "in"` + "\n" config += ` route_map_name = "RM1"` + "\n" diff --git a/internal/provider/resource_iosxe_bgp_ipv6_unicast_neighbor.go b/internal/provider/resource_iosxe_bgp_ipv6_unicast_neighbor.go index 0720e5f1..af794573 100644 --- a/internal/provider/resource_iosxe_bgp_ipv6_unicast_neighbor.go +++ b/internal/provider/resource_iosxe_bgp_ipv6_unicast_neighbor.go @@ -111,6 +111,14 @@ func (r *BGPIPv6UnicastNeighborResource) Schema(ctx context.Context, req resourc stringvalidator.OneOf("inbound"), }, }, + "default_originate": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Originate default route to this neighbor").String, + Optional: true, + }, + "default_originate_route_map": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Route-map to specify criteria to originate default").String, + Optional: true, + }, "route_maps": schema.ListNestedAttribute{ MarkdownDescription: helpers.NewAttributeDescription("Apply route map to neighbor").String, Optional: true, diff --git a/internal/provider/resource_iosxe_bgp_ipv6_unicast_neighbor_test.go b/internal/provider/resource_iosxe_bgp_ipv6_unicast_neighbor_test.go index d06a92e5..7400a12a 100644 --- a/internal/provider/resource_iosxe_bgp_ipv6_unicast_neighbor_test.go +++ b/internal/provider/resource_iosxe_bgp_ipv6_unicast_neighbor_test.go @@ -32,6 +32,8 @@ func TestAccIosxeBGPIPv6UnicastNeighbor(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv6_unicast_neighbor.test", "send_community", "both")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv6_unicast_neighbor.test", "route_reflector_client", "false")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv6_unicast_neighbor.test", "soft_reconfiguration", "inbound")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv6_unicast_neighbor.test", "default_originate", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv6_unicast_neighbor.test", "default_originate_route_map", "RM1")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv6_unicast_neighbor.test", "route_maps.0.in_out", "in")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_bgp_ipv6_unicast_neighbor.test", "route_maps.0.route_map_name", "RM1")) resource.Test(t, resource.TestCase{ @@ -112,6 +114,8 @@ func testAccIosxeBGPIPv6UnicastNeighborConfig_all() string { config += ` send_community = "both"` + "\n" config += ` route_reflector_client = false` + "\n" config += ` soft_reconfiguration = "inbound"` + "\n" + config += ` default_originate = true` + "\n" + config += ` default_originate_route_map = "RM1"` + "\n" config += ` route_maps = [{` + "\n" config += ` in_out = "in"` + "\n" config += ` route_map_name = "RM1"` + "\n" diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index 7847a187..e185c368 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -15,6 +15,7 @@ description: |- - Add `soft_reconfiguration` attribute to `iosxe_bgp_ipv4_unicast_neighbor`, `iosxe_bgp_ipv4_unicast_vrf_neighbor`, `iosxe_bgp_ipv6_unicast_neighbor` and `iosxe_bgp_l2vpn_evpn_neighbor` resources and data sources - Add `fall_over_bfd` attribute to `iosxe_bgp_neighbor` and `iosxe_bgp_ipv4_unicast_vrf_neighbor` resources and data sources - Add `iosxe_as_path_access_list` resource and data source +- Add `default_originate` and `default_originate_route_map` attributes to `iosxe_bgp_ipv4_unicast_neighbor`, `iosxe_bgp_ipv4_unicast_vrf_neighbor` and `iosxe_bgp_ipv6_unicast_neighbor` resources and data sources ## 0.5.1