diff --git a/CHANGELOG.md b/CHANGELOG.md index cd6385a6..a9eb57ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.4.1 (unreleased) + +- Add `iosxe_errdisable` resource and data source +- Add `iosxe_line` resource and data source + ## 0.4.0 - Fix issue when using `tunnel_destination_ipv4` or `tunnel_mode_ipsec_ipv4` attributes of `iosxe_interface_tunnel` resource @@ -41,8 +46,6 @@ - BREAKING CHANGE: Rename `summary_address` attribute to `summary_addresses` of `iosxe_ospf` resource and data source - Add `ipv4_unicast_networks_mask` and `ipv4_unicast_networks` attribute to `iosxe_bgp_address_family_ipv4` and `iosxe_bgp_address_family_ipv4_vrf` resources and data sources - Add `ipv6_unicast_networks` attribute to `iosxe_bgp_address_family_ipv6` and `iosxe_bgp_address_family_ipv6_vrf` resources and data sources -- Add `iosxe_errdisable` resource and data source -- Add `iosxe_line` resource and data source ## 0.3.3 diff --git a/docs/data-sources/line.md b/docs/data-sources/line.md index ab7ddf70..0d0e8dd8 100644 --- a/docs/data-sources/line.md +++ b/docs/data-sources/line.md @@ -40,10 +40,10 @@ Read-Only: - `first` (String) - `login_authentication` (String) - `login_local` (Boolean) +- `password` (String) - `password_level` (Number) Set exec level password -- `password_secret` (String) - `password_type` (String) -- `privilege_level_number` (Number) +- `privilege_level` (Number) - `stopbits` (String) Set async line stop bits @@ -52,20 +52,20 @@ Read-Only: Read-Only: -- `access_class` (Attributes List) (see [below for nested schema](#nestedatt--vty--access_class)) -- `escape_character_char` (String) +- `access_classes` (Attributes List) (see [below for nested schema](#nestedatt--vty--access_classes)) +- `escape_character` (String) - `exec_timeout_minutes` (Number) <0-35791>;;Timeout in minutes - `exec_timeout_seconds` (Number) <0-2147483>;;Timeout in seconds - `first` (Number) - `last` (Number) - `login_authentication` (String) +- `password` (String) - `password_level` (Number) Set exec level password -- `password_secret` (String) - `password_type` (String) - `transport_preferred_protocol` (String) -<a id="nestedatt--vty--access_class"></a> -### Nested Schema for `vty.access_class` +<a id="nestedatt--vty--access_classes"></a> +### Nested Schema for `vty.access_classes` Read-Only: diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index af149455..f3e68c81 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -7,6 +7,11 @@ description: |- # Changelog +## 0.4.1 (unreleased) + +- Add `iosxe_errdisable` resource and data source +- Add `iosxe_line` resource and data source + ## 0.4.0 - Fix issue when using `tunnel_destination_ipv4` or `tunnel_mode_ipsec_ipv4` attributes of `iosxe_interface_tunnel` resource @@ -50,8 +55,6 @@ description: |- - BREAKING CHANGE: Rename `summary_address` attribute to `summary_addresses` of `iosxe_ospf` resource and data source - Add `ipv4_unicast_networks_mask` and `ipv4_unicast_networks` attribute to `iosxe_bgp_address_family_ipv4` and `iosxe_bgp_address_family_ipv4_vrf` resources and data sources - Add `ipv6_unicast_networks` attribute to `iosxe_bgp_address_family_ipv6` and `iosxe_bgp_address_family_ipv6_vrf` resources and data sources -- Add `iosxe_errdisable` resource and data source -- Add `iosxe_line` resource and data source ## 0.3.3 diff --git a/docs/resources/errdisable.md b/docs/resources/errdisable.md index 18a70e0f..9dfe2f62 100644 --- a/docs/resources/errdisable.md +++ b/docs/resources/errdisable.md @@ -14,43 +14,34 @@ This resource can manage the Errdisable configuration. ```terraform resource "iosxe_errdisable" "example" { - detect_cause_all = true - detect_cause_arp_inspection = true - detect_cause_dhcp_rate_limit = true - detect_cause_dtp_flap = true - detect_cause_l2ptguard = true - detect_cause_link_flap = true - detect_cause_security_violation_shutdown_vlan = true - flap_setting_cause_dtp_flap_max_flaps = 80 - flap_setting_cause_dtp_flap_time = 90 - flap_setting_cause_link_flap_max_flaps = 80 - flap_setting_cause_link_flap_time = 90 - flap_setting_cause_pagp_flap_max_flaps = 80 - flap_setting_cause_pagp_flap_time = 90 - recovery_interval = 855 - recovery_cause_all = true - recovery_cause_arp_inspection = true - recovery_cause_bpduguard = true - recovery_cause_channel_misconfig = true - recovery_cause_dhcp_rate_limit = true - recovery_cause_dtp_flap = true - recovery_cause_gbic_invalid = true - recovery_cause_inline_power = true - recovery_cause_l2ptguard = true - recovery_cause_link_flap = true - recovery_cause_link_monitor_failure = true - recovery_cause_loopback = true - recovery_cause_mac_limit = true - recovery_cause_pagp_flap = true - recovery_cause_port_mode_failure = true - recovery_cause_pppoe_ia_rate_limit = true - recovery_cause_psp = true - recovery_cause_psecure_violation = true - recovery_cause_security_violation = true - recovery_cause_sfp_config_mismatch = true - recovery_cause_storm_control = true - recovery_cause_udld = true - recovery_cause_loopdetect = true + detect_cause_all = true + detect_cause_dhcp_rate_limit = true + detect_cause_dtp_flap = true + detect_cause_l2ptguard = true + detect_cause_link_flap = true + detect_cause_pppoe_ia_rate_limit = true + detect_cause_loopdetect = true + flap_setting_cause_dtp_flap_max_flaps = 80 + flap_setting_cause_dtp_flap_time = 90 + flap_setting_cause_link_flap_max_flaps = 80 + flap_setting_cause_link_flap_time = 90 + flap_setting_cause_pagp_flap_max_flaps = 80 + flap_setting_cause_pagp_flap_time = 90 + recovery_interval = 855 + recovery_cause_all = true + recovery_cause_arp_inspection = true + recovery_cause_bpduguard = true + recovery_cause_dhcp_rate_limit = true + recovery_cause_dtp_flap = true + recovery_cause_l2ptguard = true + recovery_cause_link_flap = true + recovery_cause_port_mode_failure = true + recovery_cause_pppoe_ia_rate_limit = true + recovery_cause_psp = true + recovery_cause_psecure_violation = true + recovery_cause_security_violation = true + recovery_cause_udld = true + recovery_cause_loopdetect = true } ``` diff --git a/docs/resources/line.md b/docs/resources/line.md index 7a525053..cbb41297 100644 --- a/docs/resources/line.md +++ b/docs/resources/line.md @@ -16,20 +16,20 @@ This resource can manage the Line configuration. resource "iosxe_line" "example" { console = [ { - first = "0" - exec_timeout_minutes = 45 - exec_timeout_seconds = 25 - privilege_level_number = 15 - stopbits = "1" - password_type = "0" - password_secret = "testpasswd" + first = "0" + exec_timeout_minutes = 45 + exec_timeout_seconds = 25 + privilege_level = 15 + stopbits = "1" + password_type = "0" + password = "testpasswd" } ] vty = [ { first = 10 last = 27 - access_class = [ + access_classes = [ { direction = "in" access_list = "2" @@ -39,9 +39,9 @@ resource "iosxe_line" "example" { exec_timeout_minutes = 45 exec_timeout_seconds = 25 password_type = "0" - password_secret = "testpasswd" + password = "testpasswd" transport_preferred_protocol = "none" - escape_character_char = "27" + escape_character = "27" } ] } @@ -77,11 +77,11 @@ Optional: - Range: `0`-`2147483` - `login_authentication` (String) - `login_local` (Boolean) +- `password` (String) - `password_level` (Number) Set exec level password - Range: `0`-`255` -- `password_secret` (String) - `password_type` (String) - Choices: `0`, `7` -- `privilege_level_number` (Number) - Range: `0`-`15` +- `privilege_level` (Number) - Range: `0`-`15` - `stopbits` (String) Set async line stop bits - Choices: `1`, `1.5`, `2` @@ -95,22 +95,22 @@ Required: Optional: -- `access_class` (Attributes List) (see [below for nested schema](#nestedatt--vty--access_class)) -- `escape_character_char` (String) +- `access_classes` (Attributes List) (see [below for nested schema](#nestedatt--vty--access_classes)) +- `escape_character` (String) - `exec_timeout_minutes` (Number) <0-35791>;;Timeout in minutes - Range: `0`-`35791` - `exec_timeout_seconds` (Number) <0-2147483>;;Timeout in seconds - Range: `0`-`2147483` - `last` (Number) - Range: `1`-`1869` - `login_authentication` (String) +- `password` (String) - `password_level` (Number) Set exec level password - Range: `0`-`255` -- `password_secret` (String) - `password_type` (String) - Choices: `0`, `7` - `transport_preferred_protocol` (String) - Choices: `acercon`, `lat`, `mop`, `nasi`, `none`, `pad`, `rlogin`, `ssh`, `telnet`, `udptn` -<a id="nestedatt--vty--access_class"></a> -### Nested Schema for `vty.access_class` +<a id="nestedatt--vty--access_classes"></a> +### Nested Schema for `vty.access_classes` Required: diff --git a/examples/resources/iosxe_errdisable/resource.tf b/examples/resources/iosxe_errdisable/resource.tf index a88fb068..0c3a3c9d 100644 --- a/examples/resources/iosxe_errdisable/resource.tf +++ b/examples/resources/iosxe_errdisable/resource.tf @@ -1,39 +1,30 @@ resource "iosxe_errdisable" "example" { - detect_cause_all = true - detect_cause_arp_inspection = true - detect_cause_dhcp_rate_limit = true - detect_cause_dtp_flap = true - detect_cause_l2ptguard = true - detect_cause_link_flap = true - detect_cause_security_violation_shutdown_vlan = true - flap_setting_cause_dtp_flap_max_flaps = 80 - flap_setting_cause_dtp_flap_time = 90 - flap_setting_cause_link_flap_max_flaps = 80 - flap_setting_cause_link_flap_time = 90 - flap_setting_cause_pagp_flap_max_flaps = 80 - flap_setting_cause_pagp_flap_time = 90 - recovery_interval = 855 - recovery_cause_all = true - recovery_cause_arp_inspection = true - recovery_cause_bpduguard = true - recovery_cause_channel_misconfig = true - recovery_cause_dhcp_rate_limit = true - recovery_cause_dtp_flap = true - recovery_cause_gbic_invalid = true - recovery_cause_inline_power = true - recovery_cause_l2ptguard = true - recovery_cause_link_flap = true - recovery_cause_link_monitor_failure = true - recovery_cause_loopback = true - recovery_cause_mac_limit = true - recovery_cause_pagp_flap = true - recovery_cause_port_mode_failure = true - recovery_cause_pppoe_ia_rate_limit = true - recovery_cause_psp = true - recovery_cause_psecure_violation = true - recovery_cause_security_violation = true - recovery_cause_sfp_config_mismatch = true - recovery_cause_storm_control = true - recovery_cause_udld = true - recovery_cause_loopdetect = true + detect_cause_all = true + detect_cause_dhcp_rate_limit = true + detect_cause_dtp_flap = true + detect_cause_l2ptguard = true + detect_cause_link_flap = true + detect_cause_pppoe_ia_rate_limit = true + detect_cause_loopdetect = true + flap_setting_cause_dtp_flap_max_flaps = 80 + flap_setting_cause_dtp_flap_time = 90 + flap_setting_cause_link_flap_max_flaps = 80 + flap_setting_cause_link_flap_time = 90 + flap_setting_cause_pagp_flap_max_flaps = 80 + flap_setting_cause_pagp_flap_time = 90 + recovery_interval = 855 + recovery_cause_all = true + recovery_cause_arp_inspection = true + recovery_cause_bpduguard = true + recovery_cause_dhcp_rate_limit = true + recovery_cause_dtp_flap = true + recovery_cause_l2ptguard = true + recovery_cause_link_flap = true + recovery_cause_port_mode_failure = true + recovery_cause_pppoe_ia_rate_limit = true + recovery_cause_psp = true + recovery_cause_psecure_violation = true + recovery_cause_security_violation = true + recovery_cause_udld = true + recovery_cause_loopdetect = true } diff --git a/examples/resources/iosxe_line/resource.tf b/examples/resources/iosxe_line/resource.tf index f5a17411..abac47fb 100644 --- a/examples/resources/iosxe_line/resource.tf +++ b/examples/resources/iosxe_line/resource.tf @@ -1,20 +1,20 @@ resource "iosxe_line" "example" { console = [ { - first = "0" - exec_timeout_minutes = 45 - exec_timeout_seconds = 25 - privilege_level_number = 15 - stopbits = "1" - password_type = "0" - password_secret = "testpasswd" + first = "0" + exec_timeout_minutes = 45 + exec_timeout_seconds = 25 + privilege_level = 15 + stopbits = "1" + password_type = "0" + password = "testpasswd" } ] vty = [ { first = 10 last = 27 - access_class = [ + access_classes = [ { direction = "in" access_list = "2" @@ -24,9 +24,9 @@ resource "iosxe_line" "example" { exec_timeout_minutes = 45 exec_timeout_seconds = 25 password_type = "0" - password_secret = "testpasswd" + password = "testpasswd" transport_preferred_protocol = "none" - escape_character_char = "27" + escape_character = "27" } ] } diff --git a/gen/definitions/errdisable.yaml b/gen/definitions/errdisable.yaml index dbc0ad5f..bc5776c9 100644 --- a/gen/definitions/errdisable.yaml +++ b/gen/definitions/errdisable.yaml @@ -2,12 +2,12 @@ name: Errdisable path: Cisco-IOS-XE-native:native/errdisable doc_category: System -test_tags: [C9000V] attributes: - yang_name: detect/cause/all example: true - yang_name: detect/cause/arp-inspection example: true + test_tags: [C9000V] - yang_name: detect/cause/bpduguard example: true exclude_test: true @@ -36,9 +36,9 @@ attributes: exclude_test: true - yang_name: detect/cause/pppoe-ia-rate-limit example: true - exclude_test: true - yang_name: detect/cause/security-violation/shutdown/vlan example: true + test_tags: [C9000V] - yang_name: detect/cause/sfp-config-mismatch example: true exclude_test: true @@ -47,20 +47,24 @@ attributes: exclude_test: true - yang_name: detect/cause/loopdetect example: true - exclude_test: true - yang_name: flap-setting/cause/dtp-flap/max-flaps - example: 80 + example: 80 + delete_parent: true - yang_name: flap-setting/cause/dtp-flap/time example: 90 + delete_parent: true - yang_name: flap-setting/cause/link-flap/max-flaps - example: 80 + example: 80 + delete_parent: true - yang_name: flap-setting/cause/link-flap/time example: 90 + delete_parent: true - yang_name: flap-setting/cause/pagp-flap/max-flaps - example: 80 + example: 80 + delete_parent: true - yang_name: flap-setting/cause/pagp-flap/time example: 90 - + delete_parent: true - yang_name: recovery/interval example: 855 - yang_name: recovery/cause/all @@ -71,44 +75,36 @@ attributes: example: true - yang_name: recovery/cause/channel-misconfig example: true - # exclude_test: true + test_tags: [C9000V] - yang_name: recovery/cause/dhcp-rate-limit example: true - yang_name: recovery/cause/dtp-flap example: true - yang_name: recovery/cause/gbic-invalid example: true - # exclude_test: true + test_tags: [C9000V] - yang_name: recovery/cause/inline-power example: true - # exclude_test: true + test_tags: [C9000V] - yang_name: recovery/cause/l2ptguard example: true - yang_name: recovery/cause/link-flap example: true - yang_name: recovery/cause/link-monitor-failure example: true - # exclude_test: true + test_tags: [C9000V] - yang_name: recovery/cause/loopback example: true - # exclude_test: true + test_tags: [C9000V] - yang_name: recovery/cause/mac-limit example: true - # exclude_test: true + test_tags: [C9000V] - yang_name: recovery/cause/mlacp-minlink example: true exclude_test: true - - # - yang_name: recovery/cause/oam-remote-failure/critical-event - # example: true - # - yang_name: recovery/cause/oam-remote-failure/dying-gasp - # example: true - # - yang_name: recovery/cause/oam-remote-failure/link-fault - # example: true - - yang_name: recovery/cause/pagp-flap example: true - # exclude_test: true + test_tags: [C9000V] - yang_name: recovery/cause/port-mode-failure example: true - yang_name: recovery/cause/pppoe-ia-rate-limit @@ -121,13 +117,13 @@ attributes: example: true - yang_name: recovery/cause/sfp-config-mismatch example: true - # exclude_test: true + test_tags: [C9000V] - yang_name: recovery/cause/small-frame example: true exclude_test: true - yang_name: recovery/cause/storm-control example: true - # exclude_test: true + test_tags: [C9000V] - yang_name: recovery/cause/udld example: true - yang_name: recovery/cause/unicast-flood @@ -138,4 +134,3 @@ attributes: exclude_test: true - yang_name: recovery/cause/loopdetect example: true - # exclude_test: true diff --git a/gen/definitions/line.yaml b/gen/definitions/line.yaml index 2d49c047..eafa0a5c 100644 --- a/gen/definitions/line.yaml +++ b/gen/definitions/line.yaml @@ -2,10 +2,12 @@ name: Line path: Cisco-IOS-XE-native:native/line doc_category: System +test_tags: [LINE] attributes: - yang_name: console tf_name: console type: List + no_delete: true attributes: - yang_name: first id: true @@ -21,6 +23,7 @@ attributes: example: localonly exclude_test: true - yang_name: privilege/level/number + tf_name: privilege_level example: 15 - yang_name: stopbits example: 1 @@ -30,11 +33,12 @@ attributes: - yang_name: password/type example: 0 - yang_name: password/secret + tf_name: password example: testpasswd - - yang_name: vty tf_name: vty type: List + no_delete: true attributes: - yang_name: first id: true @@ -42,7 +46,7 @@ attributes: - yang_name: last example: 27 - yang_name: access-class/acccess-list - tf_name: access_class + tf_name: access_classes type: List attributes: - yang_name: direction @@ -62,6 +66,7 @@ attributes: - yang_name: password/type example: 0 - yang_name: password/secret + tf_name: password example: testpasswd - yang_name: login/authentication example: LOGINAUTH @@ -69,4 +74,5 @@ attributes: - yang_name: transport/preferred/protocol example: none - yang_name: escape-character/char + tf_name: escape_character example: 27 diff --git a/internal/provider/data_source_iosxe_errdisable_test.go b/internal/provider/data_source_iosxe_errdisable_test.go index 09ef747c..39675b06 100644 --- a/internal/provider/data_source_iosxe_errdisable_test.go +++ b/internal/provider/data_source_iosxe_errdisable_test.go @@ -27,17 +27,20 @@ import ( ) func TestAccDataSourceIosxeErrdisable(t *testing.T) { - if os.Getenv("C9000V") == "" { - t.Skip("skipping test, set environment variable C9000V") - } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "detect_cause_all", "true")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "detect_cause_arp_inspection", "true")) + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "detect_cause_arp_inspection", "true")) + } checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "detect_cause_dhcp_rate_limit", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "detect_cause_dtp_flap", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "detect_cause_l2ptguard", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "detect_cause_link_flap", "true")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "detect_cause_security_violation_shutdown_vlan", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "detect_cause_pppoe_ia_rate_limit", "true")) + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "detect_cause_security_violation_shutdown_vlan", "true")) + } + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "detect_cause_loopdetect", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "flap_setting_cause_dtp_flap_max_flaps", "80")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "flap_setting_cause_dtp_flap_time", "90")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "flap_setting_cause_link_flap_max_flaps", "80")) @@ -48,24 +51,42 @@ func TestAccDataSourceIosxeErrdisable(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_all", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_arp_inspection", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_bpduguard", "true")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_channel_misconfig", "true")) + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_channel_misconfig", "true")) + } checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_dhcp_rate_limit", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_dtp_flap", "true")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_gbic_invalid", "true")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_inline_power", "true")) + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_gbic_invalid", "true")) + } + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_inline_power", "true")) + } checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_l2ptguard", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_link_flap", "true")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_link_monitor_failure", "true")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_loopback", "true")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_mac_limit", "true")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_pagp_flap", "true")) + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_link_monitor_failure", "true")) + } + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_loopback", "true")) + } + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_mac_limit", "true")) + } + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_pagp_flap", "true")) + } checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_port_mode_failure", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_pppoe_ia_rate_limit", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_psp", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_psecure_violation", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_security_violation", "true")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_sfp_config_mismatch", "true")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_storm_control", "true")) + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_sfp_config_mismatch", "true")) + } + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_storm_control", "true")) + } checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_udld", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_errdisable.test", "recovery_cause_loopdetect", "true")) resource.Test(t, resource.TestCase{ @@ -84,12 +105,18 @@ func testAccDataSourceIosxeErrdisableConfig() string { config := `resource "iosxe_errdisable" "test" {` + "\n" config += ` delete_mode = "attributes"` + "\n" config += ` detect_cause_all = true` + "\n" - config += ` detect_cause_arp_inspection = true` + "\n" + if os.Getenv("C9000V") != "" { + config += ` detect_cause_arp_inspection = true` + "\n" + } config += ` detect_cause_dhcp_rate_limit = true` + "\n" config += ` detect_cause_dtp_flap = true` + "\n" config += ` detect_cause_l2ptguard = true` + "\n" config += ` detect_cause_link_flap = true` + "\n" - config += ` detect_cause_security_violation_shutdown_vlan = true` + "\n" + config += ` detect_cause_pppoe_ia_rate_limit = true` + "\n" + if os.Getenv("C9000V") != "" { + config += ` detect_cause_security_violation_shutdown_vlan = true` + "\n" + } + config += ` detect_cause_loopdetect = true` + "\n" config += ` flap_setting_cause_dtp_flap_max_flaps = 80` + "\n" config += ` flap_setting_cause_dtp_flap_time = 90` + "\n" config += ` flap_setting_cause_link_flap_max_flaps = 80` + "\n" @@ -100,24 +127,42 @@ func testAccDataSourceIosxeErrdisableConfig() string { config += ` recovery_cause_all = true` + "\n" config += ` recovery_cause_arp_inspection = true` + "\n" config += ` recovery_cause_bpduguard = true` + "\n" - config += ` recovery_cause_channel_misconfig = true` + "\n" + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_channel_misconfig = true` + "\n" + } config += ` recovery_cause_dhcp_rate_limit = true` + "\n" config += ` recovery_cause_dtp_flap = true` + "\n" - config += ` recovery_cause_gbic_invalid = true` + "\n" - config += ` recovery_cause_inline_power = true` + "\n" + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_gbic_invalid = true` + "\n" + } + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_inline_power = true` + "\n" + } config += ` recovery_cause_l2ptguard = true` + "\n" config += ` recovery_cause_link_flap = true` + "\n" - config += ` recovery_cause_link_monitor_failure = true` + "\n" - config += ` recovery_cause_loopback = true` + "\n" - config += ` recovery_cause_mac_limit = true` + "\n" - config += ` recovery_cause_pagp_flap = true` + "\n" + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_link_monitor_failure = true` + "\n" + } + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_loopback = true` + "\n" + } + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_mac_limit = true` + "\n" + } + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_pagp_flap = true` + "\n" + } config += ` recovery_cause_port_mode_failure = true` + "\n" config += ` recovery_cause_pppoe_ia_rate_limit = true` + "\n" config += ` recovery_cause_psp = true` + "\n" config += ` recovery_cause_psecure_violation = true` + "\n" config += ` recovery_cause_security_violation = true` + "\n" - config += ` recovery_cause_sfp_config_mismatch = true` + "\n" - config += ` recovery_cause_storm_control = true` + "\n" + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_sfp_config_mismatch = true` + "\n" + } + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_storm_control = true` + "\n" + } config += ` recovery_cause_udld = true` + "\n" config += ` recovery_cause_loopdetect = true` + "\n" config += `}` + "\n" diff --git a/internal/provider/data_source_iosxe_line.go b/internal/provider/data_source_iosxe_line.go index d8d559dd..927130dd 100644 --- a/internal/provider/data_source_iosxe_line.go +++ b/internal/provider/data_source_iosxe_line.go @@ -88,7 +88,7 @@ func (d *LineDataSource) Schema(ctx context.Context, req datasource.SchemaReques MarkdownDescription: "", Computed: true, }, - "privilege_level_number": schema.Int64Attribute{ + "privilege_level": schema.Int64Attribute{ MarkdownDescription: "", Computed: true, }, @@ -104,7 +104,7 @@ func (d *LineDataSource) Schema(ctx context.Context, req datasource.SchemaReques MarkdownDescription: "", Computed: true, }, - "password_secret": schema.StringAttribute{ + "password": schema.StringAttribute{ MarkdownDescription: "", Computed: true, }, @@ -124,7 +124,7 @@ func (d *LineDataSource) Schema(ctx context.Context, req datasource.SchemaReques MarkdownDescription: "", Computed: true, }, - "access_class": schema.ListNestedAttribute{ + "access_classes": schema.ListNestedAttribute{ MarkdownDescription: "", Computed: true, NestedObject: schema.NestedAttributeObject{ @@ -160,7 +160,7 @@ func (d *LineDataSource) Schema(ctx context.Context, req datasource.SchemaReques MarkdownDescription: "", Computed: true, }, - "password_secret": schema.StringAttribute{ + "password": schema.StringAttribute{ MarkdownDescription: "", Computed: true, }, @@ -172,7 +172,7 @@ func (d *LineDataSource) Schema(ctx context.Context, req datasource.SchemaReques MarkdownDescription: "", Computed: true, }, - "escape_character_char": schema.StringAttribute{ + "escape_character": schema.StringAttribute{ MarkdownDescription: "", Computed: true, }, diff --git a/internal/provider/data_source_iosxe_line_test.go b/internal/provider/data_source_iosxe_line_test.go index 8f330c34..889c94a1 100644 --- a/internal/provider/data_source_iosxe_line_test.go +++ b/internal/provider/data_source_iosxe_line_test.go @@ -30,21 +30,21 @@ func TestAccDataSourceIosxeLine(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "console.0.first", "0")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "console.0.exec_timeout_minutes", "45")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "console.0.exec_timeout_seconds", "25")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "console.0.privilege_level_number", "15")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "console.0.privilege_level", "15")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "console.0.stopbits", "1")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "console.0.password_type", "0")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "console.0.password_secret", "testpasswd")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "console.0.password", "testpasswd")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.first", "10")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.last", "27")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.access_class.0.direction", "in")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.access_class.0.access_list", "2")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.access_class.0.vrf_also", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.access_classes.0.direction", "in")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.access_classes.0.access_list", "2")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.access_classes.0.vrf_also", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.exec_timeout_minutes", "45")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.exec_timeout_seconds", "25")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.password_type", "0")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.password_secret", "testpasswd")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.password", "testpasswd")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.transport_preferred_protocol", "none")) - checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.escape_character_char", "27")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_line.test", "vty.0.escape_character", "27")) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, @@ -64,15 +64,15 @@ func testAccDataSourceIosxeLineConfig() string { config += ` first = "0"` + "\n" config += ` exec_timeout_minutes = 45` + "\n" config += ` exec_timeout_seconds = 25` + "\n" - config += ` privilege_level_number = 15` + "\n" + config += ` privilege_level = 15` + "\n" config += ` stopbits = "1"` + "\n" config += ` password_type = "0"` + "\n" - config += ` password_secret = "testpasswd"` + "\n" + config += ` password = "testpasswd"` + "\n" config += ` }]` + "\n" config += ` vty = [{` + "\n" config += ` first = 10` + "\n" config += ` last = 27` + "\n" - config += ` access_class = [{` + "\n" + config += ` access_classes = [{` + "\n" config += ` direction = "in"` + "\n" config += ` access_list = "2"` + "\n" config += ` vrf_also = true` + "\n" @@ -80,9 +80,9 @@ func testAccDataSourceIosxeLineConfig() string { config += ` exec_timeout_minutes = 45` + "\n" config += ` exec_timeout_seconds = 25` + "\n" config += ` password_type = "0"` + "\n" - config += ` password_secret = "testpasswd"` + "\n" + config += ` password = "testpasswd"` + "\n" config += ` transport_preferred_protocol = "none"` + "\n" - config += ` escape_character_char = "27"` + "\n" + config += ` escape_character = "27"` + "\n" config += ` }]` + "\n" config += `}` + "\n" diff --git a/internal/provider/model_iosxe_errdisable.go b/internal/provider/model_iosxe_errdisable.go index a555abb1..87148f91 100644 --- a/internal/provider/model_iosxe_errdisable.go +++ b/internal/provider/model_iosxe_errdisable.go @@ -1284,22 +1284,22 @@ func (data *Errdisable) getDeletePaths(ctx context.Context) []string { deletePaths = append(deletePaths, fmt.Sprintf("%v/detect/cause/loopdetect", data.getPath())) } if !data.FlapSettingCauseDtpFlapMaxFlaps.IsNull() { - deletePaths = append(deletePaths, fmt.Sprintf("%v/flap-setting/cause/dtp-flap/max-flaps", data.getPath())) + deletePaths = append(deletePaths, fmt.Sprintf("%v/flap-setting/cause/dtp-flap", data.getPath())) } if !data.FlapSettingCauseDtpFlapTime.IsNull() { - deletePaths = append(deletePaths, fmt.Sprintf("%v/flap-setting/cause/dtp-flap/time", data.getPath())) + deletePaths = append(deletePaths, fmt.Sprintf("%v/flap-setting/cause/dtp-flap", data.getPath())) } if !data.FlapSettingCauseLinkFlapMaxFlaps.IsNull() { - deletePaths = append(deletePaths, fmt.Sprintf("%v/flap-setting/cause/link-flap/max-flaps", data.getPath())) + deletePaths = append(deletePaths, fmt.Sprintf("%v/flap-setting/cause/link-flap", data.getPath())) } if !data.FlapSettingCauseLinkFlapTime.IsNull() { - deletePaths = append(deletePaths, fmt.Sprintf("%v/flap-setting/cause/link-flap/time", data.getPath())) + deletePaths = append(deletePaths, fmt.Sprintf("%v/flap-setting/cause/link-flap", data.getPath())) } if !data.FlapSettingCausePagpFlapMaxFlaps.IsNull() { - deletePaths = append(deletePaths, fmt.Sprintf("%v/flap-setting/cause/pagp-flap/max-flaps", data.getPath())) + deletePaths = append(deletePaths, fmt.Sprintf("%v/flap-setting/cause/pagp-flap", data.getPath())) } if !data.FlapSettingCausePagpFlapTime.IsNull() { - deletePaths = append(deletePaths, fmt.Sprintf("%v/flap-setting/cause/pagp-flap/time", data.getPath())) + deletePaths = append(deletePaths, fmt.Sprintf("%v/flap-setting/cause/pagp-flap", data.getPath())) } if !data.RecoveryInterval.IsNull() { deletePaths = append(deletePaths, fmt.Sprintf("%v/recovery/interval", data.getPath())) diff --git a/internal/provider/model_iosxe_line.go b/internal/provider/model_iosxe_line.go index b3ad7121..1fa4dbca 100644 --- a/internal/provider/model_iosxe_line.go +++ b/internal/provider/model_iosxe_line.go @@ -48,31 +48,31 @@ type LineData struct { Vty []LineVty `tfsdk:"vty"` } type LineConsole struct { - First types.String `tfsdk:"first"` - ExecTimeoutMinutes types.Int64 `tfsdk:"exec_timeout_minutes"` - ExecTimeoutSeconds types.Int64 `tfsdk:"exec_timeout_seconds"` - LoginLocal types.Bool `tfsdk:"login_local"` - LoginAuthentication types.String `tfsdk:"login_authentication"` - PrivilegeLevelNumber types.Int64 `tfsdk:"privilege_level_number"` - Stopbits types.String `tfsdk:"stopbits"` - PasswordLevel types.Int64 `tfsdk:"password_level"` - PasswordType types.String `tfsdk:"password_type"` - PasswordSecret types.String `tfsdk:"password_secret"` + First types.String `tfsdk:"first"` + ExecTimeoutMinutes types.Int64 `tfsdk:"exec_timeout_minutes"` + ExecTimeoutSeconds types.Int64 `tfsdk:"exec_timeout_seconds"` + LoginLocal types.Bool `tfsdk:"login_local"` + LoginAuthentication types.String `tfsdk:"login_authentication"` + PrivilegeLevel types.Int64 `tfsdk:"privilege_level"` + Stopbits types.String `tfsdk:"stopbits"` + PasswordLevel types.Int64 `tfsdk:"password_level"` + PasswordType types.String `tfsdk:"password_type"` + Password types.String `tfsdk:"password"` } type LineVty struct { - First types.Int64 `tfsdk:"first"` - Last types.Int64 `tfsdk:"last"` - AccessClass []LineVtyAccessClass `tfsdk:"access_class"` - ExecTimeoutMinutes types.Int64 `tfsdk:"exec_timeout_minutes"` - ExecTimeoutSeconds types.Int64 `tfsdk:"exec_timeout_seconds"` - PasswordLevel types.Int64 `tfsdk:"password_level"` - PasswordType types.String `tfsdk:"password_type"` - PasswordSecret types.String `tfsdk:"password_secret"` - LoginAuthentication types.String `tfsdk:"login_authentication"` - TransportPreferredProtocol types.String `tfsdk:"transport_preferred_protocol"` - EscapeCharacterChar types.String `tfsdk:"escape_character_char"` + First types.Int64 `tfsdk:"first"` + Last types.Int64 `tfsdk:"last"` + AccessClasses []LineVtyAccessClasses `tfsdk:"access_classes"` + ExecTimeoutMinutes types.Int64 `tfsdk:"exec_timeout_minutes"` + ExecTimeoutSeconds types.Int64 `tfsdk:"exec_timeout_seconds"` + PasswordLevel types.Int64 `tfsdk:"password_level"` + PasswordType types.String `tfsdk:"password_type"` + Password types.String `tfsdk:"password"` + LoginAuthentication types.String `tfsdk:"login_authentication"` + TransportPreferredProtocol types.String `tfsdk:"transport_preferred_protocol"` + EscapeCharacter types.String `tfsdk:"escape_character"` } -type LineVtyAccessClass struct { +type LineVtyAccessClasses struct { Direction types.String `tfsdk:"direction"` AccessList types.String `tfsdk:"access_list"` VrfAlso types.Bool `tfsdk:"vrf_also"` @@ -119,8 +119,8 @@ func (data Line) toBody(ctx context.Context) string { if !item.LoginAuthentication.IsNull() && !item.LoginAuthentication.IsUnknown() { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"console"+"."+strconv.Itoa(index)+"."+"login.authentication", item.LoginAuthentication.ValueString()) } - if !item.PrivilegeLevelNumber.IsNull() && !item.PrivilegeLevelNumber.IsUnknown() { - body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"console"+"."+strconv.Itoa(index)+"."+"privilege.level.number", strconv.FormatInt(item.PrivilegeLevelNumber.ValueInt64(), 10)) + if !item.PrivilegeLevel.IsNull() && !item.PrivilegeLevel.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"console"+"."+strconv.Itoa(index)+"."+"privilege.level.number", strconv.FormatInt(item.PrivilegeLevel.ValueInt64(), 10)) } if !item.Stopbits.IsNull() && !item.Stopbits.IsUnknown() { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"console"+"."+strconv.Itoa(index)+"."+"stopbits", item.Stopbits.ValueString()) @@ -131,8 +131,8 @@ func (data Line) toBody(ctx context.Context) string { if !item.PasswordType.IsNull() && !item.PasswordType.IsUnknown() { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"console"+"."+strconv.Itoa(index)+"."+"password.type", item.PasswordType.ValueString()) } - if !item.PasswordSecret.IsNull() && !item.PasswordSecret.IsUnknown() { - body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"console"+"."+strconv.Itoa(index)+"."+"password.secret", item.PasswordSecret.ValueString()) + if !item.Password.IsNull() && !item.Password.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"console"+"."+strconv.Itoa(index)+"."+"password.secret", item.Password.ValueString()) } } } @@ -157,8 +157,8 @@ func (data Line) toBody(ctx context.Context) string { if !item.PasswordType.IsNull() && !item.PasswordType.IsUnknown() { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"vty"+"."+strconv.Itoa(index)+"."+"password.type", item.PasswordType.ValueString()) } - if !item.PasswordSecret.IsNull() && !item.PasswordSecret.IsUnknown() { - body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"vty"+"."+strconv.Itoa(index)+"."+"password.secret", item.PasswordSecret.ValueString()) + if !item.Password.IsNull() && !item.Password.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"vty"+"."+strconv.Itoa(index)+"."+"password.secret", item.Password.ValueString()) } if !item.LoginAuthentication.IsNull() && !item.LoginAuthentication.IsUnknown() { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"vty"+"."+strconv.Itoa(index)+"."+"login.authentication", item.LoginAuthentication.ValueString()) @@ -166,12 +166,12 @@ func (data Line) toBody(ctx context.Context) string { if !item.TransportPreferredProtocol.IsNull() && !item.TransportPreferredProtocol.IsUnknown() { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"vty"+"."+strconv.Itoa(index)+"."+"transport.preferred.protocol", item.TransportPreferredProtocol.ValueString()) } - if !item.EscapeCharacterChar.IsNull() && !item.EscapeCharacterChar.IsUnknown() { - body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"vty"+"."+strconv.Itoa(index)+"."+"escape-character.char", item.EscapeCharacterChar.ValueString()) + if !item.EscapeCharacter.IsNull() && !item.EscapeCharacter.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"vty"+"."+strconv.Itoa(index)+"."+"escape-character.char", item.EscapeCharacter.ValueString()) } - if len(item.AccessClass) > 0 { + if len(item.AccessClasses) > 0 { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"vty"+"."+strconv.Itoa(index)+"."+"access-class.acccess-list", []interface{}{}) - for cindex, citem := range item.AccessClass { + for cindex, citem := range item.AccessClasses { if !citem.Direction.IsNull() && !citem.Direction.IsUnknown() { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"vty"+"."+strconv.Itoa(index)+"."+"access-class.acccess-list"+"."+strconv.Itoa(cindex)+"."+"direction", citem.Direction.ValueString()) } @@ -247,10 +247,10 @@ func (data *Line) updateFromBody(ctx context.Context, res gjson.Result) { } else { data.Console[i].LoginAuthentication = types.StringNull() } - if value := r.Get("privilege.level.number"); value.Exists() && !data.Console[i].PrivilegeLevelNumber.IsNull() { - data.Console[i].PrivilegeLevelNumber = types.Int64Value(value.Int()) + if value := r.Get("privilege.level.number"); value.Exists() && !data.Console[i].PrivilegeLevel.IsNull() { + data.Console[i].PrivilegeLevel = types.Int64Value(value.Int()) } else { - data.Console[i].PrivilegeLevelNumber = types.Int64Null() + data.Console[i].PrivilegeLevel = types.Int64Null() } if value := r.Get("stopbits"); value.Exists() && !data.Console[i].Stopbits.IsNull() { data.Console[i].Stopbits = types.StringValue(value.String()) @@ -267,10 +267,10 @@ func (data *Line) updateFromBody(ctx context.Context, res gjson.Result) { } else { data.Console[i].PasswordType = types.StringNull() } - if value := r.Get("password.secret"); value.Exists() && !data.Console[i].PasswordSecret.IsNull() { - data.Console[i].PasswordSecret = types.StringValue(value.String()) + if value := r.Get("password.secret"); value.Exists() && !data.Console[i].Password.IsNull() { + data.Console[i].Password = types.StringValue(value.String()) } else { - data.Console[i].PasswordSecret = types.StringNull() + data.Console[i].Password = types.StringNull() } } for i := range data.Vty { @@ -306,9 +306,9 @@ func (data *Line) updateFromBody(ctx context.Context, res gjson.Result) { } else { data.Vty[i].Last = types.Int64Null() } - for ci := range data.Vty[i].AccessClass { + for ci := range data.Vty[i].AccessClasses { keys := [...]string{"direction"} - keyValues := [...]string{data.Vty[i].AccessClass[ci].Direction.ValueString()} + keyValues := [...]string{data.Vty[i].AccessClasses[ci].Direction.ValueString()} var cr gjson.Result r.Get("access-class.acccess-list").ForEach( @@ -329,24 +329,24 @@ func (data *Line) updateFromBody(ctx context.Context, res gjson.Result) { return true }, ) - if value := cr.Get("direction"); value.Exists() && !data.Vty[i].AccessClass[ci].Direction.IsNull() { - data.Vty[i].AccessClass[ci].Direction = types.StringValue(value.String()) + if value := cr.Get("direction"); value.Exists() && !data.Vty[i].AccessClasses[ci].Direction.IsNull() { + data.Vty[i].AccessClasses[ci].Direction = types.StringValue(value.String()) } else { - data.Vty[i].AccessClass[ci].Direction = types.StringNull() + data.Vty[i].AccessClasses[ci].Direction = types.StringNull() } - if value := cr.Get("access-list"); value.Exists() && !data.Vty[i].AccessClass[ci].AccessList.IsNull() { - data.Vty[i].AccessClass[ci].AccessList = types.StringValue(value.String()) + if value := cr.Get("access-list"); value.Exists() && !data.Vty[i].AccessClasses[ci].AccessList.IsNull() { + data.Vty[i].AccessClasses[ci].AccessList = types.StringValue(value.String()) } else { - data.Vty[i].AccessClass[ci].AccessList = types.StringNull() + data.Vty[i].AccessClasses[ci].AccessList = types.StringNull() } - if value := cr.Get("vrf-also"); !data.Vty[i].AccessClass[ci].VrfAlso.IsNull() { + if value := cr.Get("vrf-also"); !data.Vty[i].AccessClasses[ci].VrfAlso.IsNull() { if value.Exists() { - data.Vty[i].AccessClass[ci].VrfAlso = types.BoolValue(true) + data.Vty[i].AccessClasses[ci].VrfAlso = types.BoolValue(true) } else { - data.Vty[i].AccessClass[ci].VrfAlso = types.BoolValue(false) + data.Vty[i].AccessClasses[ci].VrfAlso = types.BoolValue(false) } } else { - data.Vty[i].AccessClass[ci].VrfAlso = types.BoolNull() + data.Vty[i].AccessClasses[ci].VrfAlso = types.BoolNull() } } if value := r.Get("exec-timeout.minutes"); value.Exists() && !data.Vty[i].ExecTimeoutMinutes.IsNull() { @@ -369,10 +369,10 @@ func (data *Line) updateFromBody(ctx context.Context, res gjson.Result) { } else { data.Vty[i].PasswordType = types.StringNull() } - if value := r.Get("password.secret"); value.Exists() && !data.Vty[i].PasswordSecret.IsNull() { - data.Vty[i].PasswordSecret = types.StringValue(value.String()) + if value := r.Get("password.secret"); value.Exists() && !data.Vty[i].Password.IsNull() { + data.Vty[i].Password = types.StringValue(value.String()) } else { - data.Vty[i].PasswordSecret = types.StringNull() + data.Vty[i].Password = types.StringNull() } if value := r.Get("login.authentication"); value.Exists() && !data.Vty[i].LoginAuthentication.IsNull() { data.Vty[i].LoginAuthentication = types.StringValue(value.String()) @@ -384,10 +384,10 @@ func (data *Line) updateFromBody(ctx context.Context, res gjson.Result) { } else { data.Vty[i].TransportPreferredProtocol = types.StringNull() } - if value := r.Get("escape-character.char"); value.Exists() && !data.Vty[i].EscapeCharacterChar.IsNull() { - data.Vty[i].EscapeCharacterChar = types.StringValue(value.String()) + if value := r.Get("escape-character.char"); value.Exists() && !data.Vty[i].EscapeCharacter.IsNull() { + data.Vty[i].EscapeCharacter = types.StringValue(value.String()) } else { - data.Vty[i].EscapeCharacterChar = types.StringNull() + data.Vty[i].EscapeCharacter = types.StringNull() } } } @@ -419,7 +419,7 @@ func (data *LineData) fromBody(ctx context.Context, res gjson.Result) { item.LoginAuthentication = types.StringValue(cValue.String()) } if cValue := v.Get("privilege.level.number"); cValue.Exists() { - item.PrivilegeLevelNumber = types.Int64Value(cValue.Int()) + item.PrivilegeLevel = types.Int64Value(cValue.Int()) } if cValue := v.Get("stopbits"); cValue.Exists() { item.Stopbits = types.StringValue(cValue.String()) @@ -431,7 +431,7 @@ func (data *LineData) fromBody(ctx context.Context, res gjson.Result) { item.PasswordType = types.StringValue(cValue.String()) } if cValue := v.Get("password.secret"); cValue.Exists() { - item.PasswordSecret = types.StringValue(cValue.String()) + item.Password = types.StringValue(cValue.String()) } data.Console = append(data.Console, item) return true @@ -448,9 +448,9 @@ func (data *LineData) fromBody(ctx context.Context, res gjson.Result) { item.Last = types.Int64Value(cValue.Int()) } if cValue := v.Get("access-class.acccess-list"); cValue.Exists() { - item.AccessClass = make([]LineVtyAccessClass, 0) + item.AccessClasses = make([]LineVtyAccessClasses, 0) cValue.ForEach(func(ck, cv gjson.Result) bool { - cItem := LineVtyAccessClass{} + cItem := LineVtyAccessClasses{} if ccValue := cv.Get("direction"); ccValue.Exists() { cItem.Direction = types.StringValue(ccValue.String()) } @@ -462,7 +462,7 @@ func (data *LineData) fromBody(ctx context.Context, res gjson.Result) { } else { cItem.VrfAlso = types.BoolValue(false) } - item.AccessClass = append(item.AccessClass, cItem) + item.AccessClasses = append(item.AccessClasses, cItem) return true }) } @@ -479,7 +479,7 @@ func (data *LineData) fromBody(ctx context.Context, res gjson.Result) { item.PasswordType = types.StringValue(cValue.String()) } if cValue := v.Get("password.secret"); cValue.Exists() { - item.PasswordSecret = types.StringValue(cValue.String()) + item.Password = types.StringValue(cValue.String()) } if cValue := v.Get("login.authentication"); cValue.Exists() { item.LoginAuthentication = types.StringValue(cValue.String()) @@ -488,7 +488,7 @@ func (data *LineData) fromBody(ctx context.Context, res gjson.Result) { item.TransportPreferredProtocol = types.StringValue(cValue.String()) } if cValue := v.Get("escape-character.char"); cValue.Exists() { - item.EscapeCharacterChar = types.StringValue(cValue.String()) + item.EscapeCharacter = types.StringValue(cValue.String()) } data.Vty = append(data.Vty, item) return true @@ -541,11 +541,11 @@ func (data *Line) getDeletedListItems(ctx context.Context, state Line) []string found = false } if found { - for ci := range state.Vty[i].AccessClass { - cstateKeyValues := [...]string{state.Vty[i].AccessClass[ci].Direction.ValueString()} + for ci := range state.Vty[i].AccessClasses { + cstateKeyValues := [...]string{state.Vty[i].AccessClasses[ci].Direction.ValueString()} cemptyKeys := true - if !reflect.ValueOf(state.Vty[i].AccessClass[ci].Direction.ValueString()).IsZero() { + if !reflect.ValueOf(state.Vty[i].AccessClasses[ci].Direction.ValueString()).IsZero() { cemptyKeys = false } if cemptyKeys { @@ -553,9 +553,9 @@ func (data *Line) getDeletedListItems(ctx context.Context, state Line) []string } found := false - for cj := range data.Vty[j].AccessClass { + for cj := range data.Vty[j].AccessClasses { found = true - if state.Vty[i].AccessClass[ci].Direction.ValueString() != data.Vty[j].AccessClass[cj].Direction.ValueString() { + if state.Vty[i].AccessClasses[ci].Direction.ValueString() != data.Vty[j].AccessClasses[cj].Direction.ValueString() { found = false } if found { @@ -589,9 +589,9 @@ func (data *Line) getEmptyLeafsDelete(ctx context.Context) []string { for i := range data.Vty { keyValues := [...]string{strconv.FormatInt(data.Vty[i].First.ValueInt64(), 10)} - for ci := range data.Vty[i].AccessClass { - ckeyValues := [...]string{data.Vty[i].AccessClass[ci].Direction.ValueString()} - if !data.Vty[i].AccessClass[ci].VrfAlso.IsNull() && !data.Vty[i].AccessClass[ci].VrfAlso.ValueBool() { + for ci := range data.Vty[i].AccessClasses { + ckeyValues := [...]string{data.Vty[i].AccessClasses[ci].Direction.ValueString()} + if !data.Vty[i].AccessClasses[ci].VrfAlso.IsNull() && !data.Vty[i].AccessClasses[ci].VrfAlso.ValueBool() { emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/vty=%v/access-class/acccess-list=%v/vrf-also", data.getPath(), strings.Join(keyValues[:], ","), strings.Join(ckeyValues[:], ","))) } } @@ -601,15 +601,5 @@ func (data *Line) getEmptyLeafsDelete(ctx context.Context) []string { func (data *Line) getDeletePaths(ctx context.Context) []string { var deletePaths []string - for i := range data.Console { - keyValues := [...]string{data.Console[i].First.ValueString()} - - deletePaths = append(deletePaths, fmt.Sprintf("%v/console=%v", data.getPath(), strings.Join(keyValues[:], ","))) - } - for i := range data.Vty { - keyValues := [...]string{strconv.FormatInt(data.Vty[i].First.ValueInt64(), 10)} - - deletePaths = append(deletePaths, fmt.Sprintf("%v/vty=%v", data.getPath(), strings.Join(keyValues[:], ","))) - } return deletePaths } diff --git a/internal/provider/resource_iosxe_errdisable_test.go b/internal/provider/resource_iosxe_errdisable_test.go index 4924fe78..b920b04e 100644 --- a/internal/provider/resource_iosxe_errdisable_test.go +++ b/internal/provider/resource_iosxe_errdisable_test.go @@ -27,17 +27,20 @@ import ( ) func TestAccIosxeErrdisable(t *testing.T) { - if os.Getenv("C9000V") == "" { - t.Skip("skipping test, set environment variable C9000V") - } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_all", "true")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_arp_inspection", "true")) + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_arp_inspection", "true")) + } checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_dhcp_rate_limit", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_dtp_flap", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_l2ptguard", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_link_flap", "true")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_security_violation_shutdown_vlan", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_pppoe_ia_rate_limit", "true")) + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_security_violation_shutdown_vlan", "true")) + } + checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_loopdetect", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "flap_setting_cause_dtp_flap_max_flaps", "80")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "flap_setting_cause_dtp_flap_time", "90")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "flap_setting_cause_link_flap_max_flaps", "80")) @@ -48,24 +51,42 @@ func TestAccIosxeErrdisable(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_all", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_arp_inspection", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_bpduguard", "true")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_channel_misconfig", "true")) + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_channel_misconfig", "true")) + } checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_dhcp_rate_limit", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_dtp_flap", "true")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_gbic_invalid", "true")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_inline_power", "true")) + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_gbic_invalid", "true")) + } + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_inline_power", "true")) + } checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_l2ptguard", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_link_flap", "true")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_link_monitor_failure", "true")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_loopback", "true")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_mac_limit", "true")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_pagp_flap", "true")) + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_link_monitor_failure", "true")) + } + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_loopback", "true")) + } + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_mac_limit", "true")) + } + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_pagp_flap", "true")) + } checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_port_mode_failure", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_pppoe_ia_rate_limit", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_psp", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_psecure_violation", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_security_violation", "true")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_sfp_config_mismatch", "true")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_storm_control", "true")) + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_sfp_config_mismatch", "true")) + } + if os.Getenv("C9000V") != "" { + checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_storm_control", "true")) + } checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_udld", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_loopdetect", "true")) resource.Test(t, resource.TestCase{ @@ -97,12 +118,18 @@ func testAccIosxeErrdisableConfig_minimum() string { func testAccIosxeErrdisableConfig_all() string { config := `resource "iosxe_errdisable" "test" {` + "\n" config += ` detect_cause_all = true` + "\n" - config += ` detect_cause_arp_inspection = true` + "\n" + if os.Getenv("C9000V") != "" { + config += ` detect_cause_arp_inspection = true` + "\n" + } config += ` detect_cause_dhcp_rate_limit = true` + "\n" config += ` detect_cause_dtp_flap = true` + "\n" config += ` detect_cause_l2ptguard = true` + "\n" config += ` detect_cause_link_flap = true` + "\n" - config += ` detect_cause_security_violation_shutdown_vlan = true` + "\n" + config += ` detect_cause_pppoe_ia_rate_limit = true` + "\n" + if os.Getenv("C9000V") != "" { + config += ` detect_cause_security_violation_shutdown_vlan = true` + "\n" + } + config += ` detect_cause_loopdetect = true` + "\n" config += ` flap_setting_cause_dtp_flap_max_flaps = 80` + "\n" config += ` flap_setting_cause_dtp_flap_time = 90` + "\n" config += ` flap_setting_cause_link_flap_max_flaps = 80` + "\n" @@ -113,24 +140,42 @@ func testAccIosxeErrdisableConfig_all() string { config += ` recovery_cause_all = true` + "\n" config += ` recovery_cause_arp_inspection = true` + "\n" config += ` recovery_cause_bpduguard = true` + "\n" - config += ` recovery_cause_channel_misconfig = true` + "\n" + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_channel_misconfig = true` + "\n" + } config += ` recovery_cause_dhcp_rate_limit = true` + "\n" config += ` recovery_cause_dtp_flap = true` + "\n" - config += ` recovery_cause_gbic_invalid = true` + "\n" - config += ` recovery_cause_inline_power = true` + "\n" + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_gbic_invalid = true` + "\n" + } + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_inline_power = true` + "\n" + } config += ` recovery_cause_l2ptguard = true` + "\n" config += ` recovery_cause_link_flap = true` + "\n" - config += ` recovery_cause_link_monitor_failure = true` + "\n" - config += ` recovery_cause_loopback = true` + "\n" - config += ` recovery_cause_mac_limit = true` + "\n" - config += ` recovery_cause_pagp_flap = true` + "\n" + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_link_monitor_failure = true` + "\n" + } + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_loopback = true` + "\n" + } + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_mac_limit = true` + "\n" + } + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_pagp_flap = true` + "\n" + } config += ` recovery_cause_port_mode_failure = true` + "\n" config += ` recovery_cause_pppoe_ia_rate_limit = true` + "\n" config += ` recovery_cause_psp = true` + "\n" config += ` recovery_cause_psecure_violation = true` + "\n" config += ` recovery_cause_security_violation = true` + "\n" - config += ` recovery_cause_sfp_config_mismatch = true` + "\n" - config += ` recovery_cause_storm_control = true` + "\n" + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_sfp_config_mismatch = true` + "\n" + } + if os.Getenv("C9000V") != "" { + config += ` recovery_cause_storm_control = true` + "\n" + } config += ` recovery_cause_udld = true` + "\n" config += ` recovery_cause_loopdetect = true` + "\n" config += `}` + "\n" diff --git a/internal/provider/resource_iosxe_line.go b/internal/provider/resource_iosxe_line.go index 36cb0fe1..49b280a4 100644 --- a/internal/provider/resource_iosxe_line.go +++ b/internal/provider/resource_iosxe_line.go @@ -108,7 +108,7 @@ func (r *LineResource) Schema(ctx context.Context, req resource.SchemaRequest, r MarkdownDescription: helpers.NewAttributeDescription("").String, Optional: true, }, - "privilege_level_number": schema.Int64Attribute{ + "privilege_level": schema.Int64Attribute{ MarkdownDescription: helpers.NewAttributeDescription("").AddIntegerRangeDescription(0, 15).String, Optional: true, Validators: []validator.Int64{ @@ -136,7 +136,7 @@ func (r *LineResource) Schema(ctx context.Context, req resource.SchemaRequest, r stringvalidator.OneOf("0", "7"), }, }, - "password_secret": schema.StringAttribute{ + "password": schema.StringAttribute{ MarkdownDescription: helpers.NewAttributeDescription("").String, Optional: true, Validators: []validator.String{ @@ -165,7 +165,7 @@ func (r *LineResource) Schema(ctx context.Context, req resource.SchemaRequest, r int64validator.Between(1, 1869), }, }, - "access_class": schema.ListNestedAttribute{ + "access_classes": schema.ListNestedAttribute{ MarkdownDescription: helpers.NewAttributeDescription("").String, Optional: true, NestedObject: schema.NestedAttributeObject{ @@ -216,7 +216,7 @@ func (r *LineResource) Schema(ctx context.Context, req resource.SchemaRequest, r stringvalidator.OneOf("0", "7"), }, }, - "password_secret": schema.StringAttribute{ + "password": schema.StringAttribute{ MarkdownDescription: helpers.NewAttributeDescription("").String, Optional: true, Validators: []validator.String{ @@ -234,7 +234,7 @@ func (r *LineResource) Schema(ctx context.Context, req resource.SchemaRequest, r stringvalidator.OneOf("acercon", "lat", "mop", "nasi", "none", "pad", "rlogin", "ssh", "telnet", "udptn"), }, }, - "escape_character_char": schema.StringAttribute{ + "escape_character": schema.StringAttribute{ MarkdownDescription: helpers.NewAttributeDescription("").String, Optional: true, }, diff --git a/internal/provider/resource_iosxe_line_test.go b/internal/provider/resource_iosxe_line_test.go index 6938bd90..354f8a8a 100644 --- a/internal/provider/resource_iosxe_line_test.go +++ b/internal/provider/resource_iosxe_line_test.go @@ -30,21 +30,21 @@ func TestAccIosxeLine(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "console.0.first", "0")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "console.0.exec_timeout_minutes", "45")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "console.0.exec_timeout_seconds", "25")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "console.0.privilege_level_number", "15")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "console.0.privilege_level", "15")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "console.0.stopbits", "1")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "console.0.password_type", "0")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "console.0.password_secret", "testpasswd")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "console.0.password", "testpasswd")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.first", "10")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.last", "27")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.access_class.0.direction", "in")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.access_class.0.access_list", "2")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.access_class.0.vrf_also", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.access_classes.0.direction", "in")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.access_classes.0.access_list", "2")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.access_classes.0.vrf_also", "true")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.exec_timeout_minutes", "45")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.exec_timeout_seconds", "25")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.password_type", "0")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.password_secret", "testpasswd")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.password", "testpasswd")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.transport_preferred_protocol", "none")) - checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.escape_character_char", "27")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_line.test", "vty.0.escape_character", "27")) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, @@ -77,15 +77,15 @@ func testAccIosxeLineConfig_all() string { config += ` first = "0"` + "\n" config += ` exec_timeout_minutes = 45` + "\n" config += ` exec_timeout_seconds = 25` + "\n" - config += ` privilege_level_number = 15` + "\n" + config += ` privilege_level = 15` + "\n" config += ` stopbits = "1"` + "\n" config += ` password_type = "0"` + "\n" - config += ` password_secret = "testpasswd"` + "\n" + config += ` password = "testpasswd"` + "\n" config += ` }]` + "\n" config += ` vty = [{` + "\n" config += ` first = 10` + "\n" config += ` last = 27` + "\n" - config += ` access_class = [{` + "\n" + config += ` access_classes = [{` + "\n" config += ` direction = "in"` + "\n" config += ` access_list = "2"` + "\n" config += ` vrf_also = true` + "\n" @@ -93,9 +93,9 @@ func testAccIosxeLineConfig_all() string { config += ` exec_timeout_minutes = 45` + "\n" config += ` exec_timeout_seconds = 25` + "\n" config += ` password_type = "0"` + "\n" - config += ` password_secret = "testpasswd"` + "\n" + config += ` password = "testpasswd"` + "\n" config += ` transport_preferred_protocol = "none"` + "\n" - config += ` escape_character_char = "27"` + "\n" + config += ` escape_character = "27"` + "\n" config += ` }]` + "\n" config += `}` + "\n" return config diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index af149455..f3e68c81 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -7,6 +7,11 @@ description: |- # Changelog +## 0.4.1 (unreleased) + +- Add `iosxe_errdisable` resource and data source +- Add `iosxe_line` resource and data source + ## 0.4.0 - Fix issue when using `tunnel_destination_ipv4` or `tunnel_mode_ipsec_ipv4` attributes of `iosxe_interface_tunnel` resource @@ -50,8 +55,6 @@ description: |- - BREAKING CHANGE: Rename `summary_address` attribute to `summary_addresses` of `iosxe_ospf` resource and data source - Add `ipv4_unicast_networks_mask` and `ipv4_unicast_networks` attribute to `iosxe_bgp_address_family_ipv4` and `iosxe_bgp_address_family_ipv4_vrf` resources and data sources - Add `ipv6_unicast_networks` attribute to `iosxe_bgp_address_family_ipv6` and `iosxe_bgp_address_family_ipv6_vrf` resources and data sources -- Add `iosxe_errdisable` resource and data source -- Add `iosxe_line` resource and data source ## 0.3.3