Skip to content

Commit

Permalink
remove fabric_addressing and make docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bwJuniper committed Oct 21, 2024
1 parent 810ee58 commit f164a47
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 54 deletions.
23 changes: 4 additions & 19 deletions apstra/design/template_pod_based.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"

"github.com/Juniper/apstra-go-sdk/apstra"
apstravalidator "github.com/Juniper/terraform-provider-apstra/apstra/apstra_validator"
"github.com/Juniper/terraform-provider-apstra/apstra/utils"
"github.com/hashicorp/terraform-plugin-framework-validators/mapvalidator"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
Expand All @@ -21,11 +20,10 @@ import (
)

type TemplatePodBased struct {
Id types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
SuperSpine types.Object `tfsdk:"super_spine"`
FabricAddressing types.String `tfsdk:"fabric_link_addressing"`
PodInfos types.Map `tfsdk:"pod_infos"`
Id types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
SuperSpine types.Object `tfsdk:"super_spine"`
PodInfos types.Map `tfsdk:"pod_infos"`
}

func (o TemplatePodBased) AttrTypes() map[string]attr.Type {
Expand Down Expand Up @@ -63,11 +61,6 @@ func (o TemplatePodBased) DataSourceAttributes() map[string]dataSourceSchema.Att
Computed: true,
Attributes: SuperSpine{}.DataSourceAttributes(),
},
"fabric_link_addressing": dataSourceSchema.StringAttribute{
DeprecationMessage: "Apstra 4.1.0 is not supported by this release. This field must not be used.",
MarkdownDescription: "Fabric addressing scheme for Spine/Superspine links.",
Computed: true,
},
"pod_infos": dataSourceSchema.MapNestedAttribute{
MarkdownDescription: "Map of Pod Type info (count + details)",
Computed: true,
Expand Down Expand Up @@ -95,13 +88,6 @@ func (o TemplatePodBased) ResourceAttributes() map[string]resourceSchema.Attribu
Required: true,
Attributes: SuperSpine{}.ResourceAttributes(),
},
"fabric_link_addressing": resourceSchema.StringAttribute{
DeprecationMessage: "Apstra 4.1.0 is not supported by this release. This field must not be used.",
MarkdownDescription: "Fabric addressing scheme for Spine/SuperSpine links.",
Optional: true,
Computed: true,
Validators: []validator.String{apstravalidator.MustBeOneOf([]attr.Value{types.StringNull()})},
},
"pod_infos": resourceSchema.MapNestedAttribute{
MarkdownDescription: "Map of Pod Type info (count + details) keyed by Pod Based Template ID.",
Required: true,
Expand Down Expand Up @@ -154,7 +140,6 @@ func (o *TemplatePodBased) LoadApiData(ctx context.Context, in *apstra.TemplateP
o.Name = types.StringValue(in.DisplayName)
o.SuperSpine = NewDesignTemplateSuperSpineObject(ctx, &in.Superspine, diags)
o.PodInfos = NewPodInfoMap(ctx, in, diags)
o.FabricAddressing = types.StringNull()
}

func (o *TemplatePodBased) CopyWriteOnlyElements(ctx context.Context, src *TemplatePodBased, diags *diag.Diagnostics) {
Expand Down
13 changes: 0 additions & 13 deletions apstra/design/template_rack_based.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type TemplateRackBased struct {
Spine types.Object `tfsdk:"spine"`
AsnAllocation types.String `tfsdk:"asn_allocation_scheme"`
OverlayControlProtocol types.String `tfsdk:"overlay_control_protocol"`
FabricAddressing types.String `tfsdk:"fabric_link_addressing"`
RackInfos types.Map `tfsdk:"rack_infos"`
}

Expand All @@ -38,7 +37,6 @@ func (o TemplateRackBased) AttrTypes() map[string]attr.Type {
"spine": types.ObjectType{AttrTypes: Spine{}.AttrTypes()},
"asn_allocation_scheme": types.StringType,
"overlay_control_protocol": types.StringType,
"fabric_link_addressing": types.StringType,
"rack_infos": types.MapType{ElemType: types.ObjectType{AttrTypes: TemplateRackInfo{}.AttrTypes()}},
}
}
Expand Down Expand Up @@ -77,11 +75,6 @@ func (o TemplateRackBased) DataSourceAttributes() map[string]dataSourceSchema.At
MarkdownDescription: "Defines the inter-rack virtual network overlay protocol in the fabric.",
Computed: true,
},
"fabric_link_addressing": dataSourceSchema.StringAttribute{
DeprecationMessage: "Apstra 4.1.0 is not supported by this release. This field must not be used.",
MarkdownDescription: "Fabric addressing scheme for Spine/Leaf links.",
Computed: true,
},
"rack_infos": dataSourceSchema.MapNestedAttribute{
MarkdownDescription: "Map of Rack Type info (count + details)",
Computed: true,
Expand Down Expand Up @@ -116,11 +109,6 @@ func (o TemplateRackBased) DataSourceAttributesNested() map[string]dataSourceSch
MarkdownDescription: "Defines the inter-rack virtual network overlay protocol in the fabric.",
Computed: true,
},
"fabric_link_addressing": dataSourceSchema.StringAttribute{
DeprecationMessage: "Apstra 4.1.0 is not supported by this release. This field must not be used.",
MarkdownDescription: "Fabric addressing scheme for Spine/Leaf links.",
Computed: true,
},
"rack_infos": dataSourceSchema.MapNestedAttribute{
MarkdownDescription: "Map of Rack Type info (count + details)",
Computed: true,
Expand Down Expand Up @@ -292,7 +280,6 @@ func (o *TemplateRackBased) LoadApiData(ctx context.Context, in *apstra.Template
o.AsnAllocation = types.StringValue(utils.StringersToFriendlyString(in.AsnAllocationPolicy.SpineAsnScheme))
o.OverlayControlProtocol = types.StringValue(utils.StringersToFriendlyString(in.VirtualNetworkPolicy.OverlayControlProtocol))
o.RackInfos = NewRackInfoMap(ctx, in, diags)
o.FabricAddressing = types.StringNull()
}

func (o *TemplateRackBased) CopyWriteOnlyElements(ctx context.Context, src *TemplateRackBased, diags *diag.Diagnostics) {
Expand Down
17 changes: 5 additions & 12 deletions apstra/resource_template_pod_based_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const (
resourceTemplatePodBasedHCL = `
resource %q %q {
name = %q
fabric_link_addressing = %s
super_spine = {
logical_device_id = %q
per_plane_count = %d
Expand All @@ -35,12 +34,11 @@ resource %q %q {
)

type resourceTestPodTemplate struct {
name string
fabricLinkAddressing *string
ssLd string
perPlaneCount int
planeCount *int
podInfo map[string]int
name string
ssLd string
perPlaneCount int
planeCount *int
podInfo map[string]int
}

func (o resourceTestPodTemplate) render(rType, rName string) string {
Expand All @@ -51,7 +49,6 @@ func (o resourceTestPodTemplate) render(rType, rName string) string {
return fmt.Sprintf(resourceTemplatePodBasedHCL,
rType, rName,
o.name,
stringPtrOrNull(o.fabricLinkAddressing),
o.ssLd,
o.perPlaneCount,
intPtrOrNull(o.planeCount),
Expand All @@ -66,10 +63,6 @@ func (o resourceTestPodTemplate) testChecks(t testing.TB, rType, rName string) t
result.append(t, "TestCheckResourceAttrSet", "id")
result.append(t, "TestCheckResourceAttr", "name", o.name)

if o.fabricLinkAddressing != nil {
result.append(t, "TestCheckResourceAttr", "fabric_link_addressing", *o.fabricLinkAddressing)
}

result.append(t, "TestCheckResourceAttr", "super_spine.logical_device_id", o.ssLd)
result.append(t, "TestCheckResourceAttr", "super_spine.per_plane_count", strconv.Itoa(o.perPlaneCount))

Expand Down
3 changes: 0 additions & 3 deletions apstra/resource_template_rack_based_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ resource "apstra_template_rack_based" "test" {
overlay_control_protocol = %q // mandatory field
rack_infos = %s // mandatory field
spine = %s // mandatory field
fabric_link_addressing = %s
}
`
resourceTemplateRackBasedRackInfoHcl = `
Expand Down Expand Up @@ -68,7 +67,6 @@ func TestResourceTemplateRackBased(t *testing.T) {
overlayControlProtocol string
rackInfos map[string]int
spine spine
fabricLinkAddressing string
}

renderConfig := func(config config) string {
Expand All @@ -78,7 +76,6 @@ func TestResourceTemplateRackBased(t *testing.T) {
config.overlayControlProtocol,
renderRackInfos(config.rackInfos),
renderSpine(config.spine),
stringOrNull(config.fabricLinkAddressing),
)
}

Expand Down
2 changes: 0 additions & 2 deletions docs/data-sources/template_pod_based.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ resource "apstra_template_pod_based" "example" {

### Read-Only

- `fabric_link_addressing` (String, Deprecated) Fabric addressing scheme for Spine/Superspine links.
- `pod_infos` (Attributes Map) Map of Pod Type info (count + details) (see [below for nested schema](#nestedatt--pod_infos))
- `super_spine` (Attributes) Super Spine layer details (see [below for nested schema](#nestedatt--super_spine))

Expand All @@ -53,7 +52,6 @@ Read-Only:
Read-Only:

- `asn_allocation_scheme` (String) "unique" is for 3-stage designs; "single" is for 5-stage designs.
- `fabric_link_addressing` (String, Deprecated) Fabric addressing scheme for Spine/Leaf links.
- `id` (String) ID of the pod inside the 5 stage template.
- `name` (String) Name of the pod inside the 5 stage template.
- `overlay_control_protocol` (String) Defines the inter-rack virtual network overlay protocol in the fabric.
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/template_rack_based.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ output "rack_based_template_id_to_name" {
### Read-Only

- `asn_allocation_scheme` (String) "unique" is for 3-stage designs; "single" is for 5-stage designs.
- `fabric_link_addressing` (String, Deprecated) Fabric addressing scheme for Spine/Leaf links.
- `overlay_control_protocol` (String) Defines the inter-rack virtual network overlay protocol in the fabric.
- `rack_infos` (Attributes Map) Map of Rack Type info (count + details) (see [below for nested schema](#nestedatt--rack_infos))
- `spine` (Attributes) Spine layer details (see [below for nested schema](#nestedatt--spine))
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/template_pod_based.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ resource "apstra_template_pod_based" "example" {
- `pod_infos` (Attributes Map) Map of Pod Type info (count + details) keyed by Pod Based Template ID. (see [below for nested schema](#nestedatt--pod_infos))
- `super_spine` (Attributes) SuperSpine layer details (see [below for nested schema](#nestedatt--super_spine))

### Optional

- `fabric_link_addressing` (String, Deprecated) Fabric addressing scheme for Spine/SuperSpine links.

### Read-Only

- `id` (String) Apstra ID of the Pod Based Template.
Expand Down

0 comments on commit f164a47

Please sign in to comment.