diff --git a/docs/data-sources/interface_ospf.md b/docs/data-sources/interface_ospf.md index c244eb63f..2d1b8eff3 100644 --- a/docs/data-sources/interface_ospf.md +++ b/docs/data-sources/interface_ospf.md @@ -39,6 +39,7 @@ data "iosxe_interface_ospf" "example" { - `id` (String) The path of the retrieved object. - `message_digest_keys` (Attributes List) Message digest authentication password (key) (see [below for nested schema](#nestedatt--message_digest_keys)) - `mtu_ignore` (Boolean) Ignores the MTU in DBD packets +- `multi_area_ids` (Attributes List) Set the OSPF multi-area ID (see [below for nested schema](#nestedatt--multi_area_ids)) - `network_type_broadcast` (Boolean) Specify OSPF broadcast multi-access network - `network_type_non_broadcast` (Boolean) Specify OSPF NBMA network - `network_type_point_to_multipoint` (Boolean) Specify OSPF point-to-multipoint network @@ -57,6 +58,14 @@ Read-Only: - `md5_auth_type` (Number) Encryption type (0 for not yet encrypted, 7 for proprietary) + +### Nested Schema for `multi_area_ids` + +Read-Only: + +- `area_id` (String) OSPF multi-area ID + + ### Nested Schema for `process_ids` diff --git a/docs/data-sources/ospf.md b/docs/data-sources/ospf.md index 89572a2ff..30514eecf 100644 --- a/docs/data-sources/ospf.md +++ b/docs/data-sources/ospf.md @@ -39,11 +39,24 @@ data "iosxe_ospf" "example" { - `default_metric` (Number) Set metric of redistributed routes - `distance` (Number) Administrative distance - `domain_tag` (Number) OSPF domain-tag +- `fast_reroute_per_prefix_enable_prefix_priority` (String) Priority of prefixes to be protected - `id` (String) The path of the retrieved object. +- `log_adjacency_changes` (Boolean) Log changes in adjacency state +- `log_adjacency_changes_detail` (Boolean) Log all state changes +- `max_metric_router_lsa` (Boolean) Maximum metric in self-originated router-LSAs +- `max_metric_router_lsa_external_lsa_metric` (Number) +- `max_metric_router_lsa_include_stub` (Boolean) Set maximum metric for stub links in router-LSAs +- `max_metric_router_lsa_on_startup_time` (Number) +- `max_metric_router_lsa_on_startup_wait_for_bgp` (Boolean) Let BGP decide when to originate router-LSA with normal metric +- `max_metric_router_lsa_summary_lsa_metric` (Number) - `mpls_ldp_autoconfig` (Boolean) Configure LDP automatic configuration - `mpls_ldp_sync` (Boolean) Configure LDP-IGP Synchronization - `neighbors` (Attributes List) Specify a neighbor router (see [below for nested schema](#nestedatt--neighbors)) - `networks` (Attributes List) Enable routing on an IP network (see [below for nested schema](#nestedatt--networks)) +- `nsf_cisco` (Boolean) Cisco Non-stop forwarding +- `nsf_cisco_enforce_global` (Boolean) For the whole OSPF process +- `nsf_ietf` (Boolean) IETF graceful restart +- `nsf_ietf_restart_interval` (Number) Graceful restart interval - `passive_interface` (List of String) - `passive_interface_default` (Boolean) Suppress routing updates on all interfaces - `passive_interface_disable_five_gigabit_ethernets` (Attributes Set) (see [below for nested schema](#nestedatt--passive_interface_disable_five_gigabit_ethernets)) @@ -61,6 +74,8 @@ data "iosxe_ospf" "example" { - `passive_interface_disable_two_hundred_gigabit_ethernets` (Attributes Set) (see [below for nested schema](#nestedatt--passive_interface_disable_two_hundred_gigabit_ethernets)) - `passive_interface_disable_vlans` (Attributes Set) (see [below for nested schema](#nestedatt--passive_interface_disable_vlans)) - `priority` (Number) OSPF topology priority +- `redistribute_connected_subnets` (Boolean) Consider subnets for redistribution into OSPF (Will be removed in the future) +- `redistribute_static_subnets` (Boolean) Consider subnets for redistribution into OSPF (Will be removed in the future) - `router_id` (String) Configure router identifier. New router-id will take effect immediately (peers will reset) - `shutdown` (Boolean) Shutdown the OSPF protocol under the current instance - `summary_addresses` (Attributes List) Configure IP address summaries (see [below for nested schema](#nestedatt--summary_addresses)) diff --git a/docs/data-sources/ospf_vrf.md b/docs/data-sources/ospf_vrf.md index 02f94126d..681fddaff 100644 --- a/docs/data-sources/ospf_vrf.md +++ b/docs/data-sources/ospf_vrf.md @@ -42,10 +42,22 @@ data "iosxe_ospf_vrf" "example" { - `distance` (Number) Administrative distance - `domain_tag` (Number) OSPF domain-tag - `id` (String) The path of the retrieved object. +- `log_adjacency_changes` (Boolean) Log changes in adjacency state +- `log_adjacency_changes_detail` (Boolean) Log all state changes +- `max_metric_router_lsa` (Boolean) Maximum metric in self-originated router-LSAs +- `max_metric_router_lsa_external_lsa_metric` (Number) +- `max_metric_router_lsa_include_stub` (Boolean) Set maximum metric for stub links in router-LSAs +- `max_metric_router_lsa_on_startup_time` (Number) +- `max_metric_router_lsa_on_startup_wait_for_bgp` (Boolean) Let BGP decide when to originate router-LSA with normal metric +- `max_metric_router_lsa_summary_lsa_metric` (Number) - `mpls_ldp_autoconfig` (Boolean) Configure LDP automatic configuration - `mpls_ldp_sync` (Boolean) Configure LDP-IGP Synchronization - `neighbor` (Attributes List) Specify a neighbor router (see [below for nested schema](#nestedatt--neighbor)) - `network` (Attributes List) Enable routing on an IP network (see [below for nested schema](#nestedatt--network)) +- `nsf_cisco` (Boolean) Cisco Non-stop forwarding +- `nsf_cisco_enforce_global` (Boolean) For the whole OSPF process +- `nsf_ietf` (Boolean) IETF graceful restart +- `nsf_ietf_restart_interval` (Number) Graceful restart interval - `passive_interface` (List of String) - `passive_interface_default` (Boolean) Suppress routing updates on all interfaces - `passive_interface_disable_five_gigabit_ethernets` (Attributes Set) (see [below for nested schema](#nestedatt--passive_interface_disable_five_gigabit_ethernets)) @@ -63,6 +75,8 @@ data "iosxe_ospf_vrf" "example" { - `passive_interface_disable_two_hundred_gigabit_ethernets` (Attributes Set) (see [below for nested schema](#nestedatt--passive_interface_disable_two_hundred_gigabit_ethernets)) - `passive_interface_disable_vlans` (Attributes Set) (see [below for nested schema](#nestedatt--passive_interface_disable_vlans)) - `priority` (Number) OSPF topology priority +- `redistribute_connected_subnets` (Boolean) Consider subnets for redistribution into OSPF (Will be removed in the future) +- `redistribute_static_subnets` (Boolean) Consider subnets for redistribution into OSPF (Will be removed in the future) - `router_id` (String) Configure router identifier. New router-id will take effect immediately (peers will reset) - `shutdown` (Boolean) Shutdown the OSPF protocol under the current instance - `summary_address` (Attributes List) Configure IP address summaries (see [below for nested schema](#nestedatt--summary_address)) diff --git a/docs/resources/interface_ospf.md b/docs/resources/interface_ospf.md index c2473831b..ea3f33a51 100644 --- a/docs/resources/interface_ospf.md +++ b/docs/resources/interface_ospf.md @@ -36,6 +36,11 @@ resource "iosxe_interface_ospf" "example" { ] } ] + multi_area_ids = [ + { + area_id = "10" + } + ] message_digest_keys = [ { id = 1 @@ -68,6 +73,7 @@ resource "iosxe_interface_ospf" "example" { - Range: `1`-`65535` - `message_digest_keys` (Attributes List) Message digest authentication password (key) (see [below for nested schema](#nestedatt--message_digest_keys)) - `mtu_ignore` (Boolean) Ignores the MTU in DBD packets +- `multi_area_ids` (Attributes List) Set the OSPF multi-area ID (see [below for nested schema](#nestedatt--multi_area_ids)) - `network_type_broadcast` (Boolean) Specify OSPF broadcast multi-access network - `network_type_non_broadcast` (Boolean) Specify OSPF NBMA network - `network_type_point_to_multipoint` (Boolean) Specify OSPF point-to-multipoint network @@ -97,6 +103,14 @@ Optional: - Range: `0`-`7` + +### Nested Schema for `multi_area_ids` + +Required: + +- `area_id` (String) OSPF multi-area ID + + ### Nested Schema for `process_ids` diff --git a/docs/resources/ospf.md b/docs/resources/ospf.md index e37cb77c9..2275f23d1 100644 --- a/docs/resources/ospf.md +++ b/docs/resources/ospf.md @@ -56,8 +56,23 @@ resource "iosxe_ospf" "example" { nssa_no_redistribution = true } ] - auto_cost_reference_bandwidth = 40000 - passive_interface_default = true + auto_cost_reference_bandwidth = 40000 + passive_interface_default = true + log_adjacency_changes = true + log_adjacency_changes_detail = true + nsf_cisco = true + nsf_cisco_enforce_global = true + nsf_ietf = true + nsf_ietf_restart_interval = 120 + max_metric_router_lsa = true + max_metric_router_lsa_summary_lsa_metric = 16711680 + max_metric_router_lsa_external_lsa_metric = 16711680 + max_metric_router_lsa_include_stub = true + max_metric_router_lsa_on_startup_time = 60 + max_metric_router_lsa_on_startup_wait_for_bgp = true + fast_reroute_per_prefix_enable_prefix_priority = "high" + redistribute_static_subnets = true + redistribute_connected_subnets = true } ``` @@ -86,10 +101,25 @@ resource "iosxe_ospf" "example" { - Range: `1`-`255` - `domain_tag` (Number) OSPF domain-tag - Range: `1`-`4294967295` +- `fast_reroute_per_prefix_enable_prefix_priority` (String) Priority of prefixes to be protected + - Choices: `high`, `low` +- `log_adjacency_changes` (Boolean) Log changes in adjacency state +- `log_adjacency_changes_detail` (Boolean) Log all state changes +- `max_metric_router_lsa` (Boolean) Maximum metric in self-originated router-LSAs +- `max_metric_router_lsa_external_lsa_metric` (Number) - Range: `1`-`16777214` +- `max_metric_router_lsa_include_stub` (Boolean) Set maximum metric for stub links in router-LSAs +- `max_metric_router_lsa_on_startup_time` (Number) - Range: `5`-`86400` +- `max_metric_router_lsa_on_startup_wait_for_bgp` (Boolean) Let BGP decide when to originate router-LSA with normal metric +- `max_metric_router_lsa_summary_lsa_metric` (Number) - Range: `1`-`16777214` - `mpls_ldp_autoconfig` (Boolean) Configure LDP automatic configuration - `mpls_ldp_sync` (Boolean) Configure LDP-IGP Synchronization - `neighbors` (Attributes List) Specify a neighbor router (see [below for nested schema](#nestedatt--neighbors)) - `networks` (Attributes List) Enable routing on an IP network (see [below for nested schema](#nestedatt--networks)) +- `nsf_cisco` (Boolean) Cisco Non-stop forwarding +- `nsf_cisco_enforce_global` (Boolean) For the whole OSPF process +- `nsf_ietf` (Boolean) IETF graceful restart +- `nsf_ietf_restart_interval` (Number) Graceful restart interval + - Range: `1`-`1800` - `passive_interface` (List of String) - `passive_interface_default` (Boolean) Suppress routing updates on all interfaces - `passive_interface_disable_five_gigabit_ethernets` (Attributes Set) (see [below for nested schema](#nestedatt--passive_interface_disable_five_gigabit_ethernets)) @@ -108,6 +138,8 @@ resource "iosxe_ospf" "example" { - `passive_interface_disable_vlans` (Attributes Set) (see [below for nested schema](#nestedatt--passive_interface_disable_vlans)) - `priority` (Number) OSPF topology priority - Range: `0`-`127` +- `redistribute_connected_subnets` (Boolean) Consider subnets for redistribution into OSPF (Will be removed in the future) +- `redistribute_static_subnets` (Boolean) Consider subnets for redistribution into OSPF (Will be removed in the future) - `router_id` (String) Configure router identifier. New router-id will take effect immediately (peers will reset) - `shutdown` (Boolean) Shutdown the OSPF protocol under the current instance - `summary_addresses` (Attributes List) Configure IP address summaries (see [below for nested schema](#nestedatt--summary_addresses)) diff --git a/docs/resources/ospf_vrf.md b/docs/resources/ospf_vrf.md index 7785b5c0c..b1cb026af 100644 --- a/docs/resources/ospf_vrf.md +++ b/docs/resources/ospf_vrf.md @@ -14,14 +14,28 @@ This resource can manage the OSPF VRF configuration. ```terraform resource "iosxe_ospf_vrf" "example" { - process_id = 2 - vrf = "VRF1" - bfd_all_interfaces = true - default_information_originate = true - default_information_originate_always = true - default_metric = 21 - distance = 120 - domain_tag = 10 + process_id = 2 + vrf = "VRF1" + bfd_all_interfaces = true + default_information_originate = true + default_information_originate_always = true + default_metric = 21 + distance = 120 + domain_tag = 10 + log_adjacency_changes = true + log_adjacency_changes_detail = true + nsf_cisco = true + nsf_cisco_enforce_global = true + nsf_ietf = true + nsf_ietf_restart_interval = 120 + max_metric_router_lsa = true + max_metric_router_lsa_summary_lsa_metric = 16711680 + max_metric_router_lsa_external_lsa_metric = 16711680 + max_metric_router_lsa_include_stub = true + max_metric_router_lsa_on_startup_time = 60 + max_metric_router_lsa_on_startup_wait_for_bgp = true + redistribute_static_subnets = true + redistribute_connected_subnets = true neighbor = [ { ip = "2.2.2.2" @@ -88,10 +102,23 @@ resource "iosxe_ospf_vrf" "example" { - Range: `1`-`255` - `domain_tag` (Number) OSPF domain-tag - Range: `1`-`4294967295` +- `log_adjacency_changes` (Boolean) Log changes in adjacency state +- `log_adjacency_changes_detail` (Boolean) Log all state changes +- `max_metric_router_lsa` (Boolean) Maximum metric in self-originated router-LSAs +- `max_metric_router_lsa_external_lsa_metric` (Number) - Range: `1`-`16777214` +- `max_metric_router_lsa_include_stub` (Boolean) Set maximum metric for stub links in router-LSAs +- `max_metric_router_lsa_on_startup_time` (Number) - Range: `5`-`86400` +- `max_metric_router_lsa_on_startup_wait_for_bgp` (Boolean) Let BGP decide when to originate router-LSA with normal metric +- `max_metric_router_lsa_summary_lsa_metric` (Number) - Range: `1`-`16777214` - `mpls_ldp_autoconfig` (Boolean) Configure LDP automatic configuration - `mpls_ldp_sync` (Boolean) Configure LDP-IGP Synchronization - `neighbor` (Attributes List) Specify a neighbor router (see [below for nested schema](#nestedatt--neighbor)) - `network` (Attributes List) Enable routing on an IP network (see [below for nested schema](#nestedatt--network)) +- `nsf_cisco` (Boolean) Cisco Non-stop forwarding +- `nsf_cisco_enforce_global` (Boolean) For the whole OSPF process +- `nsf_ietf` (Boolean) IETF graceful restart +- `nsf_ietf_restart_interval` (Number) Graceful restart interval + - Range: `1`-`1800` - `passive_interface` (List of String) - `passive_interface_default` (Boolean) Suppress routing updates on all interfaces - `passive_interface_disable_five_gigabit_ethernets` (Attributes Set) (see [below for nested schema](#nestedatt--passive_interface_disable_five_gigabit_ethernets)) @@ -110,6 +137,8 @@ resource "iosxe_ospf_vrf" "example" { - `passive_interface_disable_vlans` (Attributes Set) (see [below for nested schema](#nestedatt--passive_interface_disable_vlans)) - `priority` (Number) OSPF topology priority - Range: `0`-`127` +- `redistribute_connected_subnets` (Boolean) Consider subnets for redistribution into OSPF (Will be removed in the future) +- `redistribute_static_subnets` (Boolean) Consider subnets for redistribution into OSPF (Will be removed in the future) - `router_id` (String) Configure router identifier. New router-id will take effect immediately (peers will reset) - `shutdown` (Boolean) Shutdown the OSPF protocol under the current instance - `summary_address` (Attributes List) Configure IP address summaries (see [below for nested schema](#nestedatt--summary_address)) diff --git a/examples/resources/iosxe_interface_ospf/resource.tf b/examples/resources/iosxe_interface_ospf/resource.tf index bbd0bb4f6..8d874257e 100644 --- a/examples/resources/iosxe_interface_ospf/resource.tf +++ b/examples/resources/iosxe_interface_ospf/resource.tf @@ -21,6 +21,11 @@ resource "iosxe_interface_ospf" "example" { ] } ] + multi_area_ids = [ + { + area_id = "10" + } + ] message_digest_keys = [ { id = 1 diff --git a/examples/resources/iosxe_ospf/resource.tf b/examples/resources/iosxe_ospf/resource.tf index 7655fa1d1..416688337 100644 --- a/examples/resources/iosxe_ospf/resource.tf +++ b/examples/resources/iosxe_ospf/resource.tf @@ -41,6 +41,21 @@ resource "iosxe_ospf" "example" { nssa_no_redistribution = true } ] - auto_cost_reference_bandwidth = 40000 - passive_interface_default = true + auto_cost_reference_bandwidth = 40000 + passive_interface_default = true + log_adjacency_changes = true + log_adjacency_changes_detail = true + nsf_cisco = true + nsf_cisco_enforce_global = true + nsf_ietf = true + nsf_ietf_restart_interval = 120 + max_metric_router_lsa = true + max_metric_router_lsa_summary_lsa_metric = 16711680 + max_metric_router_lsa_external_lsa_metric = 16711680 + max_metric_router_lsa_include_stub = true + max_metric_router_lsa_on_startup_time = 60 + max_metric_router_lsa_on_startup_wait_for_bgp = true + fast_reroute_per_prefix_enable_prefix_priority = "high" + redistribute_static_subnets = true + redistribute_connected_subnets = true } diff --git a/examples/resources/iosxe_ospf_vrf/resource.tf b/examples/resources/iosxe_ospf_vrf/resource.tf index ca1e5e875..ef003de89 100644 --- a/examples/resources/iosxe_ospf_vrf/resource.tf +++ b/examples/resources/iosxe_ospf_vrf/resource.tf @@ -1,12 +1,26 @@ resource "iosxe_ospf_vrf" "example" { - process_id = 2 - vrf = "VRF1" - bfd_all_interfaces = true - default_information_originate = true - default_information_originate_always = true - default_metric = 21 - distance = 120 - domain_tag = 10 + process_id = 2 + vrf = "VRF1" + bfd_all_interfaces = true + default_information_originate = true + default_information_originate_always = true + default_metric = 21 + distance = 120 + domain_tag = 10 + log_adjacency_changes = true + log_adjacency_changes_detail = true + nsf_cisco = true + nsf_cisco_enforce_global = true + nsf_ietf = true + nsf_ietf_restart_interval = 120 + max_metric_router_lsa = true + max_metric_router_lsa_summary_lsa_metric = 16711680 + max_metric_router_lsa_external_lsa_metric = 16711680 + max_metric_router_lsa_include_stub = true + max_metric_router_lsa_on_startup_time = 60 + max_metric_router_lsa_on_startup_wait_for_bgp = true + redistribute_static_subnets = true + redistribute_connected_subnets = true neighbor = [ { ip = "2.2.2.2" diff --git a/gen/definitions/interface_ospf.yaml b/gen/definitions/interface_ospf.yaml index 6c33b57e2..dee60a821 100644 --- a/gen/definitions/interface_ospf.yaml +++ b/gen/definitions/interface_ospf.yaml @@ -71,6 +71,14 @@ attributes: - yang_name: area-id id: true example: 0 + - yang_name: multi-area/multi-area-id + tf_name: multi_area_ids + type: List + attributes: + - yang_name: area-id + id: true + type: String + example: "10" - yang_name: message-digest-key tf_name: message_digest_keys type: List diff --git a/gen/definitions/ospf.yaml b/gen/definitions/ospf.yaml index 19dac80bc..09e02e8cf 100644 --- a/gen/definitions/ospf.yaml +++ b/gen/definitions/ospf.yaml @@ -99,6 +99,52 @@ attributes: tf_name: passive_interface example: Loopback0 exclude_test: true + - yang_name: log-adjacency-changes-choice/log-adjacency-changes/log-adjacency-changes + xpath: log-adjacency-changes + tf_name: log_adjacency_changes + example: true + - yang_name: log-adjacency-changes-choice/log-adjacency-changes-detail/log-adjacency-changes-detail/log-adjacency-changes/detail + xpath: log-adjacency-changes-detail/log-adjacency-changes/detail + tf_name: log_adjacency_changes_detail + example: true + - yang_name: nsf/nsf-cisco-ietf/nsf-cisco/nsf-cisco + xpath: nsf/nsf-cisco + tf_name: nsf_cisco + example: true + - yang_name: nsf/nsf-cisco-ietf/nsf-cisco/nsf-cisco/enforce/global + xpath: nsf/nsf-cisco/enforce/global + tf_name: nsf_cisco_enforce_global + example: true + - yang_name: nsf/nsf-cisco-ietf/nsf-ietf/nsf-ietf + xpath: nsf/nsf-ietf + tf_name: nsf_ietf + example: true + - yang_name: nsf/nsf-cisco-ietf/nsf-ietf/nsf-ietf/restart-interval + xpath: nsf/nsf-ietf/restart-interval + tf_name: nsf_ietf_restart_interval + example: 120 + - yang_name: max-metric/router-lsa + example: true + - yang_name: max-metric/router-lsa/summary-lsa/metric + example: 16711680 + - yang_name: max-metric/router-lsa/external-lsa/metric + example: 16711680 + - yang_name: max-metric/router-lsa/include-stub + example: true + - yang_name: max-metric/router-lsa/on-startup/time-wait-for-bgp-choice/time/time + xpath: max-metric/router-lsa/on-startup/time + tf_name: max_metric_router_lsa_on_startup_time + example: 60 + - yang_name: max-metric/router-lsa/on-startup/time-wait-for-bgp-choice/wait-for-bgp/wait-for-bgp + xpath: max-metric/router-lsa/on-startup/wait-for-bgp + tf_name: max_metric_router_lsa_on_startup_wait_for_bgp + example: true + - yang_name: fast-reroute/per-prefix/enable/prefix-priority + example: high + - yang_name: redistribute/static/subnets + example: true + - yang_name: redistribute/connected/subnets + example: true - yang_name: passive-interface-config/disable-interface/GigabitEthernet tf_name: passive_interface_disable_gigabit_ethernets type: Set diff --git a/gen/definitions/ospf_vrf.yaml b/gen/definitions/ospf_vrf.yaml index 4737dd05e..a03f20099 100644 --- a/gen/definitions/ospf_vrf.yaml +++ b/gen/definitions/ospf_vrf.yaml @@ -21,6 +21,50 @@ attributes: example: 120 - yang_name: domain-tag example: 10 + - yang_name: log-adjacency-changes-choice/log-adjacency-changes/log-adjacency-changes + xpath: log-adjacency-changes + tf_name: log_adjacency_changes + example: true + - yang_name: log-adjacency-changes-choice/log-adjacency-changes-detail/log-adjacency-changes-detail/log-adjacency-changes/detail + xpath: log-adjacency-changes-detail/log-adjacency-changes/detail + tf_name: log_adjacency_changes_detail + example: true + - yang_name: nsf/nsf-cisco-ietf/nsf-cisco/nsf-cisco + xpath: nsf/nsf-cisco + tf_name: nsf_cisco + example: true + - yang_name: nsf/nsf-cisco-ietf/nsf-cisco/nsf-cisco/enforce/global + xpath: nsf/nsf-cisco/enforce/global + tf_name: nsf_cisco_enforce_global + example: true + - yang_name: nsf/nsf-cisco-ietf/nsf-ietf/nsf-ietf + xpath: nsf/nsf-ietf + tf_name: nsf_ietf + example: true + - yang_name: nsf/nsf-cisco-ietf/nsf-ietf/nsf-ietf/restart-interval + xpath: nsf/nsf-ietf/restart-interval + tf_name: nsf_ietf_restart_interval + example: 120 + - yang_name: max-metric/router-lsa + example: true + - yang_name: max-metric/router-lsa/summary-lsa/metric + example: 16711680 + - yang_name: max-metric/router-lsa/external-lsa/metric + example: 16711680 + - yang_name: max-metric/router-lsa/include-stub + example: true + - yang_name: max-metric/router-lsa/on-startup/time-wait-for-bgp-choice/time/time + xpath: max-metric/router-lsa/on-startup/time + tf_name: max_metric_router_lsa_on_startup_time + example: 60 + - yang_name: max-metric/router-lsa/on-startup/time-wait-for-bgp-choice/wait-for-bgp/wait-for-bgp + xpath: max-metric/router-lsa/on-startup/wait-for-bgp + tf_name: max_metric_router_lsa_on_startup_wait_for_bgp + example: true + - yang_name: redistribute/static/subnets + example: true + - yang_name: redistribute/connected/subnets + example: true - yang_name: mpls/ldp/autoconfig exclude_test: true example: true diff --git a/internal/provider/data_source_iosxe_interface_ospf.go b/internal/provider/data_source_iosxe_interface_ospf.go index 451d63edc..73cac194d 100644 --- a/internal/provider/data_source_iosxe_interface_ospf.go +++ b/internal/provider/data_source_iosxe_interface_ospf.go @@ -139,6 +139,18 @@ func (d *InterfaceOSPFDataSource) Schema(ctx context.Context, req datasource.Sch }, }, }, + "multi_area_ids": schema.ListNestedAttribute{ + MarkdownDescription: "Set the OSPF multi-area ID", + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "area_id": schema.StringAttribute{ + MarkdownDescription: "OSPF multi-area ID", + Computed: true, + }, + }, + }, + }, "message_digest_keys": schema.ListNestedAttribute{ MarkdownDescription: "Message digest authentication password (key)", Computed: true, diff --git a/internal/provider/data_source_iosxe_interface_ospf_test.go b/internal/provider/data_source_iosxe_interface_ospf_test.go index 6dd20b07c..695cd45c4 100644 --- a/internal/provider/data_source_iosxe_interface_ospf_test.go +++ b/internal/provider/data_source_iosxe_interface_ospf_test.go @@ -44,6 +44,7 @@ func TestAccDataSourceIosxeInterfaceOSPF(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_interface_ospf.test", "ttl_security_hops", "2")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_interface_ospf.test", "process_ids.0.id", "1")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_interface_ospf.test", "process_ids.0.areas.0.area_id", "0")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_interface_ospf.test", "multi_area_ids.0.area_id", "10")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_interface_ospf.test", "message_digest_keys.0.id", "1")) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -102,6 +103,9 @@ func testAccDataSourceIosxeInterfaceOSPFConfig() string { config += ` area_id = "0"` + "\n" config += ` }]` + "\n" config += ` }]` + "\n" + config += ` multi_area_ids = [{` + "\n" + config += ` area_id = "10"` + "\n" + config += ` }]` + "\n" config += ` message_digest_keys = [{` + "\n" config += ` id = 1` + "\n" config += ` md5_auth_key = "mykey"` + "\n" diff --git a/internal/provider/data_source_iosxe_ospf.go b/internal/provider/data_source_iosxe_ospf.go index 729615530..a8639f7f9 100644 --- a/internal/provider/data_source_iosxe_ospf.go +++ b/internal/provider/data_source_iosxe_ospf.go @@ -224,6 +224,66 @@ func (d *OSPFDataSource) Schema(ctx context.Context, req datasource.SchemaReques ElementType: types.StringType, Computed: true, }, + "log_adjacency_changes": schema.BoolAttribute{ + MarkdownDescription: "Log changes in adjacency state", + Computed: true, + }, + "log_adjacency_changes_detail": schema.BoolAttribute{ + MarkdownDescription: "Log all state changes", + Computed: true, + }, + "nsf_cisco": schema.BoolAttribute{ + MarkdownDescription: "Cisco Non-stop forwarding", + Computed: true, + }, + "nsf_cisco_enforce_global": schema.BoolAttribute{ + MarkdownDescription: "For the whole OSPF process", + Computed: true, + }, + "nsf_ietf": schema.BoolAttribute{ + MarkdownDescription: "IETF graceful restart", + Computed: true, + }, + "nsf_ietf_restart_interval": schema.Int64Attribute{ + MarkdownDescription: "Graceful restart interval", + Computed: true, + }, + "max_metric_router_lsa": schema.BoolAttribute{ + MarkdownDescription: "Maximum metric in self-originated router-LSAs", + Computed: true, + }, + "max_metric_router_lsa_summary_lsa_metric": schema.Int64Attribute{ + MarkdownDescription: "", + Computed: true, + }, + "max_metric_router_lsa_external_lsa_metric": schema.Int64Attribute{ + MarkdownDescription: "", + Computed: true, + }, + "max_metric_router_lsa_include_stub": schema.BoolAttribute{ + MarkdownDescription: "Set maximum metric for stub links in router-LSAs", + Computed: true, + }, + "max_metric_router_lsa_on_startup_time": schema.Int64Attribute{ + MarkdownDescription: "", + Computed: true, + }, + "max_metric_router_lsa_on_startup_wait_for_bgp": schema.BoolAttribute{ + MarkdownDescription: "Let BGP decide when to originate router-LSA with normal metric", + Computed: true, + }, + "fast_reroute_per_prefix_enable_prefix_priority": schema.StringAttribute{ + MarkdownDescription: "Priority of prefixes to be protected", + Computed: true, + }, + "redistribute_static_subnets": schema.BoolAttribute{ + MarkdownDescription: "Consider subnets for redistribution into OSPF (Will be removed in the future)", + Computed: true, + }, + "redistribute_connected_subnets": schema.BoolAttribute{ + MarkdownDescription: "Consider subnets for redistribution into OSPF (Will be removed in the future)", + Computed: true, + }, "passive_interface_disable_gigabit_ethernets": schema.SetNestedAttribute{ MarkdownDescription: "", Computed: true, diff --git a/internal/provider/data_source_iosxe_ospf_test.go b/internal/provider/data_source_iosxe_ospf_test.go index 2b4cd4cc1..114ab4e84 100644 --- a/internal/provider/data_source_iosxe_ospf_test.go +++ b/internal/provider/data_source_iosxe_ospf_test.go @@ -59,6 +59,21 @@ func TestAccDataSourceIosxeOSPF(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "areas.0.nssa_no_redistribution", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "auto_cost_reference_bandwidth", "40000")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "passive_interface_default", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "log_adjacency_changes", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "log_adjacency_changes_detail", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "nsf_cisco", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "nsf_cisco_enforce_global", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "nsf_ietf", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "nsf_ietf_restart_interval", "120")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "max_metric_router_lsa", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "max_metric_router_lsa_summary_lsa_metric", "16711680")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "max_metric_router_lsa_external_lsa_metric", "16711680")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "max_metric_router_lsa_include_stub", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "max_metric_router_lsa_on_startup_time", "60")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "max_metric_router_lsa_on_startup_wait_for_bgp", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "fast_reroute_per_prefix_enable_prefix_priority", "high")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "redistribute_static_subnets", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf.test", "redistribute_connected_subnets", "true")) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, @@ -117,6 +132,21 @@ func testAccDataSourceIosxeOSPFConfig() string { config += ` }]` + "\n" config += ` auto_cost_reference_bandwidth = 40000` + "\n" config += ` passive_interface_default = true` + "\n" + config += ` log_adjacency_changes = true` + "\n" + config += ` log_adjacency_changes_detail = true` + "\n" + config += ` nsf_cisco = true` + "\n" + config += ` nsf_cisco_enforce_global = true` + "\n" + config += ` nsf_ietf = true` + "\n" + config += ` nsf_ietf_restart_interval = 120` + "\n" + config += ` max_metric_router_lsa = true` + "\n" + config += ` max_metric_router_lsa_summary_lsa_metric = 16711680` + "\n" + config += ` max_metric_router_lsa_external_lsa_metric = 16711680` + "\n" + config += ` max_metric_router_lsa_include_stub = true` + "\n" + config += ` max_metric_router_lsa_on_startup_time = 60` + "\n" + config += ` max_metric_router_lsa_on_startup_wait_for_bgp = true` + "\n" + config += ` fast_reroute_per_prefix_enable_prefix_priority = "high"` + "\n" + config += ` redistribute_static_subnets = true` + "\n" + config += ` redistribute_connected_subnets = true` + "\n" config += `}` + "\n" config += ` diff --git a/internal/provider/data_source_iosxe_ospf_vrf.go b/internal/provider/data_source_iosxe_ospf_vrf.go index 8ffea9c4b..c8385aa60 100644 --- a/internal/provider/data_source_iosxe_ospf_vrf.go +++ b/internal/provider/data_source_iosxe_ospf_vrf.go @@ -99,6 +99,62 @@ func (d *OSPFVRFDataSource) Schema(ctx context.Context, req datasource.SchemaReq MarkdownDescription: "OSPF domain-tag", Computed: true, }, + "log_adjacency_changes": schema.BoolAttribute{ + MarkdownDescription: "Log changes in adjacency state", + Computed: true, + }, + "log_adjacency_changes_detail": schema.BoolAttribute{ + MarkdownDescription: "Log all state changes", + Computed: true, + }, + "nsf_cisco": schema.BoolAttribute{ + MarkdownDescription: "Cisco Non-stop forwarding", + Computed: true, + }, + "nsf_cisco_enforce_global": schema.BoolAttribute{ + MarkdownDescription: "For the whole OSPF process", + Computed: true, + }, + "nsf_ietf": schema.BoolAttribute{ + MarkdownDescription: "IETF graceful restart", + Computed: true, + }, + "nsf_ietf_restart_interval": schema.Int64Attribute{ + MarkdownDescription: "Graceful restart interval", + Computed: true, + }, + "max_metric_router_lsa": schema.BoolAttribute{ + MarkdownDescription: "Maximum metric in self-originated router-LSAs", + Computed: true, + }, + "max_metric_router_lsa_summary_lsa_metric": schema.Int64Attribute{ + MarkdownDescription: "", + Computed: true, + }, + "max_metric_router_lsa_external_lsa_metric": schema.Int64Attribute{ + MarkdownDescription: "", + Computed: true, + }, + "max_metric_router_lsa_include_stub": schema.BoolAttribute{ + MarkdownDescription: "Set maximum metric for stub links in router-LSAs", + Computed: true, + }, + "max_metric_router_lsa_on_startup_time": schema.Int64Attribute{ + MarkdownDescription: "", + Computed: true, + }, + "max_metric_router_lsa_on_startup_wait_for_bgp": schema.BoolAttribute{ + MarkdownDescription: "Let BGP decide when to originate router-LSA with normal metric", + Computed: true, + }, + "redistribute_static_subnets": schema.BoolAttribute{ + MarkdownDescription: "Consider subnets for redistribution into OSPF (Will be removed in the future)", + Computed: true, + }, + "redistribute_connected_subnets": schema.BoolAttribute{ + MarkdownDescription: "Consider subnets for redistribution into OSPF (Will be removed in the future)", + Computed: true, + }, "mpls_ldp_autoconfig": schema.BoolAttribute{ MarkdownDescription: "Configure LDP automatic configuration", Computed: true, diff --git a/internal/provider/data_source_iosxe_ospf_vrf_test.go b/internal/provider/data_source_iosxe_ospf_vrf_test.go index d135c4608..cb398967f 100644 --- a/internal/provider/data_source_iosxe_ospf_vrf_test.go +++ b/internal/provider/data_source_iosxe_ospf_vrf_test.go @@ -38,6 +38,20 @@ func TestAccDataSourceIosxeOSPFVRF(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "default_metric", "21")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "distance", "120")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "domain_tag", "10")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "log_adjacency_changes", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "log_adjacency_changes_detail", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "nsf_cisco", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "nsf_cisco_enforce_global", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "nsf_ietf", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "nsf_ietf_restart_interval", "120")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "max_metric_router_lsa", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "max_metric_router_lsa_summary_lsa_metric", "16711680")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "max_metric_router_lsa_external_lsa_metric", "16711680")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "max_metric_router_lsa_include_stub", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "max_metric_router_lsa_on_startup_time", "60")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "max_metric_router_lsa_on_startup_wait_for_bgp", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "redistribute_static_subnets", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "redistribute_connected_subnets", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "neighbor.0.ip", "2.2.2.2")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "neighbor.0.priority", "10")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_ospf_vrf.test", "neighbor.0.cost", "100")) @@ -101,6 +115,20 @@ func testAccDataSourceIosxeOSPFVRFConfig() string { config += ` default_metric = 21` + "\n" config += ` distance = 120` + "\n" config += ` domain_tag = 10` + "\n" + config += ` log_adjacency_changes = true` + "\n" + config += ` log_adjacency_changes_detail = true` + "\n" + config += ` nsf_cisco = true` + "\n" + config += ` nsf_cisco_enforce_global = true` + "\n" + config += ` nsf_ietf = true` + "\n" + config += ` nsf_ietf_restart_interval = 120` + "\n" + config += ` max_metric_router_lsa = true` + "\n" + config += ` max_metric_router_lsa_summary_lsa_metric = 16711680` + "\n" + config += ` max_metric_router_lsa_external_lsa_metric = 16711680` + "\n" + config += ` max_metric_router_lsa_include_stub = true` + "\n" + config += ` max_metric_router_lsa_on_startup_time = 60` + "\n" + config += ` max_metric_router_lsa_on_startup_wait_for_bgp = true` + "\n" + config += ` redistribute_static_subnets = true` + "\n" + config += ` redistribute_connected_subnets = true` + "\n" config += ` neighbor = [{` + "\n" config += ` ip = "2.2.2.2"` + "\n" config += ` priority = 10` + "\n" diff --git a/internal/provider/model_iosxe_interface_ospf.go b/internal/provider/model_iosxe_interface_ospf.go index 00445af0d..e80afb206 100644 --- a/internal/provider/model_iosxe_interface_ospf.go +++ b/internal/provider/model_iosxe_interface_ospf.go @@ -55,6 +55,7 @@ type InterfaceOSPF struct { Priority types.Int64 `tfsdk:"priority"` TtlSecurityHops types.Int64 `tfsdk:"ttl_security_hops"` ProcessIds []InterfaceOSPFProcessIds `tfsdk:"process_ids"` + MultiAreaIds []InterfaceOSPFMultiAreaIds `tfsdk:"multi_area_ids"` MessageDigestKeys []InterfaceOSPFMessageDigestKeys `tfsdk:"message_digest_keys"` } @@ -74,12 +75,16 @@ type InterfaceOSPFData struct { Priority types.Int64 `tfsdk:"priority"` TtlSecurityHops types.Int64 `tfsdk:"ttl_security_hops"` ProcessIds []InterfaceOSPFProcessIds `tfsdk:"process_ids"` + MultiAreaIds []InterfaceOSPFMultiAreaIds `tfsdk:"multi_area_ids"` MessageDigestKeys []InterfaceOSPFMessageDigestKeys `tfsdk:"message_digest_keys"` } type InterfaceOSPFProcessIds struct { Id types.Int64 `tfsdk:"id"` Areas []InterfaceOSPFProcessIdsAreas `tfsdk:"areas"` } +type InterfaceOSPFMultiAreaIds struct { + AreaId types.String `tfsdk:"area_id"` +} type InterfaceOSPFMessageDigestKeys struct { Id types.Int64 `tfsdk:"id"` Md5AuthKey types.String `tfsdk:"md5_auth_key"` @@ -172,6 +177,14 @@ func (data InterfaceOSPF) toBody(ctx context.Context) string { } } } + if len(data.MultiAreaIds) > 0 { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"multi-area.multi-area-id", []interface{}{}) + for index, item := range data.MultiAreaIds { + if !item.AreaId.IsNull() && !item.AreaId.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"multi-area.multi-area-id"+"."+strconv.Itoa(index)+"."+"area-id", item.AreaId.ValueString()) + } + } + } if len(data.MessageDigestKeys) > 0 { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"message-digest-key", []interface{}{}) for index, item := range data.MessageDigestKeys { @@ -324,6 +337,35 @@ func (data *InterfaceOSPF) updateFromBody(ctx context.Context, res gjson.Result) } } } + for i := range data.MultiAreaIds { + keys := [...]string{"area-id"} + keyValues := [...]string{data.MultiAreaIds[i].AreaId.ValueString()} + + var r gjson.Result + res.Get(prefix + "multi-area.multi-area-id").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("area-id"); value.Exists() && !data.MultiAreaIds[i].AreaId.IsNull() { + data.MultiAreaIds[i].AreaId = types.StringValue(value.String()) + } else { + data.MultiAreaIds[i].AreaId = types.StringNull() + } + } for i := range data.MessageDigestKeys { keys := [...]string{"id"} keyValues := [...]string{strconv.FormatInt(data.MessageDigestKeys[i].Id.ValueInt64(), 10)} @@ -426,6 +468,17 @@ func (data *InterfaceOSPF) fromBody(ctx context.Context, res gjson.Result) { return true }) } + if value := res.Get(prefix + "multi-area.multi-area-id"); value.Exists() { + data.MultiAreaIds = make([]InterfaceOSPFMultiAreaIds, 0) + value.ForEach(func(k, v gjson.Result) bool { + item := InterfaceOSPFMultiAreaIds{} + if cValue := v.Get("area-id"); cValue.Exists() { + item.AreaId = types.StringValue(cValue.String()) + } + data.MultiAreaIds = append(data.MultiAreaIds, item) + return true + }) + } if value := res.Get(prefix + "message-digest-key"); value.Exists() { data.MessageDigestKeys = make([]InterfaceOSPFMessageDigestKeys, 0) value.ForEach(func(k, v gjson.Result) bool { @@ -516,6 +569,17 @@ func (data *InterfaceOSPFData) fromBody(ctx context.Context, res gjson.Result) { return true }) } + if value := res.Get(prefix + "multi-area.multi-area-id"); value.Exists() { + data.MultiAreaIds = make([]InterfaceOSPFMultiAreaIds, 0) + value.ForEach(func(k, v gjson.Result) bool { + item := InterfaceOSPFMultiAreaIds{} + if cValue := v.Get("area-id"); cValue.Exists() { + item.AreaId = types.StringValue(cValue.String()) + } + data.MultiAreaIds = append(data.MultiAreaIds, item) + return true + }) + } if value := res.Get(prefix + "message-digest-key"); value.Exists() { data.MessageDigestKeys = make([]InterfaceOSPFMessageDigestKeys, 0) value.ForEach(func(k, v gjson.Result) bool { @@ -569,6 +633,31 @@ func (data *InterfaceOSPF) getDeletedItems(ctx context.Context, state InterfaceO deletedItems = append(deletedItems, fmt.Sprintf("%v/message-digest-key=%v", state.getPath(), strings.Join(stateKeyValues[:], ","))) } } + for i := range state.MultiAreaIds { + stateKeyValues := [...]string{state.MultiAreaIds[i].AreaId.ValueString()} + + emptyKeys := true + if !reflect.ValueOf(state.MultiAreaIds[i].AreaId.ValueString()).IsZero() { + emptyKeys = false + } + if emptyKeys { + continue + } + + found := false + for j := range data.MultiAreaIds { + found = true + if state.MultiAreaIds[i].AreaId.ValueString() != data.MultiAreaIds[j].AreaId.ValueString() { + found = false + } + if found { + break + } + } + if !found { + deletedItems = append(deletedItems, fmt.Sprintf("%v/multi-area/multi-area-id=%v", state.getPath(), strings.Join(stateKeyValues[:], ","))) + } + } for i := range state.ProcessIds { stateKeyValues := [...]string{strconv.FormatInt(state.ProcessIds[i].Id.ValueInt64(), 10)} @@ -687,6 +776,11 @@ func (data *InterfaceOSPF) getDeletePaths(ctx context.Context) []string { deletePaths = append(deletePaths, fmt.Sprintf("%v/message-digest-key=%v", data.getPath(), strings.Join(keyValues[:], ","))) } + for i := range data.MultiAreaIds { + keyValues := [...]string{data.MultiAreaIds[i].AreaId.ValueString()} + + deletePaths = append(deletePaths, fmt.Sprintf("%v/multi-area/multi-area-id=%v", data.getPath(), strings.Join(keyValues[:], ","))) + } for i := range data.ProcessIds { keyValues := [...]string{strconv.FormatInt(data.ProcessIds[i].Id.ValueInt64(), 10)} diff --git a/internal/provider/model_iosxe_ospf.go b/internal/provider/model_iosxe_ospf.go index beb94d068..6f10fc166 100644 --- a/internal/provider/model_iosxe_ospf.go +++ b/internal/provider/model_iosxe_ospf.go @@ -61,6 +61,21 @@ type OSPF struct { AutoCostReferenceBandwidth types.Int64 `tfsdk:"auto_cost_reference_bandwidth"` PassiveInterfaceDefault types.Bool `tfsdk:"passive_interface_default"` PassiveInterface types.List `tfsdk:"passive_interface"` + LogAdjacencyChanges types.Bool `tfsdk:"log_adjacency_changes"` + LogAdjacencyChangesDetail types.Bool `tfsdk:"log_adjacency_changes_detail"` + NsfCisco types.Bool `tfsdk:"nsf_cisco"` + NsfCiscoEnforceGlobal types.Bool `tfsdk:"nsf_cisco_enforce_global"` + NsfIetf types.Bool `tfsdk:"nsf_ietf"` + NsfIetfRestartInterval types.Int64 `tfsdk:"nsf_ietf_restart_interval"` + MaxMetricRouterLsa types.Bool `tfsdk:"max_metric_router_lsa"` + MaxMetricRouterLsaSummaryLsaMetric types.Int64 `tfsdk:"max_metric_router_lsa_summary_lsa_metric"` + MaxMetricRouterLsaExternalLsaMetric types.Int64 `tfsdk:"max_metric_router_lsa_external_lsa_metric"` + MaxMetricRouterLsaIncludeStub types.Bool `tfsdk:"max_metric_router_lsa_include_stub"` + MaxMetricRouterLsaOnStartupTime types.Int64 `tfsdk:"max_metric_router_lsa_on_startup_time"` + MaxMetricRouterLsaOnStartupWaitForBgp types.Bool `tfsdk:"max_metric_router_lsa_on_startup_wait_for_bgp"` + FastReroutePerPrefixEnablePrefixPriority types.String `tfsdk:"fast_reroute_per_prefix_enable_prefix_priority"` + RedistributeStaticSubnets types.Bool `tfsdk:"redistribute_static_subnets"` + RedistributeConnectedSubnets types.Bool `tfsdk:"redistribute_connected_subnets"` PassiveInterfaceDisableGigabitEthernets []OSPFPassiveInterfaceDisableGigabitEthernets `tfsdk:"passive_interface_disable_gigabit_ethernets"` PassiveInterfaceDisableTwoGigabitEthernets []OSPFPassiveInterfaceDisableTwoGigabitEthernets `tfsdk:"passive_interface_disable_two_gigabit_ethernets"` PassiveInterfaceDisableFiveGigabitEthernets []OSPFPassiveInterfaceDisableFiveGigabitEthernets `tfsdk:"passive_interface_disable_five_gigabit_ethernets"` @@ -99,6 +114,21 @@ type OSPFData struct { AutoCostReferenceBandwidth types.Int64 `tfsdk:"auto_cost_reference_bandwidth"` PassiveInterfaceDefault types.Bool `tfsdk:"passive_interface_default"` PassiveInterface types.List `tfsdk:"passive_interface"` + LogAdjacencyChanges types.Bool `tfsdk:"log_adjacency_changes"` + LogAdjacencyChangesDetail types.Bool `tfsdk:"log_adjacency_changes_detail"` + NsfCisco types.Bool `tfsdk:"nsf_cisco"` + NsfCiscoEnforceGlobal types.Bool `tfsdk:"nsf_cisco_enforce_global"` + NsfIetf types.Bool `tfsdk:"nsf_ietf"` + NsfIetfRestartInterval types.Int64 `tfsdk:"nsf_ietf_restart_interval"` + MaxMetricRouterLsa types.Bool `tfsdk:"max_metric_router_lsa"` + MaxMetricRouterLsaSummaryLsaMetric types.Int64 `tfsdk:"max_metric_router_lsa_summary_lsa_metric"` + MaxMetricRouterLsaExternalLsaMetric types.Int64 `tfsdk:"max_metric_router_lsa_external_lsa_metric"` + MaxMetricRouterLsaIncludeStub types.Bool `tfsdk:"max_metric_router_lsa_include_stub"` + MaxMetricRouterLsaOnStartupTime types.Int64 `tfsdk:"max_metric_router_lsa_on_startup_time"` + MaxMetricRouterLsaOnStartupWaitForBgp types.Bool `tfsdk:"max_metric_router_lsa_on_startup_wait_for_bgp"` + FastReroutePerPrefixEnablePrefixPriority types.String `tfsdk:"fast_reroute_per_prefix_enable_prefix_priority"` + RedistributeStaticSubnets types.Bool `tfsdk:"redistribute_static_subnets"` + RedistributeConnectedSubnets types.Bool `tfsdk:"redistribute_connected_subnets"` PassiveInterfaceDisableGigabitEthernets []OSPFPassiveInterfaceDisableGigabitEthernets `tfsdk:"passive_interface_disable_gigabit_ethernets"` PassiveInterfaceDisableTwoGigabitEthernets []OSPFPassiveInterfaceDisableTwoGigabitEthernets `tfsdk:"passive_interface_disable_two_gigabit_ethernets"` PassiveInterfaceDisableFiveGigabitEthernets []OSPFPassiveInterfaceDisableFiveGigabitEthernets `tfsdk:"passive_interface_disable_five_gigabit_ethernets"` @@ -267,6 +297,69 @@ func (data OSPF) toBody(ctx context.Context) string { data.PassiveInterface.ElementsAs(ctx, &values, false) body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"passive-interface.interface", values) } + if !data.LogAdjacencyChanges.IsNull() && !data.LogAdjacencyChanges.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"log-adjacency-changes", data.LogAdjacencyChanges.ValueBool()) + } + if !data.LogAdjacencyChangesDetail.IsNull() && !data.LogAdjacencyChangesDetail.IsUnknown() { + if data.LogAdjacencyChangesDetail.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"log-adjacency-changes-detail.log-adjacency-changes.detail", map[string]string{}) + } + } + if !data.NsfCisco.IsNull() && !data.NsfCisco.IsUnknown() { + if data.NsfCisco.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"nsf.nsf-cisco", map[string]string{}) + } + } + if !data.NsfCiscoEnforceGlobal.IsNull() && !data.NsfCiscoEnforceGlobal.IsUnknown() { + if data.NsfCiscoEnforceGlobal.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"nsf.nsf-cisco.enforce.global", map[string]string{}) + } + } + if !data.NsfIetf.IsNull() && !data.NsfIetf.IsUnknown() { + if data.NsfIetf.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"nsf.nsf-ietf", map[string]string{}) + } + } + if !data.NsfIetfRestartInterval.IsNull() && !data.NsfIetfRestartInterval.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"nsf.nsf-ietf.restart-interval", strconv.FormatInt(data.NsfIetfRestartInterval.ValueInt64(), 10)) + } + if !data.MaxMetricRouterLsa.IsNull() && !data.MaxMetricRouterLsa.IsUnknown() { + if data.MaxMetricRouterLsa.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"max-metric.router-lsa", map[string]string{}) + } + } + if !data.MaxMetricRouterLsaSummaryLsaMetric.IsNull() && !data.MaxMetricRouterLsaSummaryLsaMetric.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"max-metric.router-lsa.summary-lsa.metric", strconv.FormatInt(data.MaxMetricRouterLsaSummaryLsaMetric.ValueInt64(), 10)) + } + if !data.MaxMetricRouterLsaExternalLsaMetric.IsNull() && !data.MaxMetricRouterLsaExternalLsaMetric.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"max-metric.router-lsa.external-lsa.metric", strconv.FormatInt(data.MaxMetricRouterLsaExternalLsaMetric.ValueInt64(), 10)) + } + if !data.MaxMetricRouterLsaIncludeStub.IsNull() && !data.MaxMetricRouterLsaIncludeStub.IsUnknown() { + if data.MaxMetricRouterLsaIncludeStub.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"max-metric.router-lsa.include-stub", map[string]string{}) + } + } + if !data.MaxMetricRouterLsaOnStartupTime.IsNull() && !data.MaxMetricRouterLsaOnStartupTime.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"max-metric.router-lsa.on-startup.time", strconv.FormatInt(data.MaxMetricRouterLsaOnStartupTime.ValueInt64(), 10)) + } + if !data.MaxMetricRouterLsaOnStartupWaitForBgp.IsNull() && !data.MaxMetricRouterLsaOnStartupWaitForBgp.IsUnknown() { + if data.MaxMetricRouterLsaOnStartupWaitForBgp.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"max-metric.router-lsa.on-startup.wait-for-bgp", map[string]string{}) + } + } + if !data.FastReroutePerPrefixEnablePrefixPriority.IsNull() && !data.FastReroutePerPrefixEnablePrefixPriority.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"fast-reroute.per-prefix.enable.prefix-priority", data.FastReroutePerPrefixEnablePrefixPriority.ValueString()) + } + if !data.RedistributeStaticSubnets.IsNull() && !data.RedistributeStaticSubnets.IsUnknown() { + if data.RedistributeStaticSubnets.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"redistribute.static.subnets", map[string]string{}) + } + } + if !data.RedistributeConnectedSubnets.IsNull() && !data.RedistributeConnectedSubnets.IsUnknown() { + if data.RedistributeConnectedSubnets.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"redistribute.connected.subnets", map[string]string{}) + } + } if len(data.Neighbors) > 0 { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"neighbor", []interface{}{}) for index, item := range data.Neighbors { @@ -764,6 +857,119 @@ func (data *OSPF) updateFromBody(ctx context.Context, res gjson.Result) { } else { data.PassiveInterface = types.ListNull(types.StringType) } + if value := res.Get(prefix + "log-adjacency-changes"); !data.LogAdjacencyChanges.IsNull() { + if value.Exists() { + data.LogAdjacencyChanges = types.BoolValue(value.Bool()) + } + } else { + data.LogAdjacencyChanges = types.BoolNull() + } + if value := res.Get(prefix + "log-adjacency-changes-detail.log-adjacency-changes.detail"); !data.LogAdjacencyChangesDetail.IsNull() { + if value.Exists() { + data.LogAdjacencyChangesDetail = types.BoolValue(true) + } else { + data.LogAdjacencyChangesDetail = types.BoolValue(false) + } + } else { + data.LogAdjacencyChangesDetail = types.BoolNull() + } + if value := res.Get(prefix + "nsf.nsf-cisco"); !data.NsfCisco.IsNull() { + if value.Exists() { + data.NsfCisco = types.BoolValue(true) + } else { + data.NsfCisco = types.BoolValue(false) + } + } else { + data.NsfCisco = types.BoolNull() + } + if value := res.Get(prefix + "nsf.nsf-cisco.enforce.global"); !data.NsfCiscoEnforceGlobal.IsNull() { + if value.Exists() { + data.NsfCiscoEnforceGlobal = types.BoolValue(true) + } else { + data.NsfCiscoEnforceGlobal = types.BoolValue(false) + } + } else { + data.NsfCiscoEnforceGlobal = types.BoolNull() + } + if value := res.Get(prefix + "nsf.nsf-ietf"); !data.NsfIetf.IsNull() { + if value.Exists() { + data.NsfIetf = types.BoolValue(true) + } else { + data.NsfIetf = types.BoolValue(false) + } + } else { + data.NsfIetf = types.BoolNull() + } + if value := res.Get(prefix + "nsf.nsf-ietf.restart-interval"); value.Exists() && !data.NsfIetfRestartInterval.IsNull() { + data.NsfIetfRestartInterval = types.Int64Value(value.Int()) + } else { + data.NsfIetfRestartInterval = types.Int64Null() + } + if value := res.Get(prefix + "max-metric.router-lsa"); !data.MaxMetricRouterLsa.IsNull() { + if value.Exists() { + data.MaxMetricRouterLsa = types.BoolValue(true) + } else { + data.MaxMetricRouterLsa = types.BoolValue(false) + } + } else { + data.MaxMetricRouterLsa = types.BoolNull() + } + if value := res.Get(prefix + "max-metric.router-lsa.summary-lsa.metric"); value.Exists() && !data.MaxMetricRouterLsaSummaryLsaMetric.IsNull() { + data.MaxMetricRouterLsaSummaryLsaMetric = types.Int64Value(value.Int()) + } else { + data.MaxMetricRouterLsaSummaryLsaMetric = types.Int64Null() + } + if value := res.Get(prefix + "max-metric.router-lsa.external-lsa.metric"); value.Exists() && !data.MaxMetricRouterLsaExternalLsaMetric.IsNull() { + data.MaxMetricRouterLsaExternalLsaMetric = types.Int64Value(value.Int()) + } else { + data.MaxMetricRouterLsaExternalLsaMetric = types.Int64Null() + } + if value := res.Get(prefix + "max-metric.router-lsa.include-stub"); !data.MaxMetricRouterLsaIncludeStub.IsNull() { + if value.Exists() { + data.MaxMetricRouterLsaIncludeStub = types.BoolValue(true) + } else { + data.MaxMetricRouterLsaIncludeStub = types.BoolValue(false) + } + } else { + data.MaxMetricRouterLsaIncludeStub = types.BoolNull() + } + if value := res.Get(prefix + "max-metric.router-lsa.on-startup.time"); value.Exists() && !data.MaxMetricRouterLsaOnStartupTime.IsNull() { + data.MaxMetricRouterLsaOnStartupTime = types.Int64Value(value.Int()) + } else { + data.MaxMetricRouterLsaOnStartupTime = types.Int64Null() + } + if value := res.Get(prefix + "max-metric.router-lsa.on-startup.wait-for-bgp"); !data.MaxMetricRouterLsaOnStartupWaitForBgp.IsNull() { + if value.Exists() { + data.MaxMetricRouterLsaOnStartupWaitForBgp = types.BoolValue(true) + } else { + data.MaxMetricRouterLsaOnStartupWaitForBgp = types.BoolValue(false) + } + } else { + data.MaxMetricRouterLsaOnStartupWaitForBgp = types.BoolNull() + } + if value := res.Get(prefix + "fast-reroute.per-prefix.enable.prefix-priority"); value.Exists() && !data.FastReroutePerPrefixEnablePrefixPriority.IsNull() { + data.FastReroutePerPrefixEnablePrefixPriority = types.StringValue(value.String()) + } else { + data.FastReroutePerPrefixEnablePrefixPriority = types.StringNull() + } + if value := res.Get(prefix + "redistribute.static.subnets"); !data.RedistributeStaticSubnets.IsNull() { + if value.Exists() { + data.RedistributeStaticSubnets = types.BoolValue(true) + } else { + data.RedistributeStaticSubnets = types.BoolValue(false) + } + } else { + data.RedistributeStaticSubnets = types.BoolNull() + } + if value := res.Get(prefix + "redistribute.connected.subnets"); !data.RedistributeConnectedSubnets.IsNull() { + if value.Exists() { + data.RedistributeConnectedSubnets = types.BoolValue(true) + } else { + data.RedistributeConnectedSubnets = types.BoolValue(false) + } + } else { + data.RedistributeConnectedSubnets = types.BoolNull() + } for i := range data.PassiveInterfaceDisableGigabitEthernets { keys := [...]string{"name"} keyValues := [...]string{data.PassiveInterfaceDisableGigabitEthernets[i].Name.ValueString()} @@ -1329,6 +1535,71 @@ func (data *OSPF) fromBody(ctx context.Context, res gjson.Result) { } else { data.PassiveInterface = types.ListNull(types.StringType) } + if value := res.Get(prefix + "log-adjacency-changes"); value.Exists() { + data.LogAdjacencyChanges = types.BoolValue(value.Bool()) + } else { + data.LogAdjacencyChanges = types.BoolNull() + } + if value := res.Get(prefix + "log-adjacency-changes-detail.log-adjacency-changes.detail"); value.Exists() { + data.LogAdjacencyChangesDetail = types.BoolValue(true) + } else { + data.LogAdjacencyChangesDetail = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-cisco"); value.Exists() { + data.NsfCisco = types.BoolValue(true) + } else { + data.NsfCisco = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-cisco.enforce.global"); value.Exists() { + data.NsfCiscoEnforceGlobal = types.BoolValue(true) + } else { + data.NsfCiscoEnforceGlobal = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-ietf"); value.Exists() { + data.NsfIetf = types.BoolValue(true) + } else { + data.NsfIetf = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-ietf.restart-interval"); value.Exists() { + data.NsfIetfRestartInterval = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa"); value.Exists() { + data.MaxMetricRouterLsa = types.BoolValue(true) + } else { + data.MaxMetricRouterLsa = types.BoolValue(false) + } + if value := res.Get(prefix + "max-metric.router-lsa.summary-lsa.metric"); value.Exists() { + data.MaxMetricRouterLsaSummaryLsaMetric = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa.external-lsa.metric"); value.Exists() { + data.MaxMetricRouterLsaExternalLsaMetric = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa.include-stub"); value.Exists() { + data.MaxMetricRouterLsaIncludeStub = types.BoolValue(true) + } else { + data.MaxMetricRouterLsaIncludeStub = types.BoolValue(false) + } + if value := res.Get(prefix + "max-metric.router-lsa.on-startup.time"); value.Exists() { + data.MaxMetricRouterLsaOnStartupTime = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa.on-startup.wait-for-bgp"); value.Exists() { + data.MaxMetricRouterLsaOnStartupWaitForBgp = types.BoolValue(true) + } else { + data.MaxMetricRouterLsaOnStartupWaitForBgp = types.BoolValue(false) + } + if value := res.Get(prefix + "fast-reroute.per-prefix.enable.prefix-priority"); value.Exists() { + data.FastReroutePerPrefixEnablePrefixPriority = types.StringValue(value.String()) + } + if value := res.Get(prefix + "redistribute.static.subnets"); value.Exists() { + data.RedistributeStaticSubnets = types.BoolValue(true) + } else { + data.RedistributeStaticSubnets = types.BoolValue(false) + } + if value := res.Get(prefix + "redistribute.connected.subnets"); value.Exists() { + data.RedistributeConnectedSubnets = types.BoolValue(true) + } else { + data.RedistributeConnectedSubnets = types.BoolValue(false) + } if value := res.Get(prefix + "passive-interface-config.disable-interface.GigabitEthernet"); value.Exists() { data.PassiveInterfaceDisableGigabitEthernets = make([]OSPFPassiveInterfaceDisableGigabitEthernets, 0) value.ForEach(func(k, v gjson.Result) bool { @@ -1642,6 +1913,71 @@ func (data *OSPFData) fromBody(ctx context.Context, res gjson.Result) { } else { data.PassiveInterface = types.ListNull(types.StringType) } + if value := res.Get(prefix + "log-adjacency-changes"); value.Exists() { + data.LogAdjacencyChanges = types.BoolValue(value.Bool()) + } else { + data.LogAdjacencyChanges = types.BoolNull() + } + if value := res.Get(prefix + "log-adjacency-changes-detail.log-adjacency-changes.detail"); value.Exists() { + data.LogAdjacencyChangesDetail = types.BoolValue(true) + } else { + data.LogAdjacencyChangesDetail = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-cisco"); value.Exists() { + data.NsfCisco = types.BoolValue(true) + } else { + data.NsfCisco = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-cisco.enforce.global"); value.Exists() { + data.NsfCiscoEnforceGlobal = types.BoolValue(true) + } else { + data.NsfCiscoEnforceGlobal = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-ietf"); value.Exists() { + data.NsfIetf = types.BoolValue(true) + } else { + data.NsfIetf = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-ietf.restart-interval"); value.Exists() { + data.NsfIetfRestartInterval = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa"); value.Exists() { + data.MaxMetricRouterLsa = types.BoolValue(true) + } else { + data.MaxMetricRouterLsa = types.BoolValue(false) + } + if value := res.Get(prefix + "max-metric.router-lsa.summary-lsa.metric"); value.Exists() { + data.MaxMetricRouterLsaSummaryLsaMetric = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa.external-lsa.metric"); value.Exists() { + data.MaxMetricRouterLsaExternalLsaMetric = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa.include-stub"); value.Exists() { + data.MaxMetricRouterLsaIncludeStub = types.BoolValue(true) + } else { + data.MaxMetricRouterLsaIncludeStub = types.BoolValue(false) + } + if value := res.Get(prefix + "max-metric.router-lsa.on-startup.time"); value.Exists() { + data.MaxMetricRouterLsaOnStartupTime = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa.on-startup.wait-for-bgp"); value.Exists() { + data.MaxMetricRouterLsaOnStartupWaitForBgp = types.BoolValue(true) + } else { + data.MaxMetricRouterLsaOnStartupWaitForBgp = types.BoolValue(false) + } + if value := res.Get(prefix + "fast-reroute.per-prefix.enable.prefix-priority"); value.Exists() { + data.FastReroutePerPrefixEnablePrefixPriority = types.StringValue(value.String()) + } + if value := res.Get(prefix + "redistribute.static.subnets"); value.Exists() { + data.RedistributeStaticSubnets = types.BoolValue(true) + } else { + data.RedistributeStaticSubnets = types.BoolValue(false) + } + if value := res.Get(prefix + "redistribute.connected.subnets"); value.Exists() { + data.RedistributeConnectedSubnets = types.BoolValue(true) + } else { + data.RedistributeConnectedSubnets = types.BoolValue(false) + } if value := res.Get(prefix + "passive-interface-config.disable-interface.GigabitEthernet"); value.Exists() { data.PassiveInterfaceDisableGigabitEthernets = make([]OSPFPassiveInterfaceDisableGigabitEthernets, 0) value.ForEach(func(k, v gjson.Result) bool { @@ -2154,6 +2490,51 @@ func (data *OSPF) getDeletedItems(ctx context.Context, state OSPF) []string { deletedItems = append(deletedItems, fmt.Sprintf("%v/passive-interface-config/disable-interface/GigabitEthernet=%v", state.getPath(), strings.Join(stateKeyValues[:], ","))) } } + if !state.RedistributeConnectedSubnets.IsNull() && data.RedistributeConnectedSubnets.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/redistribute/connected/subnets", state.getPath())) + } + if !state.RedistributeStaticSubnets.IsNull() && data.RedistributeStaticSubnets.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/redistribute/static/subnets", state.getPath())) + } + if !state.FastReroutePerPrefixEnablePrefixPriority.IsNull() && data.FastReroutePerPrefixEnablePrefixPriority.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/fast-reroute/per-prefix/enable/prefix-priority", state.getPath())) + } + if !state.MaxMetricRouterLsaOnStartupWaitForBgp.IsNull() && data.MaxMetricRouterLsaOnStartupWaitForBgp.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/max-metric/router-lsa/on-startup/wait-for-bgp", state.getPath())) + } + if !state.MaxMetricRouterLsaOnStartupTime.IsNull() && data.MaxMetricRouterLsaOnStartupTime.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/max-metric/router-lsa/on-startup/time", state.getPath())) + } + if !state.MaxMetricRouterLsaIncludeStub.IsNull() && data.MaxMetricRouterLsaIncludeStub.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/max-metric/router-lsa/include-stub", state.getPath())) + } + if !state.MaxMetricRouterLsaExternalLsaMetric.IsNull() && data.MaxMetricRouterLsaExternalLsaMetric.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/max-metric/router-lsa/external-lsa/metric", state.getPath())) + } + if !state.MaxMetricRouterLsaSummaryLsaMetric.IsNull() && data.MaxMetricRouterLsaSummaryLsaMetric.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/max-metric/router-lsa/summary-lsa/metric", state.getPath())) + } + if !state.MaxMetricRouterLsa.IsNull() && data.MaxMetricRouterLsa.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/max-metric/router-lsa", state.getPath())) + } + if !state.NsfIetfRestartInterval.IsNull() && data.NsfIetfRestartInterval.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/nsf/nsf-ietf/restart-interval", state.getPath())) + } + if !state.NsfIetf.IsNull() && data.NsfIetf.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/nsf/nsf-ietf", state.getPath())) + } + if !state.NsfCiscoEnforceGlobal.IsNull() && data.NsfCiscoEnforceGlobal.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/nsf/nsf-cisco/enforce/global", state.getPath())) + } + if !state.NsfCisco.IsNull() && data.NsfCisco.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/nsf/nsf-cisco", state.getPath())) + } + if !state.LogAdjacencyChangesDetail.IsNull() && data.LogAdjacencyChangesDetail.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/log-adjacency-changes-detail/log-adjacency-changes/detail", state.getPath())) + } + if !state.LogAdjacencyChanges.IsNull() && data.LogAdjacencyChanges.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/log-adjacency-changes", state.getPath())) + } if !state.PassiveInterface.IsNull() { if data.PassiveInterface.IsNull() { deletedItems = append(deletedItems, fmt.Sprintf("%v/passive-interface/interface", state.getPath())) @@ -2361,6 +2742,34 @@ func (data *OSPF) getDeletedItems(ctx context.Context, state OSPF) []string { func (data *OSPF) getEmptyLeafsDelete(ctx context.Context) []string { emptyLeafsDelete := make([]string, 0) + if !data.RedistributeConnectedSubnets.IsNull() && !data.RedistributeConnectedSubnets.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/redistribute/connected/subnets", data.getPath())) + } + if !data.RedistributeStaticSubnets.IsNull() && !data.RedistributeStaticSubnets.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/redistribute/static/subnets", data.getPath())) + } + if !data.MaxMetricRouterLsaOnStartupWaitForBgp.IsNull() && !data.MaxMetricRouterLsaOnStartupWaitForBgp.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/max-metric/router-lsa/on-startup/wait-for-bgp", data.getPath())) + } + if !data.MaxMetricRouterLsaIncludeStub.IsNull() && !data.MaxMetricRouterLsaIncludeStub.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/max-metric/router-lsa/include-stub", data.getPath())) + } + if !data.MaxMetricRouterLsa.IsNull() && !data.MaxMetricRouterLsa.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/max-metric/router-lsa", data.getPath())) + } + if !data.NsfIetf.IsNull() && !data.NsfIetf.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/nsf/nsf-ietf", data.getPath())) + } + if !data.NsfCiscoEnforceGlobal.IsNull() && !data.NsfCiscoEnforceGlobal.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/nsf/nsf-cisco/enforce/global", data.getPath())) + } + if !data.NsfCisco.IsNull() && !data.NsfCisco.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/nsf/nsf-cisco", data.getPath())) + } + if !data.LogAdjacencyChangesDetail.IsNull() && !data.LogAdjacencyChangesDetail.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/log-adjacency-changes-detail/log-adjacency-changes/detail", data.getPath())) + } + for i := range data.Areas { keyValues := [...]string{data.Areas[i].AreaId.ValueString()} if !data.Areas[i].NssaNoRedistribution.IsNull() && !data.Areas[i].NssaNoRedistribution.ValueBool() { @@ -2475,6 +2884,51 @@ func (data *OSPF) getDeletePaths(ctx context.Context) []string { deletePaths = append(deletePaths, fmt.Sprintf("%v/passive-interface-config/disable-interface/GigabitEthernet=%v", data.getPath(), strings.Join(keyValues[:], ","))) } + if !data.RedistributeConnectedSubnets.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/redistribute/connected/subnets", data.getPath())) + } + if !data.RedistributeStaticSubnets.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/redistribute/static/subnets", data.getPath())) + } + if !data.FastReroutePerPrefixEnablePrefixPriority.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/fast-reroute/per-prefix/enable/prefix-priority", data.getPath())) + } + if !data.MaxMetricRouterLsaOnStartupWaitForBgp.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/max-metric/router-lsa/on-startup/wait-for-bgp", data.getPath())) + } + if !data.MaxMetricRouterLsaOnStartupTime.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/max-metric/router-lsa/on-startup/time", data.getPath())) + } + if !data.MaxMetricRouterLsaIncludeStub.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/max-metric/router-lsa/include-stub", data.getPath())) + } + if !data.MaxMetricRouterLsaExternalLsaMetric.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/max-metric/router-lsa/external-lsa/metric", data.getPath())) + } + if !data.MaxMetricRouterLsaSummaryLsaMetric.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/max-metric/router-lsa/summary-lsa/metric", data.getPath())) + } + if !data.MaxMetricRouterLsa.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/max-metric/router-lsa", data.getPath())) + } + if !data.NsfIetfRestartInterval.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/nsf/nsf-ietf/restart-interval", data.getPath())) + } + if !data.NsfIetf.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/nsf/nsf-ietf", data.getPath())) + } + if !data.NsfCiscoEnforceGlobal.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/nsf/nsf-cisco/enforce/global", data.getPath())) + } + if !data.NsfCisco.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/nsf/nsf-cisco", data.getPath())) + } + if !data.LogAdjacencyChangesDetail.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/log-adjacency-changes-detail/log-adjacency-changes/detail", data.getPath())) + } + if !data.LogAdjacencyChanges.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/log-adjacency-changes", data.getPath())) + } if !data.PassiveInterface.IsNull() { deletePaths = append(deletePaths, fmt.Sprintf("%v/passive-interface/interface", data.getPath())) } diff --git a/internal/provider/model_iosxe_ospf_vrf.go b/internal/provider/model_iosxe_ospf_vrf.go index 1b679246c..cc9d7544f 100644 --- a/internal/provider/model_iosxe_ospf_vrf.go +++ b/internal/provider/model_iosxe_ospf_vrf.go @@ -50,6 +50,20 @@ type OSPFVRF struct { DefaultMetric types.Int64 `tfsdk:"default_metric"` Distance types.Int64 `tfsdk:"distance"` DomainTag types.Int64 `tfsdk:"domain_tag"` + LogAdjacencyChanges types.Bool `tfsdk:"log_adjacency_changes"` + LogAdjacencyChangesDetail types.Bool `tfsdk:"log_adjacency_changes_detail"` + NsfCisco types.Bool `tfsdk:"nsf_cisco"` + NsfCiscoEnforceGlobal types.Bool `tfsdk:"nsf_cisco_enforce_global"` + NsfIetf types.Bool `tfsdk:"nsf_ietf"` + NsfIetfRestartInterval types.Int64 `tfsdk:"nsf_ietf_restart_interval"` + MaxMetricRouterLsa types.Bool `tfsdk:"max_metric_router_lsa"` + MaxMetricRouterLsaSummaryLsaMetric types.Int64 `tfsdk:"max_metric_router_lsa_summary_lsa_metric"` + MaxMetricRouterLsaExternalLsaMetric types.Int64 `tfsdk:"max_metric_router_lsa_external_lsa_metric"` + MaxMetricRouterLsaIncludeStub types.Bool `tfsdk:"max_metric_router_lsa_include_stub"` + MaxMetricRouterLsaOnStartupTime types.Int64 `tfsdk:"max_metric_router_lsa_on_startup_time"` + MaxMetricRouterLsaOnStartupWaitForBgp types.Bool `tfsdk:"max_metric_router_lsa_on_startup_wait_for_bgp"` + RedistributeStaticSubnets types.Bool `tfsdk:"redistribute_static_subnets"` + RedistributeConnectedSubnets types.Bool `tfsdk:"redistribute_connected_subnets"` MplsLdpAutoconfig types.Bool `tfsdk:"mpls_ldp_autoconfig"` MplsLdpSync types.Bool `tfsdk:"mpls_ldp_sync"` Neighbor []OSPFVRFNeighbor `tfsdk:"neighbor"` @@ -89,6 +103,20 @@ type OSPFVRFData struct { DefaultMetric types.Int64 `tfsdk:"default_metric"` Distance types.Int64 `tfsdk:"distance"` DomainTag types.Int64 `tfsdk:"domain_tag"` + LogAdjacencyChanges types.Bool `tfsdk:"log_adjacency_changes"` + LogAdjacencyChangesDetail types.Bool `tfsdk:"log_adjacency_changes_detail"` + NsfCisco types.Bool `tfsdk:"nsf_cisco"` + NsfCiscoEnforceGlobal types.Bool `tfsdk:"nsf_cisco_enforce_global"` + NsfIetf types.Bool `tfsdk:"nsf_ietf"` + NsfIetfRestartInterval types.Int64 `tfsdk:"nsf_ietf_restart_interval"` + MaxMetricRouterLsa types.Bool `tfsdk:"max_metric_router_lsa"` + MaxMetricRouterLsaSummaryLsaMetric types.Int64 `tfsdk:"max_metric_router_lsa_summary_lsa_metric"` + MaxMetricRouterLsaExternalLsaMetric types.Int64 `tfsdk:"max_metric_router_lsa_external_lsa_metric"` + MaxMetricRouterLsaIncludeStub types.Bool `tfsdk:"max_metric_router_lsa_include_stub"` + MaxMetricRouterLsaOnStartupTime types.Int64 `tfsdk:"max_metric_router_lsa_on_startup_time"` + MaxMetricRouterLsaOnStartupWaitForBgp types.Bool `tfsdk:"max_metric_router_lsa_on_startup_wait_for_bgp"` + RedistributeStaticSubnets types.Bool `tfsdk:"redistribute_static_subnets"` + RedistributeConnectedSubnets types.Bool `tfsdk:"redistribute_connected_subnets"` MplsLdpAutoconfig types.Bool `tfsdk:"mpls_ldp_autoconfig"` MplsLdpSync types.Bool `tfsdk:"mpls_ldp_sync"` Neighbor []OSPFVRFNeighbor `tfsdk:"neighbor"` @@ -242,6 +270,66 @@ func (data OSPFVRF) toBody(ctx context.Context) string { if !data.DomainTag.IsNull() && !data.DomainTag.IsUnknown() { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"domain-tag", strconv.FormatInt(data.DomainTag.ValueInt64(), 10)) } + if !data.LogAdjacencyChanges.IsNull() && !data.LogAdjacencyChanges.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"log-adjacency-changes", data.LogAdjacencyChanges.ValueBool()) + } + if !data.LogAdjacencyChangesDetail.IsNull() && !data.LogAdjacencyChangesDetail.IsUnknown() { + if data.LogAdjacencyChangesDetail.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"log-adjacency-changes-detail.log-adjacency-changes.detail", map[string]string{}) + } + } + if !data.NsfCisco.IsNull() && !data.NsfCisco.IsUnknown() { + if data.NsfCisco.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"nsf.nsf-cisco", map[string]string{}) + } + } + if !data.NsfCiscoEnforceGlobal.IsNull() && !data.NsfCiscoEnforceGlobal.IsUnknown() { + if data.NsfCiscoEnforceGlobal.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"nsf.nsf-cisco.enforce.global", map[string]string{}) + } + } + if !data.NsfIetf.IsNull() && !data.NsfIetf.IsUnknown() { + if data.NsfIetf.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"nsf.nsf-ietf", map[string]string{}) + } + } + if !data.NsfIetfRestartInterval.IsNull() && !data.NsfIetfRestartInterval.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"nsf.nsf-ietf.restart-interval", strconv.FormatInt(data.NsfIetfRestartInterval.ValueInt64(), 10)) + } + if !data.MaxMetricRouterLsa.IsNull() && !data.MaxMetricRouterLsa.IsUnknown() { + if data.MaxMetricRouterLsa.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"max-metric.router-lsa", map[string]string{}) + } + } + if !data.MaxMetricRouterLsaSummaryLsaMetric.IsNull() && !data.MaxMetricRouterLsaSummaryLsaMetric.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"max-metric.router-lsa.summary-lsa.metric", strconv.FormatInt(data.MaxMetricRouterLsaSummaryLsaMetric.ValueInt64(), 10)) + } + if !data.MaxMetricRouterLsaExternalLsaMetric.IsNull() && !data.MaxMetricRouterLsaExternalLsaMetric.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"max-metric.router-lsa.external-lsa.metric", strconv.FormatInt(data.MaxMetricRouterLsaExternalLsaMetric.ValueInt64(), 10)) + } + if !data.MaxMetricRouterLsaIncludeStub.IsNull() && !data.MaxMetricRouterLsaIncludeStub.IsUnknown() { + if data.MaxMetricRouterLsaIncludeStub.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"max-metric.router-lsa.include-stub", map[string]string{}) + } + } + if !data.MaxMetricRouterLsaOnStartupTime.IsNull() && !data.MaxMetricRouterLsaOnStartupTime.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"max-metric.router-lsa.on-startup.time", strconv.FormatInt(data.MaxMetricRouterLsaOnStartupTime.ValueInt64(), 10)) + } + if !data.MaxMetricRouterLsaOnStartupWaitForBgp.IsNull() && !data.MaxMetricRouterLsaOnStartupWaitForBgp.IsUnknown() { + if data.MaxMetricRouterLsaOnStartupWaitForBgp.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"max-metric.router-lsa.on-startup.wait-for-bgp", map[string]string{}) + } + } + if !data.RedistributeStaticSubnets.IsNull() && !data.RedistributeStaticSubnets.IsUnknown() { + if data.RedistributeStaticSubnets.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"redistribute.static.subnets", map[string]string{}) + } + } + if !data.RedistributeConnectedSubnets.IsNull() && !data.RedistributeConnectedSubnets.IsUnknown() { + if data.RedistributeConnectedSubnets.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"redistribute.connected.subnets", map[string]string{}) + } + } if !data.MplsLdpAutoconfig.IsNull() && !data.MplsLdpAutoconfig.IsUnknown() { if data.MplsLdpAutoconfig.ValueBool() { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"mpls.ldp.autoconfig", map[string]string{}) @@ -526,6 +614,114 @@ func (data *OSPFVRF) updateFromBody(ctx context.Context, res gjson.Result) { } else { data.DomainTag = types.Int64Null() } + if value := res.Get(prefix + "log-adjacency-changes"); !data.LogAdjacencyChanges.IsNull() { + if value.Exists() { + data.LogAdjacencyChanges = types.BoolValue(value.Bool()) + } + } else { + data.LogAdjacencyChanges = types.BoolNull() + } + if value := res.Get(prefix + "log-adjacency-changes-detail.log-adjacency-changes.detail"); !data.LogAdjacencyChangesDetail.IsNull() { + if value.Exists() { + data.LogAdjacencyChangesDetail = types.BoolValue(true) + } else { + data.LogAdjacencyChangesDetail = types.BoolValue(false) + } + } else { + data.LogAdjacencyChangesDetail = types.BoolNull() + } + if value := res.Get(prefix + "nsf.nsf-cisco"); !data.NsfCisco.IsNull() { + if value.Exists() { + data.NsfCisco = types.BoolValue(true) + } else { + data.NsfCisco = types.BoolValue(false) + } + } else { + data.NsfCisco = types.BoolNull() + } + if value := res.Get(prefix + "nsf.nsf-cisco.enforce.global"); !data.NsfCiscoEnforceGlobal.IsNull() { + if value.Exists() { + data.NsfCiscoEnforceGlobal = types.BoolValue(true) + } else { + data.NsfCiscoEnforceGlobal = types.BoolValue(false) + } + } else { + data.NsfCiscoEnforceGlobal = types.BoolNull() + } + if value := res.Get(prefix + "nsf.nsf-ietf"); !data.NsfIetf.IsNull() { + if value.Exists() { + data.NsfIetf = types.BoolValue(true) + } else { + data.NsfIetf = types.BoolValue(false) + } + } else { + data.NsfIetf = types.BoolNull() + } + if value := res.Get(prefix + "nsf.nsf-ietf.restart-interval"); value.Exists() && !data.NsfIetfRestartInterval.IsNull() { + data.NsfIetfRestartInterval = types.Int64Value(value.Int()) + } else { + data.NsfIetfRestartInterval = types.Int64Null() + } + if value := res.Get(prefix + "max-metric.router-lsa"); !data.MaxMetricRouterLsa.IsNull() { + if value.Exists() { + data.MaxMetricRouterLsa = types.BoolValue(true) + } else { + data.MaxMetricRouterLsa = types.BoolValue(false) + } + } else { + data.MaxMetricRouterLsa = types.BoolNull() + } + if value := res.Get(prefix + "max-metric.router-lsa.summary-lsa.metric"); value.Exists() && !data.MaxMetricRouterLsaSummaryLsaMetric.IsNull() { + data.MaxMetricRouterLsaSummaryLsaMetric = types.Int64Value(value.Int()) + } else { + data.MaxMetricRouterLsaSummaryLsaMetric = types.Int64Null() + } + if value := res.Get(prefix + "max-metric.router-lsa.external-lsa.metric"); value.Exists() && !data.MaxMetricRouterLsaExternalLsaMetric.IsNull() { + data.MaxMetricRouterLsaExternalLsaMetric = types.Int64Value(value.Int()) + } else { + data.MaxMetricRouterLsaExternalLsaMetric = types.Int64Null() + } + if value := res.Get(prefix + "max-metric.router-lsa.include-stub"); !data.MaxMetricRouterLsaIncludeStub.IsNull() { + if value.Exists() { + data.MaxMetricRouterLsaIncludeStub = types.BoolValue(true) + } else { + data.MaxMetricRouterLsaIncludeStub = types.BoolValue(false) + } + } else { + data.MaxMetricRouterLsaIncludeStub = types.BoolNull() + } + if value := res.Get(prefix + "max-metric.router-lsa.on-startup.time"); value.Exists() && !data.MaxMetricRouterLsaOnStartupTime.IsNull() { + data.MaxMetricRouterLsaOnStartupTime = types.Int64Value(value.Int()) + } else { + data.MaxMetricRouterLsaOnStartupTime = types.Int64Null() + } + if value := res.Get(prefix + "max-metric.router-lsa.on-startup.wait-for-bgp"); !data.MaxMetricRouterLsaOnStartupWaitForBgp.IsNull() { + if value.Exists() { + data.MaxMetricRouterLsaOnStartupWaitForBgp = types.BoolValue(true) + } else { + data.MaxMetricRouterLsaOnStartupWaitForBgp = types.BoolValue(false) + } + } else { + data.MaxMetricRouterLsaOnStartupWaitForBgp = types.BoolNull() + } + if value := res.Get(prefix + "redistribute.static.subnets"); !data.RedistributeStaticSubnets.IsNull() { + if value.Exists() { + data.RedistributeStaticSubnets = types.BoolValue(true) + } else { + data.RedistributeStaticSubnets = types.BoolValue(false) + } + } else { + data.RedistributeStaticSubnets = types.BoolNull() + } + if value := res.Get(prefix + "redistribute.connected.subnets"); !data.RedistributeConnectedSubnets.IsNull() { + if value.Exists() { + data.RedistributeConnectedSubnets = types.BoolValue(true) + } else { + data.RedistributeConnectedSubnets = types.BoolValue(false) + } + } else { + data.RedistributeConnectedSubnets = types.BoolNull() + } if value := res.Get(prefix + "mpls.ldp.autoconfig"); !data.MplsLdpAutoconfig.IsNull() { if value.Exists() { data.MplsLdpAutoconfig = types.BoolValue(true) @@ -1215,6 +1411,68 @@ func (data *OSPFVRF) fromBody(ctx context.Context, res gjson.Result) { if value := res.Get(prefix + "domain-tag"); value.Exists() { data.DomainTag = types.Int64Value(value.Int()) } + if value := res.Get(prefix + "log-adjacency-changes"); value.Exists() { + data.LogAdjacencyChanges = types.BoolValue(value.Bool()) + } else { + data.LogAdjacencyChanges = types.BoolNull() + } + if value := res.Get(prefix + "log-adjacency-changes-detail.log-adjacency-changes.detail"); value.Exists() { + data.LogAdjacencyChangesDetail = types.BoolValue(true) + } else { + data.LogAdjacencyChangesDetail = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-cisco"); value.Exists() { + data.NsfCisco = types.BoolValue(true) + } else { + data.NsfCisco = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-cisco.enforce.global"); value.Exists() { + data.NsfCiscoEnforceGlobal = types.BoolValue(true) + } else { + data.NsfCiscoEnforceGlobal = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-ietf"); value.Exists() { + data.NsfIetf = types.BoolValue(true) + } else { + data.NsfIetf = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-ietf.restart-interval"); value.Exists() { + data.NsfIetfRestartInterval = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa"); value.Exists() { + data.MaxMetricRouterLsa = types.BoolValue(true) + } else { + data.MaxMetricRouterLsa = types.BoolValue(false) + } + if value := res.Get(prefix + "max-metric.router-lsa.summary-lsa.metric"); value.Exists() { + data.MaxMetricRouterLsaSummaryLsaMetric = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa.external-lsa.metric"); value.Exists() { + data.MaxMetricRouterLsaExternalLsaMetric = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa.include-stub"); value.Exists() { + data.MaxMetricRouterLsaIncludeStub = types.BoolValue(true) + } else { + data.MaxMetricRouterLsaIncludeStub = types.BoolValue(false) + } + if value := res.Get(prefix + "max-metric.router-lsa.on-startup.time"); value.Exists() { + data.MaxMetricRouterLsaOnStartupTime = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa.on-startup.wait-for-bgp"); value.Exists() { + data.MaxMetricRouterLsaOnStartupWaitForBgp = types.BoolValue(true) + } else { + data.MaxMetricRouterLsaOnStartupWaitForBgp = types.BoolValue(false) + } + if value := res.Get(prefix + "redistribute.static.subnets"); value.Exists() { + data.RedistributeStaticSubnets = types.BoolValue(true) + } else { + data.RedistributeStaticSubnets = types.BoolValue(false) + } + if value := res.Get(prefix + "redistribute.connected.subnets"); value.Exists() { + data.RedistributeConnectedSubnets = types.BoolValue(true) + } else { + data.RedistributeConnectedSubnets = types.BoolValue(false) + } if value := res.Get(prefix + "mpls.ldp.autoconfig"); value.Exists() { data.MplsLdpAutoconfig = types.BoolValue(true) } else { @@ -1528,6 +1786,68 @@ func (data *OSPFVRFData) fromBody(ctx context.Context, res gjson.Result) { if value := res.Get(prefix + "domain-tag"); value.Exists() { data.DomainTag = types.Int64Value(value.Int()) } + if value := res.Get(prefix + "log-adjacency-changes"); value.Exists() { + data.LogAdjacencyChanges = types.BoolValue(value.Bool()) + } else { + data.LogAdjacencyChanges = types.BoolNull() + } + if value := res.Get(prefix + "log-adjacency-changes-detail.log-adjacency-changes.detail"); value.Exists() { + data.LogAdjacencyChangesDetail = types.BoolValue(true) + } else { + data.LogAdjacencyChangesDetail = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-cisco"); value.Exists() { + data.NsfCisco = types.BoolValue(true) + } else { + data.NsfCisco = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-cisco.enforce.global"); value.Exists() { + data.NsfCiscoEnforceGlobal = types.BoolValue(true) + } else { + data.NsfCiscoEnforceGlobal = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-ietf"); value.Exists() { + data.NsfIetf = types.BoolValue(true) + } else { + data.NsfIetf = types.BoolValue(false) + } + if value := res.Get(prefix + "nsf.nsf-ietf.restart-interval"); value.Exists() { + data.NsfIetfRestartInterval = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa"); value.Exists() { + data.MaxMetricRouterLsa = types.BoolValue(true) + } else { + data.MaxMetricRouterLsa = types.BoolValue(false) + } + if value := res.Get(prefix + "max-metric.router-lsa.summary-lsa.metric"); value.Exists() { + data.MaxMetricRouterLsaSummaryLsaMetric = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa.external-lsa.metric"); value.Exists() { + data.MaxMetricRouterLsaExternalLsaMetric = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa.include-stub"); value.Exists() { + data.MaxMetricRouterLsaIncludeStub = types.BoolValue(true) + } else { + data.MaxMetricRouterLsaIncludeStub = types.BoolValue(false) + } + if value := res.Get(prefix + "max-metric.router-lsa.on-startup.time"); value.Exists() { + data.MaxMetricRouterLsaOnStartupTime = types.Int64Value(value.Int()) + } + if value := res.Get(prefix + "max-metric.router-lsa.on-startup.wait-for-bgp"); value.Exists() { + data.MaxMetricRouterLsaOnStartupWaitForBgp = types.BoolValue(true) + } else { + data.MaxMetricRouterLsaOnStartupWaitForBgp = types.BoolValue(false) + } + if value := res.Get(prefix + "redistribute.static.subnets"); value.Exists() { + data.RedistributeStaticSubnets = types.BoolValue(true) + } else { + data.RedistributeStaticSubnets = types.BoolValue(false) + } + if value := res.Get(prefix + "redistribute.connected.subnets"); value.Exists() { + data.RedistributeConnectedSubnets = types.BoolValue(true) + } else { + data.RedistributeConnectedSubnets = types.BoolValue(false) + } if value := res.Get(prefix + "mpls.ldp.autoconfig"); value.Exists() { data.MplsLdpAutoconfig = types.BoolValue(true) } else { @@ -2342,6 +2662,48 @@ func (data *OSPFVRF) getDeletedItems(ctx context.Context, state OSPFVRF) []strin if !state.MplsLdpAutoconfig.IsNull() && data.MplsLdpAutoconfig.IsNull() { deletedItems = append(deletedItems, fmt.Sprintf("%v/mpls/ldp/autoconfig", state.getPath())) } + if !state.RedistributeConnectedSubnets.IsNull() && data.RedistributeConnectedSubnets.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/redistribute/connected/subnets", state.getPath())) + } + if !state.RedistributeStaticSubnets.IsNull() && data.RedistributeStaticSubnets.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/redistribute/static/subnets", state.getPath())) + } + if !state.MaxMetricRouterLsaOnStartupWaitForBgp.IsNull() && data.MaxMetricRouterLsaOnStartupWaitForBgp.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/max-metric/router-lsa/on-startup/wait-for-bgp", state.getPath())) + } + if !state.MaxMetricRouterLsaOnStartupTime.IsNull() && data.MaxMetricRouterLsaOnStartupTime.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/max-metric/router-lsa/on-startup/time", state.getPath())) + } + if !state.MaxMetricRouterLsaIncludeStub.IsNull() && data.MaxMetricRouterLsaIncludeStub.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/max-metric/router-lsa/include-stub", state.getPath())) + } + if !state.MaxMetricRouterLsaExternalLsaMetric.IsNull() && data.MaxMetricRouterLsaExternalLsaMetric.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/max-metric/router-lsa/external-lsa/metric", state.getPath())) + } + if !state.MaxMetricRouterLsaSummaryLsaMetric.IsNull() && data.MaxMetricRouterLsaSummaryLsaMetric.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/max-metric/router-lsa/summary-lsa/metric", state.getPath())) + } + if !state.MaxMetricRouterLsa.IsNull() && data.MaxMetricRouterLsa.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/max-metric/router-lsa", state.getPath())) + } + if !state.NsfIetfRestartInterval.IsNull() && data.NsfIetfRestartInterval.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/nsf/nsf-ietf/restart-interval", state.getPath())) + } + if !state.NsfIetf.IsNull() && data.NsfIetf.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/nsf/nsf-ietf", state.getPath())) + } + if !state.NsfCiscoEnforceGlobal.IsNull() && data.NsfCiscoEnforceGlobal.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/nsf/nsf-cisco/enforce/global", state.getPath())) + } + if !state.NsfCisco.IsNull() && data.NsfCisco.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/nsf/nsf-cisco", state.getPath())) + } + if !state.LogAdjacencyChangesDetail.IsNull() && data.LogAdjacencyChangesDetail.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/log-adjacency-changes-detail/log-adjacency-changes/detail", state.getPath())) + } + if !state.LogAdjacencyChanges.IsNull() && data.LogAdjacencyChanges.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/log-adjacency-changes", state.getPath())) + } if !state.DomainTag.IsNull() && data.DomainTag.IsNull() { deletedItems = append(deletedItems, fmt.Sprintf("%v/domain-tag", state.getPath())) } @@ -2396,6 +2758,33 @@ func (data *OSPFVRF) getEmptyLeafsDelete(ctx context.Context) []string { if !data.MplsLdpAutoconfig.IsNull() && !data.MplsLdpAutoconfig.ValueBool() { emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/mpls/ldp/autoconfig", data.getPath())) } + if !data.RedistributeConnectedSubnets.IsNull() && !data.RedistributeConnectedSubnets.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/redistribute/connected/subnets", data.getPath())) + } + if !data.RedistributeStaticSubnets.IsNull() && !data.RedistributeStaticSubnets.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/redistribute/static/subnets", data.getPath())) + } + if !data.MaxMetricRouterLsaOnStartupWaitForBgp.IsNull() && !data.MaxMetricRouterLsaOnStartupWaitForBgp.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/max-metric/router-lsa/on-startup/wait-for-bgp", data.getPath())) + } + if !data.MaxMetricRouterLsaIncludeStub.IsNull() && !data.MaxMetricRouterLsaIncludeStub.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/max-metric/router-lsa/include-stub", data.getPath())) + } + if !data.MaxMetricRouterLsa.IsNull() && !data.MaxMetricRouterLsa.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/max-metric/router-lsa", data.getPath())) + } + if !data.NsfIetf.IsNull() && !data.NsfIetf.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/nsf/nsf-ietf", data.getPath())) + } + if !data.NsfCiscoEnforceGlobal.IsNull() && !data.NsfCiscoEnforceGlobal.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/nsf/nsf-cisco/enforce/global", data.getPath())) + } + if !data.NsfCisco.IsNull() && !data.NsfCisco.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/nsf/nsf-cisco", data.getPath())) + } + if !data.LogAdjacencyChangesDetail.IsNull() && !data.LogAdjacencyChangesDetail.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/log-adjacency-changes-detail/log-adjacency-changes/detail", data.getPath())) + } if !data.DefaultInformationOriginateAlways.IsNull() && !data.DefaultInformationOriginateAlways.ValueBool() { emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/default-information/originate/always", data.getPath())) } @@ -2529,6 +2918,48 @@ func (data *OSPFVRF) getDeletePaths(ctx context.Context) []string { if !data.MplsLdpAutoconfig.IsNull() { deletePaths = append(deletePaths, fmt.Sprintf("%v/mpls/ldp/autoconfig", data.getPath())) } + if !data.RedistributeConnectedSubnets.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/redistribute/connected/subnets", data.getPath())) + } + if !data.RedistributeStaticSubnets.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/redistribute/static/subnets", data.getPath())) + } + if !data.MaxMetricRouterLsaOnStartupWaitForBgp.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/max-metric/router-lsa/on-startup/wait-for-bgp", data.getPath())) + } + if !data.MaxMetricRouterLsaOnStartupTime.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/max-metric/router-lsa/on-startup/time", data.getPath())) + } + if !data.MaxMetricRouterLsaIncludeStub.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/max-metric/router-lsa/include-stub", data.getPath())) + } + if !data.MaxMetricRouterLsaExternalLsaMetric.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/max-metric/router-lsa/external-lsa/metric", data.getPath())) + } + if !data.MaxMetricRouterLsaSummaryLsaMetric.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/max-metric/router-lsa/summary-lsa/metric", data.getPath())) + } + if !data.MaxMetricRouterLsa.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/max-metric/router-lsa", data.getPath())) + } + if !data.NsfIetfRestartInterval.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/nsf/nsf-ietf/restart-interval", data.getPath())) + } + if !data.NsfIetf.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/nsf/nsf-ietf", data.getPath())) + } + if !data.NsfCiscoEnforceGlobal.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/nsf/nsf-cisco/enforce/global", data.getPath())) + } + if !data.NsfCisco.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/nsf/nsf-cisco", data.getPath())) + } + if !data.LogAdjacencyChangesDetail.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/log-adjacency-changes-detail/log-adjacency-changes/detail", data.getPath())) + } + if !data.LogAdjacencyChanges.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/log-adjacency-changes", data.getPath())) + } if !data.DomainTag.IsNull() { deletePaths = append(deletePaths, fmt.Sprintf("%v/domain-tag", data.getPath())) } diff --git a/internal/provider/resource_iosxe_interface_ospf.go b/internal/provider/resource_iosxe_interface_ospf.go index c872a7325..cc52c9928 100644 --- a/internal/provider/resource_iosxe_interface_ospf.go +++ b/internal/provider/resource_iosxe_interface_ospf.go @@ -188,6 +188,18 @@ func (r *InterfaceOSPFResource) Schema(ctx context.Context, req resource.SchemaR }, }, }, + "multi_area_ids": schema.ListNestedAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Set the OSPF multi-area ID").String, + Optional: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "area_id": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("OSPF multi-area ID").String, + Required: true, + }, + }, + }, + }, "message_digest_keys": schema.ListNestedAttribute{ MarkdownDescription: helpers.NewAttributeDescription("Message digest authentication password (key)").String, Optional: true, diff --git a/internal/provider/resource_iosxe_interface_ospf_test.go b/internal/provider/resource_iosxe_interface_ospf_test.go index c8bdc637b..a29cf3c89 100644 --- a/internal/provider/resource_iosxe_interface_ospf_test.go +++ b/internal/provider/resource_iosxe_interface_ospf_test.go @@ -46,6 +46,7 @@ func TestAccIosxeInterfaceOSPF(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("iosxe_interface_ospf.test", "ttl_security_hops", "2")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_interface_ospf.test", "process_ids.0.id", "1")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_interface_ospf.test", "process_ids.0.areas.0.area_id", "0")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_interface_ospf.test", "multi_area_ids.0.area_id", "10")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_interface_ospf.test", "message_digest_keys.0.id", "1")) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -141,6 +142,9 @@ func testAccIosxeInterfaceOSPFConfig_all() string { config += ` area_id = "0"` + "\n" config += ` }]` + "\n" config += ` }]` + "\n" + config += ` multi_area_ids = [{` + "\n" + config += ` area_id = "10"` + "\n" + config += ` }]` + "\n" config += ` message_digest_keys = [{` + "\n" config += ` id = 1` + "\n" config += ` md5_auth_key = "mykey"` + "\n" diff --git a/internal/provider/resource_iosxe_ospf.go b/internal/provider/resource_iosxe_ospf.go index 49be17386..3baac4afd 100644 --- a/internal/provider/resource_iosxe_ospf.go +++ b/internal/provider/resource_iosxe_ospf.go @@ -296,6 +296,81 @@ func (r *OSPFResource) Schema(ctx context.Context, req resource.SchemaRequest, r ElementType: types.StringType, Optional: true, }, + "log_adjacency_changes": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Log changes in adjacency state").String, + Optional: true, + }, + "log_adjacency_changes_detail": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Log all state changes").String, + Optional: true, + }, + "nsf_cisco": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Cisco Non-stop forwarding").String, + Optional: true, + }, + "nsf_cisco_enforce_global": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("For the whole OSPF process").String, + Optional: true, + }, + "nsf_ietf": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("IETF graceful restart").String, + Optional: true, + }, + "nsf_ietf_restart_interval": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("Graceful restart interval").AddIntegerRangeDescription(1, 1800).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(1, 1800), + }, + }, + "max_metric_router_lsa": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Maximum metric in self-originated router-LSAs").String, + Optional: true, + }, + "max_metric_router_lsa_summary_lsa_metric": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("").AddIntegerRangeDescription(1, 16777214).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(1, 16777214), + }, + }, + "max_metric_router_lsa_external_lsa_metric": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("").AddIntegerRangeDescription(1, 16777214).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(1, 16777214), + }, + }, + "max_metric_router_lsa_include_stub": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Set maximum metric for stub links in router-LSAs").String, + Optional: true, + }, + "max_metric_router_lsa_on_startup_time": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("").AddIntegerRangeDescription(5, 86400).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(5, 86400), + }, + }, + "max_metric_router_lsa_on_startup_wait_for_bgp": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Let BGP decide when to originate router-LSA with normal metric").String, + Optional: true, + }, + "fast_reroute_per_prefix_enable_prefix_priority": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Priority of prefixes to be protected").AddStringEnumDescription("high", "low").String, + Optional: true, + Validators: []validator.String{ + stringvalidator.OneOf("high", "low"), + }, + }, + "redistribute_static_subnets": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Consider subnets for redistribution into OSPF (Will be removed in the future)").String, + Optional: true, + }, + "redistribute_connected_subnets": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Consider subnets for redistribution into OSPF (Will be removed in the future)").String, + Optional: true, + }, "passive_interface_disable_gigabit_ethernets": schema.SetNestedAttribute{ MarkdownDescription: helpers.NewAttributeDescription("").String, Optional: true, diff --git a/internal/provider/resource_iosxe_ospf_test.go b/internal/provider/resource_iosxe_ospf_test.go index d57b3a2a2..14c38c645 100644 --- a/internal/provider/resource_iosxe_ospf_test.go +++ b/internal/provider/resource_iosxe_ospf_test.go @@ -62,6 +62,21 @@ func TestAccIosxeOSPF(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "areas.0.nssa_no_redistribution", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "auto_cost_reference_bandwidth", "40000")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "passive_interface_default", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "log_adjacency_changes", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "log_adjacency_changes_detail", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "nsf_cisco", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "nsf_cisco_enforce_global", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "nsf_ietf", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "nsf_ietf_restart_interval", "120")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "max_metric_router_lsa", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "max_metric_router_lsa_summary_lsa_metric", "16711680")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "max_metric_router_lsa_external_lsa_metric", "16711680")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "max_metric_router_lsa_include_stub", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "max_metric_router_lsa_on_startup_time", "60")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "max_metric_router_lsa_on_startup_wait_for_bgp", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "fast_reroute_per_prefix_enable_prefix_priority", "high")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "redistribute_static_subnets", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf.test", "redistribute_connected_subnets", "true")) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, @@ -154,6 +169,21 @@ func testAccIosxeOSPFConfig_all() string { config += ` }]` + "\n" config += ` auto_cost_reference_bandwidth = 40000` + "\n" config += ` passive_interface_default = true` + "\n" + config += ` log_adjacency_changes = true` + "\n" + config += ` log_adjacency_changes_detail = true` + "\n" + config += ` nsf_cisco = true` + "\n" + config += ` nsf_cisco_enforce_global = true` + "\n" + config += ` nsf_ietf = true` + "\n" + config += ` nsf_ietf_restart_interval = 120` + "\n" + config += ` max_metric_router_lsa = true` + "\n" + config += ` max_metric_router_lsa_summary_lsa_metric = 16711680` + "\n" + config += ` max_metric_router_lsa_external_lsa_metric = 16711680` + "\n" + config += ` max_metric_router_lsa_include_stub = true` + "\n" + config += ` max_metric_router_lsa_on_startup_time = 60` + "\n" + config += ` max_metric_router_lsa_on_startup_wait_for_bgp = true` + "\n" + config += ` fast_reroute_per_prefix_enable_prefix_priority = "high"` + "\n" + config += ` redistribute_static_subnets = true` + "\n" + config += ` redistribute_connected_subnets = true` + "\n" config += `}` + "\n" return config } diff --git a/internal/provider/resource_iosxe_ospf_vrf.go b/internal/provider/resource_iosxe_ospf_vrf.go index 2d3e48b84..ec8445147 100644 --- a/internal/provider/resource_iosxe_ospf_vrf.go +++ b/internal/provider/resource_iosxe_ospf_vrf.go @@ -138,6 +138,74 @@ func (r *OSPFVRFResource) Schema(ctx context.Context, req resource.SchemaRequest int64validator.Between(1, 4294967295), }, }, + "log_adjacency_changes": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Log changes in adjacency state").String, + Optional: true, + }, + "log_adjacency_changes_detail": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Log all state changes").String, + Optional: true, + }, + "nsf_cisco": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Cisco Non-stop forwarding").String, + Optional: true, + }, + "nsf_cisco_enforce_global": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("For the whole OSPF process").String, + Optional: true, + }, + "nsf_ietf": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("IETF graceful restart").String, + Optional: true, + }, + "nsf_ietf_restart_interval": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("Graceful restart interval").AddIntegerRangeDescription(1, 1800).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(1, 1800), + }, + }, + "max_metric_router_lsa": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Maximum metric in self-originated router-LSAs").String, + Optional: true, + }, + "max_metric_router_lsa_summary_lsa_metric": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("").AddIntegerRangeDescription(1, 16777214).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(1, 16777214), + }, + }, + "max_metric_router_lsa_external_lsa_metric": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("").AddIntegerRangeDescription(1, 16777214).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(1, 16777214), + }, + }, + "max_metric_router_lsa_include_stub": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Set maximum metric for stub links in router-LSAs").String, + Optional: true, + }, + "max_metric_router_lsa_on_startup_time": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("").AddIntegerRangeDescription(5, 86400).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(5, 86400), + }, + }, + "max_metric_router_lsa_on_startup_wait_for_bgp": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Let BGP decide when to originate router-LSA with normal metric").String, + Optional: true, + }, + "redistribute_static_subnets": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Consider subnets for redistribution into OSPF (Will be removed in the future)").String, + Optional: true, + }, + "redistribute_connected_subnets": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Consider subnets for redistribution into OSPF (Will be removed in the future)").String, + Optional: true, + }, "mpls_ldp_autoconfig": schema.BoolAttribute{ MarkdownDescription: helpers.NewAttributeDescription("Configure LDP automatic configuration").String, Optional: true, diff --git a/internal/provider/resource_iosxe_ospf_vrf_test.go b/internal/provider/resource_iosxe_ospf_vrf_test.go index 8deb3c2a5..8d97991b0 100644 --- a/internal/provider/resource_iosxe_ospf_vrf_test.go +++ b/internal/provider/resource_iosxe_ospf_vrf_test.go @@ -42,6 +42,20 @@ func TestAccIosxeOSPFVRF(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "default_metric", "21")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "distance", "120")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "domain_tag", "10")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "log_adjacency_changes", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "log_adjacency_changes_detail", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "nsf_cisco", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "nsf_cisco_enforce_global", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "nsf_ietf", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "nsf_ietf_restart_interval", "120")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "max_metric_router_lsa", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "max_metric_router_lsa_summary_lsa_metric", "16711680")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "max_metric_router_lsa_external_lsa_metric", "16711680")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "max_metric_router_lsa_include_stub", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "max_metric_router_lsa_on_startup_time", "60")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "max_metric_router_lsa_on_startup_wait_for_bgp", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "redistribute_static_subnets", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "redistribute_connected_subnets", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "neighbor.0.ip", "2.2.2.2")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "neighbor.0.priority", "10")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_ospf_vrf.test", "neighbor.0.cost", "100")) @@ -142,6 +156,20 @@ func testAccIosxeOSPFVRFConfig_all() string { config += ` default_metric = 21` + "\n" config += ` distance = 120` + "\n" config += ` domain_tag = 10` + "\n" + config += ` log_adjacency_changes = true` + "\n" + config += ` log_adjacency_changes_detail = true` + "\n" + config += ` nsf_cisco = true` + "\n" + config += ` nsf_cisco_enforce_global = true` + "\n" + config += ` nsf_ietf = true` + "\n" + config += ` nsf_ietf_restart_interval = 120` + "\n" + config += ` max_metric_router_lsa = true` + "\n" + config += ` max_metric_router_lsa_summary_lsa_metric = 16711680` + "\n" + config += ` max_metric_router_lsa_external_lsa_metric = 16711680` + "\n" + config += ` max_metric_router_lsa_include_stub = true` + "\n" + config += ` max_metric_router_lsa_on_startup_time = 60` + "\n" + config += ` max_metric_router_lsa_on_startup_wait_for_bgp = true` + "\n" + config += ` redistribute_static_subnets = true` + "\n" + config += ` redistribute_connected_subnets = true` + "\n" config += ` neighbor = [{` + "\n" config += ` ip = "2.2.2.2"` + "\n" config += ` priority = 10` + "\n"