diff --git a/CHANGELOG.md b/CHANGELOG.md index f574972c..821df450 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 0.5.5 (unreleased) - Add `bandwidth` attribute to `iosxe_interface_ethernet` resource and data source +- Add `speed_nonegotiate` attribute to `iosxe_interface_ethernet` resource and data source ## 0.5.4 diff --git a/docs/data-sources/interface_ethernet.md b/docs/data-sources/interface_ethernet.md index 8c6d464d..4c7fb77d 100644 --- a/docs/data-sources/interface_ethernet.md +++ b/docs/data-sources/interface_ethernet.md @@ -126,6 +126,7 @@ data "iosxe_interface_ethernet" "example" { - `speed_25000` (Boolean) 25000 Mbps operation - `speed_40000` (Boolean) 40000 Mbps operation - `speed_5000` (Boolean) 5000 Mbps operation +- `speed_nonegotiate` (Boolean) - `switchport` (Boolean) - `trust_device` (String) trusted device class - `unnumbered` (String) Enable IP processing without an explicit address diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index 7ecde398..2e3dc20b 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -10,6 +10,7 @@ description: |- ## 0.5.5 (unreleased) - Add `bandwidth` attribute to `iosxe_interface_ethernet` resource and data source +- Add `speed_nonegotiate` attribute to `iosxe_interface_ethernet` resource and data source ## 0.5.4 diff --git a/docs/resources/interface_ethernet.md b/docs/resources/interface_ethernet.md index c1328b28..d0d84bbd 100644 --- a/docs/resources/interface_ethernet.md +++ b/docs/resources/interface_ethernet.md @@ -190,6 +190,7 @@ resource "iosxe_interface_ethernet" "example" { - `speed_25000` (Boolean) 25000 Mbps operation - `speed_40000` (Boolean) 40000 Mbps operation - `speed_5000` (Boolean) 5000 Mbps operation +- `speed_nonegotiate` (Boolean) - `switchport` (Boolean) - `trust_device` (String) trusted device class - Choices: `cisco-phone`, `cts`, `ip-camera`, `media-player` diff --git a/gen/definitions/interface_ethernet.yaml b/gen/definitions/interface_ethernet.yaml index 38ac72dd..2f64a705 100644 --- a/gen/definitions/interface_ethernet.yaml +++ b/gen/definitions/interface_ethernet.yaml @@ -281,6 +281,11 @@ attributes: tf_name: speed_100000 example: true exclude_test: true + - yang_name: Cisco-IOS-XE-ethernet:speed/speed-choice/nonegotiate/nonegotiate + xpath: Cisco-IOS-XE-ethernet:speed/nonegotiate + tf_name: speed_nonegotiate + example: true + exclude_test: true - yang_name: Cisco-IOS-XE-sanet:authentication/host-mode example: multi-auth exclude_test: true diff --git a/internal/provider/data_source_iosxe_interface_ethernet.go b/internal/provider/data_source_iosxe_interface_ethernet.go index 74d435b9..ba26517e 100644 --- a/internal/provider/data_source_iosxe_interface_ethernet.go +++ b/internal/provider/data_source_iosxe_interface_ethernet.go @@ -379,6 +379,10 @@ func (d *InterfaceEthernetDataSource) Schema(ctx context.Context, req datasource MarkdownDescription: "100000 Mbps operation", Computed: true, }, + "speed_nonegotiate": schema.BoolAttribute{ + MarkdownDescription: "", + Computed: true, + }, "authentication_host_mode": schema.StringAttribute{ MarkdownDescription: "Set the Host mode for authentication on this interface", Computed: true, diff --git a/internal/provider/model_iosxe_interface_ethernet.go b/internal/provider/model_iosxe_interface_ethernet.go index ffe04ed0..f848a427 100644 --- a/internal/provider/model_iosxe_interface_ethernet.go +++ b/internal/provider/model_iosxe_interface_ethernet.go @@ -103,6 +103,7 @@ type InterfaceEthernet struct { Speed25000 types.Bool `tfsdk:"speed_25000"` Speed40000 types.Bool `tfsdk:"speed_40000"` Speed100000 types.Bool `tfsdk:"speed_100000"` + SpeedNonegotiate types.Bool `tfsdk:"speed_nonegotiate"` AuthenticationHostMode types.String `tfsdk:"authentication_host_mode"` AuthenticationOrderDot1x types.Bool `tfsdk:"authentication_order_dot1x"` AuthenticationOrderDot1xMab types.Bool `tfsdk:"authentication_order_dot1x_mab"` @@ -206,6 +207,7 @@ type InterfaceEthernetData struct { Speed25000 types.Bool `tfsdk:"speed_25000"` Speed40000 types.Bool `tfsdk:"speed_40000"` Speed100000 types.Bool `tfsdk:"speed_100000"` + SpeedNonegotiate types.Bool `tfsdk:"speed_nonegotiate"` AuthenticationHostMode types.String `tfsdk:"authentication_host_mode"` AuthenticationOrderDot1x types.Bool `tfsdk:"authentication_order_dot1x"` AuthenticationOrderDot1xMab types.Bool `tfsdk:"authentication_order_dot1x_mab"` @@ -521,6 +523,11 @@ func (data InterfaceEthernet) toBody(ctx context.Context) string { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ethernet:speed.value-100000", map[string]string{}) } } + if !data.SpeedNonegotiate.IsNull() && !data.SpeedNonegotiate.IsUnknown() { + if data.SpeedNonegotiate.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-ethernet:speed.nonegotiate", map[string]string{}) + } + } if !data.AuthenticationHostMode.IsNull() && !data.AuthenticationHostMode.IsUnknown() { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"Cisco-IOS-XE-sanet:authentication.host-mode", data.AuthenticationHostMode.ValueString()) } @@ -1310,6 +1317,15 @@ func (data *InterfaceEthernet) updateFromBody(ctx context.Context, res gjson.Res } else { data.Speed100000 = types.BoolNull() } + if value := res.Get(prefix + "Cisco-IOS-XE-ethernet:speed.nonegotiate"); !data.SpeedNonegotiate.IsNull() { + if value.Exists() { + data.SpeedNonegotiate = types.BoolValue(true) + } else { + data.SpeedNonegotiate = types.BoolValue(false) + } + } else { + data.SpeedNonegotiate = types.BoolNull() + } if value := res.Get(prefix + "Cisco-IOS-XE-sanet:authentication.host-mode"); value.Exists() && !data.AuthenticationHostMode.IsNull() { data.AuthenticationHostMode = types.StringValue(value.String()) } else { @@ -1868,6 +1884,11 @@ func (data *InterfaceEthernetData) fromBody(ctx context.Context, res gjson.Resul } else { data.Speed100000 = types.BoolValue(false) } + if value := res.Get(prefix + "Cisco-IOS-XE-ethernet:speed.nonegotiate"); value.Exists() { + data.SpeedNonegotiate = types.BoolValue(true) + } else { + data.SpeedNonegotiate = types.BoolValue(false) + } if value := res.Get(prefix + "Cisco-IOS-XE-sanet:authentication.host-mode"); value.Exists() { data.AuthenticationHostMode = types.StringValue(value.String()) } @@ -2299,6 +2320,9 @@ func (data *InterfaceEthernet) getDeletedItems(ctx context.Context, state Interf if !state.Speed100000.IsNull() && data.Speed100000.IsNull() { deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ethernet:speed/value-100000", state.getPath())) } + if !state.SpeedNonegotiate.IsNull() && data.SpeedNonegotiate.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-ethernet:speed/nonegotiate", state.getPath())) + } if !state.AuthenticationHostMode.IsNull() && data.AuthenticationHostMode.IsNull() { deletedItems = append(deletedItems, fmt.Sprintf("%v/Cisco-IOS-XE-sanet:authentication/host-mode", state.getPath())) } @@ -2518,6 +2542,9 @@ func (data *InterfaceEthernet) getEmptyLeafsDelete(ctx context.Context) []string if !data.Speed100000.IsNull() && !data.Speed100000.ValueBool() { emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ethernet:speed/value-100000", data.getPath())) } + if !data.SpeedNonegotiate.IsNull() && !data.SpeedNonegotiate.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-ethernet:speed/nonegotiate", data.getPath())) + } if !data.AuthenticationOrderDot1x.IsNull() && !data.AuthenticationOrderDot1x.ValueBool() { emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/Cisco-IOS-XE-sanet:authentication/order-config/dot1x-config", data.getPath())) } @@ -2777,6 +2804,9 @@ func (data *InterfaceEthernet) getDeletePaths(ctx context.Context) []string { if !data.Speed100000.IsNull() { deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ethernet:speed/value-100000", data.getPath())) } + if !data.SpeedNonegotiate.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-ethernet:speed/nonegotiate", data.getPath())) + } if !data.AuthenticationHostMode.IsNull() { deletePaths = append(deletePaths, fmt.Sprintf("%v/Cisco-IOS-XE-sanet:authentication/host-mode", data.getPath())) } diff --git a/internal/provider/resource_iosxe_interface_ethernet.go b/internal/provider/resource_iosxe_interface_ethernet.go index bb6bf938..aa7d5d67 100644 --- a/internal/provider/resource_iosxe_interface_ethernet.go +++ b/internal/provider/resource_iosxe_interface_ethernet.go @@ -458,6 +458,10 @@ func (r *InterfaceEthernetResource) Schema(ctx context.Context, req resource.Sch MarkdownDescription: helpers.NewAttributeDescription("100000 Mbps operation").String, Optional: true, }, + "speed_nonegotiate": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("").String, + Optional: true, + }, "authentication_host_mode": schema.StringAttribute{ MarkdownDescription: helpers.NewAttributeDescription("Set the Host mode for authentication on this interface").AddStringEnumDescription("multi-auth", "multi-domain", "multi-host", "single-host").String, Optional: true, diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index 7ecde398..2e3dc20b 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -10,6 +10,7 @@ description: |- ## 0.5.5 (unreleased) - Add `bandwidth` attribute to `iosxe_interface_ethernet` resource and data source +- Add `speed_nonegotiate` attribute to `iosxe_interface_ethernet` resource and data source ## 0.5.4