diff --git a/CHANGELOG.md b/CHANGELOG.md index 556a9c9d..34733ea4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Add `record_ipv4`, `record_ipv6`, `record_mpls` and `sflow_options` attributes to `iosxr_flow_monitor_map` resource and data source - Add `set_overload_bit` attributes to `iosxr_router_isis` resource and data source - Add `metric` attributes to `iosxr_router_isis_interface_address_family` resource and data source +- Add `nexthop_trigger_delay_critical` and `nexthop_trigger_delay_non_critical` attributes to `iosxr_router_bgp_address_family` resource and data source ## 0.2.3 diff --git a/docs/data-sources/router_bgp_address_family.md b/docs/data-sources/router_bgp_address_family.md index 35ad23d9..260731b8 100644 --- a/docs/data-sources/router_bgp_address_family.md +++ b/docs/data-sources/router_bgp_address_family.md @@ -47,6 +47,8 @@ data "iosxr_router_bgp_address_family" "example" { - `maximum_paths_eibgp_multipath` (Number) eiBGP-multipath - `maximum_paths_ibgp_multipath` (Number) iBGP-multipath - `networks` (Attributes List) IPv6 network and mask or masklength (see [below for nested schema](#nestedatt--networks)) +- `nexthop_trigger_delay_critical` (Number) For critical notification +- `nexthop_trigger_delay_non_critical` (Number) For non-critical notification - `redistribute_connected` (Boolean) Connected routes - `redistribute_connected_metric` (Number) Metric for redistributed routes - `redistribute_isis` (Attributes List) ISO IS-IS (see [below for nested schema](#nestedatt--redistribute_isis)) diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index 31c450c1..c0e3a432 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -12,6 +12,7 @@ description: |- - Add `record_ipv4`, `record_ipv6`, `record_mpls` and `sflow_options` attributes to `iosxr_flow_monitor_map` resource and data source - Add `set_overload_bit` attributes to `iosxr_router_isis` resource and data source - Add `metric` attributes to `iosxr_router_isis_interface_address_family` resource and data source +- Add `nexthop_trigger_delay_critical` and `nexthop_trigger_delay_non_critical` attributes to `iosxr_router_bgp_address_family` resource and data source ## 0.2.3 diff --git a/docs/resources/router_bgp_address_family.md b/docs/resources/router_bgp_address_family.md index e6766dfb..298ac648 100644 --- a/docs/resources/router_bgp_address_family.md +++ b/docs/resources/router_bgp_address_family.md @@ -21,6 +21,8 @@ resource "iosxr_router_bgp_address_family" "example" { additional_paths_selection_route_policy = "ROUTE_POLICY_1" advertise_best_external = true allocate_label_all = true + nexthop_trigger_delay_critical = 10 + nexthop_trigger_delay_non_critical = 20 label_mode_per_ce = false label_mode_per_vrf = false redistribute_connected = true @@ -100,6 +102,10 @@ resource "iosxr_router_bgp_address_family" "example" { - `maximum_paths_ibgp_multipath` (Number) iBGP-multipath - Range: `2`-`1024` - `networks` (Attributes List) IPv6 network and mask or masklength (see [below for nested schema](#nestedatt--networks)) +- `nexthop_trigger_delay_critical` (Number) For critical notification + - Range: `0`-`4294967295` +- `nexthop_trigger_delay_non_critical` (Number) For non-critical notification + - Range: `0`-`4294967295` - `redistribute_connected` (Boolean) Connected routes - `redistribute_connected_metric` (Number) Metric for redistributed routes - Range: `0`-`4294967295` diff --git a/examples/resources/iosxr_router_bgp_address_family/resource.tf b/examples/resources/iosxr_router_bgp_address_family/resource.tf index 06e31009..b31e6597 100644 --- a/examples/resources/iosxr_router_bgp_address_family/resource.tf +++ b/examples/resources/iosxr_router_bgp_address_family/resource.tf @@ -6,6 +6,8 @@ resource "iosxr_router_bgp_address_family" "example" { additional_paths_selection_route_policy = "ROUTE_POLICY_1" advertise_best_external = true allocate_label_all = true + nexthop_trigger_delay_critical = 10 + nexthop_trigger_delay_non_critical = 20 label_mode_per_ce = false label_mode_per_vrf = false redistribute_connected = true diff --git a/gen/definitions/router_bgp_address_family.yaml b/gen/definitions/router_bgp_address_family.yaml index 672423ad..c6b37fd1 100644 --- a/gen/definitions/router_bgp_address_family.yaml +++ b/gen/definitions/router_bgp_address_family.yaml @@ -32,6 +32,10 @@ attributes: optional: true example: 10 exclude_test: true + - yang_name: nexthop/trigger-delay/critical + example: 10 + - yang_name: nexthop/trigger-delay/non-critical + example: 20 - yang_name: label/mode/per-ce example: false - yang_name: label/mode/per-vrf diff --git a/internal/provider/data_source_iosxr_router_bgp_address_family.go b/internal/provider/data_source_iosxr_router_bgp_address_family.go index 0ebda43d..7d477536 100644 --- a/internal/provider/data_source_iosxr_router_bgp_address_family.go +++ b/internal/provider/data_source_iosxr_router_bgp_address_family.go @@ -106,6 +106,14 @@ func (d *RouterBGPAddressFamilyDataSource) Schema(ctx context.Context, req datas MarkdownDescription: "iBGP-multipath", Computed: true, }, + "nexthop_trigger_delay_critical": schema.Int64Attribute{ + MarkdownDescription: "For critical notification", + Computed: true, + }, + "nexthop_trigger_delay_non_critical": schema.Int64Attribute{ + MarkdownDescription: "For non-critical notification", + Computed: true, + }, "label_mode_per_ce": schema.BoolAttribute{ MarkdownDescription: "Set per CE label mode", Computed: true, diff --git a/internal/provider/data_source_iosxr_router_bgp_address_family_test.go b/internal/provider/data_source_iosxr_router_bgp_address_family_test.go index 62da09eb..b2cc02bf 100644 --- a/internal/provider/data_source_iosxr_router_bgp_address_family_test.go +++ b/internal/provider/data_source_iosxr_router_bgp_address_family_test.go @@ -32,6 +32,8 @@ func TestAccDataSourceIosxrRouterBGPAddressFamily(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_bgp_address_family.test", "additional_paths_selection_route_policy", "ROUTE_POLICY_1")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_bgp_address_family.test", "advertise_best_external", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_bgp_address_family.test", "allocate_label_all", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_bgp_address_family.test", "nexthop_trigger_delay_critical", "10")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_bgp_address_family.test", "nexthop_trigger_delay_non_critical", "20")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_bgp_address_family.test", "label_mode_per_ce", "false")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_bgp_address_family.test", "label_mode_per_vrf", "false")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_bgp_address_family.test", "redistribute_connected", "true")) @@ -102,6 +104,8 @@ func testAccDataSourceIosxrRouterBGPAddressFamilyConfig() string { config += ` additional_paths_selection_route_policy = "ROUTE_POLICY_1"` + "\n" config += ` advertise_best_external = true` + "\n" config += ` allocate_label_all = true` + "\n" + config += ` nexthop_trigger_delay_critical = 10` + "\n" + config += ` nexthop_trigger_delay_non_critical = 20` + "\n" config += ` label_mode_per_ce = false` + "\n" config += ` label_mode_per_vrf = false` + "\n" config += ` redistribute_connected = true` + "\n" diff --git a/internal/provider/model_iosxr_router_bgp_address_family.go b/internal/provider/model_iosxr_router_bgp_address_family.go index 3b5c7988..0ac782aa 100644 --- a/internal/provider/model_iosxr_router_bgp_address_family.go +++ b/internal/provider/model_iosxr_router_bgp_address_family.go @@ -45,6 +45,8 @@ type RouterBGPAddressFamily struct { MaximumPathsEbgpMultipath types.Int64 `tfsdk:"maximum_paths_ebgp_multipath"` MaximumPathsEibgpMultipath types.Int64 `tfsdk:"maximum_paths_eibgp_multipath"` MaximumPathsIbgpMultipath types.Int64 `tfsdk:"maximum_paths_ibgp_multipath"` + NexthopTriggerDelayCritical types.Int64 `tfsdk:"nexthop_trigger_delay_critical"` + NexthopTriggerDelayNonCritical types.Int64 `tfsdk:"nexthop_trigger_delay_non_critical"` LabelModePerCe types.Bool `tfsdk:"label_mode_per_ce"` LabelModePerVrf types.Bool `tfsdk:"label_mode_per_vrf"` RedistributeConnected types.Bool `tfsdk:"redistribute_connected"` @@ -71,6 +73,8 @@ type RouterBGPAddressFamilyData struct { MaximumPathsEbgpMultipath types.Int64 `tfsdk:"maximum_paths_ebgp_multipath"` MaximumPathsEibgpMultipath types.Int64 `tfsdk:"maximum_paths_eibgp_multipath"` MaximumPathsIbgpMultipath types.Int64 `tfsdk:"maximum_paths_ibgp_multipath"` + NexthopTriggerDelayCritical types.Int64 `tfsdk:"nexthop_trigger_delay_critical"` + NexthopTriggerDelayNonCritical types.Int64 `tfsdk:"nexthop_trigger_delay_non_critical"` LabelModePerCe types.Bool `tfsdk:"label_mode_per_ce"` LabelModePerVrf types.Bool `tfsdk:"label_mode_per_vrf"` RedistributeConnected types.Bool `tfsdk:"redistribute_connected"` @@ -165,6 +169,12 @@ func (data RouterBGPAddressFamily) toBody(ctx context.Context) string { if !data.MaximumPathsIbgpMultipath.IsNull() && !data.MaximumPathsIbgpMultipath.IsUnknown() { body, _ = sjson.Set(body, "maximum-paths.ibgp.multipath", strconv.FormatInt(data.MaximumPathsIbgpMultipath.ValueInt64(), 10)) } + if !data.NexthopTriggerDelayCritical.IsNull() && !data.NexthopTriggerDelayCritical.IsUnknown() { + body, _ = sjson.Set(body, "nexthop.trigger-delay.critical", strconv.FormatInt(data.NexthopTriggerDelayCritical.ValueInt64(), 10)) + } + if !data.NexthopTriggerDelayNonCritical.IsNull() && !data.NexthopTriggerDelayNonCritical.IsUnknown() { + body, _ = sjson.Set(body, "nexthop.trigger-delay.non-critical", strconv.FormatInt(data.NexthopTriggerDelayNonCritical.ValueInt64(), 10)) + } if !data.LabelModePerCe.IsNull() && !data.LabelModePerCe.IsUnknown() { if data.LabelModePerCe.ValueBool() { body, _ = sjson.Set(body, "label.mode.per-ce", map[string]string{}) @@ -384,6 +394,16 @@ func (data *RouterBGPAddressFamily) updateFromBody(ctx context.Context, res []by } else { data.MaximumPathsIbgpMultipath = types.Int64Null() } + if value := gjson.GetBytes(res, "nexthop.trigger-delay.critical"); value.Exists() && !data.NexthopTriggerDelayCritical.IsNull() { + data.NexthopTriggerDelayCritical = types.Int64Value(value.Int()) + } else { + data.NexthopTriggerDelayCritical = types.Int64Null() + } + if value := gjson.GetBytes(res, "nexthop.trigger-delay.non-critical"); value.Exists() && !data.NexthopTriggerDelayNonCritical.IsNull() { + data.NexthopTriggerDelayNonCritical = types.Int64Value(value.Int()) + } else { + data.NexthopTriggerDelayNonCritical = types.Int64Null() + } if value := gjson.GetBytes(res, "label.mode.per-ce"); !data.LabelModePerCe.IsNull() { if value.Exists() { data.LabelModePerCe = types.BoolValue(true) @@ -750,6 +770,12 @@ func (data *RouterBGPAddressFamilyData) fromBody(ctx context.Context, res []byte if value := gjson.GetBytes(res, "maximum-paths.ibgp.multipath"); value.Exists() { data.MaximumPathsIbgpMultipath = types.Int64Value(value.Int()) } + if value := gjson.GetBytes(res, "nexthop.trigger-delay.critical"); value.Exists() { + data.NexthopTriggerDelayCritical = types.Int64Value(value.Int()) + } + if value := gjson.GetBytes(res, "nexthop.trigger-delay.non-critical"); value.Exists() { + data.NexthopTriggerDelayNonCritical = types.Int64Value(value.Int()) + } if value := gjson.GetBytes(res, "label.mode.per-ce"); value.Exists() { data.LabelModePerCe = types.BoolValue(true) } else { @@ -1192,6 +1218,12 @@ func (data *RouterBGPAddressFamily) getDeletePaths(ctx context.Context) []string if !data.MaximumPathsIbgpMultipath.IsNull() { deletePaths = append(deletePaths, fmt.Sprintf("%v/maximum-paths/ibgp/multipath", data.getPath())) } + if !data.NexthopTriggerDelayCritical.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/nexthop/trigger-delay/critical", data.getPath())) + } + if !data.NexthopTriggerDelayNonCritical.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/nexthop/trigger-delay/non-critical", data.getPath())) + } if !data.LabelModePerCe.IsNull() { deletePaths = append(deletePaths, fmt.Sprintf("%v/label/mode/per-ce", data.getPath())) } diff --git a/internal/provider/resource_iosxr_router_bgp_address_family.go b/internal/provider/resource_iosxr_router_bgp_address_family.go index ceea2c6d..d4434ac4 100644 --- a/internal/provider/resource_iosxr_router_bgp_address_family.go +++ b/internal/provider/resource_iosxr_router_bgp_address_family.go @@ -139,6 +139,20 @@ func (r *RouterBGPAddressFamilyResource) Schema(ctx context.Context, req resourc int64validator.Between(2, 1024), }, }, + "nexthop_trigger_delay_critical": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("For critical notification").AddIntegerRangeDescription(0, 4294967295).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(0, 4294967295), + }, + }, + "nexthop_trigger_delay_non_critical": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("For non-critical notification").AddIntegerRangeDescription(0, 4294967295).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(0, 4294967295), + }, + }, "label_mode_per_ce": schema.BoolAttribute{ MarkdownDescription: helpers.NewAttributeDescription("Set per CE label mode").String, Optional: true, diff --git a/internal/provider/resource_iosxr_router_bgp_address_family_test.go b/internal/provider/resource_iosxr_router_bgp_address_family_test.go index cbcfc841..41538be6 100644 --- a/internal/provider/resource_iosxr_router_bgp_address_family_test.go +++ b/internal/provider/resource_iosxr_router_bgp_address_family_test.go @@ -34,6 +34,8 @@ func TestAccIosxrRouterBGPAddressFamily(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_bgp_address_family.test", "additional_paths_selection_route_policy", "ROUTE_POLICY_1")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_bgp_address_family.test", "advertise_best_external", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_bgp_address_family.test", "allocate_label_all", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_bgp_address_family.test", "nexthop_trigger_delay_critical", "10")) + checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_bgp_address_family.test", "nexthop_trigger_delay_non_critical", "20")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_bgp_address_family.test", "label_mode_per_ce", "false")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_bgp_address_family.test", "label_mode_per_vrf", "false")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_bgp_address_family.test", "redistribute_connected", "true")) @@ -122,6 +124,8 @@ func testAccIosxrRouterBGPAddressFamilyConfig_all() string { config += ` additional_paths_selection_route_policy = "ROUTE_POLICY_1"` + "\n" config += ` advertise_best_external = true` + "\n" config += ` allocate_label_all = true` + "\n" + config += ` nexthop_trigger_delay_critical = 10` + "\n" + config += ` nexthop_trigger_delay_non_critical = 20` + "\n" config += ` label_mode_per_ce = false` + "\n" config += ` label_mode_per_vrf = false` + "\n" config += ` redistribute_connected = true` + "\n" diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index 31c450c1..c0e3a432 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -12,6 +12,7 @@ description: |- - Add `record_ipv4`, `record_ipv6`, `record_mpls` and `sflow_options` attributes to `iosxr_flow_monitor_map` resource and data source - Add `set_overload_bit` attributes to `iosxr_router_isis` resource and data source - Add `metric` attributes to `iosxr_router_isis_interface_address_family` resource and data source +- Add `nexthop_trigger_delay_critical` and `nexthop_trigger_delay_non_critical` attributes to `iosxr_router_bgp_address_family` resource and data source ## 0.2.3