From 40d434cf35e661ae331ae7890e996730304f9e2f Mon Sep 17 00:00:00 2001 From: Sean Conroy <141843633+seconroy@users.noreply.github.com> Date: Wed, 16 Oct 2024 09:53:06 +0100 Subject: [PATCH] Add support for tracker and route features where missing (#339) --- ...vice_lan_vpn_interface_ethernet_feature.md | 13 ++ .../service_lan_vpn_interface_svi_feature.md | 13 ++ ...vice_lan_vpn_interface_ethernet_feature.md | 22 +++ .../service_lan_vpn_interface_svi_feature.md | 22 +++ .../resource.tf | 7 + .../resource.tf | 7 + .../profile_parcels/service_lan_vpn.yaml | 22 --- .../service_lan_vpn_interface_ethernet.yaml | 40 +++-- .../service_lan_vpn_interface_svi.yaml | 40 +++-- .../profile_parcels/service_routing_bgp.yaml | 16 -- .../transport_routing_bgp.yaml | 16 -- .../service_lan_vpn_interface_ethernet.json | 30 ++-- ...vice_lan_vpn_interface_ethernet_feature.go | 28 ++++ ...lan_vpn_interface_ethernet_feature_test.go | 22 +++ ...n_service_lan_vpn_interface_svi_feature.go | 28 ++++ ...vice_lan_vpn_interface_svi_feature_test.go | 22 +++ ...vice_lan_vpn_interface_ethernet_feature.go | 139 ++++++++++++++++++ ...n_service_lan_vpn_interface_svi_feature.go | 139 ++++++++++++++++++ ...vice_lan_vpn_interface_ethernet_feature.go | 37 +++++ ...lan_vpn_interface_ethernet_feature_test.go | 22 +++ ...n_service_lan_vpn_interface_svi_feature.go | 37 +++++ ...vice_lan_vpn_interface_svi_feature_test.go | 22 +++ 22 files changed, 651 insertions(+), 93 deletions(-) diff --git a/docs/data-sources/service_lan_vpn_interface_ethernet_feature.md b/docs/data-sources/service_lan_vpn_interface_ethernet_feature.md index 7767e2611..090f0822a 100644 --- a/docs/data-sources/service_lan_vpn_interface_ethernet_feature.md +++ b/docs/data-sources/service_lan_vpn_interface_ethernet_feature.md @@ -159,6 +159,7 @@ Read-Only: - `tloc_pref_change_value` (Number) Timer interval for successive advertisements, in milliseconds - `tloc_prefix_change` (Boolean) Timer interval for successive advertisements, in milliseconds - `track_omp` (Boolean) Track OMP status +- `tracking_objects` (Attributes List) Tracking object for VRRP configuration (see [below for nested schema](#nestedatt--ipv4_vrrps--tracking_objects)) ### Nested Schema for `ipv4_vrrps.secondary_addresses` @@ -171,6 +172,18 @@ Read-Only: - `subnet_mask_variable` (String) Variable name + +### Nested Schema for `ipv4_vrrps.tracking_objects` + +Read-Only: + +- `decrement_value` (Number) Decrement Value for VRRP priority +- `decrement_value_variable` (String) Variable name +- `tracker_action` (String) Track Action +- `tracker_action_variable` (String) Variable name +- `tracker_id` (String) + + ### Nested Schema for `ipv6_dhcp_helpers` diff --git a/docs/data-sources/service_lan_vpn_interface_svi_feature.md b/docs/data-sources/service_lan_vpn_interface_svi_feature.md index 27ce9e9c3..93cebe1f5 100644 --- a/docs/data-sources/service_lan_vpn_interface_svi_feature.md +++ b/docs/data-sources/service_lan_vpn_interface_svi_feature.md @@ -112,6 +112,7 @@ Read-Only: - `tloc_prefix_change_value_variable` (String) Variable name - `track_omp` (Boolean) Track OMP status - `track_omp_variable` (String) Variable name +- `tracking_objects` (Attributes List) tracking object for VRRP configuration (see [below for nested schema](#nestedatt--ipv4_vrrps--tracking_objects)) ### Nested Schema for `ipv4_vrrps.secondary_addresses` @@ -122,6 +123,18 @@ Read-Only: - `address_variable` (String) Variable name + +### Nested Schema for `ipv4_vrrps.tracking_objects` + +Read-Only: + +- `decrement_value` (Number) Decrement Value for VRRP priority +- `decrement_value_variable` (String) Variable name +- `track_action` (String) Track Action +- `track_action_variable` (String) Variable name +- `tracker_id` (String) + + ### Nested Schema for `ipv6_dhcp_helpers` diff --git a/docs/resources/service_lan_vpn_interface_ethernet_feature.md b/docs/resources/service_lan_vpn_interface_ethernet_feature.md index 1a62faedf..6fcfe78f3 100644 --- a/docs/resources/service_lan_vpn_interface_ethernet_feature.md +++ b/docs/resources/service_lan_vpn_interface_ethernet_feature.md @@ -87,6 +87,13 @@ resource "sdwan_service_lan_vpn_interface_ethernet_feature" "example" { ] tloc_prefix_change = true tloc_pref_change_value = 100 + tracking_objects = [ + { + tracker_id = "1b270f6d-479b-47e3-ab0b-51bc6811a303" + tracker_action = "Decrement" + decrement_value = 100 + } + ] } ] arps = [ @@ -299,6 +306,7 @@ Optional: - Default value: `false` - `track_omp` (Boolean) Track OMP status - Default value: `false` +- `tracking_objects` (Attributes List) Tracking object for VRRP configuration (see [below for nested schema](#nestedatt--ipv4_vrrps--tracking_objects)) ### Nested Schema for `ipv4_vrrps.secondary_addresses` @@ -312,6 +320,20 @@ Optional: - `subnet_mask_variable` (String) Variable name + +### Nested Schema for `ipv4_vrrps.tracking_objects` + +Optional: + +- `decrement_value` (Number) Decrement Value for VRRP priority + - Range: `1`-`255` +- `decrement_value_variable` (String) Variable name +- `tracker_action` (String) Track Action + - Choices: `Decrement`, `Shutdown` +- `tracker_action_variable` (String) Variable name +- `tracker_id` (String) + + ### Nested Schema for `ipv6_dhcp_helpers` diff --git a/docs/resources/service_lan_vpn_interface_svi_feature.md b/docs/resources/service_lan_vpn_interface_svi_feature.md index bbb13496f..7d9c4fb82 100644 --- a/docs/resources/service_lan_vpn_interface_svi_feature.md +++ b/docs/resources/service_lan_vpn_interface_svi_feature.md @@ -67,6 +67,13 @@ resource "sdwan_service_lan_vpn_interface_svi_feature" "example" { ] tloc_prefix_change = true tloc_prefix_change_value = 100 + tracking_objects = [ + { + tracker_id = "1b270f6d-479b-47e3-ab0b-51bc6811a303" + track_action = "decrement" + decrement_value = 100 + } + ] } ] ipv6_vrrps = [ @@ -213,6 +220,7 @@ Optional: - `track_omp` (Boolean) Track OMP status - Default value: `false` - `track_omp_variable` (String) Variable name +- `tracking_objects` (Attributes List) tracking object for VRRP configuration (see [below for nested schema](#nestedatt--ipv4_vrrps--tracking_objects)) ### Nested Schema for `ipv4_vrrps.secondary_addresses` @@ -223,6 +231,20 @@ Optional: - `address_variable` (String) Variable name + +### Nested Schema for `ipv4_vrrps.tracking_objects` + +Optional: + +- `decrement_value` (Number) Decrement Value for VRRP priority + - Range: `1`-`255` +- `decrement_value_variable` (String) Variable name +- `track_action` (String) Track Action + - Choices: `decrement`, `shutdown` +- `track_action_variable` (String) Variable name +- `tracker_id` (String) + + ### Nested Schema for `ipv6_dhcp_helpers` diff --git a/examples/resources/sdwan_service_lan_vpn_interface_ethernet_feature/resource.tf b/examples/resources/sdwan_service_lan_vpn_interface_ethernet_feature/resource.tf index 68e339a94..e4877fa1d 100644 --- a/examples/resources/sdwan_service_lan_vpn_interface_ethernet_feature/resource.tf +++ b/examples/resources/sdwan_service_lan_vpn_interface_ethernet_feature/resource.tf @@ -70,6 +70,13 @@ resource "sdwan_service_lan_vpn_interface_ethernet_feature" "example" { ] tloc_prefix_change = true tloc_pref_change_value = 100 + tracking_objects = [ + { + tracker_id = "1b270f6d-479b-47e3-ab0b-51bc6811a303" + tracker_action = "Decrement" + decrement_value = 100 + } + ] } ] arps = [ diff --git a/examples/resources/sdwan_service_lan_vpn_interface_svi_feature/resource.tf b/examples/resources/sdwan_service_lan_vpn_interface_svi_feature/resource.tf index d95a0b1df..a606577b6 100644 --- a/examples/resources/sdwan_service_lan_vpn_interface_svi_feature/resource.tf +++ b/examples/resources/sdwan_service_lan_vpn_interface_svi_feature/resource.tf @@ -50,6 +50,13 @@ resource "sdwan_service_lan_vpn_interface_svi_feature" "example" { ] tloc_prefix_change = true tloc_prefix_change_value = 100 + tracking_objects = [ + { + tracker_id = "1b270f6d-479b-47e3-ab0b-51bc6811a303" + track_action = "decrement" + decrement_value = 100 + } + ] } ] ipv6_vrrps = [ diff --git a/gen/definitions/profile_parcels/service_lan_vpn.yaml b/gen/definitions/profile_parcels/service_lan_vpn.yaml index e9c266898..ecb61706a 100644 --- a/gen/definitions/profile_parcels/service_lan_vpn.yaml +++ b/gen/definitions/profile_parcels/service_lan_vpn.yaml @@ -57,13 +57,11 @@ attributes: - model_name: ompProtocol tf_name: protocol example: bgp - # ====== UX2.0 Route Policy Not Supported By Provider ====== - model_name: refId tf_name: route_policy_id data_path: [routePolicy] id: true example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 - # test_value: - model_name: prefixList tf_name: prefixes exclude_test: true @@ -88,13 +86,11 @@ attributes: - model_name: ompProtocol tf_name: protocol example: OSPF - # ====== UX2.0 Route Policy Not Supported By Provider ====== - model_name: refId tf_name: route_policy_id data_path: [routePolicy] id: true example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 - # test_value: - model_name: protocolSubType example: External - model_name: prefixList @@ -137,12 +133,10 @@ attributes: - model_name: distance tf_name: administrative_distance example: 1 - # ====== UX2.0 Tracker and Trackerobject Not Supported By Provider ====== - model_name: refId tf_name: tracker_id data_path: [tracker] example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 - # test_value: - model_name: null0 data_path: [oneOfIpRoute] exclude_test: true @@ -250,13 +244,11 @@ attributes: example: true - model_name: direction example: inside - # ====== UX2.0 Tracker and Trackerobject Not Supported By Provider ====== - model_name: refId tf_name: tracker_object_id data_path: [trackingObject, trackerId] exclude_test: true example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 - # test_value: - model_name: natPortForward tf_name: nat_port_forwards attributes: @@ -285,13 +277,11 @@ attributes: example: 2.3.4.5 - model_name: staticNatDirection example: inside - # ====== UX2.0 Tracker and Trackerobject Not Supported By Provider ====== - model_name: refId tf_name: tracker_object_id data_path: [trackingObject, trackerId] exclude_test: true example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 - # test_value: - model_name: nat64V4Pool tf_name: nat_64_v4_pools attributes: @@ -314,52 +304,44 @@ attributes: attributes: - model_name: routeProtocol example: static - # ====== UX2.0 Route Policy Not Supported By Provider ====== - model_name: refId tf_name: route_policy_id data_path: [routePolicy] id: true example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 - # test_value: - model_name: redistributeToProtocol tf_name: redistributions exclude_test: true attributes: - model_name: protocol example: bgp - # ====== UX2.0 Route Policy Not Supported By Provider ====== - model_name: refId data_path: [policy] tf_name: redistribution_policy_id id: true example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 - # test_value: - model_name: routeLeakFromService tf_name: route_leak_to_global_vpns exclude_test: true attributes: - model_name: routeProtocol example: static - # ====== UX2.0 Route Policy Not Supported By Provider ====== - model_name: refId tf_name: route_policy_id data_path: [routePolicy] id: true example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 - # test_value: - model_name: redistributeToProtocol tf_name: redistributions attributes: - model_name: protocol example: bgp - # ====== UX2.0 Route Policy Not Supported By Provider ====== - model_name: refId tf_name: redistribution_policy_id data_path: [policy] id: true exclude_test: true example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 - # test_value: - model_name: routeLeakBetweenServices tf_name: route_leak_from_other_services exclude_test: true @@ -368,26 +350,22 @@ attributes: example: 1 - model_name: routeProtocol example: static - # ====== UX2.0 Route Policy Not Supported By Provider ====== - model_name: refId tf_name: route_policy_id data_path: [routePolicy] id: true example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 - # test_value: - model_name: redistributeToProtocol tf_name: redistributions exclude_test: true attributes: - model_name: protocol example: bgp - # ====== UX2.0 Route Policy Not Supported By Provider ====== - model_name: refId tf_name: redistribution_policy_id data_path: [policy] id: true example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 - # test_value: - model_name: importRtList tf_name: ipv4_import_route_targets data_path: [mplsVpnIpv4RouteTarget] diff --git a/gen/definitions/profile_parcels/service_lan_vpn_interface_ethernet.yaml b/gen/definitions/profile_parcels/service_lan_vpn_interface_ethernet.yaml index dab1e6649..1a451ded6 100644 --- a/gen/definitions/profile_parcels/service_lan_vpn_interface_ethernet.yaml +++ b/gen/definitions/profile_parcels/service_lan_vpn_interface_ethernet.yaml @@ -236,18 +236,19 @@ attributes: example: true - model_name: tlocPrefChangeValue example: 100 - # - model_name: trackingObject - # tf_name: tracking_objects - # exclude_test: true - # attributes: - # - model_name: trackerId - # tf_name: tracker_policy_id - # id: true - # example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 - # - model_name: trackerAction - # example: decrement - # - model_name: decrementValue - # example: 100 + - model_name: trackingObject + tf_name: tracking_objects + attributes: + - model_name: refId + tf_name: tracker_id + data_path: [trackerId] + id: true + example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 + test_value: sdwan_service_tracker_feature.test.id + - model_name: trackerAction + example: Decrement + - model_name: decrementValue + example: 100 - model_name: arp tf_name: arps attributes: @@ -330,4 +331,19 @@ test_prerequisites: | resource "sdwan_service_lan_vpn_feature" "test" { name = "TF_TEST_SLAN" feature_profile_id = sdwan_service_feature_profile.test.id + } + + resource "sdwan_service_tracker_feature" "test" { + name = "TF_TEST_TRACKER" + description = "Terraform test" + feature_profile_id = sdwan_service_feature_profile.test.id + tracker_name = "TRACKER_1" + endpoint_api_url = "google.com" + endpoint_dns_name = "google.com" + endpoint_ip = "1.2.3.4" + interval = 30 + multiplier = 3 + threshold = 300 + endpoint_tracker_type = "static-route" + tracker_type = "endpoint" } \ No newline at end of file diff --git a/gen/definitions/profile_parcels/service_lan_vpn_interface_svi.yaml b/gen/definitions/profile_parcels/service_lan_vpn_interface_svi.yaml index f7efb7207..9b4975673 100644 --- a/gen/definitions/profile_parcels/service_lan_vpn_interface_svi.yaml +++ b/gen/definitions/profile_parcels/service_lan_vpn_interface_svi.yaml @@ -143,18 +143,19 @@ attributes: - model_name: tlocPrefChangeValue tf_name: tloc_prefix_change_value example: 100 - # - model_name: trackingObject - # tf_name: tracking_objects - # exclude_test: true - # attributes: - # - model_name: trackerId - # tf_name: tracker_policy_id - # id: true - # example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 - # - model_name: trackerAction - # example: decrement - # - model_name: decrementValue - # example: 100 + - model_name: trackingObject + tf_name: tracking_objects + attributes: + - model_name: refId + tf_name: tracker_id + data_path: [trackerId] + id: true + example: 1b270f6d-479b-47e3-ab0b-51bc6811a303 + test_value: sdwan_service_tracker_feature.test.id + - model_name: trackAction + example: decrement + - model_name: decrementValue + example: 100 - model_name: vrrpIpv6 tf_name: ipv6_vrrps attributes: @@ -210,4 +211,19 @@ test_prerequisites: | resource "sdwan_service_lan_vpn_feature" "test" { name = "TF_TEST_SLAN" feature_profile_id = sdwan_service_feature_profile.test.id + } + + resource "sdwan_service_tracker_feature" "test" { + name = "TF_TEST_TRACKER" + description = "Terraform test" + feature_profile_id = sdwan_service_feature_profile.test.id + tracker_name = "TRACKER_1" + endpoint_api_url = "google.com" + endpoint_dns_name = "google.com" + endpoint_ip = "1.2.3.4" + interval = 30 + multiplier = 3 + threshold = 300 + endpoint_tracker_type = "static-route" + tracker_type = "endpoint" } \ No newline at end of file diff --git a/gen/definitions/profile_parcels/service_routing_bgp.yaml b/gen/definitions/profile_parcels/service_routing_bgp.yaml index bc9f86928..c615e6df7 100644 --- a/gen/definitions/profile_parcels/service_routing_bgp.yaml +++ b/gen/definitions/profile_parcels/service_routing_bgp.yaml @@ -115,20 +115,16 @@ attributes: - model_name: restartInterval data_path: [maxPrefixConfig] example: 30 - # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: in_route_policy_id data_path: [inRoutePolicy] exclude_test: true example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # test_value: - # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: out_route_policy_id data_path: [outRoutePolicy] exclude_test: true example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # test_value: - model_name: ipv6Neighbor tf_name: ipv6_neighbors attributes: @@ -191,20 +187,16 @@ attributes: - model_name: restartInterval data_path: [maxPrefixConfig] example: 30 - # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: in_route_policy_id data_path: [inRoutePolicy] exclude_test: true example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # test_value: - # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: out_route_policy_id data_path: [outRoutePolicy] exclude_test: true example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # test_value: - model_name: aggregateAddress tf_name: ipv4_aggregate_addresses data_path: [addressFamily] @@ -244,14 +236,12 @@ attributes: tf_name: ipv4_originate data_path: [addressFamily] example: false - # # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: ipv4_table_map_route_policy_id data_path: [addressFamily, name] always_include_parent: true exclude_test: true example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # # test_value: - model_name: filter tf_name: ipv4_table_map_filter data_path: [addressFamily] @@ -263,12 +253,10 @@ attributes: attributes: - model_name: protocol example: static - # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: route_policy_id data_path: [routePolicy] example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # test_value: - model_name: ipv6AggregateAddress tf_name: ipv6_aggregate_addresses data_path: [ipv6AddressFamily] @@ -298,14 +286,12 @@ attributes: tf_name: ipv6_originate data_path: [ipv6AddressFamily] example: true - # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: ipv6_table_map_route_policy_id data_path: [ipv6AddressFamily, name] always_include_parent: true exclude_test: true example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # test_value: - model_name: filter tf_name: ipv6_table_map_filter data_path: [ipv6AddressFamily] @@ -317,12 +303,10 @@ attributes: attributes: - model_name: protocol example: static - # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: route_policy_id data_path: [routePolicy] example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # test_value: test_prerequisites: | resource "sdwan_transport_feature_profile" "test" { diff --git a/gen/definitions/profile_parcels/transport_routing_bgp.yaml b/gen/definitions/profile_parcels/transport_routing_bgp.yaml index 33e6baedd..80dce40ff 100644 --- a/gen/definitions/profile_parcels/transport_routing_bgp.yaml +++ b/gen/definitions/profile_parcels/transport_routing_bgp.yaml @@ -118,20 +118,16 @@ attributes: - model_name: restartInterval data_path: [maxPrefixConfig] example: 30 - # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: in_route_policy_id data_path: [inRoutePolicy] exclude_test: true example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # test_value: - # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: out_route_policy_id data_path: [outRoutePolicy] exclude_test: true example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # test_value: - model_name: ipv6Neighbor tf_name: ipv6_neighbors attributes: @@ -194,20 +190,16 @@ attributes: - model_name: restartInterval data_path: [maxPrefixConfig] example: 30 - # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: in_route_policy_id data_path: [inRoutePolicy] exclude_test: true example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # test_value: - # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: out_route_policy_id data_path: [outRoutePolicy] exclude_test: true example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # test_value: - model_name: aggregateAddress tf_name: ipv4_aggregate_addresses data_path: [addressFamily] @@ -247,14 +239,12 @@ attributes: tf_name: ipv4_originate data_path: [addressFamily] example: false - # # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: ipv4_table_map_route_policy_id data_path: [addressFamily, name] always_include_parent: true exclude_test: true example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # # test_value: - model_name: filter tf_name: ipv4_table_map_filter data_path: [addressFamily] @@ -266,12 +256,10 @@ attributes: attributes: - model_name: protocol example: static - # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: route_policy_id data_path: [routePolicy] example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # test_value: - model_name: ipv6AggregateAddress tf_name: ipv6_aggregate_addresses data_path: [ipv6AddressFamily] @@ -301,14 +289,12 @@ attributes: tf_name: ipv6_originate data_path: [ipv6AddressFamily] example: true - # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: ipv6_table_map_route_policy_id data_path: [ipv6AddressFamily, name] always_include_parent: true exclude_test: true example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # test_value: - model_name: filter tf_name: ipv6_table_map_filter data_path: [ipv6AddressFamily] @@ -320,12 +306,10 @@ attributes: attributes: - model_name: protocol example: static - # === UX2.0 Route Policy Not Supported by Provider === - model_name: refId tf_name: route_policy_id data_path: [routePolicy] example: a509839f-33aa-492a-ab8e-6a6fe70d7d79 - # test_value: - model_name: mplsInterface tf_name: mpls_interfaces attributes: diff --git a/gen/models/profile_parcels/service_lan_vpn_interface_ethernet.json b/gen/models/profile_parcels/service_lan_vpn_interface_ethernet.json index 9dba74c85..f64fc3799 100644 --- a/gen/models/profile_parcels/service_lan_vpn_interface_ethernet.json +++ b/gen/models/profile_parcels/service_lan_vpn_interface_ethernet.json @@ -2987,20 +2987,6 @@ "description": "Associate Object Tracker/Object Tracker Group", "type": "object", "oneOf": [ - { - "properties": { - "optionType": { - "type": "string", - "enum": [ - "default" - ] - } - }, - "required": [ - "optionType" - ], - "additionalProperties": false - }, { "properties": { "refId": { @@ -3027,7 +3013,21 @@ "refId" ], "additionalProperties": false - } + }, + { + "properties": { + "optionType": { + "type": "string", + "enum": [ + "default" + ] + } + }, + "required": [ + "optionType" + ], + "additionalProperties": false + } ] }, "trackerAction": { diff --git a/internal/provider/data_source_sdwan_service_lan_vpn_interface_ethernet_feature.go b/internal/provider/data_source_sdwan_service_lan_vpn_interface_ethernet_feature.go index e52cd5f7e..3521303d7 100644 --- a/internal/provider/data_source_sdwan_service_lan_vpn_interface_ethernet_feature.go +++ b/internal/provider/data_source_sdwan_service_lan_vpn_interface_ethernet_feature.go @@ -501,6 +501,34 @@ func (d *ServiceLANVPNInterfaceEthernetProfileParcelDataSource) Schema(ctx conte MarkdownDescription: "Timer interval for successive advertisements, in milliseconds", Computed: true, }, + "tracking_objects": schema.ListNestedAttribute{ + MarkdownDescription: "Tracking object for VRRP configuration", + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "tracker_id": schema.StringAttribute{ + MarkdownDescription: "", + Computed: true, + }, + "tracker_action": schema.StringAttribute{ + MarkdownDescription: "Track Action", + Computed: true, + }, + "tracker_action_variable": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + Computed: true, + }, + "decrement_value": schema.Int64Attribute{ + MarkdownDescription: "Decrement Value for VRRP priority", + Computed: true, + }, + "decrement_value_variable": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + Computed: true, + }, + }, + }, + }, }, }, }, diff --git a/internal/provider/data_source_sdwan_service_lan_vpn_interface_ethernet_feature_test.go b/internal/provider/data_source_sdwan_service_lan_vpn_interface_ethernet_feature_test.go index f561a8386..a36f8beb8 100644 --- a/internal/provider/data_source_sdwan_service_lan_vpn_interface_ethernet_feature_test.go +++ b/internal/provider/data_source_sdwan_service_lan_vpn_interface_ethernet_feature_test.go @@ -73,6 +73,8 @@ func TestAccDataSourceSdwanServiceLANVPNInterfaceEthernetProfileParcel(t *testin checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_vrrps.0.secondary_addresses.0.subnet_mask", "0.0.0.0")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_vrrps.0.tloc_prefix_change", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_vrrps.0.tloc_pref_change_value", "100")) + checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_vrrps.0.tracking_objects.0.tracker_action", "Decrement")) + checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_vrrps.0.tracking_objects.0.decrement_value", "100")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "arps.0.ip_address", "1.2.3.4")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "arps.0.mac_address", "00-B0-D0-63-C2-26")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_ethernet_feature.test", "trustsec_enable_sgt_propogation", "false")) @@ -119,6 +121,21 @@ resource "sdwan_service_lan_vpn_feature" "test" { name = "TF_TEST_SLAN" feature_profile_id = sdwan_service_feature_profile.test.id } + +resource "sdwan_service_tracker_feature" "test" { + name = "TF_TEST_TRACKER" + description = "Terraform test" + feature_profile_id = sdwan_service_feature_profile.test.id + tracker_name = "TRACKER_1" + endpoint_api_url = "google.com" + endpoint_dns_name = "google.com" + endpoint_ip = "1.2.3.4" + interval = 30 + multiplier = 3 + threshold = 300 + endpoint_tracker_type = "static-route" + tracker_type = "endpoint" +} ` // End of section. //template:end testPrerequisites @@ -184,6 +201,11 @@ func testAccDataSourceSdwanServiceLANVPNInterfaceEthernetProfileParcelConfig() s config += ` }]` + "\n" config += ` tloc_prefix_change = true` + "\n" config += ` tloc_pref_change_value = 100` + "\n" + config += ` tracking_objects = [{` + "\n" + config += ` tracker_id = sdwan_service_tracker_feature.test.id` + "\n" + config += ` tracker_action = "Decrement"` + "\n" + config += ` decrement_value = 100` + "\n" + config += ` }]` + "\n" config += ` }]` + "\n" config += ` arps = [{` + "\n" config += ` ip_address = "1.2.3.4"` + "\n" diff --git a/internal/provider/data_source_sdwan_service_lan_vpn_interface_svi_feature.go b/internal/provider/data_source_sdwan_service_lan_vpn_interface_svi_feature.go index 50ac0ab9c..acf509599 100644 --- a/internal/provider/data_source_sdwan_service_lan_vpn_interface_svi_feature.go +++ b/internal/provider/data_source_sdwan_service_lan_vpn_interface_svi_feature.go @@ -325,6 +325,34 @@ func (d *ServiceLANVPNInterfaceSVIProfileParcelDataSource) Schema(ctx context.Co MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, Computed: true, }, + "tracking_objects": schema.ListNestedAttribute{ + MarkdownDescription: "tracking object for VRRP configuration", + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "tracker_id": schema.StringAttribute{ + MarkdownDescription: "", + Computed: true, + }, + "track_action": schema.StringAttribute{ + MarkdownDescription: "Track Action", + Computed: true, + }, + "track_action_variable": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + Computed: true, + }, + "decrement_value": schema.Int64Attribute{ + MarkdownDescription: "Decrement Value for VRRP priority", + Computed: true, + }, + "decrement_value_variable": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + Computed: true, + }, + }, + }, + }, }, }, }, diff --git a/internal/provider/data_source_sdwan_service_lan_vpn_interface_svi_feature_test.go b/internal/provider/data_source_sdwan_service_lan_vpn_interface_svi_feature_test.go index b1012659f..830b499a0 100644 --- a/internal/provider/data_source_sdwan_service_lan_vpn_interface_svi_feature_test.go +++ b/internal/provider/data_source_sdwan_service_lan_vpn_interface_svi_feature_test.go @@ -57,6 +57,8 @@ func TestAccDataSourceSdwanServiceLANVPNInterfaceSVIProfileParcel(t *testing.T) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_svi_feature.test", "ipv4_vrrps.0.secondary_addresses.0.address", "2.3.4.5")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_svi_feature.test", "ipv4_vrrps.0.tloc_prefix_change", "true")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_svi_feature.test", "ipv4_vrrps.0.tloc_prefix_change_value", "100")) + checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_svi_feature.test", "ipv4_vrrps.0.tracking_objects.0.track_action", "decrement")) + checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_svi_feature.test", "ipv4_vrrps.0.tracking_objects.0.decrement_value", "100")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_svi_feature.test", "ipv6_vrrps.0.group_id", "1")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_svi_feature.test", "ipv6_vrrps.0.priority", "100")) checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_service_lan_vpn_interface_svi_feature.test", "ipv6_vrrps.0.timer", "1000")) @@ -95,6 +97,21 @@ resource "sdwan_service_lan_vpn_feature" "test" { name = "TF_TEST_SLAN" feature_profile_id = sdwan_service_feature_profile.test.id } + +resource "sdwan_service_tracker_feature" "test" { + name = "TF_TEST_TRACKER" + description = "Terraform test" + feature_profile_id = sdwan_service_feature_profile.test.id + tracker_name = "TRACKER_1" + endpoint_api_url = "google.com" + endpoint_dns_name = "google.com" + endpoint_ip = "1.2.3.4" + interval = 30 + multiplier = 3 + threshold = 300 + endpoint_tracker_type = "static-route" + tracker_type = "endpoint" +} ` // End of section. //template:end testPrerequisites @@ -142,6 +159,11 @@ func testAccDataSourceSdwanServiceLANVPNInterfaceSVIProfileParcelConfig() string config += ` }]` + "\n" config += ` tloc_prefix_change = true` + "\n" config += ` tloc_prefix_change_value = 100` + "\n" + config += ` tracking_objects = [{` + "\n" + config += ` tracker_id = sdwan_service_tracker_feature.test.id` + "\n" + config += ` track_action = "decrement"` + "\n" + config += ` decrement_value = 100` + "\n" + config += ` }]` + "\n" config += ` }]` + "\n" config += ` ipv6_vrrps = [{` + "\n" config += ` group_id = 1` + "\n" diff --git a/internal/provider/model_sdwan_service_lan_vpn_interface_ethernet_feature.go b/internal/provider/model_sdwan_service_lan_vpn_interface_ethernet_feature.go index 85fbaee32..df8c860ca 100644 --- a/internal/provider/model_sdwan_service_lan_vpn_interface_ethernet_feature.go +++ b/internal/provider/model_sdwan_service_lan_vpn_interface_ethernet_feature.go @@ -185,6 +185,7 @@ type ServiceLANVPNInterfaceEthernetIpv4Vrrps struct { SecondaryAddresses []ServiceLANVPNInterfaceEthernetIpv4VrrpsSecondaryAddresses `tfsdk:"secondary_addresses"` TlocPrefixChange types.Bool `tfsdk:"tloc_prefix_change"` TlocPrefChangeValue types.Int64 `tfsdk:"tloc_pref_change_value"` + TrackingObjects []ServiceLANVPNInterfaceEthernetIpv4VrrpsTrackingObjects `tfsdk:"tracking_objects"` } type ServiceLANVPNInterfaceEthernetArps struct { @@ -207,6 +208,13 @@ type ServiceLANVPNInterfaceEthernetIpv4VrrpsSecondaryAddresses struct { SubnetMask types.String `tfsdk:"subnet_mask"` SubnetMaskVariable types.String `tfsdk:"subnet_mask_variable"` } +type ServiceLANVPNInterfaceEthernetIpv4VrrpsTrackingObjects struct { + TrackerId types.String `tfsdk:"tracker_id"` + TrackerAction types.String `tfsdk:"tracker_action"` + TrackerActionVariable types.String `tfsdk:"tracker_action_variable"` + DecrementValue types.Int64 `tfsdk:"decrement_value"` + DecrementValueVariable types.String `tfsdk:"decrement_value_variable"` +} // End of section. //template:end types @@ -934,6 +942,43 @@ func (data ServiceLANVPNInterfaceEthernet) toBody(ctx context.Context) string { itemBody, _ = sjson.Set(itemBody, "tlocPrefChangeValue.value", item.TlocPrefChangeValue.ValueInt64()) } } + if true { + itemBody, _ = sjson.Set(itemBody, "trackingObject", []interface{}{}) + for _, childItem := range item.TrackingObjects { + itemChildBody := "" + if !childItem.TrackerId.IsNull() { + if true { + itemChildBody, _ = sjson.Set(itemChildBody, "trackerId.refId.optionType", "global") + itemChildBody, _ = sjson.Set(itemChildBody, "trackerId.refId.value", childItem.TrackerId.ValueString()) + } + } + + if !childItem.TrackerActionVariable.IsNull() { + if true { + itemChildBody, _ = sjson.Set(itemChildBody, "trackerAction.optionType", "variable") + itemChildBody, _ = sjson.Set(itemChildBody, "trackerAction.value", childItem.TrackerActionVariable.ValueString()) + } + } else if !childItem.TrackerAction.IsNull() { + if true { + itemChildBody, _ = sjson.Set(itemChildBody, "trackerAction.optionType", "global") + itemChildBody, _ = sjson.Set(itemChildBody, "trackerAction.value", childItem.TrackerAction.ValueString()) + } + } + + if !childItem.DecrementValueVariable.IsNull() { + if true { + itemChildBody, _ = sjson.Set(itemChildBody, "decrementValue.optionType", "variable") + itemChildBody, _ = sjson.Set(itemChildBody, "decrementValue.value", childItem.DecrementValueVariable.ValueString()) + } + } else if !childItem.DecrementValue.IsNull() { + if true { + itemChildBody, _ = sjson.Set(itemChildBody, "decrementValue.optionType", "global") + itemChildBody, _ = sjson.Set(itemChildBody, "decrementValue.value", childItem.DecrementValue.ValueInt64()) + } + } + itemBody, _ = sjson.SetRaw(itemBody, "trackingObject.-1", itemChildBody) + } + } body, _ = sjson.SetRaw(body, path+"vrrp.-1", itemBody) } } @@ -1834,6 +1879,42 @@ func (data *ServiceLANVPNInterfaceEthernet) fromBody(ctx context.Context, res gj item.TlocPrefChangeValue = types.Int64Value(va.Int()) } } + if cValue := v.Get("trackingObject"); cValue.Exists() { + item.TrackingObjects = make([]ServiceLANVPNInterfaceEthernetIpv4VrrpsTrackingObjects, 0) + cValue.ForEach(func(ck, cv gjson.Result) bool { + cItem := ServiceLANVPNInterfaceEthernetIpv4VrrpsTrackingObjects{} + cItem.TrackerId = types.StringNull() + + if t := cv.Get("trackerId.refId.optionType"); t.Exists() { + va := cv.Get("trackerId.refId.value") + if t.String() == "global" { + cItem.TrackerId = types.StringValue(va.String()) + } + } + cItem.TrackerAction = types.StringNull() + cItem.TrackerActionVariable = types.StringNull() + if t := cv.Get("trackerAction.optionType"); t.Exists() { + va := cv.Get("trackerAction.value") + if t.String() == "variable" { + cItem.TrackerActionVariable = types.StringValue(va.String()) + } else if t.String() == "global" { + cItem.TrackerAction = types.StringValue(va.String()) + } + } + cItem.DecrementValue = types.Int64Null() + cItem.DecrementValueVariable = types.StringNull() + if t := cv.Get("decrementValue.optionType"); t.Exists() { + va := cv.Get("decrementValue.value") + if t.String() == "variable" { + cItem.DecrementValueVariable = types.StringValue(va.String()) + } else if t.String() == "global" { + cItem.DecrementValue = types.Int64Value(va.Int()) + } + } + item.TrackingObjects = append(item.TrackingObjects, cItem) + return true + }) + } data.Ipv4Vrrps = append(data.Ipv4Vrrps, item) return true }) @@ -2806,6 +2887,64 @@ func (data *ServiceLANVPNInterfaceEthernet) updateFromBody(ctx context.Context, data.Ipv4Vrrps[i].TlocPrefChangeValue = types.Int64Value(va.Int()) } } + for ci := range data.Ipv4Vrrps[i].TrackingObjects { + keys := [...]string{"trackerId.refId"} + keyValues := [...]string{data.Ipv4Vrrps[i].TrackingObjects[ci].TrackerId.ValueString()} + keyValuesVariables := [...]string{""} + + var cr gjson.Result + r.Get("trackingObject").ForEach( + func(_, v gjson.Result) bool { + found := false + for ik := range keys { + tt := v.Get(keys[ik] + ".optionType") + vv := v.Get(keys[ik] + ".value") + if tt.Exists() && vv.Exists() { + if (tt.String() == "variable" && vv.String() == keyValuesVariables[ik]) || (tt.String() == "global" && vv.String() == keyValues[ik]) { + found = true + continue + } + found = false + break + } + continue + } + if found { + cr = v + return false + } + return true + }, + ) + data.Ipv4Vrrps[i].TrackingObjects[ci].TrackerId = types.StringNull() + + if t := cr.Get("trackerId.refId.optionType"); t.Exists() { + va := cr.Get("trackerId.refId.value") + if t.String() == "global" { + data.Ipv4Vrrps[i].TrackingObjects[ci].TrackerId = types.StringValue(va.String()) + } + } + data.Ipv4Vrrps[i].TrackingObjects[ci].TrackerAction = types.StringNull() + data.Ipv4Vrrps[i].TrackingObjects[ci].TrackerActionVariable = types.StringNull() + if t := cr.Get("trackerAction.optionType"); t.Exists() { + va := cr.Get("trackerAction.value") + if t.String() == "variable" { + data.Ipv4Vrrps[i].TrackingObjects[ci].TrackerActionVariable = types.StringValue(va.String()) + } else if t.String() == "global" { + data.Ipv4Vrrps[i].TrackingObjects[ci].TrackerAction = types.StringValue(va.String()) + } + } + data.Ipv4Vrrps[i].TrackingObjects[ci].DecrementValue = types.Int64Null() + data.Ipv4Vrrps[i].TrackingObjects[ci].DecrementValueVariable = types.StringNull() + if t := cr.Get("decrementValue.optionType"); t.Exists() { + va := cr.Get("decrementValue.value") + if t.String() == "variable" { + data.Ipv4Vrrps[i].TrackingObjects[ci].DecrementValueVariable = types.StringValue(va.String()) + } else if t.String() == "global" { + data.Ipv4Vrrps[i].TrackingObjects[ci].DecrementValue = types.Int64Value(va.Int()) + } + } + } } for i := range data.Arps { keys := [...]string{"ipAddress", "macAddress"} diff --git a/internal/provider/model_sdwan_service_lan_vpn_interface_svi_feature.go b/internal/provider/model_sdwan_service_lan_vpn_interface_svi_feature.go index d460ff756..69f37df0f 100644 --- a/internal/provider/model_sdwan_service_lan_vpn_interface_svi_feature.go +++ b/internal/provider/model_sdwan_service_lan_vpn_interface_svi_feature.go @@ -119,6 +119,7 @@ type ServiceLANVPNInterfaceSVIIpv4Vrrps struct { TlocPrefixChange types.Bool `tfsdk:"tloc_prefix_change"` TlocPrefixChangeValue types.Int64 `tfsdk:"tloc_prefix_change_value"` TlocPrefixChangeValueVariable types.String `tfsdk:"tloc_prefix_change_value_variable"` + TrackingObjects []ServiceLANVPNInterfaceSVIIpv4VrrpsTrackingObjects `tfsdk:"tracking_objects"` } type ServiceLANVPNInterfaceSVIIpv6Vrrps struct { @@ -140,6 +141,13 @@ type ServiceLANVPNInterfaceSVIIpv4VrrpsSecondaryAddresses struct { Address types.String `tfsdk:"address"` AddressVariable types.String `tfsdk:"address_variable"` } +type ServiceLANVPNInterfaceSVIIpv4VrrpsTrackingObjects struct { + TrackerId types.String `tfsdk:"tracker_id"` + TrackAction types.String `tfsdk:"track_action"` + TrackActionVariable types.String `tfsdk:"track_action_variable"` + DecrementValue types.Int64 `tfsdk:"decrement_value"` + DecrementValueVariable types.String `tfsdk:"decrement_value_variable"` +} type ServiceLANVPNInterfaceSVIIpv6VrrpsAddresses struct { LinkLocalAddress types.String `tfsdk:"link_local_address"` @@ -574,6 +582,43 @@ func (data ServiceLANVPNInterfaceSVI) toBody(ctx context.Context) string { itemBody, _ = sjson.Set(itemBody, "tlocPrefChangeValue.value", item.TlocPrefixChangeValue.ValueInt64()) } } + if true { + itemBody, _ = sjson.Set(itemBody, "trackingObject", []interface{}{}) + for _, childItem := range item.TrackingObjects { + itemChildBody := "" + if !childItem.TrackerId.IsNull() { + if true { + itemChildBody, _ = sjson.Set(itemChildBody, "trackerId.refId.optionType", "global") + itemChildBody, _ = sjson.Set(itemChildBody, "trackerId.refId.value", childItem.TrackerId.ValueString()) + } + } + + if !childItem.TrackActionVariable.IsNull() { + if true { + itemChildBody, _ = sjson.Set(itemChildBody, "trackAction.optionType", "variable") + itemChildBody, _ = sjson.Set(itemChildBody, "trackAction.value", childItem.TrackActionVariable.ValueString()) + } + } else if !childItem.TrackAction.IsNull() { + if true { + itemChildBody, _ = sjson.Set(itemChildBody, "trackAction.optionType", "global") + itemChildBody, _ = sjson.Set(itemChildBody, "trackAction.value", childItem.TrackAction.ValueString()) + } + } + + if !childItem.DecrementValueVariable.IsNull() { + if true { + itemChildBody, _ = sjson.Set(itemChildBody, "decrementValue.optionType", "variable") + itemChildBody, _ = sjson.Set(itemChildBody, "decrementValue.value", childItem.DecrementValueVariable.ValueString()) + } + } else if !childItem.DecrementValue.IsNull() { + if true { + itemChildBody, _ = sjson.Set(itemChildBody, "decrementValue.optionType", "global") + itemChildBody, _ = sjson.Set(itemChildBody, "decrementValue.value", childItem.DecrementValue.ValueInt64()) + } + } + itemBody, _ = sjson.SetRaw(itemBody, "trackingObject.-1", itemChildBody) + } + } body, _ = sjson.SetRaw(body, path+"vrrp.-1", itemBody) } } @@ -1110,6 +1155,42 @@ func (data *ServiceLANVPNInterfaceSVI) fromBody(ctx context.Context, res gjson.R item.TlocPrefixChangeValue = types.Int64Value(va.Int()) } } + if cValue := v.Get("trackingObject"); cValue.Exists() { + item.TrackingObjects = make([]ServiceLANVPNInterfaceSVIIpv4VrrpsTrackingObjects, 0) + cValue.ForEach(func(ck, cv gjson.Result) bool { + cItem := ServiceLANVPNInterfaceSVIIpv4VrrpsTrackingObjects{} + cItem.TrackerId = types.StringNull() + + if t := cv.Get("trackerId.refId.optionType"); t.Exists() { + va := cv.Get("trackerId.refId.value") + if t.String() == "global" { + cItem.TrackerId = types.StringValue(va.String()) + } + } + cItem.TrackAction = types.StringNull() + cItem.TrackActionVariable = types.StringNull() + if t := cv.Get("trackAction.optionType"); t.Exists() { + va := cv.Get("trackAction.value") + if t.String() == "variable" { + cItem.TrackActionVariable = types.StringValue(va.String()) + } else if t.String() == "global" { + cItem.TrackAction = types.StringValue(va.String()) + } + } + cItem.DecrementValue = types.Int64Null() + cItem.DecrementValueVariable = types.StringNull() + if t := cv.Get("decrementValue.optionType"); t.Exists() { + va := cv.Get("decrementValue.value") + if t.String() == "variable" { + cItem.DecrementValueVariable = types.StringValue(va.String()) + } else if t.String() == "global" { + cItem.DecrementValue = types.Int64Value(va.Int()) + } + } + item.TrackingObjects = append(item.TrackingObjects, cItem) + return true + }) + } data.Ipv4Vrrps = append(data.Ipv4Vrrps, item) return true }) @@ -1708,6 +1789,64 @@ func (data *ServiceLANVPNInterfaceSVI) updateFromBody(ctx context.Context, res g data.Ipv4Vrrps[i].TlocPrefixChangeValue = types.Int64Value(va.Int()) } } + for ci := range data.Ipv4Vrrps[i].TrackingObjects { + keys := [...]string{"trackerId.refId"} + keyValues := [...]string{data.Ipv4Vrrps[i].TrackingObjects[ci].TrackerId.ValueString()} + keyValuesVariables := [...]string{""} + + var cr gjson.Result + r.Get("trackingObject").ForEach( + func(_, v gjson.Result) bool { + found := false + for ik := range keys { + tt := v.Get(keys[ik] + ".optionType") + vv := v.Get(keys[ik] + ".value") + if tt.Exists() && vv.Exists() { + if (tt.String() == "variable" && vv.String() == keyValuesVariables[ik]) || (tt.String() == "global" && vv.String() == keyValues[ik]) { + found = true + continue + } + found = false + break + } + continue + } + if found { + cr = v + return false + } + return true + }, + ) + data.Ipv4Vrrps[i].TrackingObjects[ci].TrackerId = types.StringNull() + + if t := cr.Get("trackerId.refId.optionType"); t.Exists() { + va := cr.Get("trackerId.refId.value") + if t.String() == "global" { + data.Ipv4Vrrps[i].TrackingObjects[ci].TrackerId = types.StringValue(va.String()) + } + } + data.Ipv4Vrrps[i].TrackingObjects[ci].TrackAction = types.StringNull() + data.Ipv4Vrrps[i].TrackingObjects[ci].TrackActionVariable = types.StringNull() + if t := cr.Get("trackAction.optionType"); t.Exists() { + va := cr.Get("trackAction.value") + if t.String() == "variable" { + data.Ipv4Vrrps[i].TrackingObjects[ci].TrackActionVariable = types.StringValue(va.String()) + } else if t.String() == "global" { + data.Ipv4Vrrps[i].TrackingObjects[ci].TrackAction = types.StringValue(va.String()) + } + } + data.Ipv4Vrrps[i].TrackingObjects[ci].DecrementValue = types.Int64Null() + data.Ipv4Vrrps[i].TrackingObjects[ci].DecrementValueVariable = types.StringNull() + if t := cr.Get("decrementValue.optionType"); t.Exists() { + va := cr.Get("decrementValue.value") + if t.String() == "variable" { + data.Ipv4Vrrps[i].TrackingObjects[ci].DecrementValueVariable = types.StringValue(va.String()) + } else if t.String() == "global" { + data.Ipv4Vrrps[i].TrackingObjects[ci].DecrementValue = types.Int64Value(va.Int()) + } + } + } } for i := range data.Ipv6Vrrps { keys := [...]string{"groupId"} diff --git a/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature.go b/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature.go index 2e854420d..c1f946248 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature.go @@ -602,6 +602,43 @@ func (r *ServiceLANVPNInterfaceEthernetProfileParcelResource) Schema(ctx context int64validator.Between(100, 4294967295), }, }, + "tracking_objects": schema.ListNestedAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Tracking object for VRRP configuration").String, + Optional: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "tracker_id": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("").String, + Optional: true, + Validators: []validator.String{ + stringvalidator.RegexMatches(regexp.MustCompile(`[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}`), ""), + }, + }, + "tracker_action": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Track Action").AddStringEnumDescription("Decrement", "Shutdown").String, + Optional: true, + Validators: []validator.String{ + stringvalidator.OneOf("Decrement", "Shutdown"), + }, + }, + "tracker_action_variable": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + Optional: true, + }, + "decrement_value": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("Decrement Value for VRRP priority").AddIntegerRangeDescription(1, 255).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(1, 255), + }, + }, + "decrement_value_variable": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + Optional: true, + }, + }, + }, + }, }, }, }, diff --git a/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_test.go b/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_test.go index 9ef4457dd..f0d454892 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_test.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_test.go @@ -73,6 +73,8 @@ func TestAccSdwanServiceLANVPNInterfaceEthernetProfileParcel(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_vrrps.0.secondary_addresses.0.subnet_mask", "0.0.0.0")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_vrrps.0.tloc_prefix_change", "true")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_vrrps.0.tloc_pref_change_value", "100")) + checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_vrrps.0.tracking_objects.0.tracker_action", "Decrement")) + checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_ethernet_feature.test", "ipv4_vrrps.0.tracking_objects.0.decrement_value", "100")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_ethernet_feature.test", "arps.0.ip_address", "1.2.3.4")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_ethernet_feature.test", "arps.0.mac_address", "00-B0-D0-63-C2-26")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_ethernet_feature.test", "trustsec_enable_sgt_propogation", "false")) @@ -122,6 +124,21 @@ resource "sdwan_service_lan_vpn_feature" "test" { name = "TF_TEST_SLAN" feature_profile_id = sdwan_service_feature_profile.test.id } + +resource "sdwan_service_tracker_feature" "test" { + name = "TF_TEST_TRACKER" + description = "Terraform test" + feature_profile_id = sdwan_service_feature_profile.test.id + tracker_name = "TRACKER_1" + endpoint_api_url = "google.com" + endpoint_dns_name = "google.com" + endpoint_ip = "1.2.3.4" + interval = 30 + multiplier = 3 + threshold = 300 + endpoint_tracker_type = "static-route" + tracker_type = "endpoint" +} ` // End of section. //template:end testPrerequisites @@ -204,6 +221,11 @@ func testAccSdwanServiceLANVPNInterfaceEthernetProfileParcelConfig_all() string config += ` }]` + "\n" config += ` tloc_prefix_change = true` + "\n" config += ` tloc_pref_change_value = 100` + "\n" + config += ` tracking_objects = [{` + "\n" + config += ` tracker_id = sdwan_service_tracker_feature.test.id` + "\n" + config += ` tracker_action = "Decrement"` + "\n" + config += ` decrement_value = 100` + "\n" + config += ` }]` + "\n" config += ` }]` + "\n" config += ` arps = [{` + "\n" config += ` ip_address = "1.2.3.4"` + "\n" diff --git a/internal/provider/resource_sdwan_service_lan_vpn_interface_svi_feature.go b/internal/provider/resource_sdwan_service_lan_vpn_interface_svi_feature.go index 1513fe0be..078645d37 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_interface_svi_feature.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_interface_svi_feature.go @@ -379,6 +379,43 @@ func (r *ServiceLANVPNInterfaceSVIProfileParcelResource) Schema(ctx context.Cont MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, Optional: true, }, + "tracking_objects": schema.ListNestedAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("tracking object for VRRP configuration").String, + Optional: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "tracker_id": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("").String, + Optional: true, + Validators: []validator.String{ + stringvalidator.RegexMatches(regexp.MustCompile(`[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}`), ""), + }, + }, + "track_action": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Track Action").AddStringEnumDescription("decrement", "shutdown").String, + Optional: true, + Validators: []validator.String{ + stringvalidator.OneOf("decrement", "shutdown"), + }, + }, + "track_action_variable": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + Optional: true, + }, + "decrement_value": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("Decrement Value for VRRP priority").AddIntegerRangeDescription(1, 255).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(1, 255), + }, + }, + "decrement_value_variable": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Variable name").String, + Optional: true, + }, + }, + }, + }, }, }, }, diff --git a/internal/provider/resource_sdwan_service_lan_vpn_interface_svi_feature_test.go b/internal/provider/resource_sdwan_service_lan_vpn_interface_svi_feature_test.go index 757dc9484..a591c3f1e 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_interface_svi_feature_test.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_interface_svi_feature_test.go @@ -57,6 +57,8 @@ func TestAccSdwanServiceLANVPNInterfaceSVIProfileParcel(t *testing.T) { checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_svi_feature.test", "ipv4_vrrps.0.secondary_addresses.0.address", "2.3.4.5")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_svi_feature.test", "ipv4_vrrps.0.tloc_prefix_change", "true")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_svi_feature.test", "ipv4_vrrps.0.tloc_prefix_change_value", "100")) + checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_svi_feature.test", "ipv4_vrrps.0.tracking_objects.0.track_action", "decrement")) + checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_svi_feature.test", "ipv4_vrrps.0.tracking_objects.0.decrement_value", "100")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_svi_feature.test", "ipv6_vrrps.0.group_id", "1")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_svi_feature.test", "ipv6_vrrps.0.priority", "100")) checks = append(checks, resource.TestCheckResourceAttr("sdwan_service_lan_vpn_interface_svi_feature.test", "ipv6_vrrps.0.timer", "1000")) @@ -98,6 +100,21 @@ resource "sdwan_service_lan_vpn_feature" "test" { name = "TF_TEST_SLAN" feature_profile_id = sdwan_service_feature_profile.test.id } + +resource "sdwan_service_tracker_feature" "test" { + name = "TF_TEST_TRACKER" + description = "Terraform test" + feature_profile_id = sdwan_service_feature_profile.test.id + tracker_name = "TRACKER_1" + endpoint_api_url = "google.com" + endpoint_dns_name = "google.com" + endpoint_ip = "1.2.3.4" + interval = 30 + multiplier = 3 + threshold = 300 + endpoint_tracker_type = "static-route" + tracker_type = "endpoint" +} ` // End of section. //template:end testPrerequisites @@ -161,6 +178,11 @@ func testAccSdwanServiceLANVPNInterfaceSVIProfileParcelConfig_all() string { config += ` }]` + "\n" config += ` tloc_prefix_change = true` + "\n" config += ` tloc_prefix_change_value = 100` + "\n" + config += ` tracking_objects = [{` + "\n" + config += ` tracker_id = sdwan_service_tracker_feature.test.id` + "\n" + config += ` track_action = "decrement"` + "\n" + config += ` decrement_value = 100` + "\n" + config += ` }]` + "\n" config += ` }]` + "\n" config += ` ipv6_vrrps = [{` + "\n" config += ` group_id = 1` + "\n"