Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up obsolete version constraints #930

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions apstra/api_versions/constraints.go

This file was deleted.

5 changes: 2 additions & 3 deletions apstra/api_versions/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ package apiversions
// track back to this file. When support for an old release is dropped, these
// constants should help track down code relevant to those versions.
const (
Apstra410 = "4.1.0"
Apstra411 = "4.1.1"
Apstra412 = "4.1.2"
Apstra420 = "4.2.0"
Apstra421 = "4.2.1"
Apstra4211 = "4.2.1.1"
Apstra422 = "4.2.2"
Apstra500 = "5.0.0"

GeApstra421 = ">" + Apstra421

LtApstra500 = "<" + Apstra500
)
63 changes: 30 additions & 33 deletions apstra/blueprint/blueprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/Juniper/apstra-go-sdk/apstra"
"github.com/Juniper/apstra-go-sdk/apstra/enum"
apiversions "github.com/Juniper/terraform-provider-apstra/apstra/api_versions"
apstraplanmodifier "github.com/Juniper/terraform-provider-apstra/apstra/apstra_plan_modifier"
apstravalidator "github.com/Juniper/terraform-provider-apstra/apstra/apstra_validator"
"github.com/Juniper/terraform-provider-apstra/apstra/constants"
Expand Down Expand Up @@ -324,8 +323,8 @@ func (o Blueprint) ResourceAttributes() map[string]resourceSchema.Attribute {
},
"fabric_addressing": resourceSchema.StringAttribute{
MarkdownDescription: fmt.Sprintf("Addressing scheme for both superspine/spine and spine/leaf links. "+
"Requires Apstra %s. Must be one of: %s",
apiversions.Ge411, strings.Join([]string{
"Must be one of: %s",
strings.Join([]string{
apstra.AddressingSchemeIp4.String(),
apstra.AddressingSchemeIp6.String(),
apstra.AddressingSchemeIp46.String(),
Expand Down Expand Up @@ -423,7 +422,7 @@ func (o Blueprint) ResourceAttributes() map[string]resourceSchema.Attribute {
"default_ip_links_to_generic_mtu": resourceSchema.Int64Attribute{
MarkdownDescription: fmt.Sprintf("Default L3 MTU for IP links to generic systems. A null or empty "+
"value implies AOS will not render explicit MTU value and system defaults will be used. Should be an "+
"even number between %d and %d. Requires Apstra %s", constants.L3MtuMin, constants.L3MtuMax, apiversions.Ge420),
"even number between %d and %d.", constants.L3MtuMin, constants.L3MtuMax),
Optional: true,
Computed: true,
Validators: []validator.Int64{
Expand All @@ -433,7 +432,7 @@ func (o Blueprint) ResourceAttributes() map[string]resourceSchema.Attribute {
},
"default_svi_l3_mtu": resourceSchema.Int64Attribute{
MarkdownDescription: fmt.Sprintf("Default L3 MTU for SVI interfaces. Should be an even number "+
"between %d and %d. Requires Apstra %s.", constants.L3MtuMin, constants.L3MtuMax, apiversions.Ge420),
"between %d and %d.", constants.L3MtuMin, constants.L3MtuMax),
Optional: true,
Computed: true,
Validators: []validator.Int64{
Expand All @@ -455,19 +454,19 @@ func (o Blueprint) ResourceAttributes() map[string]resourceSchema.Attribute {
"evpn_type_5_routes": resourceSchema.BoolAttribute{
Computed: true,
Optional: true,
MarkdownDescription: fmt.Sprintf("When `true`, all EVPN VTEPs in the fabric will redistribute "+
"ARP/IPV6 ND (when possible on NOS type) as EVPN type 5 /32 routes in the routing table. Currently, "+
"this option is only certified for Juniper Junos. FRR (SONiC) does this implicitly and cannot be "+
"disabled. This setting will be ignored. On Arista and Cisco, no configuration is rendered and will "+
"result in a Blueprint warning that it is not supported by AOS. This value is disabled by default, as "+
"it generates a very large number of routes in the BGP routing table and takes large amounts of TCAM. "+
"When these /32 & /128 routes are generated, they enable direct unicast routing to host destinations "+
"on VNIs that are not stretched to the ingress VTEP, and avoid a route lookup to a subnet (eg, /24) "+
"that may be hosted on many leafs. Requires Apstra %s.", apiversions.Ge420),
MarkdownDescription: "When `true`, all EVPN VTEPs in the fabric will redistribute " +
"ARP/IPV6 ND (when possible on NOS type) as EVPN type 5 /32 routes in the routing table. Currently, " +
"this option is only certified for Juniper Junos. FRR (SONiC) does this implicitly and cannot be " +
"disabled. This setting will be ignored. On Arista and Cisco, no configuration is rendered and will " +
"result in a Blueprint warning that it is not supported by AOS. This value is disabled by default, as " +
"it generates a very large number of routes in the BGP routing table and takes large amounts of TCAM. " +
"When these /32 & /128 routes are generated, they enable direct unicast routing to host destinations " +
"on VNIs that are not stretched to the ingress VTEP, and avoid a route lookup to a subnet (eg, /24) " +
"that may be hosted on many leafs.",
},
"fabric_mtu": resourceSchema.Int64Attribute{
MarkdownDescription: fmt.Sprintf("MTU of fabric links. Must be an even number between %d and %d. "+
"Requires Apstra %s.", constants.L3MtuMin, constants.L3MtuMax, apiversions.Ge420),
MarkdownDescription: fmt.Sprintf("MTU of fabric links. Must be an even number between %d and %d.",
constants.L3MtuMin, constants.L3MtuMax),
Optional: true,
Computed: true,
Validators: []validator.Int64{
Expand Down Expand Up @@ -495,33 +494,31 @@ func (o Blueprint) ResourceAttributes() map[string]resourceSchema.Attribute {
"junos_evpn_max_nexthop_and_interface_number": resourceSchema.BoolAttribute{
Computed: true,
Optional: true,
MarkdownDescription: fmt.Sprintf("**Changing this value will result in a disruptive restart of the "+
"PFE.** Enables configuring the maximum number of nexthops and interface numbers reserved for use in "+
"EVPN-VXLAN overlay network on Junos leaf devices. AOS default is `true`. Requires Apstra %s",
apiversions.Ge420),
MarkdownDescription: "**Changing this value will result in a disruptive restart of the " +
"PFE.** Enables configuring the maximum number of nexthops and interface numbers reserved for use in " +
"EVPN-VXLAN overlay network on Junos leaf devices. AOS default is `true`.",
},
"junos_evpn_routing_instance_mode_mac_vrf": resourceSchema.BoolAttribute{
Computed: true,
Optional: true,
MarkdownDescription: fmt.Sprintf("In releases before 4.2, Apstra used a single default switch "+
"instance as the configuration model for Junos. In Apstra 4.2, Apstra transitioned to using MAC-VRF for "+
"all new blueprints and normalized the configuration of Junos to Junos Evolved. This option allows you "+
"to transition Junos devices to the MAC-VRF configuration model for any blueprints deployed before the "+
"4.2 release. All models use the VLAN-Aware service type. Requires Apstra %s", apiversions.Ge420),
MarkdownDescription: "In releases before 4.2, Apstra used a single default switch " +
"instance as the configuration model for Junos. In Apstra 4.2, Apstra transitioned to using MAC-VRF for " +
"all new blueprints and normalized the configuration of Junos to Junos Evolved. This option allows you " +
"to transition Junos devices to the MAC-VRF configuration model for any blueprints deployed before the " +
"4.2 release. All models use the VLAN-Aware service type.",
},
"junos_ex_overlay_ecmp": resourceSchema.BoolAttribute{
Computed: true,
Optional: true,
MarkdownDescription: fmt.Sprintf("**Changing this value will result in a disruptive restart of the "+
"PFE on EX-series devices.** When `true,`VXLAN Overlay ECMP will be enabled on Junos EX-series devices. "+
"Requires Apstra %s.", apiversions.Ge420),
MarkdownDescription: "**Changing this value will result in a disruptive restart of the " +
"PFE on EX-series devices.** When `true,`VXLAN Overlay ECMP will be enabled on Junos EX-series devices. ",
},
"junos_graceful_restart": resourceSchema.BoolAttribute{
Computed: true,
Optional: true,
MarkdownDescription: fmt.Sprintf("**Changing this value may result in a flap of all BGP sessions as "+
"the sessions are re-negotiated.** When `true`, the bgp graceful restart feature is enabled on Junos "+
"devices. Requires Apstra %s", apiversions.Ge420),
MarkdownDescription: "**Changing this value may result in a flap of all BGP sessions as " +
"the sessions are re-negotiated.** When `true`, the bgp graceful restart feature is enabled on Junos " +
"devices.",
},
"max_evpn_routes_count": resourceSchema.Int64Attribute{
MarkdownDescription: "Maximum number of EVPN routes to accept on Leaf Switches. " +
Expand Down Expand Up @@ -573,8 +570,8 @@ func (o Blueprint) ResourceAttributes() map[string]resourceSchema.Attribute {
Validators: []validator.Int64{int64validator.Between(-1, math.MaxUint32)},
},
"optimize_routing_zone_footprint": resourceSchema.BoolAttribute{
MarkdownDescription: fmt.Sprintf("When `true`: routing zones will not be rendered on leafs where "+
"they are not required, resulting in less resource consumption. Requires Apstra %s", apiversions.Ge420),
MarkdownDescription: "When `true`: routing zones will not be rendered on leafs where " +
"they are not required, resulting in less resource consumption.",
Optional: true,
Computed: true,
},
Expand Down
28 changes: 10 additions & 18 deletions apstra/blueprint/datacenter_generic_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

"github.com/Juniper/apstra-go-sdk/apstra"
"github.com/Juniper/apstra-go-sdk/apstra/enum"
apiversions "github.com/Juniper/terraform-provider-apstra/apstra/api_versions"
"github.com/Juniper/terraform-provider-apstra/apstra/constants"
"github.com/Juniper/terraform-provider-apstra/apstra/design"
"github.com/Juniper/terraform-provider-apstra/apstra/utils"
Expand Down Expand Up @@ -93,9 +92,8 @@ func (o DatacenterGenericSystem) ResourceAttributes() map[string]resourceSchema.
},
},
"links": resourceSchema.SetNestedAttribute{
MarkdownDescription: fmt.Sprintf("Generic System link details. Note that tagging Links requires "+
"Apstra %s or newer.", apiversions.Apstra412),
Required: true,
MarkdownDescription: "Generic System link details.",
Required: true,
NestedObject: resourceSchema.NestedAttributeObject{
Attributes: DatacenterGenericSystemLink{}.ResourceAttributes(),
},
Expand All @@ -122,26 +120,20 @@ func (o DatacenterGenericSystem) ResourceAttributes() map[string]resourceSchema.
Optional: true,
},
"port_channel_id_min": resourceSchema.Int64Attribute{
MarkdownDescription: fmt.Sprintf("Omit this attribute to allow any available port-channel to be "+
"used. In Apstra version %s and earlier, all port channel min/max constraints had to be unique per "+
"blueprint. Port channel ranges could not overlap. This requirement has been relaxed, and now they "+
"need only be unique per system.", apiversions.Apstra412),
Optional: true,
Computed: true,
Default: int64default.StaticInt64(design.PoIdMin),
MarkdownDescription: "Omit this attribute to allow any available port-channel to be used.",
Optional: true,
Computed: true,
Default: int64default.StaticInt64(design.PoIdMin),
Validators: []validator.Int64{
int64validator.Between(design.PoIdMin, design.PoIdMax),
int64validator.AlsoRequires(path.MatchRelative().AtParent().AtName("port_channel_id_max")),
},
},
"port_channel_id_max": resourceSchema.Int64Attribute{
MarkdownDescription: fmt.Sprintf("Omit this attribute to allow any available port-channel to be "+
"used. In Apstra version %s and earlier, all port channel min/max constraints had to be unique per "+
"blueprint. Port channel ranges could not overlap. This requirement has been relaxed, and now they "+
"need only be unique per system.", apiversions.Apstra412),
Optional: true,
Computed: true,
Default: int64default.StaticInt64(design.PoIdMin),
MarkdownDescription: "Omit this attribute to allow any available port-channel to be used.",
Optional: true,
Computed: true,
Default: int64default.StaticInt64(design.PoIdMin),
Validators: []validator.Int64{
int64validator.Between(design.PoIdMin, design.PoIdMax),
int64validator.AtLeastSumOf(path.MatchRelative().AtParent().AtName("port_channel_id_min")),
Expand Down
1 change: 1 addition & 0 deletions apstra/compatibility/constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var (
BpIbaDashboardOk = versionconstraints.New(apiversions.LtApstra500)
BpIbaProbeOk = versionconstraints.New(apiversions.LtApstra500)
BpIbaWidgetOk = versionconstraints.New(apiversions.LtApstra500)
FabricSettingsSetInCreate = versionconstraints.New(apiversions.GeApstra421)
TemplateRequiresAntiAffinityPolicy = versionconstraints.New(apiversions.Apstra420)
VnEmptyBindingsOk = versionconstraints.New(">= 5.0.0")
)
20 changes: 8 additions & 12 deletions apstra/design/template_pod_based.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ package design

import (
"context"
"fmt"

"github.com/Juniper/apstra-go-sdk/apstra"
apiversions "github.com/Juniper/terraform-provider-apstra/apstra/api_versions"
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"
Expand Down Expand Up @@ -66,10 +64,9 @@ func (o TemplatePodBased) DataSourceAttributes() map[string]dataSourceSchema.Att
Attributes: SuperSpine{}.DataSourceAttributes(),
},
"fabric_link_addressing": dataSourceSchema.StringAttribute{
DeprecationMessage: fmt.Sprintf("Apstra %s is not supported by this release. This field must not be used.", apiversions.Apstra410),
MarkdownDescription: fmt.Sprintf("Fabric addressing scheme for Spine/Superspine links. Applies only to "+
"Apstra %s.", apiversions.Apstra410),
Computed: true,
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)",
Expand Down Expand Up @@ -99,12 +96,11 @@ func (o TemplatePodBased) ResourceAttributes() map[string]resourceSchema.Attribu
Attributes: SuperSpine{}.ResourceAttributes(),
},
"fabric_link_addressing": resourceSchema.StringAttribute{
DeprecationMessage: fmt.Sprintf("Apstra %s is not supported by this release. This field must not be used.", apiversions.Apstra410),
MarkdownDescription: fmt.Sprintf("Fabric addressing scheme for Spine/SuperSpine links. Required for "+
"Apstra <= %s, not supported by Apstra >= %s.", apiversions.Apstra410, apiversions.Apstra411),
Optional: true,
Computed: true,
Validators: []validator.String{apstravalidator.MustBeOneOf([]attr.Value{types.StringNull()})},
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.",
Expand Down
31 changes: 14 additions & 17 deletions apstra/design/template_rack_based.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"

"github.com/Juniper/apstra-go-sdk/apstra"
apiversions "github.com/Juniper/terraform-provider-apstra/apstra/api_versions"
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"
Expand Down Expand Up @@ -79,9 +78,9 @@ func (o TemplateRackBased) DataSourceAttributes() map[string]dataSourceSchema.At
Computed: true,
},
"fabric_link_addressing": dataSourceSchema.StringAttribute{
MarkdownDescription: fmt.Sprintf("Fabric addressing scheme for Spine/Leaf links. Applies only to "+
"Apstra %s.", apiversions.Apstra410),
Computed: true,
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)",
Expand Down Expand Up @@ -118,10 +117,9 @@ func (o TemplateRackBased) DataSourceAttributesNested() map[string]dataSourceSch
Computed: true,
},
"fabric_link_addressing": dataSourceSchema.StringAttribute{
DeprecationMessage: fmt.Sprintf("Apstra %s is not supported by this release. This field must not be used.", apiversions.Apstra410),
MarkdownDescription: fmt.Sprintf("Fabric addressing scheme for Spine/Leaf links. Applies only to "+
"Apstra %s.", apiversions.Apstra410),
Computed: true,
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)",
Expand Down Expand Up @@ -166,12 +164,11 @@ func (o TemplateRackBased) ResourceAttributes() map[string]resourceSchema.Attrib
},
},
"fabric_link_addressing": resourceSchema.StringAttribute{
DeprecationMessage: fmt.Sprintf("Apstra %s is not supported by this release. This field must not be used.", apiversions.Apstra410),
MarkdownDescription: fmt.Sprintf("Fabric addressing scheme for Spine/Leaf links. Required for "+
"Apstra <= %s, not supported by Apstra >= %s.", apiversions.Apstra410, apiversions.Apstra411),
Optional: true,
Computed: true,
Validators: []validator.String{apstravalidator.MustBeOneOf([]attr.Value{types.StringNull()})},
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.",
Optional: true,
Computed: true,
Validators: []validator.String{apstravalidator.MustBeOneOf([]attr.Value{types.StringNull()})},
},
"rack_infos": resourceSchema.MapNestedAttribute{
MarkdownDescription: "Map of Rack Type info (count + details) keyed by Rack Type ID.",
Expand Down Expand Up @@ -209,9 +206,9 @@ func (o TemplateRackBased) ResourceAttributesNested() map[string]resourceSchema.
Computed: true,
},
"fabric_link_addressing": resourceSchema.StringAttribute{
MarkdownDescription: fmt.Sprintf("Fabric addressing scheme for Spine/Leaf links. Applies only to "+
"Apstra %s.", apiversions.Apstra410),
Computed: true,
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": resourceSchema.MapNestedAttribute{
MarkdownDescription: "Map of Rack Type info (count + details)",
Expand Down
Loading
Loading