Skip to content

Commit

Permalink
MIST-118835 - storm control bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tmunzer committed Jul 31, 2024
1 parent 90d8739 commit 21d6531
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 47 deletions.
35 changes: 20 additions & 15 deletions internal/resource_device_switch/terraform_to_sdk_port_usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,26 @@ import (

func portUsageScTerraformToSdk(ctx context.Context, diags *diag.Diagnostics, d basetypes.ObjectValue) models.SwitchPortUsageStormControl {
data := models.SwitchPortUsageStormControl{}
if d.IsNull() || d.IsUnknown() {
return data
} else {
v_plan := NewStormControlValueMust(StormControlValue{}.AttributeTypes(ctx), d.Attributes())
if v_plan.NoMulticast.ValueBoolPointer() != nil {
data.NoMulticast = models.ToPointer(v_plan.NoMulticast.ValueBool())
}
if v_plan.NoRegisteredMulticast.ValueBoolPointer() != nil {
data.NoRegisteredMulticast = models.ToPointer(v_plan.NoRegisteredMulticast.ValueBool())
}
if v_plan.NoUnknownUnicast.ValueBoolPointer() != nil {
data.NoUnknownUnicast = models.ToPointer(v_plan.NoUnknownUnicast.ValueBool())
}
if v_plan.Percentage.ValueInt64Pointer() != nil {
data.Percentage = models.ToPointer(int(v_plan.Percentage.ValueInt64()))
if !d.IsNull() && !d.IsUnknown() {
v_plan, e := NewStormControlValue(d.AttributeTypes(ctx), d.Attributes())
if e != nil {
diags.Append(e...)
} else {
if v_plan.NoBroadcast.ValueBoolPointer() != nil {
data.NoBroadcast = models.ToPointer(v_plan.NoBroadcast.ValueBool())
}
if v_plan.NoMulticast.ValueBoolPointer() != nil {
data.NoMulticast = models.ToPointer(v_plan.NoMulticast.ValueBool())
}
if v_plan.NoRegisteredMulticast.ValueBoolPointer() != nil {
data.NoRegisteredMulticast = models.ToPointer(v_plan.NoRegisteredMulticast.ValueBool())
}
if v_plan.NoUnknownUnicast.ValueBoolPointer() != nil {
data.NoUnknownUnicast = models.ToPointer(v_plan.NoUnknownUnicast.ValueBool())
}
if v_plan.Percentage.ValueInt64Pointer() != nil {
data.Percentage = models.ToPointer(int(v_plan.Percentage.ValueInt64()))
}
}
}
return data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,26 @@ import (

func portUsageScTerraformToSdk(ctx context.Context, diags *diag.Diagnostics, d basetypes.ObjectValue) models.SwitchPortUsageStormControl {
data := models.SwitchPortUsageStormControl{}
if d.IsNull() || d.IsUnknown() {
return data
} else {
var sc_attr_interface interface{} = d
v_plan := sc_attr_interface.(StormControlValue)
if v_plan.NoMulticast.ValueBoolPointer() != nil {
data.NoMulticast = models.ToPointer(v_plan.NoMulticast.ValueBool())
}
if v_plan.NoRegisteredMulticast.ValueBoolPointer() != nil {
data.NoRegisteredMulticast = models.ToPointer(v_plan.NoRegisteredMulticast.ValueBool())
}
if v_plan.NoUnknownUnicast.ValueBoolPointer() != nil {
data.NoUnknownUnicast = models.ToPointer(v_plan.NoUnknownUnicast.ValueBool())
}
if v_plan.Percentage.ValueInt64Pointer() != nil {
data.Percentage = models.ToPointer(int(v_plan.Percentage.ValueInt64()))
if !d.IsNull() && !d.IsUnknown() {
v_plan, e := NewStormControlValue(d.AttributeTypes(ctx), d.Attributes())
if e != nil {
diags.Append(e...)
} else {
if v_plan.NoBroadcast.ValueBoolPointer() != nil {
data.NoBroadcast = models.ToPointer(v_plan.NoBroadcast.ValueBool())
}
if v_plan.NoMulticast.ValueBoolPointer() != nil {
data.NoMulticast = models.ToPointer(v_plan.NoMulticast.ValueBool())
}
if v_plan.NoRegisteredMulticast.ValueBoolPointer() != nil {
data.NoRegisteredMulticast = models.ToPointer(v_plan.NoRegisteredMulticast.ValueBool())
}
if v_plan.NoUnknownUnicast.ValueBoolPointer() != nil {
data.NoUnknownUnicast = models.ToPointer(v_plan.NoUnknownUnicast.ValueBool())
}
if v_plan.Percentage.ValueInt64Pointer() != nil {
data.Percentage = models.ToPointer(int(v_plan.Percentage.ValueInt64()))
}
}
}
return data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,26 @@ import (

func portUsageScTerraformToSdk(ctx context.Context, diags *diag.Diagnostics, d basetypes.ObjectValue) models.SwitchPortUsageStormControl {
data := models.SwitchPortUsageStormControl{}
if d.IsNull() || d.IsUnknown() {
return data
} else {
var sc_attr_interface interface{} = d
v_plan := sc_attr_interface.(StormControlValue)
if v_plan.NoMulticast.ValueBoolPointer() != nil {
data.NoMulticast = models.ToPointer(v_plan.NoMulticast.ValueBool())
}
if v_plan.NoRegisteredMulticast.ValueBoolPointer() != nil {
data.NoRegisteredMulticast = models.ToPointer(v_plan.NoRegisteredMulticast.ValueBool())
}
if v_plan.NoUnknownUnicast.ValueBoolPointer() != nil {
data.NoUnknownUnicast = models.ToPointer(v_plan.NoUnknownUnicast.ValueBool())
}
if v_plan.Percentage.ValueInt64Pointer() != nil {
data.Percentage = models.ToPointer(int(v_plan.Percentage.ValueInt64()))
if !d.IsNull() && !d.IsUnknown() {
v_plan, e := NewStormControlValue(d.AttributeTypes(ctx), d.Attributes())
if e != nil {
diags.Append(e...)
} else {
if v_plan.NoBroadcast.ValueBoolPointer() != nil {
data.NoBroadcast = models.ToPointer(v_plan.NoBroadcast.ValueBool())
}
if v_plan.NoMulticast.ValueBoolPointer() != nil {
data.NoMulticast = models.ToPointer(v_plan.NoMulticast.ValueBool())
}
if v_plan.NoRegisteredMulticast.ValueBoolPointer() != nil {
data.NoRegisteredMulticast = models.ToPointer(v_plan.NoRegisteredMulticast.ValueBool())
}
if v_plan.NoUnknownUnicast.ValueBoolPointer() != nil {
data.NoUnknownUnicast = models.ToPointer(v_plan.NoUnknownUnicast.ValueBool())
}
if v_plan.Percentage.ValueInt64Pointer() != nil {
data.Percentage = models.ToPointer(int(v_plan.Percentage.ValueInt64()))
}
}
}
return data
Expand Down

0 comments on commit 21d6531

Please sign in to comment.