diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dde2bd9..9f480657 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ - Make `set_overload_bit_on_startup_advertise_as_overloaded_time_to_advertise` and `on_startup_advertise_as_overloaded_time_to_advertise` attributes of `iosxr_router_isis` resource optional - Make `make_before_break_delay` attribute of `iosxr_mpls_ldp` resource optional - Make various `iosxr_key_chain` resource attributes optional +- Add `fast_reroute_per_prefix_ti_lfa` and `fast_reroute_node_protecting_srlg_disjoint` attributes to `iosxr_router_ospf_area_interface` resource and data source +- Add `prefix_sid_strict_spf` and `prefix_sid_algorithm` attributes to `iosxr_router_ospf_area_interface` resource and data source +- Add `segment_routing_mpls` and `segment_routing_sr_prefer` attributes to `iosxr_router_ospf` resource and data source +- Add `v3_sha_encryption` and `v3_aes_encryption` attributes to `iosxr_snmp_server` resource and data source + ## 0.3.0 diff --git a/docs/data-sources/router_ospf.md b/docs/data-sources/router_ospf.md index 7c66ee5f..e6251de3 100644 --- a/docs/data-sources/router_ospf.md +++ b/docs/data-sources/router_ospf.md @@ -59,6 +59,8 @@ data "iosxr_router_ospf" "example" { - `redistribute_static_metric_type` (String) OSPF exterior metric type for redistributed routes - `redistribute_static_tag` (Number) Set tag for routes redistributed into OSPF - `router_id` (String) configure this node +- `segment_routing_mpls` (Boolean) SR using MPLS dataplane +- `segment_routing_sr_prefer` (Boolean) Prefer segment routing labels over LDP labels ### Nested Schema for `areas` diff --git a/docs/data-sources/router_ospf_area_interface.md b/docs/data-sources/router_ospf_area_interface.md index 0b420499..2cb9efa6 100644 --- a/docs/data-sources/router_ospf_area_interface.md +++ b/docs/data-sources/router_ospf_area_interface.md @@ -36,6 +36,9 @@ data "iosxr_router_ospf_area_interface" "example" { ### Read-Only - `cost` (Number) Interface cost +- `fast_reroute_per_prefix_ti_lfa_enable` (Boolean) Enable TI LFA computation +- `fast_reroute_per_prefix_tiebreaker_node_protecting_index` (Number) Set preference order among tiebreakers +- `fast_reroute_per_prefix_tiebreaker_srlg_disjoint_index` (Number) Set preference order among tiebreakers - `id` (String) The path of the retrieved object. - `network_broadcast` (Boolean) Specify OSPF broadcast multi-access network - `network_non_broadcast` (Boolean) Specify OSPF NBMA network @@ -43,4 +46,19 @@ data "iosxr_router_ospf_area_interface" "example" { - `network_point_to_point` (Boolean) Specify OSPF point-to-point network - `passive_disable` (Boolean) Disable passive - `passive_enable` (Boolean) Enable passive +- `prefix_sid_algorithms` (Attributes List) Algorithm Specific Prefix SID Configuration (see [below for nested schema](#nestedatt--prefix_sid_algorithms)) +- `prefix_sid_strict_spf_index_sid_index` (Number) SID Index - `priority` (Number) Router priority + + +### Nested Schema for `prefix_sid_algorithms` + +Read-Only: + +- `absolute_explicit_null` (Boolean) Force penultimate hop to send explicit-null label +- `absolute_n_flag_clear` (Boolean) Not a node SID (e.g. for anycast SID use) +- `absolute_sid_label` (Number) SID value +- `algorithm_number` (Number) Algorithm Specific Prefix SID Configuration +- `index_explicit_null` (Boolean) Force penultimate hop to send explicit-null label +- `index_n_flag_clear` (Boolean) Not a node SID (e.g. for anycast SID use) +- `index_sid_index` (Number) SID Index diff --git a/docs/data-sources/snmp_server.md b/docs/data-sources/snmp_server.md index 2de1fdb2..6dddedf0 100644 --- a/docs/data-sources/snmp_server.md +++ b/docs/data-sources/snmp_server.md @@ -113,3 +113,9 @@ Read-Only: - `user_name` (String) Name of the user - `v3_auth_md5_encryption_aes` (String) Specifies an aes-128 ENCRYPTED authentication password - `v3_auth_md5_encryption_default` (String) Specifies an default ENCRYPTED authentication password +- `v3_auth_sha_encryption_aes` (String) Specifies an aes-128 ENCRYPTED authentication password +- `v3_auth_sha_encryption_default` (String) Specifies an default ENCRYPTED authentication password +- `v3_ipv4` (String) Type of Access-list +- `v3_priv_aes_aes_128_encryption_aes` (String) Specifies an aes-128 ENCRYPTED authentication password +- `v3_priv_aes_aes_128_encryption_default` (String) Specifies an default ENCRYPTED authentication password +- `v3_systemowner` (Boolean) System Owner permissions for MIB objects diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index 03c9a3d6..6916b084 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -17,6 +17,11 @@ description: |- - Make `set_overload_bit_on_startup_advertise_as_overloaded_time_to_advertise` and `on_startup_advertise_as_overloaded_time_to_advertise` attributes of `iosxr_router_isis` resource optional - Make `make_before_break_delay` attribute of `iosxr_mpls_ldp` resource optional - Make various `iosxr_key_chain` resource attributes optional +- Add `fast_reroute_per_prefix_ti_lfa` and `fast_reroute_node_protecting_srlg_disjoint` attributes to `iosxr_router_ospf_area_interface` resource and data source +- Add `prefix_sid_strict_spf` and `prefix_sid_algorithm` attributes to `iosxr_router_ospf_area_interface` resource and data source +- Add `segment_routing_mpls` and `segment_routing_sr_prefer` attributes to `iosxr_router_ospf` resource and data source +- Add `v3_sha_encryption` and `v3_aes_encryption` attributes to `iosxr_snmp_server` resource and data source + ## 0.3.0 diff --git a/docs/resources/router_ospf.md b/docs/resources/router_ospf.md index dc32c040..e16a3634 100644 --- a/docs/resources/router_ospf.md +++ b/docs/resources/router_ospf.md @@ -38,6 +38,8 @@ resource "iosxr_router_ospf" "example" { default_information_originate_metric_type = 1 auto_cost_reference_bandwidth = 100000 auto_cost_disable = false + segment_routing_mpls = true + segment_routing_sr_prefer = true areas = [ { area_id = "0" @@ -123,6 +125,8 @@ resource "iosxr_router_ospf" "example" { - `redistribute_static_tag` (Number) Set tag for routes redistributed into OSPF - Range: `0`-`4294967295` - `router_id` (String) configure this node +- `segment_routing_mpls` (Boolean) SR using MPLS dataplane +- `segment_routing_sr_prefer` (Boolean) Prefer segment routing labels over LDP labels ### Read-Only diff --git a/docs/resources/router_ospf_area_interface.md b/docs/resources/router_ospf_area_interface.md index 59e187c0..65749564 100644 --- a/docs/resources/router_ospf_area_interface.md +++ b/docs/resources/router_ospf_area_interface.md @@ -14,17 +14,20 @@ This resource can manage the Router OSPF Area Interface configuration. ```terraform resource "iosxr_router_ospf_area_interface" "example" { - process_name = "OSPF1" - area_id = "0" - interface_name = "GigabitEthernet0/0/0/1" - network_broadcast = false - network_non_broadcast = false - network_point_to_point = true - network_point_to_multipoint = false - cost = 20 - priority = 100 - passive_enable = false - passive_disable = true + process_name = "OSPF1" + area_id = "0" + interface_name = "GigabitEthernet0/0/0/1" + network_broadcast = false + network_non_broadcast = false + network_point_to_point = true + network_point_to_multipoint = false + cost = 20 + priority = 100 + passive_enable = false + passive_disable = true + fast_reroute_per_prefix_ti_lfa_enable = true + fast_reroute_per_prefix_tiebreaker_srlg_disjoint_index = 22 + fast_reroute_per_prefix_tiebreaker_node_protecting_index = 33 } ``` @@ -44,12 +47,20 @@ resource "iosxr_router_ospf_area_interface" "example" { - `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. +- `fast_reroute_per_prefix_ti_lfa_enable` (Boolean) Enable TI LFA computation +- `fast_reroute_per_prefix_tiebreaker_node_protecting_index` (Number) Set preference order among tiebreakers + - Range: `1`-`255` +- `fast_reroute_per_prefix_tiebreaker_srlg_disjoint_index` (Number) Set preference order among tiebreakers + - Range: `1`-`255` - `network_broadcast` (Boolean) Specify OSPF broadcast multi-access network - `network_non_broadcast` (Boolean) Specify OSPF NBMA network - `network_point_to_multipoint` (Boolean) Specify OSPF point-to-multipoint network - `network_point_to_point` (Boolean) Specify OSPF point-to-point network - `passive_disable` (Boolean) Disable passive - `passive_enable` (Boolean) Enable passive +- `prefix_sid_algorithms` (Attributes List) Algorithm Specific Prefix SID Configuration (see [below for nested schema](#nestedatt--prefix_sid_algorithms)) +- `prefix_sid_strict_spf_index_sid_index` (Number) SID Index + - Range: `0`-`1048575` - `priority` (Number) Router priority - Range: `0`-`255` @@ -57,6 +68,25 @@ resource "iosxr_router_ospf_area_interface" "example" { - `id` (String) The path of the object. + +### Nested Schema for `prefix_sid_algorithms` + +Required: + +- `absolute_sid_label` (Number) SID value + - Range: `16000`-`1048575` +- `algorithm_number` (Number) Algorithm Specific Prefix SID Configuration + - Range: `128`-`255` +- `index_sid_index` (Number) SID Index + - Range: `0`-`1048575` + +Optional: + +- `absolute_explicit_null` (Boolean) Force penultimate hop to send explicit-null label +- `absolute_n_flag_clear` (Boolean) Not a node SID (e.g. for anycast SID use) +- `index_explicit_null` (Boolean) Force penultimate hop to send explicit-null label +- `index_n_flag_clear` (Boolean) Not a node SID (e.g. for anycast SID use) + ## Import Import is supported using the following syntax: diff --git a/docs/resources/snmp_server.md b/docs/resources/snmp_server.md index f33f2b6c..a3402b13 100644 --- a/docs/resources/snmp_server.md +++ b/docs/resources/snmp_server.md @@ -44,6 +44,8 @@ resource "iosxr_snmp_server" "example" { user_name = "USER1" group_name = "GROUP1" v3_auth_md5_encryption_aes = "073C05626E2A4841141D" + v3_ipv4 = "ACL1" + v3_systemowner = true } ] groups = [ @@ -218,6 +220,12 @@ Optional: - `v3_auth_md5_encryption_aes` (String) Specifies an aes-128 ENCRYPTED authentication password - `v3_auth_md5_encryption_default` (String) Specifies an default ENCRYPTED authentication password +- `v3_auth_sha_encryption_aes` (String) Specifies an aes-128 ENCRYPTED authentication password +- `v3_auth_sha_encryption_default` (String) Specifies an default ENCRYPTED authentication password +- `v3_ipv4` (String) Type of Access-list +- `v3_priv_aes_aes_128_encryption_aes` (String) Specifies an aes-128 ENCRYPTED authentication password +- `v3_priv_aes_aes_128_encryption_default` (String) Specifies an default ENCRYPTED authentication password +- `v3_systemowner` (Boolean) System Owner permissions for MIB objects ## Import diff --git a/examples/resources/iosxr_router_ospf/resource.tf b/examples/resources/iosxr_router_ospf/resource.tf index 7312c492..47fffd41 100644 --- a/examples/resources/iosxr_router_ospf/resource.tf +++ b/examples/resources/iosxr_router_ospf/resource.tf @@ -23,6 +23,8 @@ resource "iosxr_router_ospf" "example" { default_information_originate_metric_type = 1 auto_cost_reference_bandwidth = 100000 auto_cost_disable = false + segment_routing_mpls = true + segment_routing_sr_prefer = true areas = [ { area_id = "0" diff --git a/examples/resources/iosxr_router_ospf_area_interface/resource.tf b/examples/resources/iosxr_router_ospf_area_interface/resource.tf index ad57a290..a7444d42 100644 --- a/examples/resources/iosxr_router_ospf_area_interface/resource.tf +++ b/examples/resources/iosxr_router_ospf_area_interface/resource.tf @@ -1,13 +1,16 @@ resource "iosxr_router_ospf_area_interface" "example" { - process_name = "OSPF1" - area_id = "0" - interface_name = "GigabitEthernet0/0/0/1" - network_broadcast = false - network_non_broadcast = false - network_point_to_point = true - network_point_to_multipoint = false - cost = 20 - priority = 100 - passive_enable = false - passive_disable = true + process_name = "OSPF1" + area_id = "0" + interface_name = "GigabitEthernet0/0/0/1" + network_broadcast = false + network_non_broadcast = false + network_point_to_point = true + network_point_to_multipoint = false + cost = 20 + priority = 100 + passive_enable = false + passive_disable = true + fast_reroute_per_prefix_ti_lfa_enable = true + fast_reroute_per_prefix_tiebreaker_srlg_disjoint_index = 22 + fast_reroute_per_prefix_tiebreaker_node_protecting_index = 33 } diff --git a/examples/resources/iosxr_snmp_server/resource.tf b/examples/resources/iosxr_snmp_server/resource.tf index 8815005d..564ca43c 100644 --- a/examples/resources/iosxr_snmp_server/resource.tf +++ b/examples/resources/iosxr_snmp_server/resource.tf @@ -29,6 +29,8 @@ resource "iosxr_snmp_server" "example" { user_name = "USER1" group_name = "GROUP1" v3_auth_md5_encryption_aes = "073C05626E2A4841141D" + v3_ipv4 = "ACL1" + v3_systemowner = true } ] groups = [ diff --git a/gen/definitions/router_ospf.yaml b/gen/definitions/router_ospf.yaml index dad488e4..10da9a04 100644 --- a/gen/definitions/router_ospf.yaml +++ b/gen/definitions/router_ospf.yaml @@ -51,6 +51,10 @@ attributes: example: 100000 - yang_name: auto-cost/disable example: false + - yang_name: segment-routing/mpls + example: true + - yang_name: segment-routing/sr-prefer + example: true - yang_name: areas/area tf_name: areas type: List diff --git a/gen/definitions/router_ospf_area_interface.yaml b/gen/definitions/router_ospf_area_interface.yaml index 0a434ac3..3eb52809 100644 --- a/gen/definitions/router_ospf_area_interface.yaml +++ b/gen/definitions/router_ospf_area_interface.yaml @@ -25,3 +25,38 @@ attributes: example: false - yang_name: passive/disable example: true + - yang_name: fast-reroute/per-prefix/ti-lfa/enable + example: true + - yang_name: fast-reroute/per-prefix/tiebreaker/srlg-disjoint/index + example: 22 + - yang_name: fast-reroute/per-prefix/tiebreaker/node-protecting/index + example: 33 + - yang_name: prefix-sid/strict-spf/index/sid-index + example: 3000 + optional: true + delete_parent: true + exclude_test: true + ## prefix-sid only support for Loopback interface + + - yang_name: prefix-sid/algorithms/algorithm + tf_name: prefix_sid_algorithms + type: List + exclude_test: true + attributes: + - yang_name: algorithm-number + id: true + example: 233 + - yang_name: index/sid-index + example: 1048 + - yang_name: index/explicit-null + example: false + - yang_name: index/n-flag-clear + example: false + - yang_name: absolute/sid-label + example: 17000 + - yang_name: absolute/explicit-null + example: true + exclude_test: true + - yang_name: absolute/n-flag-clear + example: true + exclude_test: true \ No newline at end of file diff --git a/gen/definitions/snmp_server.yaml b/gen/definitions/snmp_server.yaml index 0fd042e9..2dfec509 100644 --- a/gen/definitions/snmp_server.yaml +++ b/gen/definitions/snmp_server.yaml @@ -140,6 +140,22 @@ attributes: - yang_name: v3/auth/md5/encryption-default exclude_test: true example: 073C05626E2A4841141D + - yang_name: v3/auth/sha/encryption-aes + example: 073C05626E2A4841231D + exclude_test: true + - yang_name: v3/auth/sha/encryption-default + exclude_test: true + example: 073C05626E2A4843341D + - yang_name: v3/priv/aes/aes-128/encryption-default + example: 073C05626E2A4841141D + exclude_test: true + - yang_name: v3/priv/aes/aes-128/encryption-aes + example: 073C05626E2A4841231D + exclude_test: true + - yang_name: v3/ipv4 + example: ACL1 + - yang_name: v3/systemowner + example: true - yang_name: groups/group tf_name: groups type: List diff --git a/internal/provider/data_source_iosxr_router_ospf.go b/internal/provider/data_source_iosxr_router_ospf.go index fcdb08aa..dd790aea 100644 --- a/internal/provider/data_source_iosxr_router_ospf.go +++ b/internal/provider/data_source_iosxr_router_ospf.go @@ -158,6 +158,14 @@ func (d *RouterOSPFDataSource) Schema(ctx context.Context, req datasource.Schema MarkdownDescription: "Assign OSPF cost based on interface type", Computed: true, }, + "segment_routing_mpls": schema.BoolAttribute{ + MarkdownDescription: "SR using MPLS dataplane", + Computed: true, + }, + "segment_routing_sr_prefer": schema.BoolAttribute{ + MarkdownDescription: "Prefer segment routing labels over LDP labels", + Computed: true, + }, "areas": schema.ListNestedAttribute{ MarkdownDescription: "Enter the OSPF area configuration submode", Computed: true, diff --git a/internal/provider/data_source_iosxr_router_ospf_area_interface.go b/internal/provider/data_source_iosxr_router_ospf_area_interface.go index 95216d5b..58a750eb 100644 --- a/internal/provider/data_source_iosxr_router_ospf_area_interface.go +++ b/internal/provider/data_source_iosxr_router_ospf_area_interface.go @@ -106,6 +106,58 @@ func (d *RouterOSPFAreaInterfaceDataSource) Schema(ctx context.Context, req data MarkdownDescription: "Disable passive", Computed: true, }, + "fast_reroute_per_prefix_ti_lfa_enable": schema.BoolAttribute{ + MarkdownDescription: "Enable TI LFA computation", + Computed: true, + }, + "fast_reroute_per_prefix_tiebreaker_srlg_disjoint_index": schema.Int64Attribute{ + MarkdownDescription: "Set preference order among tiebreakers", + Computed: true, + }, + "fast_reroute_per_prefix_tiebreaker_node_protecting_index": schema.Int64Attribute{ + MarkdownDescription: "Set preference order among tiebreakers", + Computed: true, + }, + "prefix_sid_strict_spf_index_sid_index": schema.Int64Attribute{ + MarkdownDescription: "SID Index", + Computed: true, + }, + "prefix_sid_algorithms": schema.ListNestedAttribute{ + MarkdownDescription: "Algorithm Specific Prefix SID Configuration", + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "algorithm_number": schema.Int64Attribute{ + MarkdownDescription: "Algorithm Specific Prefix SID Configuration", + Computed: true, + }, + "index_sid_index": schema.Int64Attribute{ + MarkdownDescription: "SID Index", + Computed: true, + }, + "index_explicit_null": schema.BoolAttribute{ + MarkdownDescription: "Force penultimate hop to send explicit-null label", + Computed: true, + }, + "index_n_flag_clear": schema.BoolAttribute{ + MarkdownDescription: "Not a node SID (e.g. for anycast SID use)", + Computed: true, + }, + "absolute_sid_label": schema.Int64Attribute{ + MarkdownDescription: "SID value", + Computed: true, + }, + "absolute_explicit_null": schema.BoolAttribute{ + MarkdownDescription: "Force penultimate hop to send explicit-null label", + Computed: true, + }, + "absolute_n_flag_clear": schema.BoolAttribute{ + MarkdownDescription: "Not a node SID (e.g. for anycast SID use)", + Computed: true, + }, + }, + }, + }, }, } } diff --git a/internal/provider/data_source_iosxr_router_ospf_area_interface_test.go b/internal/provider/data_source_iosxr_router_ospf_area_interface_test.go index f503102b..4712c377 100644 --- a/internal/provider/data_source_iosxr_router_ospf_area_interface_test.go +++ b/internal/provider/data_source_iosxr_router_ospf_area_interface_test.go @@ -35,6 +35,9 @@ func TestAccDataSourceIosxrRouterOSPFAreaInterface(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_ospf_area_interface.test", "priority", "100")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_ospf_area_interface.test", "passive_enable", "false")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_ospf_area_interface.test", "passive_disable", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_ospf_area_interface.test", "fast_reroute_per_prefix_ti_lfa_enable", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_ospf_area_interface.test", "fast_reroute_per_prefix_tiebreaker_srlg_disjoint_index", "22")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_ospf_area_interface.test", "fast_reroute_per_prefix_tiebreaker_node_protecting_index", "33")) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, @@ -61,6 +64,9 @@ func testAccDataSourceIosxrRouterOSPFAreaInterfaceConfig() string { config += ` priority = 100` + "\n" config += ` passive_enable = false` + "\n" config += ` passive_disable = true` + "\n" + config += ` fast_reroute_per_prefix_ti_lfa_enable = true` + "\n" + config += ` fast_reroute_per_prefix_tiebreaker_srlg_disjoint_index = 22` + "\n" + config += ` fast_reroute_per_prefix_tiebreaker_node_protecting_index = 33` + "\n" config += `}` + "\n" config += ` diff --git a/internal/provider/data_source_iosxr_router_ospf_test.go b/internal/provider/data_source_iosxr_router_ospf_test.go index 46b33b05..9eb396b3 100644 --- a/internal/provider/data_source_iosxr_router_ospf_test.go +++ b/internal/provider/data_source_iosxr_router_ospf_test.go @@ -50,6 +50,8 @@ func TestAccDataSourceIosxrRouterOSPF(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_ospf.test", "default_information_originate_metric_type", "1")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_ospf.test", "auto_cost_reference_bandwidth", "100000")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_ospf.test", "auto_cost_disable", "false")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_ospf.test", "segment_routing_mpls", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_ospf.test", "segment_routing_sr_prefer", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_ospf.test", "areas.0.area_id", "0")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_ospf.test", "redistribute_bgp.0.as_number", "65001")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_router_ospf.test", "redistribute_bgp.0.tag", "3")) @@ -105,6 +107,8 @@ func testAccDataSourceIosxrRouterOSPFConfig() string { config += ` default_information_originate_metric_type = 1` + "\n" config += ` auto_cost_reference_bandwidth = 100000` + "\n" config += ` auto_cost_disable = false` + "\n" + config += ` segment_routing_mpls = true` + "\n" + config += ` segment_routing_sr_prefer = true` + "\n" config += ` areas = [{` + "\n" config += ` area_id = "0"` + "\n" config += ` }]` + "\n" diff --git a/internal/provider/data_source_iosxr_snmp_server.go b/internal/provider/data_source_iosxr_snmp_server.go index 2dc4879d..c0cb283a 100644 --- a/internal/provider/data_source_iosxr_snmp_server.go +++ b/internal/provider/data_source_iosxr_snmp_server.go @@ -255,6 +255,30 @@ func (d *SNMPServerDataSource) Schema(ctx context.Context, req datasource.Schema MarkdownDescription: "Specifies an default ENCRYPTED authentication password", Computed: true, }, + "v3_auth_sha_encryption_aes": schema.StringAttribute{ + MarkdownDescription: "Specifies an aes-128 ENCRYPTED authentication password", + Computed: true, + }, + "v3_auth_sha_encryption_default": schema.StringAttribute{ + MarkdownDescription: "Specifies an default ENCRYPTED authentication password", + Computed: true, + }, + "v3_priv_aes_aes_128_encryption_default": schema.StringAttribute{ + MarkdownDescription: "Specifies an default ENCRYPTED authentication password", + Computed: true, + }, + "v3_priv_aes_aes_128_encryption_aes": schema.StringAttribute{ + MarkdownDescription: "Specifies an aes-128 ENCRYPTED authentication password", + Computed: true, + }, + "v3_ipv4": schema.StringAttribute{ + MarkdownDescription: "Type of Access-list", + Computed: true, + }, + "v3_systemowner": schema.BoolAttribute{ + MarkdownDescription: "System Owner permissions for MIB objects", + Computed: true, + }, }, }, }, diff --git a/internal/provider/data_source_iosxr_snmp_server_test.go b/internal/provider/data_source_iosxr_snmp_server_test.go index 789b96ca..b8ed8aa1 100644 --- a/internal/provider/data_source_iosxr_snmp_server_test.go +++ b/internal/provider/data_source_iosxr_snmp_server_test.go @@ -55,6 +55,8 @@ func TestAccDataSourceIosxrSNMPServer(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_snmp_server.test", "users.0.user_name", "USER1")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_snmp_server.test", "users.0.group_name", "GROUP1")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_snmp_server.test", "users.0.v3_auth_md5_encryption_aes", "073C05626E2A4841141D")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_snmp_server.test", "users.0.v3_ipv4", "ACL1")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_snmp_server.test", "users.0.v3_systemowner", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_snmp_server.test", "groups.0.group_name", "GROUP12")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_snmp_server.test", "groups.0.v3_priv", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxr_snmp_server.test", "groups.0.v3_read", "VIEW1")) @@ -115,6 +117,8 @@ func testAccDataSourceIosxrSNMPServerConfig() string { config += ` user_name = "USER1"` + "\n" config += ` group_name = "GROUP1"` + "\n" config += ` v3_auth_md5_encryption_aes = "073C05626E2A4841141D"` + "\n" + config += ` v3_ipv4 = "ACL1"` + "\n" + config += ` v3_systemowner = true` + "\n" config += ` }]` + "\n" config += ` groups = [{` + "\n" config += ` group_name = "GROUP12"` + "\n" diff --git a/internal/provider/model_iosxr_router_ospf.go b/internal/provider/model_iosxr_router_ospf.go index 7cd59a97..f51b9803 100644 --- a/internal/provider/model_iosxr_router_ospf.go +++ b/internal/provider/model_iosxr_router_ospf.go @@ -58,6 +58,8 @@ type RouterOSPF struct { DefaultInformationOriginateMetricType types.Int64 `tfsdk:"default_information_originate_metric_type"` AutoCostReferenceBandwidth types.Int64 `tfsdk:"auto_cost_reference_bandwidth"` AutoCostDisable types.Bool `tfsdk:"auto_cost_disable"` + SegmentRoutingMpls types.Bool `tfsdk:"segment_routing_mpls"` + SegmentRoutingSrPrefer types.Bool `tfsdk:"segment_routing_sr_prefer"` Areas []RouterOSPFAreas `tfsdk:"areas"` RedistributeBgp []RouterOSPFRedistributeBgp `tfsdk:"redistribute_bgp"` RedistributeIsis []RouterOSPFRedistributeIsis `tfsdk:"redistribute_isis"` @@ -91,6 +93,8 @@ type RouterOSPFData struct { DefaultInformationOriginateMetricType types.Int64 `tfsdk:"default_information_originate_metric_type"` AutoCostReferenceBandwidth types.Int64 `tfsdk:"auto_cost_reference_bandwidth"` AutoCostDisable types.Bool `tfsdk:"auto_cost_disable"` + SegmentRoutingMpls types.Bool `tfsdk:"segment_routing_mpls"` + SegmentRoutingSrPrefer types.Bool `tfsdk:"segment_routing_sr_prefer"` Areas []RouterOSPFAreas `tfsdk:"areas"` RedistributeBgp []RouterOSPFRedistributeBgp `tfsdk:"redistribute_bgp"` RedistributeIsis []RouterOSPFRedistributeIsis `tfsdk:"redistribute_isis"` @@ -225,6 +229,16 @@ func (data RouterOSPF) toBody(ctx context.Context) string { body, _ = sjson.Set(body, "auto-cost.disable", map[string]string{}) } } + if !data.SegmentRoutingMpls.IsNull() && !data.SegmentRoutingMpls.IsUnknown() { + if data.SegmentRoutingMpls.ValueBool() { + body, _ = sjson.Set(body, "segment-routing.mpls", map[string]string{}) + } + } + if !data.SegmentRoutingSrPrefer.IsNull() && !data.SegmentRoutingSrPrefer.IsUnknown() { + if data.SegmentRoutingSrPrefer.ValueBool() { + body, _ = sjson.Set(body, "segment-routing.sr-prefer", map[string]string{}) + } + } if len(data.Areas) > 0 { body, _ = sjson.Set(body, "areas.area", []interface{}{}) for index, item := range data.Areas { @@ -468,6 +482,24 @@ func (data *RouterOSPF) updateFromBody(ctx context.Context, res []byte) { } else { data.AutoCostDisable = types.BoolNull() } + if value := gjson.GetBytes(res, "segment-routing.mpls"); !data.SegmentRoutingMpls.IsNull() { + if value.Exists() { + data.SegmentRoutingMpls = types.BoolValue(true) + } else { + data.SegmentRoutingMpls = types.BoolValue(false) + } + } else { + data.SegmentRoutingMpls = types.BoolNull() + } + if value := gjson.GetBytes(res, "segment-routing.sr-prefer"); !data.SegmentRoutingSrPrefer.IsNull() { + if value.Exists() { + data.SegmentRoutingSrPrefer = types.BoolValue(true) + } else { + data.SegmentRoutingSrPrefer = types.BoolValue(false) + } + } else { + data.SegmentRoutingSrPrefer = types.BoolNull() + } for i := range data.Areas { keys := [...]string{"area-id"} keyValues := [...]string{data.Areas[i].AreaId.ValueString()} @@ -762,6 +794,16 @@ func (data *RouterOSPFData) fromBody(ctx context.Context, res []byte) { } else { data.AutoCostDisable = types.BoolValue(false) } + if value := gjson.GetBytes(res, "segment-routing.mpls"); value.Exists() { + data.SegmentRoutingMpls = types.BoolValue(true) + } else { + data.SegmentRoutingMpls = types.BoolValue(false) + } + if value := gjson.GetBytes(res, "segment-routing.sr-prefer"); value.Exists() { + data.SegmentRoutingSrPrefer = types.BoolValue(true) + } else { + data.SegmentRoutingSrPrefer = types.BoolValue(false) + } if value := gjson.GetBytes(res, "areas.area"); value.Exists() { data.Areas = make([]RouterOSPFAreas, 0) value.ForEach(func(k, v gjson.Result) bool { @@ -927,6 +969,12 @@ func (data *RouterOSPF) getDeletedItems(ctx context.Context, state RouterOSPF) [ if !state.AutoCostDisable.IsNull() && data.AutoCostDisable.IsNull() { deletedItems = append(deletedItems, fmt.Sprintf("%v/auto-cost/disable", state.getPath())) } + if !state.SegmentRoutingMpls.IsNull() && data.SegmentRoutingMpls.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/segment-routing/mpls", state.getPath())) + } + if !state.SegmentRoutingSrPrefer.IsNull() && data.SegmentRoutingSrPrefer.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/segment-routing/sr-prefer", state.getPath())) + } for i := range state.Areas { keys := [...]string{"area-id"} stateKeyValues := [...]string{state.Areas[i].AreaId.ValueString()} @@ -1121,6 +1169,12 @@ func (data *RouterOSPF) getEmptyLeafsDelete(ctx context.Context) []string { if !data.AutoCostDisable.IsNull() && !data.AutoCostDisable.ValueBool() { emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/auto-cost/disable", data.getPath())) } + if !data.SegmentRoutingMpls.IsNull() && !data.SegmentRoutingMpls.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/segment-routing/mpls", data.getPath())) + } + if !data.SegmentRoutingSrPrefer.IsNull() && !data.SegmentRoutingSrPrefer.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/segment-routing/sr-prefer", data.getPath())) + } for i := range data.Areas { keys := [...]string{"area-id"} keyValues := [...]string{data.Areas[i].AreaId.ValueString()} @@ -1245,6 +1299,12 @@ func (data *RouterOSPF) getDeletePaths(ctx context.Context) []string { if !data.AutoCostDisable.IsNull() { deletePaths = append(deletePaths, fmt.Sprintf("%v/auto-cost/disable", data.getPath())) } + if !data.SegmentRoutingMpls.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/segment-routing/mpls", data.getPath())) + } + if !data.SegmentRoutingSrPrefer.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/segment-routing/sr-prefer", data.getPath())) + } for i := range data.Areas { keys := [...]string{"area-id"} keyValues := [...]string{data.Areas[i].AreaId.ValueString()} diff --git a/internal/provider/model_iosxr_router_ospf_area_interface.go b/internal/provider/model_iosxr_router_ospf_area_interface.go index a031fac2..887a4743 100644 --- a/internal/provider/model_iosxr_router_ospf_area_interface.go +++ b/internal/provider/model_iosxr_router_ospf_area_interface.go @@ -22,6 +22,7 @@ package provider import ( "context" "fmt" + "reflect" "strconv" "github.com/hashicorp/terraform-plugin-framework/types" @@ -30,36 +31,55 @@ import ( ) type RouterOSPFAreaInterface struct { - Device types.String `tfsdk:"device"` - Id types.String `tfsdk:"id"` - DeleteMode types.String `tfsdk:"delete_mode"` - ProcessName types.String `tfsdk:"process_name"` - AreaId types.String `tfsdk:"area_id"` - InterfaceName types.String `tfsdk:"interface_name"` - NetworkBroadcast types.Bool `tfsdk:"network_broadcast"` - NetworkNonBroadcast types.Bool `tfsdk:"network_non_broadcast"` - NetworkPointToPoint types.Bool `tfsdk:"network_point_to_point"` - NetworkPointToMultipoint types.Bool `tfsdk:"network_point_to_multipoint"` - Cost types.Int64 `tfsdk:"cost"` - Priority types.Int64 `tfsdk:"priority"` - PassiveEnable types.Bool `tfsdk:"passive_enable"` - PassiveDisable types.Bool `tfsdk:"passive_disable"` + Device types.String `tfsdk:"device"` + Id types.String `tfsdk:"id"` + DeleteMode types.String `tfsdk:"delete_mode"` + ProcessName types.String `tfsdk:"process_name"` + AreaId types.String `tfsdk:"area_id"` + InterfaceName types.String `tfsdk:"interface_name"` + NetworkBroadcast types.Bool `tfsdk:"network_broadcast"` + NetworkNonBroadcast types.Bool `tfsdk:"network_non_broadcast"` + NetworkPointToPoint types.Bool `tfsdk:"network_point_to_point"` + NetworkPointToMultipoint types.Bool `tfsdk:"network_point_to_multipoint"` + Cost types.Int64 `tfsdk:"cost"` + Priority types.Int64 `tfsdk:"priority"` + PassiveEnable types.Bool `tfsdk:"passive_enable"` + PassiveDisable types.Bool `tfsdk:"passive_disable"` + FastReroutePerPrefixTiLfaEnable types.Bool `tfsdk:"fast_reroute_per_prefix_ti_lfa_enable"` + FastReroutePerPrefixTiebreakerSrlgDisjointIndex types.Int64 `tfsdk:"fast_reroute_per_prefix_tiebreaker_srlg_disjoint_index"` + FastReroutePerPrefixTiebreakerNodeProtectingIndex types.Int64 `tfsdk:"fast_reroute_per_prefix_tiebreaker_node_protecting_index"` + PrefixSidStrictSpfIndexSidIndex types.Int64 `tfsdk:"prefix_sid_strict_spf_index_sid_index"` + PrefixSidAlgorithms []RouterOSPFAreaInterfacePrefixSidAlgorithms `tfsdk:"prefix_sid_algorithms"` } type RouterOSPFAreaInterfaceData struct { - Device types.String `tfsdk:"device"` - Id types.String `tfsdk:"id"` - ProcessName types.String `tfsdk:"process_name"` - AreaId types.String `tfsdk:"area_id"` - InterfaceName types.String `tfsdk:"interface_name"` - NetworkBroadcast types.Bool `tfsdk:"network_broadcast"` - NetworkNonBroadcast types.Bool `tfsdk:"network_non_broadcast"` - NetworkPointToPoint types.Bool `tfsdk:"network_point_to_point"` - NetworkPointToMultipoint types.Bool `tfsdk:"network_point_to_multipoint"` - Cost types.Int64 `tfsdk:"cost"` - Priority types.Int64 `tfsdk:"priority"` - PassiveEnable types.Bool `tfsdk:"passive_enable"` - PassiveDisable types.Bool `tfsdk:"passive_disable"` + Device types.String `tfsdk:"device"` + Id types.String `tfsdk:"id"` + ProcessName types.String `tfsdk:"process_name"` + AreaId types.String `tfsdk:"area_id"` + InterfaceName types.String `tfsdk:"interface_name"` + NetworkBroadcast types.Bool `tfsdk:"network_broadcast"` + NetworkNonBroadcast types.Bool `tfsdk:"network_non_broadcast"` + NetworkPointToPoint types.Bool `tfsdk:"network_point_to_point"` + NetworkPointToMultipoint types.Bool `tfsdk:"network_point_to_multipoint"` + Cost types.Int64 `tfsdk:"cost"` + Priority types.Int64 `tfsdk:"priority"` + PassiveEnable types.Bool `tfsdk:"passive_enable"` + PassiveDisable types.Bool `tfsdk:"passive_disable"` + FastReroutePerPrefixTiLfaEnable types.Bool `tfsdk:"fast_reroute_per_prefix_ti_lfa_enable"` + FastReroutePerPrefixTiebreakerSrlgDisjointIndex types.Int64 `tfsdk:"fast_reroute_per_prefix_tiebreaker_srlg_disjoint_index"` + FastReroutePerPrefixTiebreakerNodeProtectingIndex types.Int64 `tfsdk:"fast_reroute_per_prefix_tiebreaker_node_protecting_index"` + PrefixSidStrictSpfIndexSidIndex types.Int64 `tfsdk:"prefix_sid_strict_spf_index_sid_index"` + PrefixSidAlgorithms []RouterOSPFAreaInterfacePrefixSidAlgorithms `tfsdk:"prefix_sid_algorithms"` +} +type RouterOSPFAreaInterfacePrefixSidAlgorithms struct { + AlgorithmNumber types.Int64 `tfsdk:"algorithm_number"` + IndexSidIndex types.Int64 `tfsdk:"index_sid_index"` + IndexExplicitNull types.Bool `tfsdk:"index_explicit_null"` + IndexNFlagClear types.Bool `tfsdk:"index_n_flag_clear"` + AbsoluteSidLabel types.Int64 `tfsdk:"absolute_sid_label"` + AbsoluteExplicitNull types.Bool `tfsdk:"absolute_explicit_null"` + AbsoluteNFlagClear types.Bool `tfsdk:"absolute_n_flag_clear"` } func (data RouterOSPFAreaInterface) getPath() string { @@ -111,6 +131,54 @@ func (data RouterOSPFAreaInterface) toBody(ctx context.Context) string { body, _ = sjson.Set(body, "passive.disable", map[string]string{}) } } + if !data.FastReroutePerPrefixTiLfaEnable.IsNull() && !data.FastReroutePerPrefixTiLfaEnable.IsUnknown() { + if data.FastReroutePerPrefixTiLfaEnable.ValueBool() { + body, _ = sjson.Set(body, "fast-reroute.per-prefix.ti-lfa.enable", map[string]string{}) + } + } + if !data.FastReroutePerPrefixTiebreakerSrlgDisjointIndex.IsNull() && !data.FastReroutePerPrefixTiebreakerSrlgDisjointIndex.IsUnknown() { + body, _ = sjson.Set(body, "fast-reroute.per-prefix.tiebreaker.srlg-disjoint.index", strconv.FormatInt(data.FastReroutePerPrefixTiebreakerSrlgDisjointIndex.ValueInt64(), 10)) + } + if !data.FastReroutePerPrefixTiebreakerNodeProtectingIndex.IsNull() && !data.FastReroutePerPrefixTiebreakerNodeProtectingIndex.IsUnknown() { + body, _ = sjson.Set(body, "fast-reroute.per-prefix.tiebreaker.node-protecting.index", strconv.FormatInt(data.FastReroutePerPrefixTiebreakerNodeProtectingIndex.ValueInt64(), 10)) + } + if !data.PrefixSidStrictSpfIndexSidIndex.IsNull() && !data.PrefixSidStrictSpfIndexSidIndex.IsUnknown() { + body, _ = sjson.Set(body, "prefix-sid.strict-spf.index.sid-index", strconv.FormatInt(data.PrefixSidStrictSpfIndexSidIndex.ValueInt64(), 10)) + } + if len(data.PrefixSidAlgorithms) > 0 { + body, _ = sjson.Set(body, "prefix-sid.algorithms.algorithm", []interface{}{}) + for index, item := range data.PrefixSidAlgorithms { + if !item.AlgorithmNumber.IsNull() && !item.AlgorithmNumber.IsUnknown() { + body, _ = sjson.Set(body, "prefix-sid.algorithms.algorithm"+"."+strconv.Itoa(index)+"."+"algorithm-number", strconv.FormatInt(item.AlgorithmNumber.ValueInt64(), 10)) + } + if !item.IndexSidIndex.IsNull() && !item.IndexSidIndex.IsUnknown() { + body, _ = sjson.Set(body, "prefix-sid.algorithms.algorithm"+"."+strconv.Itoa(index)+"."+"index.sid-index", strconv.FormatInt(item.IndexSidIndex.ValueInt64(), 10)) + } + if !item.IndexExplicitNull.IsNull() && !item.IndexExplicitNull.IsUnknown() { + if item.IndexExplicitNull.ValueBool() { + body, _ = sjson.Set(body, "prefix-sid.algorithms.algorithm"+"."+strconv.Itoa(index)+"."+"index.explicit-null", map[string]string{}) + } + } + if !item.IndexNFlagClear.IsNull() && !item.IndexNFlagClear.IsUnknown() { + if item.IndexNFlagClear.ValueBool() { + body, _ = sjson.Set(body, "prefix-sid.algorithms.algorithm"+"."+strconv.Itoa(index)+"."+"index.n-flag-clear", map[string]string{}) + } + } + if !item.AbsoluteSidLabel.IsNull() && !item.AbsoluteSidLabel.IsUnknown() { + body, _ = sjson.Set(body, "prefix-sid.algorithms.algorithm"+"."+strconv.Itoa(index)+"."+"absolute.sid-label", strconv.FormatInt(item.AbsoluteSidLabel.ValueInt64(), 10)) + } + if !item.AbsoluteExplicitNull.IsNull() && !item.AbsoluteExplicitNull.IsUnknown() { + if item.AbsoluteExplicitNull.ValueBool() { + body, _ = sjson.Set(body, "prefix-sid.algorithms.algorithm"+"."+strconv.Itoa(index)+"."+"absolute.explicit-null", map[string]string{}) + } + } + if !item.AbsoluteNFlagClear.IsNull() && !item.AbsoluteNFlagClear.IsUnknown() { + if item.AbsoluteNFlagClear.ValueBool() { + body, _ = sjson.Set(body, "prefix-sid.algorithms.algorithm"+"."+strconv.Itoa(index)+"."+"absolute.n-flag-clear", map[string]string{}) + } + } + } + } return body } @@ -179,6 +247,105 @@ func (data *RouterOSPFAreaInterface) updateFromBody(ctx context.Context, res []b } else { data.PassiveDisable = types.BoolNull() } + if value := gjson.GetBytes(res, "fast-reroute.per-prefix.ti-lfa.enable"); !data.FastReroutePerPrefixTiLfaEnable.IsNull() { + if value.Exists() { + data.FastReroutePerPrefixTiLfaEnable = types.BoolValue(true) + } else { + data.FastReroutePerPrefixTiLfaEnable = types.BoolValue(false) + } + } else { + data.FastReroutePerPrefixTiLfaEnable = types.BoolNull() + } + if value := gjson.GetBytes(res, "fast-reroute.per-prefix.tiebreaker.srlg-disjoint.index"); value.Exists() && !data.FastReroutePerPrefixTiebreakerSrlgDisjointIndex.IsNull() { + data.FastReroutePerPrefixTiebreakerSrlgDisjointIndex = types.Int64Value(value.Int()) + } else { + data.FastReroutePerPrefixTiebreakerSrlgDisjointIndex = types.Int64Null() + } + if value := gjson.GetBytes(res, "fast-reroute.per-prefix.tiebreaker.node-protecting.index"); value.Exists() && !data.FastReroutePerPrefixTiebreakerNodeProtectingIndex.IsNull() { + data.FastReroutePerPrefixTiebreakerNodeProtectingIndex = types.Int64Value(value.Int()) + } else { + data.FastReroutePerPrefixTiebreakerNodeProtectingIndex = types.Int64Null() + } + if value := gjson.GetBytes(res, "prefix-sid.strict-spf.index.sid-index"); value.Exists() && !data.PrefixSidStrictSpfIndexSidIndex.IsNull() { + data.PrefixSidStrictSpfIndexSidIndex = types.Int64Value(value.Int()) + } else { + data.PrefixSidStrictSpfIndexSidIndex = types.Int64Null() + } + for i := range data.PrefixSidAlgorithms { + keys := [...]string{"algorithm-number"} + keyValues := [...]string{strconv.FormatInt(data.PrefixSidAlgorithms[i].AlgorithmNumber.ValueInt64(), 10)} + + var r gjson.Result + gjson.GetBytes(res, "prefix-sid.algorithms.algorithm").ForEach( + func(_, v gjson.Result) bool { + found := false + for ik := range keys { + if v.Get(keys[ik]).String() == keyValues[ik] { + found = true + continue + } + found = false + break + } + if found { + r = v + return false + } + return true + }, + ) + if value := r.Get("algorithm-number"); value.Exists() && !data.PrefixSidAlgorithms[i].AlgorithmNumber.IsNull() { + data.PrefixSidAlgorithms[i].AlgorithmNumber = types.Int64Value(value.Int()) + } else { + data.PrefixSidAlgorithms[i].AlgorithmNumber = types.Int64Null() + } + if value := r.Get("index.sid-index"); value.Exists() && !data.PrefixSidAlgorithms[i].IndexSidIndex.IsNull() { + data.PrefixSidAlgorithms[i].IndexSidIndex = types.Int64Value(value.Int()) + } else { + data.PrefixSidAlgorithms[i].IndexSidIndex = types.Int64Null() + } + if value := r.Get("index.explicit-null"); !data.PrefixSidAlgorithms[i].IndexExplicitNull.IsNull() { + if value.Exists() { + data.PrefixSidAlgorithms[i].IndexExplicitNull = types.BoolValue(true) + } else { + data.PrefixSidAlgorithms[i].IndexExplicitNull = types.BoolValue(false) + } + } else { + data.PrefixSidAlgorithms[i].IndexExplicitNull = types.BoolNull() + } + if value := r.Get("index.n-flag-clear"); !data.PrefixSidAlgorithms[i].IndexNFlagClear.IsNull() { + if value.Exists() { + data.PrefixSidAlgorithms[i].IndexNFlagClear = types.BoolValue(true) + } else { + data.PrefixSidAlgorithms[i].IndexNFlagClear = types.BoolValue(false) + } + } else { + data.PrefixSidAlgorithms[i].IndexNFlagClear = types.BoolNull() + } + if value := r.Get("absolute.sid-label"); value.Exists() && !data.PrefixSidAlgorithms[i].AbsoluteSidLabel.IsNull() { + data.PrefixSidAlgorithms[i].AbsoluteSidLabel = types.Int64Value(value.Int()) + } else { + data.PrefixSidAlgorithms[i].AbsoluteSidLabel = types.Int64Null() + } + if value := r.Get("absolute.explicit-null"); !data.PrefixSidAlgorithms[i].AbsoluteExplicitNull.IsNull() { + if value.Exists() { + data.PrefixSidAlgorithms[i].AbsoluteExplicitNull = types.BoolValue(true) + } else { + data.PrefixSidAlgorithms[i].AbsoluteExplicitNull = types.BoolValue(false) + } + } else { + data.PrefixSidAlgorithms[i].AbsoluteExplicitNull = types.BoolNull() + } + if value := r.Get("absolute.n-flag-clear"); !data.PrefixSidAlgorithms[i].AbsoluteNFlagClear.IsNull() { + if value.Exists() { + data.PrefixSidAlgorithms[i].AbsoluteNFlagClear = types.BoolValue(true) + } else { + data.PrefixSidAlgorithms[i].AbsoluteNFlagClear = types.BoolValue(false) + } + } else { + data.PrefixSidAlgorithms[i].AbsoluteNFlagClear = types.BoolNull() + } + } } func (data *RouterOSPFAreaInterfaceData) fromBody(ctx context.Context, res []byte) { @@ -218,6 +385,57 @@ func (data *RouterOSPFAreaInterfaceData) fromBody(ctx context.Context, res []byt } else { data.PassiveDisable = types.BoolValue(false) } + if value := gjson.GetBytes(res, "fast-reroute.per-prefix.ti-lfa.enable"); value.Exists() { + data.FastReroutePerPrefixTiLfaEnable = types.BoolValue(true) + } else { + data.FastReroutePerPrefixTiLfaEnable = types.BoolValue(false) + } + if value := gjson.GetBytes(res, "fast-reroute.per-prefix.tiebreaker.srlg-disjoint.index"); value.Exists() { + data.FastReroutePerPrefixTiebreakerSrlgDisjointIndex = types.Int64Value(value.Int()) + } + if value := gjson.GetBytes(res, "fast-reroute.per-prefix.tiebreaker.node-protecting.index"); value.Exists() { + data.FastReroutePerPrefixTiebreakerNodeProtectingIndex = types.Int64Value(value.Int()) + } + if value := gjson.GetBytes(res, "prefix-sid.strict-spf.index.sid-index"); value.Exists() { + data.PrefixSidStrictSpfIndexSidIndex = types.Int64Value(value.Int()) + } + if value := gjson.GetBytes(res, "prefix-sid.algorithms.algorithm"); value.Exists() { + data.PrefixSidAlgorithms = make([]RouterOSPFAreaInterfacePrefixSidAlgorithms, 0) + value.ForEach(func(k, v gjson.Result) bool { + item := RouterOSPFAreaInterfacePrefixSidAlgorithms{} + if cValue := v.Get("algorithm-number"); cValue.Exists() { + item.AlgorithmNumber = types.Int64Value(cValue.Int()) + } + if cValue := v.Get("index.sid-index"); cValue.Exists() { + item.IndexSidIndex = types.Int64Value(cValue.Int()) + } + if cValue := v.Get("index.explicit-null"); cValue.Exists() { + item.IndexExplicitNull = types.BoolValue(true) + } else { + item.IndexExplicitNull = types.BoolValue(false) + } + if cValue := v.Get("index.n-flag-clear"); cValue.Exists() { + item.IndexNFlagClear = types.BoolValue(true) + } else { + item.IndexNFlagClear = types.BoolValue(false) + } + if cValue := v.Get("absolute.sid-label"); cValue.Exists() { + item.AbsoluteSidLabel = types.Int64Value(cValue.Int()) + } + if cValue := v.Get("absolute.explicit-null"); cValue.Exists() { + item.AbsoluteExplicitNull = types.BoolValue(true) + } else { + item.AbsoluteExplicitNull = types.BoolValue(false) + } + if cValue := v.Get("absolute.n-flag-clear"); cValue.Exists() { + item.AbsoluteNFlagClear = types.BoolValue(true) + } else { + item.AbsoluteNFlagClear = types.BoolValue(false) + } + data.PrefixSidAlgorithms = append(data.PrefixSidAlgorithms, item) + return true + }) + } } func (data *RouterOSPFAreaInterface) getDeletedItems(ctx context.Context, state RouterOSPFAreaInterface) []string { @@ -246,6 +464,66 @@ func (data *RouterOSPFAreaInterface) getDeletedItems(ctx context.Context, state if !state.PassiveDisable.IsNull() && data.PassiveDisable.IsNull() { deletedItems = append(deletedItems, fmt.Sprintf("%v/passive/disable", state.getPath())) } + if !state.FastReroutePerPrefixTiLfaEnable.IsNull() && data.FastReroutePerPrefixTiLfaEnable.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/fast-reroute/per-prefix/ti-lfa/enable", state.getPath())) + } + if !state.FastReroutePerPrefixTiebreakerSrlgDisjointIndex.IsNull() && data.FastReroutePerPrefixTiebreakerSrlgDisjointIndex.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/fast-reroute/per-prefix/tiebreaker/srlg-disjoint/index", state.getPath())) + } + if !state.FastReroutePerPrefixTiebreakerNodeProtectingIndex.IsNull() && data.FastReroutePerPrefixTiebreakerNodeProtectingIndex.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/fast-reroute/per-prefix/tiebreaker/node-protecting/index", state.getPath())) + } + if !state.PrefixSidStrictSpfIndexSidIndex.IsNull() && data.PrefixSidStrictSpfIndexSidIndex.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/prefix-sid/strict-spf/index", state.getPath())) + } + for i := range state.PrefixSidAlgorithms { + keys := [...]string{"algorithm-number"} + stateKeyValues := [...]string{strconv.FormatInt(state.PrefixSidAlgorithms[i].AlgorithmNumber.ValueInt64(), 10)} + keyString := "" + for ki := range keys { + keyString += "[" + keys[ki] + "=" + stateKeyValues[ki] + "]" + } + + emptyKeys := true + if !reflect.ValueOf(state.PrefixSidAlgorithms[i].AlgorithmNumber.ValueInt64()).IsZero() { + emptyKeys = false + } + if emptyKeys { + continue + } + + found := false + for j := range data.PrefixSidAlgorithms { + found = true + if state.PrefixSidAlgorithms[i].AlgorithmNumber.ValueInt64() != data.PrefixSidAlgorithms[j].AlgorithmNumber.ValueInt64() { + found = false + } + if found { + if !state.PrefixSidAlgorithms[i].IndexSidIndex.IsNull() && data.PrefixSidAlgorithms[j].IndexSidIndex.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/prefix-sid/algorithms/algorithm%v/index/sid-index", state.getPath(), keyString)) + } + if !state.PrefixSidAlgorithms[i].IndexExplicitNull.IsNull() && data.PrefixSidAlgorithms[j].IndexExplicitNull.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/prefix-sid/algorithms/algorithm%v/index/explicit-null", state.getPath(), keyString)) + } + if !state.PrefixSidAlgorithms[i].IndexNFlagClear.IsNull() && data.PrefixSidAlgorithms[j].IndexNFlagClear.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/prefix-sid/algorithms/algorithm%v/index/n-flag-clear", state.getPath(), keyString)) + } + if !state.PrefixSidAlgorithms[i].AbsoluteSidLabel.IsNull() && data.PrefixSidAlgorithms[j].AbsoluteSidLabel.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/prefix-sid/algorithms/algorithm%v/absolute/sid-label", state.getPath(), keyString)) + } + if !state.PrefixSidAlgorithms[i].AbsoluteExplicitNull.IsNull() && data.PrefixSidAlgorithms[j].AbsoluteExplicitNull.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/prefix-sid/algorithms/algorithm%v/absolute/explicit-null", state.getPath(), keyString)) + } + if !state.PrefixSidAlgorithms[i].AbsoluteNFlagClear.IsNull() && data.PrefixSidAlgorithms[j].AbsoluteNFlagClear.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/prefix-sid/algorithms/algorithm%v/absolute/n-flag-clear", state.getPath(), keyString)) + } + break + } + } + if !found { + deletedItems = append(deletedItems, fmt.Sprintf("%v/prefix-sid/algorithms/algorithm%v", state.getPath(), keyString)) + } + } return deletedItems } @@ -269,6 +547,29 @@ func (data *RouterOSPFAreaInterface) getEmptyLeafsDelete(ctx context.Context) [] if !data.PassiveDisable.IsNull() && !data.PassiveDisable.ValueBool() { emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/passive/disable", data.getPath())) } + if !data.FastReroutePerPrefixTiLfaEnable.IsNull() && !data.FastReroutePerPrefixTiLfaEnable.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/fast-reroute/per-prefix/ti-lfa/enable", data.getPath())) + } + for i := range data.PrefixSidAlgorithms { + keys := [...]string{"algorithm-number"} + keyValues := [...]string{strconv.FormatInt(data.PrefixSidAlgorithms[i].AlgorithmNumber.ValueInt64(), 10)} + keyString := "" + for ki := range keys { + keyString += "[" + keys[ki] + "=" + keyValues[ki] + "]" + } + if !data.PrefixSidAlgorithms[i].IndexExplicitNull.IsNull() && !data.PrefixSidAlgorithms[i].IndexExplicitNull.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/prefix-sid/algorithms/algorithm%v/index/explicit-null", data.getPath(), keyString)) + } + if !data.PrefixSidAlgorithms[i].IndexNFlagClear.IsNull() && !data.PrefixSidAlgorithms[i].IndexNFlagClear.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/prefix-sid/algorithms/algorithm%v/index/n-flag-clear", data.getPath(), keyString)) + } + if !data.PrefixSidAlgorithms[i].AbsoluteExplicitNull.IsNull() && !data.PrefixSidAlgorithms[i].AbsoluteExplicitNull.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/prefix-sid/algorithms/algorithm%v/absolute/explicit-null", data.getPath(), keyString)) + } + if !data.PrefixSidAlgorithms[i].AbsoluteNFlagClear.IsNull() && !data.PrefixSidAlgorithms[i].AbsoluteNFlagClear.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/prefix-sid/algorithms/algorithm%v/absolute/n-flag-clear", data.getPath(), keyString)) + } + } return emptyLeafsDelete } @@ -298,5 +599,27 @@ func (data *RouterOSPFAreaInterface) getDeletePaths(ctx context.Context) []strin if !data.PassiveDisable.IsNull() { deletePaths = append(deletePaths, fmt.Sprintf("%v/passive/disable", data.getPath())) } + if !data.FastReroutePerPrefixTiLfaEnable.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/fast-reroute/per-prefix/ti-lfa/enable", data.getPath())) + } + if !data.FastReroutePerPrefixTiebreakerSrlgDisjointIndex.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/fast-reroute/per-prefix/tiebreaker/srlg-disjoint/index", data.getPath())) + } + if !data.FastReroutePerPrefixTiebreakerNodeProtectingIndex.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/fast-reroute/per-prefix/tiebreaker/node-protecting/index", data.getPath())) + } + if !data.PrefixSidStrictSpfIndexSidIndex.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/prefix-sid/strict-spf/index", data.getPath())) + } + for i := range data.PrefixSidAlgorithms { + keys := [...]string{"algorithm-number"} + keyValues := [...]string{strconv.FormatInt(data.PrefixSidAlgorithms[i].AlgorithmNumber.ValueInt64(), 10)} + + keyString := "" + for ki := range keys { + keyString += "[" + keys[ki] + "=" + keyValues[ki] + "]" + } + deletePaths = append(deletePaths, fmt.Sprintf("%v/prefix-sid/algorithms/algorithm%v", data.getPath(), keyString)) + } return deletePaths } diff --git a/internal/provider/model_iosxr_snmp_server.go b/internal/provider/model_iosxr_snmp_server.go index e2bd4d19..d3d512b2 100644 --- a/internal/provider/model_iosxr_snmp_server.go +++ b/internal/provider/model_iosxr_snmp_server.go @@ -133,10 +133,16 @@ type SNMPServerData struct { Communities []SNMPServerCommunities `tfsdk:"communities"` } type SNMPServerUsers struct { - UserName types.String `tfsdk:"user_name"` - GroupName types.String `tfsdk:"group_name"` - V3AuthMd5EncryptionAes types.String `tfsdk:"v3_auth_md5_encryption_aes"` - V3AuthMd5EncryptionDefault types.String `tfsdk:"v3_auth_md5_encryption_default"` + UserName types.String `tfsdk:"user_name"` + GroupName types.String `tfsdk:"group_name"` + V3AuthMd5EncryptionAes types.String `tfsdk:"v3_auth_md5_encryption_aes"` + V3AuthMd5EncryptionDefault types.String `tfsdk:"v3_auth_md5_encryption_default"` + V3AuthShaEncryptionAes types.String `tfsdk:"v3_auth_sha_encryption_aes"` + V3AuthShaEncryptionDefault types.String `tfsdk:"v3_auth_sha_encryption_default"` + V3PrivAesAes128EncryptionDefault types.String `tfsdk:"v3_priv_aes_aes_128_encryption_default"` + V3PrivAesAes128EncryptionAes types.String `tfsdk:"v3_priv_aes_aes_128_encryption_aes"` + V3Ipv4 types.String `tfsdk:"v3_ipv4"` + V3Systemowner types.Bool `tfsdk:"v3_systemowner"` } type SNMPServerGroups struct { GroupName types.String `tfsdk:"group_name"` @@ -355,6 +361,26 @@ func (data SNMPServer) toBody(ctx context.Context) string { if !item.V3AuthMd5EncryptionDefault.IsNull() && !item.V3AuthMd5EncryptionDefault.IsUnknown() { body, _ = sjson.Set(body, "users.user"+"."+strconv.Itoa(index)+"."+"v3.auth.md5.encryption-default", item.V3AuthMd5EncryptionDefault.ValueString()) } + if !item.V3AuthShaEncryptionAes.IsNull() && !item.V3AuthShaEncryptionAes.IsUnknown() { + body, _ = sjson.Set(body, "users.user"+"."+strconv.Itoa(index)+"."+"v3.auth.sha.encryption-aes", item.V3AuthShaEncryptionAes.ValueString()) + } + if !item.V3AuthShaEncryptionDefault.IsNull() && !item.V3AuthShaEncryptionDefault.IsUnknown() { + body, _ = sjson.Set(body, "users.user"+"."+strconv.Itoa(index)+"."+"v3.auth.sha.encryption-default", item.V3AuthShaEncryptionDefault.ValueString()) + } + if !item.V3PrivAesAes128EncryptionDefault.IsNull() && !item.V3PrivAesAes128EncryptionDefault.IsUnknown() { + body, _ = sjson.Set(body, "users.user"+"."+strconv.Itoa(index)+"."+"v3.priv.aes.aes-128.encryption-default", item.V3PrivAesAes128EncryptionDefault.ValueString()) + } + if !item.V3PrivAesAes128EncryptionAes.IsNull() && !item.V3PrivAesAes128EncryptionAes.IsUnknown() { + body, _ = sjson.Set(body, "users.user"+"."+strconv.Itoa(index)+"."+"v3.priv.aes.aes-128.encryption-aes", item.V3PrivAesAes128EncryptionAes.ValueString()) + } + if !item.V3Ipv4.IsNull() && !item.V3Ipv4.IsUnknown() { + body, _ = sjson.Set(body, "users.user"+"."+strconv.Itoa(index)+"."+"v3.ipv4", item.V3Ipv4.ValueString()) + } + if !item.V3Systemowner.IsNull() && !item.V3Systemowner.IsUnknown() { + if item.V3Systemowner.ValueBool() { + body, _ = sjson.Set(body, "users.user"+"."+strconv.Itoa(index)+"."+"v3.systemowner", map[string]string{}) + } + } } } if len(data.Groups) > 0 { @@ -771,6 +797,40 @@ func (data *SNMPServer) updateFromBody(ctx context.Context, res []byte) { } else { data.Users[i].V3AuthMd5EncryptionDefault = types.StringNull() } + if value := r.Get("v3.auth.sha.encryption-aes"); value.Exists() && !data.Users[i].V3AuthShaEncryptionAes.IsNull() { + data.Users[i].V3AuthShaEncryptionAes = types.StringValue(value.String()) + } else { + data.Users[i].V3AuthShaEncryptionAes = types.StringNull() + } + if value := r.Get("v3.auth.sha.encryption-default"); value.Exists() && !data.Users[i].V3AuthShaEncryptionDefault.IsNull() { + data.Users[i].V3AuthShaEncryptionDefault = types.StringValue(value.String()) + } else { + data.Users[i].V3AuthShaEncryptionDefault = types.StringNull() + } + if value := r.Get("v3.priv.aes.aes-128.encryption-default"); value.Exists() && !data.Users[i].V3PrivAesAes128EncryptionDefault.IsNull() { + data.Users[i].V3PrivAesAes128EncryptionDefault = types.StringValue(value.String()) + } else { + data.Users[i].V3PrivAesAes128EncryptionDefault = types.StringNull() + } + if value := r.Get("v3.priv.aes.aes-128.encryption-aes"); value.Exists() && !data.Users[i].V3PrivAesAes128EncryptionAes.IsNull() { + data.Users[i].V3PrivAesAes128EncryptionAes = types.StringValue(value.String()) + } else { + data.Users[i].V3PrivAesAes128EncryptionAes = types.StringNull() + } + if value := r.Get("v3.ipv4"); value.Exists() && !data.Users[i].V3Ipv4.IsNull() { + data.Users[i].V3Ipv4 = types.StringValue(value.String()) + } else { + data.Users[i].V3Ipv4 = types.StringNull() + } + if value := r.Get("v3.systemowner"); !data.Users[i].V3Systemowner.IsNull() { + if value.Exists() { + data.Users[i].V3Systemowner = types.BoolValue(true) + } else { + data.Users[i].V3Systemowner = types.BoolValue(false) + } + } else { + data.Users[i].V3Systemowner = types.BoolNull() + } } for i := range data.Groups { keys := [...]string{"group-name"} @@ -1110,6 +1170,26 @@ func (data *SNMPServerData) fromBody(ctx context.Context, res []byte) { if cValue := v.Get("v3.auth.md5.encryption-default"); cValue.Exists() { item.V3AuthMd5EncryptionDefault = types.StringValue(cValue.String()) } + if cValue := v.Get("v3.auth.sha.encryption-aes"); cValue.Exists() { + item.V3AuthShaEncryptionAes = types.StringValue(cValue.String()) + } + if cValue := v.Get("v3.auth.sha.encryption-default"); cValue.Exists() { + item.V3AuthShaEncryptionDefault = types.StringValue(cValue.String()) + } + if cValue := v.Get("v3.priv.aes.aes-128.encryption-default"); cValue.Exists() { + item.V3PrivAesAes128EncryptionDefault = types.StringValue(cValue.String()) + } + if cValue := v.Get("v3.priv.aes.aes-128.encryption-aes"); cValue.Exists() { + item.V3PrivAesAes128EncryptionAes = types.StringValue(cValue.String()) + } + if cValue := v.Get("v3.ipv4"); cValue.Exists() { + item.V3Ipv4 = types.StringValue(cValue.String()) + } + if cValue := v.Get("v3.systemowner"); cValue.Exists() { + item.V3Systemowner = types.BoolValue(true) + } else { + item.V3Systemowner = types.BoolValue(false) + } data.Users = append(data.Users, item) return true }) @@ -1353,6 +1433,24 @@ func (data *SNMPServer) getDeletedItems(ctx context.Context, state SNMPServer) [ if !state.Users[i].V3AuthMd5EncryptionDefault.IsNull() && data.Users[j].V3AuthMd5EncryptionDefault.IsNull() { deletedItems = append(deletedItems, fmt.Sprintf("%v/users/user%v/v3/auth/md5/encryption-default", state.getPath(), keyString)) } + if !state.Users[i].V3AuthShaEncryptionAes.IsNull() && data.Users[j].V3AuthShaEncryptionAes.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/users/user%v/v3/auth/sha/encryption-aes", state.getPath(), keyString)) + } + if !state.Users[i].V3AuthShaEncryptionDefault.IsNull() && data.Users[j].V3AuthShaEncryptionDefault.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/users/user%v/v3/auth/sha/encryption-default", state.getPath(), keyString)) + } + if !state.Users[i].V3PrivAesAes128EncryptionDefault.IsNull() && data.Users[j].V3PrivAesAes128EncryptionDefault.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/users/user%v/v3/priv/aes/aes-128/encryption-default", state.getPath(), keyString)) + } + if !state.Users[i].V3PrivAesAes128EncryptionAes.IsNull() && data.Users[j].V3PrivAesAes128EncryptionAes.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/users/user%v/v3/priv/aes/aes-128/encryption-aes", state.getPath(), keyString)) + } + if !state.Users[i].V3Ipv4.IsNull() && data.Users[j].V3Ipv4.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/users/user%v/v3/ipv4", state.getPath(), keyString)) + } + if !state.Users[i].V3Systemowner.IsNull() && data.Users[j].V3Systemowner.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/users/user%v/v3/systemowner", state.getPath(), keyString)) + } break } } @@ -1537,6 +1635,9 @@ func (data *SNMPServer) getEmptyLeafsDelete(ctx context.Context) []string { for ki := range keys { keyString += "[" + keys[ki] + "=" + keyValues[ki] + "]" } + if !data.Users[i].V3Systemowner.IsNull() && !data.Users[i].V3Systemowner.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/users/user%v/v3/systemowner", data.getPath(), keyString)) + } } for i := range data.Groups { keys := [...]string{"group-name"} diff --git a/internal/provider/resource_iosxr_router_ospf.go b/internal/provider/resource_iosxr_router_ospf.go index d675ecea..06f5256a 100644 --- a/internal/provider/resource_iosxr_router_ospf.go +++ b/internal/provider/resource_iosxr_router_ospf.go @@ -214,6 +214,14 @@ func (r *RouterOSPFResource) Schema(ctx context.Context, req resource.SchemaRequ MarkdownDescription: helpers.NewAttributeDescription("Assign OSPF cost based on interface type").String, Optional: true, }, + "segment_routing_mpls": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("SR using MPLS dataplane").String, + Optional: true, + }, + "segment_routing_sr_prefer": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Prefer segment routing labels over LDP labels").String, + Optional: true, + }, "areas": schema.ListNestedAttribute{ MarkdownDescription: helpers.NewAttributeDescription("Enter the OSPF area configuration submode").String, Optional: true, diff --git a/internal/provider/resource_iosxr_router_ospf_area_interface.go b/internal/provider/resource_iosxr_router_ospf_area_interface.go index f1e44dce..c46cc094 100644 --- a/internal/provider/resource_iosxr_router_ospf_area_interface.go +++ b/internal/provider/resource_iosxr_router_ospf_area_interface.go @@ -140,6 +140,76 @@ func (r *RouterOSPFAreaInterfaceResource) Schema(ctx context.Context, req resour MarkdownDescription: helpers.NewAttributeDescription("Disable passive").String, Optional: true, }, + "fast_reroute_per_prefix_ti_lfa_enable": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Enable TI LFA computation").String, + Optional: true, + }, + "fast_reroute_per_prefix_tiebreaker_srlg_disjoint_index": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("Set preference order among tiebreakers").AddIntegerRangeDescription(1, 255).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(1, 255), + }, + }, + "fast_reroute_per_prefix_tiebreaker_node_protecting_index": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("Set preference order among tiebreakers").AddIntegerRangeDescription(1, 255).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(1, 255), + }, + }, + "prefix_sid_strict_spf_index_sid_index": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("SID Index").AddIntegerRangeDescription(0, 1048575).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(0, 1048575), + }, + }, + "prefix_sid_algorithms": schema.ListNestedAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Algorithm Specific Prefix SID Configuration").String, + Optional: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "algorithm_number": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("Algorithm Specific Prefix SID Configuration").AddIntegerRangeDescription(128, 255).String, + Required: true, + Validators: []validator.Int64{ + int64validator.Between(128, 255), + }, + }, + "index_sid_index": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("SID Index").AddIntegerRangeDescription(0, 1048575).String, + Required: true, + Validators: []validator.Int64{ + int64validator.Between(0, 1048575), + }, + }, + "index_explicit_null": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Force penultimate hop to send explicit-null label").String, + Optional: true, + }, + "index_n_flag_clear": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Not a node SID (e.g. for anycast SID use)").String, + Optional: true, + }, + "absolute_sid_label": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("SID value").AddIntegerRangeDescription(16000, 1048575).String, + Required: true, + Validators: []validator.Int64{ + int64validator.Between(16000, 1048575), + }, + }, + "absolute_explicit_null": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Force penultimate hop to send explicit-null label").String, + Optional: true, + }, + "absolute_n_flag_clear": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Not a node SID (e.g. for anycast SID use)").String, + Optional: true, + }, + }, + }, + }, }, } } diff --git a/internal/provider/resource_iosxr_router_ospf_area_interface_test.go b/internal/provider/resource_iosxr_router_ospf_area_interface_test.go index 5cd52559..e428630c 100644 --- a/internal/provider/resource_iosxr_router_ospf_area_interface_test.go +++ b/internal/provider/resource_iosxr_router_ospf_area_interface_test.go @@ -37,6 +37,9 @@ func TestAccIosxrRouterOSPFAreaInterface(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_ospf_area_interface.test", "priority", "100")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_ospf_area_interface.test", "passive_enable", "false")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_ospf_area_interface.test", "passive_disable", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_ospf_area_interface.test", "fast_reroute_per_prefix_ti_lfa_enable", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_ospf_area_interface.test", "fast_reroute_per_prefix_tiebreaker_srlg_disjoint_index", "22")) + checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_ospf_area_interface.test", "fast_reroute_per_prefix_tiebreaker_node_protecting_index", "33")) var steps []resource.TestStep if os.Getenv("SKIP_MINIMUM_TEST") == "" { steps = append(steps, resource.TestStep{ @@ -81,6 +84,9 @@ func testAccIosxrRouterOSPFAreaInterfaceConfig_all() string { config += ` priority = 100` + "\n" config += ` passive_enable = false` + "\n" config += ` passive_disable = true` + "\n" + config += ` fast_reroute_per_prefix_ti_lfa_enable = true` + "\n" + config += ` fast_reroute_per_prefix_tiebreaker_srlg_disjoint_index = 22` + "\n" + config += ` fast_reroute_per_prefix_tiebreaker_node_protecting_index = 33` + "\n" config += `}` + "\n" return config } diff --git a/internal/provider/resource_iosxr_router_ospf_test.go b/internal/provider/resource_iosxr_router_ospf_test.go index 38d1376f..b57666ae 100644 --- a/internal/provider/resource_iosxr_router_ospf_test.go +++ b/internal/provider/resource_iosxr_router_ospf_test.go @@ -52,6 +52,8 @@ func TestAccIosxrRouterOSPF(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_ospf.test", "default_information_originate_metric_type", "1")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_ospf.test", "auto_cost_reference_bandwidth", "100000")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_ospf.test", "auto_cost_disable", "false")) + checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_ospf.test", "segment_routing_mpls", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_ospf.test", "segment_routing_sr_prefer", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_ospf.test", "areas.0.area_id", "0")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_ospf.test", "redistribute_bgp.0.as_number", "65001")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_router_ospf.test", "redistribute_bgp.0.tag", "3")) @@ -123,6 +125,8 @@ func testAccIosxrRouterOSPFConfig_all() string { config += ` default_information_originate_metric_type = 1` + "\n" config += ` auto_cost_reference_bandwidth = 100000` + "\n" config += ` auto_cost_disable = false` + "\n" + config += ` segment_routing_mpls = true` + "\n" + config += ` segment_routing_sr_prefer = true` + "\n" config += ` areas = [{` + "\n" config += ` area_id = "0"` + "\n" config += ` }]` + "\n" diff --git a/internal/provider/resource_iosxr_snmp_server.go b/internal/provider/resource_iosxr_snmp_server.go index a53875aa..2d507d8c 100644 --- a/internal/provider/resource_iosxr_snmp_server.go +++ b/internal/provider/resource_iosxr_snmp_server.go @@ -385,6 +385,48 @@ func (r *SNMPServerResource) Schema(ctx context.Context, req resource.SchemaRequ stringvalidator.RegexMatches(regexp.MustCompile(`(!.+)|([^!].+)`), ""), }, }, + "v3_auth_sha_encryption_aes": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Specifies an aes-128 ENCRYPTED authentication password").String, + Optional: true, + Validators: []validator.String{ + stringvalidator.LengthBetween(1, 1024), + stringvalidator.RegexMatches(regexp.MustCompile(`[0-9a-zA-Z]+`), ""), + }, + }, + "v3_auth_sha_encryption_default": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Specifies an default ENCRYPTED authentication password").String, + Optional: true, + Validators: []validator.String{ + stringvalidator.RegexMatches(regexp.MustCompile(`(!.+)|([^!].+)`), ""), + }, + }, + "v3_priv_aes_aes_128_encryption_default": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Specifies an default ENCRYPTED authentication password").String, + Optional: true, + Validators: []validator.String{ + stringvalidator.RegexMatches(regexp.MustCompile(`(!.+)|([^!].+)`), ""), + }, + }, + "v3_priv_aes_aes_128_encryption_aes": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Specifies an aes-128 ENCRYPTED authentication password").String, + Optional: true, + Validators: []validator.String{ + stringvalidator.LengthBetween(1, 1024), + stringvalidator.RegexMatches(regexp.MustCompile(`[0-9a-zA-Z]+`), ""), + }, + }, + "v3_ipv4": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Type of Access-list").String, + Optional: true, + Validators: []validator.String{ + stringvalidator.LengthBetween(1, 32), + stringvalidator.RegexMatches(regexp.MustCompile(`[\w\-\.:,_@#%$\+=\|;]+`), ""), + }, + }, + "v3_systemowner": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("System Owner permissions for MIB objects").String, + Optional: true, + }, }, }, }, diff --git a/internal/provider/resource_iosxr_snmp_server_test.go b/internal/provider/resource_iosxr_snmp_server_test.go index 97311118..0d673495 100644 --- a/internal/provider/resource_iosxr_snmp_server_test.go +++ b/internal/provider/resource_iosxr_snmp_server_test.go @@ -56,6 +56,8 @@ func TestAccIosxrSNMPServer(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("iosxr_snmp_server.test", "users.0.user_name", "USER1")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_snmp_server.test", "users.0.group_name", "GROUP1")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_snmp_server.test", "users.0.v3_auth_md5_encryption_aes", "073C05626E2A4841141D")) + checks = append(checks, resource.TestCheckResourceAttr("iosxr_snmp_server.test", "users.0.v3_ipv4", "ACL1")) + checks = append(checks, resource.TestCheckResourceAttr("iosxr_snmp_server.test", "users.0.v3_systemowner", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_snmp_server.test", "groups.0.group_name", "GROUP12")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_snmp_server.test", "groups.0.v3_priv", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxr_snmp_server.test", "groups.0.v3_read", "VIEW1")) @@ -131,6 +133,8 @@ func testAccIosxrSNMPServerConfig_all() string { config += ` user_name = "USER1"` + "\n" config += ` group_name = "GROUP1"` + "\n" config += ` v3_auth_md5_encryption_aes = "073C05626E2A4841141D"` + "\n" + config += ` v3_ipv4 = "ACL1"` + "\n" + config += ` v3_systemowner = true` + "\n" config += ` }]` + "\n" config += ` groups = [{` + "\n" config += ` group_name = "GROUP12"` + "\n" diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index 03c9a3d6..6916b084 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -17,6 +17,11 @@ description: |- - Make `set_overload_bit_on_startup_advertise_as_overloaded_time_to_advertise` and `on_startup_advertise_as_overloaded_time_to_advertise` attributes of `iosxr_router_isis` resource optional - Make `make_before_break_delay` attribute of `iosxr_mpls_ldp` resource optional - Make various `iosxr_key_chain` resource attributes optional +- Add `fast_reroute_per_prefix_ti_lfa` and `fast_reroute_node_protecting_srlg_disjoint` attributes to `iosxr_router_ospf_area_interface` resource and data source +- Add `prefix_sid_strict_spf` and `prefix_sid_algorithm` attributes to `iosxr_router_ospf_area_interface` resource and data source +- Add `segment_routing_mpls` and `segment_routing_sr_prefer` attributes to `iosxr_router_ospf` resource and data source +- Add `v3_sha_encryption` and `v3_aes_encryption` attributes to `iosxr_snmp_server` resource and data source + ## 0.3.0