diff --git a/CHANGELOG.md b/CHANGELOG.md index fe30a677..3a958ac6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Add `ip_dhcp_relay_information_option_vpn_id` attribute to `iosxe_interface_ethernet` resource and `iosxe_interface_vlan` resource - Add `local_routing` attribute to `iosxe_interface_nve` resource and data source - Add `ipv4_unicast_maximum_paths_ebgp` and `ipv4_unicast_maximum_paths_ibgp` attributes to the `iosxe_bgp_address_family_ipv4` and `iosxe_bgp_address_family_ipv4_vrf` resources +- Add `ip_cef_load_sharing_algorithm_include_ports_source`, `ip_cef_load_sharing_algorithm_include_ports_destination`, `ipv6_cef_load_sharing_algorithm_include_ports_source`, `ipv6_cef_load_sharing_algorithm_include_ports_destination`, and `port_channel_load_balance` attributes to `iosxe_system` resource and data source ## 0.9.3 diff --git a/docs/data-sources/system.md b/docs/data-sources/system.md index c45474ef..cebef555 100644 --- a/docs/data-sources/system.md +++ b/docs/data-sources/system.md @@ -51,6 +51,8 @@ data "iosxe_system" "example" { - `hostname` (String) Set system's network name - `id` (String) The path of the retrieved object. - `ip_bgp_community_new_format` (Boolean) select aa:nn format for BGP community +- `ip_cef_load_sharing_algorithm_include_ports_destination` (Boolean) +- `ip_cef_load_sharing_algorithm_include_ports_source` (Boolean) - `ip_domain_list_names` (List of String) - `ip_domain_list_vrf` (String) - `ip_domain_list_vrf_domain` (String) @@ -132,6 +134,8 @@ data "iosxe_system" "example" { - `ip_tacacs_source_interface_two_gigabit_ethernet` (String) Two GigabitEthernet - `ip_tacacs_source_interface_vlan` (Number) Iosxr Vlans - `ip_tacacs_source_interface_vrf` (String) VPN Routing/Forwarding parameters +- `ipv6_cef_load_sharing_algorithm_include_ports_destination` (Boolean) +- `ipv6_cef_load_sharing_algorithm_include_ports_source` (Boolean) - `ipv6_unicast_routing` (Boolean) Enable unicast routing - `login_delay` (Number) Set delay between successive fail login - `login_on_failure` (Boolean) Set options for failed login attempt @@ -144,6 +148,7 @@ data "iosxe_system" "example" { - `multicast_routing_vrfs` (Attributes List) Select VPN Routing/Forwarding instance (see [below for nested schema](#nestedatt--multicast_routing_vrfs)) - `multilink_ppp_bundle_name` (String) Select method for naming multilink bundles - `pnp_profiles` (Attributes List) PNP profile (see [below for nested schema](#nestedatt--pnp_profiles)) +- `port_channel_load_balance` (String) - `redundancy` (Boolean) Enter redundancy mode - `redundancy_mode` (String) redundancy mode for this chassis - `security_passwords_min_length` (Number) Minimum length of passwords diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index 50baf778..76e44d3a 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -20,6 +20,7 @@ description: |- - Add `ip_dhcp_relay_information_option_vpn_id` attribute to `iosxe_interface_ethernet` resource and `iosxe_interface_vlan` resource - Add `local_routing` attribute to `iosxe_interface_nve` resource and data source - Add `ipv4_unicast_maximum_paths_ebgp` and `ipv4_unicast_maximum_paths_ibgp` attributes to the `iosxe_bgp_address_family_ipv4` and `iosxe_bgp_address_family_ipv4_vrf` resources +- Add `ip_cef_load_sharing_algorithm_include_ports_source`, `ip_cef_load_sharing_algorithm_include_ports_destination`, `ipv6_cef_load_sharing_algorithm_include_ports_source`, `ipv6_cef_load_sharing_algorithm_include_ports_destination`, and `port_channel_load_balance` attributes to `iosxe_system` resource and data source ## 0.9.3 diff --git a/docs/resources/system.md b/docs/resources/system.md index b6f51492..4b6b95cd 100644 --- a/docs/resources/system.md +++ b/docs/resources/system.md @@ -45,20 +45,25 @@ resource "iosxe_system" "example" { source_interface_gigabit_ethernet = "1/0/1" } ] - diagnostic_bootup_level = "minimal" - memory_free_low_watermark_processor = 203038 - ip_ssh_time_out = 120 - ip_ssh_authentication_retries = 3 - ip_ssh_bulk_mode = true - ip_ssh_bulk_mode_window_size = 262144 - call_home_contact_email = "email@test.com" - call_home_cisco_tac_1_profile_active = true - call_home_cisco_tac_1_destination_transport_method = "email" - ip_nbar_classification_dns_classify_by_domain = true - ip_multicast_route_limit = 200000 - ip_domain_list_vrf_domain = "example.com" - ip_domain_list_vrf = "VRF1" - ip_routing_protocol_purge_interface = true + diagnostic_bootup_level = "minimal" + memory_free_low_watermark_processor = 203038 + ip_ssh_time_out = 120 + ip_ssh_authentication_retries = 3 + ip_ssh_bulk_mode = true + ip_ssh_bulk_mode_window_size = 262144 + call_home_contact_email = "email@test.com" + call_home_cisco_tac_1_profile_active = true + call_home_cisco_tac_1_destination_transport_method = "email" + ip_nbar_classification_dns_classify_by_domain = true + ip_multicast_route_limit = 200000 + ip_domain_list_vrf_domain = "example.com" + ip_domain_list_vrf = "VRF1" + ip_routing_protocol_purge_interface = true + ip_cef_load_sharing_algorithm_include_ports_source = true + ip_cef_load_sharing_algorithm_include_ports_destination = true + ipv6_cef_load_sharing_algorithm_include_ports_source = true + ipv6_cef_load_sharing_algorithm_include_ports_destination = true + port_channel_load_balance = "src-dst-mixed-ip-port" } ``` @@ -101,6 +106,8 @@ resource "iosxe_system" "example" { - Range: `2500`-`10000` - `hostname` (String) Set system's network name - `ip_bgp_community_new_format` (Boolean) select aa:nn format for BGP community +- `ip_cef_load_sharing_algorithm_include_ports_destination` (Boolean) +- `ip_cef_load_sharing_algorithm_include_ports_source` (Boolean) - `ip_domain_list_names` (List of String) - `ip_domain_list_vrf` (String) - `ip_domain_list_vrf_domain` (String) @@ -199,6 +206,8 @@ resource "iosxe_system" "example" { - `ip_tacacs_source_interface_vlan` (Number) Iosxr Vlans - Range: `0`-`65535` - `ip_tacacs_source_interface_vrf` (String) VPN Routing/Forwarding parameters +- `ipv6_cef_load_sharing_algorithm_include_ports_destination` (Boolean) +- `ipv6_cef_load_sharing_algorithm_include_ports_source` (Boolean) - `ipv6_unicast_routing` (Boolean) Enable unicast routing - `login_delay` (Number) Set delay between successive fail login - Range: `1`-`10` @@ -214,6 +223,7 @@ resource "iosxe_system" "example" { - `multilink_ppp_bundle_name` (String) Select method for naming multilink bundles - Choices: `authenticated`, `both`, `endpoint`, `rfc` - `pnp_profiles` (Attributes List) PNP profile (see [below for nested schema](#nestedatt--pnp_profiles)) +- `port_channel_load_balance` (String) - Choices: `dst-ip`, `dst-mac`, `dst-mixed-ip-port`, `dst-port`, `mpls`, `src-dst-ip`, `src-dst-mac`, `src-dst-mixed-ip-port`, `src-dst-port`, `src-ip`, `src-mac`, `src-mixed-ip-port`, `src-port`, `vlan-dst-ip`, `vlan-dst-mixed-ip-port`, `vlan-src-dst-ip`, `vlan-src-dst-mixed-ip-port`, `vlan-src-ip`, `vlan-src-mixed-ip-port` - `redundancy` (Boolean) Enter redundancy mode - `redundancy_mode` (String) redundancy mode for this chassis - Choices: `none`, `rpr`, `rpr-plus`, `sso` diff --git a/examples/resources/iosxe_system/resource.tf b/examples/resources/iosxe_system/resource.tf index 150c2b56..68c94d94 100644 --- a/examples/resources/iosxe_system/resource.tf +++ b/examples/resources/iosxe_system/resource.tf @@ -30,18 +30,23 @@ resource "iosxe_system" "example" { source_interface_gigabit_ethernet = "1/0/1" } ] - diagnostic_bootup_level = "minimal" - memory_free_low_watermark_processor = 203038 - ip_ssh_time_out = 120 - ip_ssh_authentication_retries = 3 - ip_ssh_bulk_mode = true - ip_ssh_bulk_mode_window_size = 262144 - call_home_contact_email = "email@test.com" - call_home_cisco_tac_1_profile_active = true - call_home_cisco_tac_1_destination_transport_method = "email" - ip_nbar_classification_dns_classify_by_domain = true - ip_multicast_route_limit = 200000 - ip_domain_list_vrf_domain = "example.com" - ip_domain_list_vrf = "VRF1" - ip_routing_protocol_purge_interface = true + diagnostic_bootup_level = "minimal" + memory_free_low_watermark_processor = 203038 + ip_ssh_time_out = 120 + ip_ssh_authentication_retries = 3 + ip_ssh_bulk_mode = true + ip_ssh_bulk_mode_window_size = 262144 + call_home_contact_email = "email@test.com" + call_home_cisco_tac_1_profile_active = true + call_home_cisco_tac_1_destination_transport_method = "email" + ip_nbar_classification_dns_classify_by_domain = true + ip_multicast_route_limit = 200000 + ip_domain_list_vrf_domain = "example.com" + ip_domain_list_vrf = "VRF1" + ip_routing_protocol_purge_interface = true + ip_cef_load_sharing_algorithm_include_ports_source = true + ip_cef_load_sharing_algorithm_include_ports_destination = true + ipv6_cef_load_sharing_algorithm_include_ports_source = true + ipv6_cef_load_sharing_algorithm_include_ports_destination = true + port_channel_load_balance = "src-dst-mixed-ip-port" } diff --git a/gen/definitions/system.yaml b/gen/definitions/system.yaml index de98d4b0..44936f1b 100644 --- a/gen/definitions/system.yaml +++ b/gen/definitions/system.yaml @@ -651,6 +651,25 @@ attributes: - yang_name: ip/routing-new/routing/protocol/purge/interface tf_name: ip_routing_protocol_purge_interface example: true + - yang_name: ip/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/Cisco-IOS-XE-cef:algorithm-v2/alg-type/include-ports/Cisco-IOS-XE-cef:include-ports-v2/source + xpath: ip/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/source + tf_name: ip_cef_load_sharing_algorithm_include_ports_source + example: true + - yang_name: ip/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/Cisco-IOS-XE-cef:algorithm-v2/alg-type/include-ports/Cisco-IOS-XE-cef:include-ports-v2/destination + xpath: ip/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/destination + tf_name: ip_cef_load_sharing_algorithm_include_ports_destination + example: true + - yang_name: ipv6/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/Cisco-IOS-XE-cef:algorithm-v2/alg-type/include-ports/Cisco-IOS-XE-cef:include-ports-v2/source + xpath: ipv6/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/source + tf_name: ipv6_cef_load_sharing_algorithm_include_ports_source + example: true + - yang_name: ipv6/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/Cisco-IOS-XE-cef:algorithm-v2/alg-type/include-ports/Cisco-IOS-XE-cef:include-ports-v2/destination + xpath: ipv6/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/destination + tf_name: ipv6_cef_load_sharing_algorithm_include_ports_destination + example: true + - yang_name: port-channel/Cisco-IOS-XE-ethernet:load-balance/load-balance + tf_name: port_channel_load_balance + example: src-dst-mixed-ip-port test_prerequisites: - path: Cisco-IOS-XE-native:native/vrf/definition=VRF1 diff --git a/gen/load_models.go b/gen/load_models.go index e79cfb19..645c0e9a 100644 --- a/gen/load_models.go +++ b/gen/load_models.go @@ -44,6 +44,7 @@ var models = []string{ "https://raw.githubusercontent.com/YangModels/yang/main/vendor/cisco/xe/17151/Cisco-IOS-XE-logging.yang", "https://raw.githubusercontent.com/YangModels/yang/main/vendor/cisco/xe/17151/Cisco-IOS-XE-ip.yang", "https://raw.githubusercontent.com/YangModels/yang/main/vendor/cisco/xe/17151/Cisco-IOS-XE-ipv6.yang", + "https://raw.githubusercontent.com/YangModels/yang/main/vendor/cisco/xe/17151/Cisco-IOS-XE-cef.yang", "https://raw.githubusercontent.com/YangModels/yang/main/vendor/cisco/xe/17151/Cisco-IOS-XE-interfaces.yang", "https://raw.githubusercontent.com/YangModels/yang/main/vendor/cisco/xe/17151/Cisco-IOS-XE-isis.yang", "https://raw.githubusercontent.com/YangModels/yang/main/vendor/cisco/xe/17151/Cisco-IOS-XE-snmp.yang", diff --git a/internal/provider/data_source_iosxe_system.go b/internal/provider/data_source_iosxe_system.go index f0951d83..aa612346 100644 --- a/internal/provider/data_source_iosxe_system.go +++ b/internal/provider/data_source_iosxe_system.go @@ -777,6 +777,26 @@ func (d *SystemDataSource) Schema(ctx context.Context, req datasource.SchemaRequ MarkdownDescription: "Perform IP routing protocol routes purge on link failures", Computed: true, }, + "ip_cef_load_sharing_algorithm_include_ports_source": schema.BoolAttribute{ + MarkdownDescription: "", + Computed: true, + }, + "ip_cef_load_sharing_algorithm_include_ports_destination": schema.BoolAttribute{ + MarkdownDescription: "", + Computed: true, + }, + "ipv6_cef_load_sharing_algorithm_include_ports_source": schema.BoolAttribute{ + MarkdownDescription: "", + Computed: true, + }, + "ipv6_cef_load_sharing_algorithm_include_ports_destination": schema.BoolAttribute{ + MarkdownDescription: "", + Computed: true, + }, + "port_channel_load_balance": schema.StringAttribute{ + MarkdownDescription: "", + Computed: true, + }, }, } } diff --git a/internal/provider/data_source_iosxe_system_test.go b/internal/provider/data_source_iosxe_system_test.go index d418ea5d..c7981b80 100644 --- a/internal/provider/data_source_iosxe_system_test.go +++ b/internal/provider/data_source_iosxe_system_test.go @@ -85,6 +85,11 @@ func TestAccDataSourceIosxeSystem(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_domain_list_vrf_domain", "example.com")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_domain_list_vrf", "VRF1")) checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_routing_protocol_purge_interface", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_cef_load_sharing_algorithm_include_ports_source", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_cef_load_sharing_algorithm_include_ports_destination", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ipv6_cef_load_sharing_algorithm_include_ports_source", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ipv6_cef_load_sharing_algorithm_include_ports_destination", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "port_channel_load_balance", "src-dst-mixed-ip-port")) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, @@ -178,6 +183,11 @@ func testAccDataSourceIosxeSystemConfig() string { config += ` ip_domain_list_vrf_domain = "example.com"` + "\n" config += ` ip_domain_list_vrf = "VRF1"` + "\n" config += ` ip_routing_protocol_purge_interface = true` + "\n" + config += ` ip_cef_load_sharing_algorithm_include_ports_source = true` + "\n" + config += ` ip_cef_load_sharing_algorithm_include_ports_destination = true` + "\n" + config += ` ipv6_cef_load_sharing_algorithm_include_ports_source = true` + "\n" + config += ` ipv6_cef_load_sharing_algorithm_include_ports_destination = true` + "\n" + config += ` port_channel_load_balance = "src-dst-mixed-ip-port"` + "\n" config += ` depends_on = [iosxe_restconf.PreReq0, ]` + "\n" config += `}` + "\n" diff --git a/internal/provider/model_iosxe_system.go b/internal/provider/model_iosxe_system.go index 5fdbd35a..0b6cbe16 100644 --- a/internal/provider/model_iosxe_system.go +++ b/internal/provider/model_iosxe_system.go @@ -175,6 +175,11 @@ type System struct { StandbyRedirects types.Bool `tfsdk:"standby_redirects"` StandbyRedirectsEnableDisable types.String `tfsdk:"standby_redirects_enable_disable"` IpRoutingProtocolPurgeInterface types.Bool `tfsdk:"ip_routing_protocol_purge_interface"` + IpCefLoadSharingAlgorithmIncludePortsSource types.Bool `tfsdk:"ip_cef_load_sharing_algorithm_include_ports_source"` + IpCefLoadSharingAlgorithmIncludePortsDestination types.Bool `tfsdk:"ip_cef_load_sharing_algorithm_include_ports_destination"` + Ipv6CefLoadSharingAlgorithmIncludePortsSource types.Bool `tfsdk:"ipv6_cef_load_sharing_algorithm_include_ports_source"` + Ipv6CefLoadSharingAlgorithmIncludePortsDestination types.Bool `tfsdk:"ipv6_cef_load_sharing_algorithm_include_ports_destination"` + PortChannelLoadBalance types.String `tfsdk:"port_channel_load_balance"` } type SystemData struct { @@ -315,6 +320,11 @@ type SystemData struct { StandbyRedirects types.Bool `tfsdk:"standby_redirects"` StandbyRedirectsEnableDisable types.String `tfsdk:"standby_redirects_enable_disable"` IpRoutingProtocolPurgeInterface types.Bool `tfsdk:"ip_routing_protocol_purge_interface"` + IpCefLoadSharingAlgorithmIncludePortsSource types.Bool `tfsdk:"ip_cef_load_sharing_algorithm_include_ports_source"` + IpCefLoadSharingAlgorithmIncludePortsDestination types.Bool `tfsdk:"ip_cef_load_sharing_algorithm_include_ports_destination"` + Ipv6CefLoadSharingAlgorithmIncludePortsSource types.Bool `tfsdk:"ipv6_cef_load_sharing_algorithm_include_ports_source"` + Ipv6CefLoadSharingAlgorithmIncludePortsDestination types.Bool `tfsdk:"ipv6_cef_load_sharing_algorithm_include_ports_destination"` + PortChannelLoadBalance types.String `tfsdk:"port_channel_load_balance"` } type SystemMulticastRoutingVrfs struct { Vrf types.String `tfsdk:"vrf"` @@ -823,6 +833,29 @@ func (data System) toBody(ctx context.Context) string { if !data.IpRoutingProtocolPurgeInterface.IsNull() && !data.IpRoutingProtocolPurgeInterface.IsUnknown() { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"ip.routing-new.routing.protocol.purge.interface", data.IpRoutingProtocolPurgeInterface.ValueBool()) } + if !data.IpCefLoadSharingAlgorithmIncludePortsSource.IsNull() && !data.IpCefLoadSharingAlgorithmIncludePortsSource.IsUnknown() { + if data.IpCefLoadSharingAlgorithmIncludePortsSource.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"ip.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.source", map[string]string{}) + } + } + if !data.IpCefLoadSharingAlgorithmIncludePortsDestination.IsNull() && !data.IpCefLoadSharingAlgorithmIncludePortsDestination.IsUnknown() { + if data.IpCefLoadSharingAlgorithmIncludePortsDestination.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"ip.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.destination", map[string]string{}) + } + } + if !data.Ipv6CefLoadSharingAlgorithmIncludePortsSource.IsNull() && !data.Ipv6CefLoadSharingAlgorithmIncludePortsSource.IsUnknown() { + if data.Ipv6CefLoadSharingAlgorithmIncludePortsSource.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"ipv6.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.source", map[string]string{}) + } + } + if !data.Ipv6CefLoadSharingAlgorithmIncludePortsDestination.IsNull() && !data.Ipv6CefLoadSharingAlgorithmIncludePortsDestination.IsUnknown() { + if data.Ipv6CefLoadSharingAlgorithmIncludePortsDestination.ValueBool() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"ipv6.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.destination", map[string]string{}) + } + } + if !data.PortChannelLoadBalance.IsNull() && !data.PortChannelLoadBalance.IsUnknown() { + body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"port-channel.Cisco-IOS-XE-ethernet:load-balance.load-balance", data.PortChannelLoadBalance.ValueString()) + } if len(data.MulticastRoutingVrfs) > 0 { body, _ = sjson.Set(body, helpers.LastElement(data.getPath())+"."+"ip.Cisco-IOS-XE-multicast:multicast-routing.vrf", []interface{}{}) for index, item := range data.MulticastRoutingVrfs { @@ -2133,6 +2166,47 @@ func (data *System) updateFromBody(ctx context.Context, res gjson.Result) { } else { data.IpRoutingProtocolPurgeInterface = types.BoolNull() } + if value := res.Get(prefix + "ip.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.source"); !data.IpCefLoadSharingAlgorithmIncludePortsSource.IsNull() { + if value.Exists() { + data.IpCefLoadSharingAlgorithmIncludePortsSource = types.BoolValue(true) + } else { + data.IpCefLoadSharingAlgorithmIncludePortsSource = types.BoolValue(false) + } + } else { + data.IpCefLoadSharingAlgorithmIncludePortsSource = types.BoolNull() + } + if value := res.Get(prefix + "ip.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.destination"); !data.IpCefLoadSharingAlgorithmIncludePortsDestination.IsNull() { + if value.Exists() { + data.IpCefLoadSharingAlgorithmIncludePortsDestination = types.BoolValue(true) + } else { + data.IpCefLoadSharingAlgorithmIncludePortsDestination = types.BoolValue(false) + } + } else { + data.IpCefLoadSharingAlgorithmIncludePortsDestination = types.BoolNull() + } + if value := res.Get(prefix + "ipv6.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.source"); !data.Ipv6CefLoadSharingAlgorithmIncludePortsSource.IsNull() { + if value.Exists() { + data.Ipv6CefLoadSharingAlgorithmIncludePortsSource = types.BoolValue(true) + } else { + data.Ipv6CefLoadSharingAlgorithmIncludePortsSource = types.BoolValue(false) + } + } else { + data.Ipv6CefLoadSharingAlgorithmIncludePortsSource = types.BoolNull() + } + if value := res.Get(prefix + "ipv6.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.destination"); !data.Ipv6CefLoadSharingAlgorithmIncludePortsDestination.IsNull() { + if value.Exists() { + data.Ipv6CefLoadSharingAlgorithmIncludePortsDestination = types.BoolValue(true) + } else { + data.Ipv6CefLoadSharingAlgorithmIncludePortsDestination = types.BoolValue(false) + } + } else { + data.Ipv6CefLoadSharingAlgorithmIncludePortsDestination = types.BoolNull() + } + if value := res.Get(prefix + "port-channel.Cisco-IOS-XE-ethernet:load-balance.load-balance"); value.Exists() && !data.PortChannelLoadBalance.IsNull() { + data.PortChannelLoadBalance = types.StringValue(value.String()) + } else { + data.PortChannelLoadBalance = types.StringNull() + } } // End of section. //template:end updateFromBody @@ -2776,6 +2850,29 @@ func (data *System) fromBody(ctx context.Context, res gjson.Result) { } else { data.IpRoutingProtocolPurgeInterface = types.BoolNull() } + if value := res.Get(prefix + "ip.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.source"); value.Exists() { + data.IpCefLoadSharingAlgorithmIncludePortsSource = types.BoolValue(true) + } else { + data.IpCefLoadSharingAlgorithmIncludePortsSource = types.BoolValue(false) + } + if value := res.Get(prefix + "ip.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.destination"); value.Exists() { + data.IpCefLoadSharingAlgorithmIncludePortsDestination = types.BoolValue(true) + } else { + data.IpCefLoadSharingAlgorithmIncludePortsDestination = types.BoolValue(false) + } + if value := res.Get(prefix + "ipv6.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.source"); value.Exists() { + data.Ipv6CefLoadSharingAlgorithmIncludePortsSource = types.BoolValue(true) + } else { + data.Ipv6CefLoadSharingAlgorithmIncludePortsSource = types.BoolValue(false) + } + if value := res.Get(prefix + "ipv6.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.destination"); value.Exists() { + data.Ipv6CefLoadSharingAlgorithmIncludePortsDestination = types.BoolValue(true) + } else { + data.Ipv6CefLoadSharingAlgorithmIncludePortsDestination = types.BoolValue(false) + } + if value := res.Get(prefix + "port-channel.Cisco-IOS-XE-ethernet:load-balance.load-balance"); value.Exists() { + data.PortChannelLoadBalance = types.StringValue(value.String()) + } } // End of section. //template:end fromBody @@ -3419,6 +3516,29 @@ func (data *SystemData) fromBody(ctx context.Context, res gjson.Result) { } else { data.IpRoutingProtocolPurgeInterface = types.BoolNull() } + if value := res.Get(prefix + "ip.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.source"); value.Exists() { + data.IpCefLoadSharingAlgorithmIncludePortsSource = types.BoolValue(true) + } else { + data.IpCefLoadSharingAlgorithmIncludePortsSource = types.BoolValue(false) + } + if value := res.Get(prefix + "ip.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.destination"); value.Exists() { + data.IpCefLoadSharingAlgorithmIncludePortsDestination = types.BoolValue(true) + } else { + data.IpCefLoadSharingAlgorithmIncludePortsDestination = types.BoolValue(false) + } + if value := res.Get(prefix + "ipv6.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.source"); value.Exists() { + data.Ipv6CefLoadSharingAlgorithmIncludePortsSource = types.BoolValue(true) + } else { + data.Ipv6CefLoadSharingAlgorithmIncludePortsSource = types.BoolValue(false) + } + if value := res.Get(prefix + "ipv6.cef-v2.Cisco-IOS-XE-cef:load-sharing-v2.algorithm-v2.include-ports-v2.destination"); value.Exists() { + data.Ipv6CefLoadSharingAlgorithmIncludePortsDestination = types.BoolValue(true) + } else { + data.Ipv6CefLoadSharingAlgorithmIncludePortsDestination = types.BoolValue(false) + } + if value := res.Get(prefix + "port-channel.Cisco-IOS-XE-ethernet:load-balance.load-balance"); value.Exists() { + data.PortChannelLoadBalance = types.StringValue(value.String()) + } } // End of section. //template:end fromBodyData @@ -3427,6 +3547,21 @@ func (data *SystemData) fromBody(ctx context.Context, res gjson.Result) { func (data *System) getDeletedItems(ctx context.Context, state System) []string { deletedItems := make([]string, 0) + if !state.PortChannelLoadBalance.IsNull() && data.PortChannelLoadBalance.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/port-channel/Cisco-IOS-XE-ethernet:load-balance/load-balance", state.getPath())) + } + if !state.Ipv6CefLoadSharingAlgorithmIncludePortsDestination.IsNull() && data.Ipv6CefLoadSharingAlgorithmIncludePortsDestination.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/ipv6/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/destination", state.getPath())) + } + if !state.Ipv6CefLoadSharingAlgorithmIncludePortsSource.IsNull() && data.Ipv6CefLoadSharingAlgorithmIncludePortsSource.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/ipv6/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/source", state.getPath())) + } + if !state.IpCefLoadSharingAlgorithmIncludePortsDestination.IsNull() && data.IpCefLoadSharingAlgorithmIncludePortsDestination.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/ip/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/destination", state.getPath())) + } + if !state.IpCefLoadSharingAlgorithmIncludePortsSource.IsNull() && data.IpCefLoadSharingAlgorithmIncludePortsSource.IsNull() { + deletedItems = append(deletedItems, fmt.Sprintf("%v/ip/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/source", state.getPath())) + } if !state.IpRoutingProtocolPurgeInterface.IsNull() && data.IpRoutingProtocolPurgeInterface.IsNull() { deletedItems = append(deletedItems, fmt.Sprintf("%v/ip/routing-new/routing/protocol/purge/interface", state.getPath())) } @@ -4231,6 +4366,18 @@ func (data *System) getDeletedItems(ctx context.Context, state System) []string func (data *System) getEmptyLeafsDelete(ctx context.Context) []string { emptyLeafsDelete := make([]string, 0) + if !data.Ipv6CefLoadSharingAlgorithmIncludePortsDestination.IsNull() && !data.Ipv6CefLoadSharingAlgorithmIncludePortsDestination.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/ipv6/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/destination", data.getPath())) + } + if !data.Ipv6CefLoadSharingAlgorithmIncludePortsSource.IsNull() && !data.Ipv6CefLoadSharingAlgorithmIncludePortsSource.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/ipv6/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/source", data.getPath())) + } + if !data.IpCefLoadSharingAlgorithmIncludePortsDestination.IsNull() && !data.IpCefLoadSharingAlgorithmIncludePortsDestination.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/ip/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/destination", data.getPath())) + } + if !data.IpCefLoadSharingAlgorithmIncludePortsSource.IsNull() && !data.IpCefLoadSharingAlgorithmIncludePortsSource.ValueBool() { + emptyLeafsDelete = append(emptyLeafsDelete, fmt.Sprintf("%v/ip/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/source", data.getPath())) + } for i := range data.TrackObjects { keyValues := [...]string{data.TrackObjects[i].Number.ValueString()} @@ -4328,6 +4475,21 @@ func (data *System) getEmptyLeafsDelete(ctx context.Context) []string { func (data *System) getDeletePaths(ctx context.Context) []string { var deletePaths []string + if !data.PortChannelLoadBalance.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/port-channel/Cisco-IOS-XE-ethernet:load-balance/load-balance", data.getPath())) + } + if !data.Ipv6CefLoadSharingAlgorithmIncludePortsDestination.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/ipv6/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/destination", data.getPath())) + } + if !data.Ipv6CefLoadSharingAlgorithmIncludePortsSource.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/ipv6/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/source", data.getPath())) + } + if !data.IpCefLoadSharingAlgorithmIncludePortsDestination.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/ip/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/destination", data.getPath())) + } + if !data.IpCefLoadSharingAlgorithmIncludePortsSource.IsNull() { + deletePaths = append(deletePaths, fmt.Sprintf("%v/ip/cef-v2/Cisco-IOS-XE-cef:load-sharing-v2/algorithm-v2/include-ports-v2/source", data.getPath())) + } if !data.IpRoutingProtocolPurgeInterface.IsNull() { deletePaths = append(deletePaths, fmt.Sprintf("%v/ip/routing-new/routing/protocol/purge/interface", data.getPath())) } diff --git a/internal/provider/resource_iosxe_system.go b/internal/provider/resource_iosxe_system.go index 29c7837c..26fa0a43 100644 --- a/internal/provider/resource_iosxe_system.go +++ b/internal/provider/resource_iosxe_system.go @@ -928,6 +928,29 @@ func (r *SystemResource) Schema(ctx context.Context, req resource.SchemaRequest, MarkdownDescription: helpers.NewAttributeDescription("Perform IP routing protocol routes purge on link failures").String, Optional: true, }, + "ip_cef_load_sharing_algorithm_include_ports_source": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("").String, + Optional: true, + }, + "ip_cef_load_sharing_algorithm_include_ports_destination": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("").String, + Optional: true, + }, + "ipv6_cef_load_sharing_algorithm_include_ports_source": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("").String, + Optional: true, + }, + "ipv6_cef_load_sharing_algorithm_include_ports_destination": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("").String, + Optional: true, + }, + "port_channel_load_balance": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("").AddStringEnumDescription("dst-ip", "dst-mac", "dst-mixed-ip-port", "dst-port", "mpls", "src-dst-ip", "src-dst-mac", "src-dst-mixed-ip-port", "src-dst-port", "src-ip", "src-mac", "src-mixed-ip-port", "src-port", "vlan-dst-ip", "vlan-dst-mixed-ip-port", "vlan-src-dst-ip", "vlan-src-dst-mixed-ip-port", "vlan-src-ip", "vlan-src-mixed-ip-port").String, + Optional: true, + Validators: []validator.String{ + stringvalidator.OneOf("dst-ip", "dst-mac", "dst-mixed-ip-port", "dst-port", "mpls", "src-dst-ip", "src-dst-mac", "src-dst-mixed-ip-port", "src-dst-port", "src-ip", "src-mac", "src-mixed-ip-port", "src-port", "vlan-dst-ip", "vlan-dst-mixed-ip-port", "vlan-src-dst-ip", "vlan-src-dst-mixed-ip-port", "vlan-src-ip", "vlan-src-mixed-ip-port"), + }, + }, }, } } diff --git a/internal/provider/resource_iosxe_system_test.go b/internal/provider/resource_iosxe_system_test.go index d19c1c5e..339f5ab4 100644 --- a/internal/provider/resource_iosxe_system_test.go +++ b/internal/provider/resource_iosxe_system_test.go @@ -87,6 +87,11 @@ func TestAccIosxeSystem(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("iosxe_system.test", "ip_domain_list_vrf_domain", "example.com")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_system.test", "ip_domain_list_vrf", "VRF1")) checks = append(checks, resource.TestCheckResourceAttr("iosxe_system.test", "ip_routing_protocol_purge_interface", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_system.test", "ip_cef_load_sharing_algorithm_include_ports_source", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_system.test", "ip_cef_load_sharing_algorithm_include_ports_destination", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_system.test", "ipv6_cef_load_sharing_algorithm_include_ports_source", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_system.test", "ipv6_cef_load_sharing_algorithm_include_ports_destination", "true")) + checks = append(checks, resource.TestCheckResourceAttr("iosxe_system.test", "port_channel_load_balance", "src-dst-mixed-ip-port")) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, @@ -213,6 +218,11 @@ func testAccIosxeSystemConfig_all() string { config += ` ip_domain_list_vrf_domain = "example.com"` + "\n" config += ` ip_domain_list_vrf = "VRF1"` + "\n" config += ` ip_routing_protocol_purge_interface = true` + "\n" + config += ` ip_cef_load_sharing_algorithm_include_ports_source = true` + "\n" + config += ` ip_cef_load_sharing_algorithm_include_ports_destination = true` + "\n" + config += ` ipv6_cef_load_sharing_algorithm_include_ports_source = true` + "\n" + config += ` ipv6_cef_load_sharing_algorithm_include_ports_destination = true` + "\n" + config += ` port_channel_load_balance = "src-dst-mixed-ip-port"` + "\n" config += ` depends_on = [iosxe_restconf.PreReq0, ]` + "\n" config += `}` + "\n" return config diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index 50baf778..76e44d3a 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -20,6 +20,7 @@ description: |- - Add `ip_dhcp_relay_information_option_vpn_id` attribute to `iosxe_interface_ethernet` resource and `iosxe_interface_vlan` resource - Add `local_routing` attribute to `iosxe_interface_nve` resource and data source - Add `ipv4_unicast_maximum_paths_ebgp` and `ipv4_unicast_maximum_paths_ibgp` attributes to the `iosxe_bgp_address_family_ipv4` and `iosxe_bgp_address_family_ipv4_vrf` resources +- Add `ip_cef_load_sharing_algorithm_include_ports_source`, `ip_cef_load_sharing_algorithm_include_ports_destination`, `ipv6_cef_load_sharing_algorithm_include_ports_source`, `ipv6_cef_load_sharing_algorithm_include_ports_destination`, and `port_channel_load_balance` attributes to `iosxe_system` resource and data source ## 0.9.3