Skip to content

Commit

Permalink
Resolve testing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
seconroy committed Oct 2, 2024
1 parent 550ad1c commit 315037e
Show file tree
Hide file tree
Showing 15 changed files with 205 additions and 70 deletions.
7 changes: 6 additions & 1 deletion docs/data-sources/transport_cellular_profile_feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,19 @@ data "sdwan_transport_cellular_profile_feature" "example" {

- `access_point_name` (String) Set access point name
- `access_point_name_variable` (String) Variable name
- `authentication_type` (String) Set authentication type
- `authentication_type_variable` (String) Variable name
- `description` (String) The description of the Feature
- `name` (String) The name of the Feature
- `need_authentication` (String)
- `no_authentication` (String) No Authentication
- `no_overwrite` (Boolean) No Overwrite
- `no_overwrite_variable` (String) Variable name
- `packet_data_network_type` (String) Set packet data network type
- `packet_data_network_type_variable` (String) Variable name
- `profile_id` (Number) Set Profile ID
- `profile_id_variable` (String) Variable name
- `profile_password` (String) Set the profile password
- `profile_password_variable` (String) Variable name
- `profile_username` (String) Set the profile username
- `profile_username_variable` (String) Variable name
- `version` (Number) The version of the Feature
4 changes: 2 additions & 2 deletions docs/resources/transport_cellular_controller_feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resource "sdwan_transport_cellular_controller_feature" "example" {
name = "Example"
description = "My Example"
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
cellular_id = "1"
cellular_id = "0/3/0"
primary_sim_slot = 0
sim_failover_retries = 5
sim_failover_timeout = 3
Expand All @@ -32,12 +32,12 @@ resource "sdwan_transport_cellular_controller_feature" "example" {

### Required

- `cellular_id` (String) Cellular ID
- `feature_profile_id` (String) Feature Profile ID
- `name` (String) The name of the Feature

### Optional

- `cellular_id` (String) Cellular ID
- `cellular_id_variable` (String) Variable name
- `description` (String) The description of the Feature
- `firmware_auto_sim` (Boolean) Enable/Disable Firmware Auto Sim
Expand Down
18 changes: 13 additions & 5 deletions docs/resources/transport_cellular_profile_feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ resource "sdwan_transport_cellular_profile_feature" "example" {
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
profile_id = 1
access_point_name = "apn1"
need_authentication = "pap"
authentication_type = "pap"
profile_username = "example"
profile_password = "example123!"
packet_data_network_type = "ipv4"
no_overwrite = false
}
Expand All @@ -32,25 +34,31 @@ resource "sdwan_transport_cellular_profile_feature" "example" {

### Required

- `access_point_name` (String) Set access point name
- `feature_profile_id` (String) Feature Profile ID
- `name` (String) The name of the Feature
- `profile_id` (Number) Set Profile ID
- Range: `1`-`16`

### Optional

- `access_point_name` (String) Set access point name
- `access_point_name_variable` (String) Variable name
- `authentication_type` (String) Set authentication type
- Choices: `pap`, `chap`, `pap_chap`
- `authentication_type_variable` (String) Variable name
- `description` (String) The description of the Feature
- `need_authentication` (String)
- `no_authentication` (String) No Authentication
- `no_overwrite` (Boolean) No Overwrite
- `no_overwrite_variable` (String) Variable name
- `packet_data_network_type` (String) Set packet data network type
- Choices: `ipv4`, `ipv4v6`, `ipv6`
- Default value: `ipv4`
- `packet_data_network_type_variable` (String) Variable name
- `profile_id` (Number) Set Profile ID
- Range: `1`-`16`
- `profile_id_variable` (String) Variable name
- `profile_password` (String) Set the profile password
- `profile_password_variable` (String) Variable name
- `profile_username` (String) Set the profile username
- `profile_username_variable` (String) Variable name

### Read-Only

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resource "sdwan_transport_cellular_controller_feature" "example" {
name = "Example"
description = "My Example"
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
cellular_id = "1"
cellular_id = "0/3/0"
primary_sim_slot = 0
sim_failover_retries = 5
sim_failover_timeout = 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ resource "sdwan_transport_cellular_profile_feature" "example" {
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
profile_id = 1
access_point_name = "apn1"
need_authentication = "pap"
authentication_type = "pap"
profile_username = "example"
profile_password = "example123!"
packet_data_network_type = "ipv4"
no_overwrite = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ rest_endpoint: /v1/feature-profile/sdwan/transport/%v/cellular-controller
minimum_version: 20.12.0
test_tags: [SDWAN_2012]
parcel_type: feature
skip_minimum_test: true
attributes:
- tf_name: feature_profile_id
reference: true
Expand All @@ -14,11 +15,12 @@ attributes:
test_value: sdwan_transport_feature_profile.test.id
- model_name: configType
type: String
example: non-Esim
example: non-eSim
- model_name: id
tf_name: cellular_id
data_path: [controllerConfig]
example: 1
mandatory: true
example: 0/3/0
- model_name: slot
tf_name: primary_sim_slot
data_path: [controllerConfig]
Expand Down
21 changes: 18 additions & 3 deletions gen/definitions/profile_parcels/transport_cellular_profile.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
name: Transport Cellular Profile
rest_endpoint: /v1/feature-profile/sdwan/transport/%v/cellular
rest_endpoint: /v1/feature-profile/sdwan/transport/%v/cellular-profile
minimum_version: 20.12.0
test_tags: [SDWAN_2012]
parcel_type: feature
skip_minimum_test: true
attributes:
- tf_name: feature_profile_id
reference: true
Expand All @@ -18,20 +19,34 @@ attributes:
- model_name: id
tf_name: profile_id
data_path: [profileConfig]
mandatory: true
example: 1
- model_name: apn
tf_name: access_point_name
data_path: [profileConfig, profileInfo]
mandatory: true
example: apn1
- model_name: noAuthentication
data_path: [profileConfig, profileInfo, authentication]
type: String
exclude_test: true
example: none
- model_name: needAuthentication
data_path: [profileConfig, profileInfo, authentication]
- model_name: type
tf_name: authentication_type
data_path: [profileConfig, profileInfo, authentication, needAuthentication]
type: String
example: pap
- model_name: username
tf_name: profile_username
data_path: [profileConfig, profileInfo, authentication, needAuthentication]
type: String
example: example
- model_name: password
tf_name: profile_password
data_path: [profileConfig, profileInfo, authentication, needAuthentication]
type: String
write_only: true
example: example123!
- model_name: pdnType
tf_name: packet_data_network_type
data_path: [profileConfig, profileInfo]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestAccDataSourceSdwanTransportCellularControllerProfileParcel(t *testing.T
t.Skip("skipping test, set environment variable SDWAN_2012")
}
var checks []resource.TestCheckFunc
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_transport_cellular_controller_feature.test", "cellular_id", "1"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_transport_cellular_controller_feature.test", "cellular_id", "0/3/0"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_transport_cellular_controller_feature.test", "primary_sim_slot", "0"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_transport_cellular_controller_feature.test", "sim_failover_retries", "5"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_transport_cellular_controller_feature.test", "sim_failover_timeout", "3"))
Expand Down Expand Up @@ -68,7 +68,7 @@ func testAccDataSourceSdwanTransportCellularControllerProfileParcelConfig() stri
config += ` name = "TF_TEST"` + "\n"
config += ` description = "Terraform integration test"` + "\n"
config += ` feature_profile_id = sdwan_transport_feature_profile.test.id` + "\n"
config += ` cellular_id = "1"` + "\n"
config += ` cellular_id = "0/3/0"` + "\n"
config += ` primary_sim_slot = 0` + "\n"
config += ` sim_failover_retries = 5` + "\n"
config += ` sim_failover_timeout = 3` + "\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,28 @@ func (d *TransportCellularProfileProfileParcelDataSource) Schema(ctx context.Con
MarkdownDescription: "No Authentication",
Computed: true,
},
"need_authentication": schema.StringAttribute{
MarkdownDescription: "",
"authentication_type": schema.StringAttribute{
MarkdownDescription: "Set authentication type",
Computed: true,
},
"authentication_type_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"profile_username": schema.StringAttribute{
MarkdownDescription: "Set the profile username",
Computed: true,
},
"profile_username_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"profile_password": schema.StringAttribute{
MarkdownDescription: "Set the profile password",
Computed: true,
},
"profile_password_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"packet_data_network_type": schema.StringAttribute{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ func TestAccDataSourceSdwanTransportCellularProfileProfileParcel(t *testing.T) {
var checks []resource.TestCheckFunc
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_transport_cellular_profile_feature.test", "profile_id", "1"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_transport_cellular_profile_feature.test", "access_point_name", "apn1"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_transport_cellular_profile_feature.test", "need_authentication", "pap"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_transport_cellular_profile_feature.test", "authentication_type", "pap"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_transport_cellular_profile_feature.test", "profile_username", "example"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_transport_cellular_profile_feature.test", "packet_data_network_type", "ipv4"))
checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_transport_cellular_profile_feature.test", "no_overwrite", "false"))
resource.Test(t, resource.TestCase{
Expand Down Expand Up @@ -70,7 +71,9 @@ func testAccDataSourceSdwanTransportCellularProfileProfileParcelConfig() string
config += ` feature_profile_id = sdwan_transport_feature_profile.test.id` + "\n"
config += ` profile_id = 1` + "\n"
config += ` access_point_name = "apn1"` + "\n"
config += ` need_authentication = "pap"` + "\n"
config += ` authentication_type = "pap"` + "\n"
config += ` profile_username = "example"` + "\n"
config += ` profile_password = "example123!"` + "\n"
config += ` packet_data_network_type = "ipv4"` + "\n"
config += ` no_overwrite = false` + "\n"
config += `}` + "\n"
Expand Down
Loading

0 comments on commit 315037e

Please sign in to comment.