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

Split existing apstra_datacenter_blueprint data source test into v4-only and v6-enabled tests #873

Merged
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
82 changes: 78 additions & 4 deletions apstra/data_source_datacenter_blueprint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ func TestDatasourceDatacenterBlueprint(t *testing.T) {
templateId apstra.ObjectId
fabricSettings apstra.FabricSettings
checks []resource.TestCheckFunc
ipv6 bool
}

testCases := map[string]testCase{
"evpn_all_versions": {
"evpn_all_versions_ipv4": {
label: acctest.RandString(5),
templateId: "L2_Virtual_EVPN",
fabricSettings: apstra.FabricSettings{
Expand All @@ -55,7 +56,75 @@ func TestDatasourceDatacenterBlueprint(t *testing.T) {
EvpnGenerateType5HostRoutes: &enum.FeatureSwitchEnabled,
ExternalRouterMtu: utils.ToPtr(uint16(9002)),
// FabricL3Mtu: nil,
Ipv6Enabled: utils.ToPtr(true),
Ipv6Enabled: utils.ToPtr(false),
// JunosEvpnDuplicateMacRecoveryTime: nil,
// JunosEvpnMaxNexthopAndInterfaceNumber: nil,
// JunosEvpnRoutingInstanceVlanAware: nil,
// JunosExOverlayEcmp: nil,
// JunosGracefulRestart: nil,
MaxEvpnRoutes: utils.ToPtr(uint32(10001)),
MaxExternalRoutes: utils.ToPtr(uint32(10002)),
MaxFabricRoutes: utils.ToPtr(uint32(10003)),
MaxMlagRoutes: utils.ToPtr(uint32(10004)),
// OptimiseSzFootprint: nil,
// OverlayControlProtocol: nil,
// SpineLeafLinks: nil,
// SpineSuperspineLinks: nil,
},
checks: []resource.TestCheckFunc{
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "status", "created"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "superspine_switch_count", "0"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "spine_switch_count", "2"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "leaf_switch_count", "4"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "access_switch_count", "0"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "generic_system_count", "8"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "external_router_count", "0"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "has_uncommitted_changes", "true"),
resource.TestCheckResourceAttrWith("data.apstra_datacenter_blueprint.test", "version", testCheckIntGE1),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "build_errors_count", "52"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "build_warnings_count", "0"),

resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "anti_affinity_mode", apstra.AntiAffinityModeEnabledStrict.String()),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "anti_affinity_policy.max_links_count_per_slot", "8"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "anti_affinity_policy.max_links_count_per_system_per_slot", "4"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "anti_affinity_policy.max_links_count_per_port", "4"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "anti_affinity_policy.max_links_count_per_system_per_port", "2"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "default_ip_links_to_generic_mtu", "9002"),
// resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "default_svi_l3_mtu", "9000"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "esi_mac_msb", "4"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "evpn_type_5_routes", "true"),
// resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "fabric_mtu", "9170"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "ipv6_applications", "false"),
// resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "junos_evpn_max_nexthop_and_interface_number", "true"),
// resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "junos_evpn_routing_instance_mode_mac_vrf", "true"),
// resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "junos_ex_overlay_ecmp", "true"),
// resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "junos_graceful_restart", "true"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "max_evpn_routes_count", "10001"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "max_external_routes_count", "10002"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "max_fabric_routes_count", "10003"),
resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "max_mlag_routes_count", "10004"),
// resource.TestCheckResourceAttr("data.apstra_datacenter_blueprint.test", "optimize_routing_zone_footprint", "true"),
},
},
"evpn_all_versions_ipv6": {
ipv6: true,
label: acctest.RandString(5),
templateId: "L2_Virtual_EVPN",
fabricSettings: apstra.FabricSettings{
AntiAffinityPolicy: &apstra.AntiAffinityPolicy{
Algorithm: apstra.AlgorithmHeuristic,
MaxLinksPerPort: 4,
MaxLinksPerSlot: 8,
MaxPerSystemLinksPerPort: 2,
MaxPerSystemLinksPerSlot: 4,
Mode: apstra.AntiAffinityModeEnabledStrict,
},
// DefaultSviL3Mtu: nil,
EsiMacMsb: utils.ToPtr(uint8(4)),
EvpnGenerateType5HostRoutes: &enum.FeatureSwitchEnabled,
ExternalRouterMtu: utils.ToPtr(uint16(9002)),
// FabricL3Mtu: nil,
Ipv6Enabled: utils.ToPtr(false),
// JunosEvpnDuplicateMacRecoveryTime: nil,
// JunosEvpnMaxNexthopAndInterfaceNumber: nil,
// JunosEvpnRoutingInstanceVlanAware: nil,
Expand Down Expand Up @@ -127,11 +196,16 @@ func TestDatasourceDatacenterBlueprint(t *testing.T) {
require.NoError(t, err)
t.Cleanup(func() { require.NoError(t, client.DeleteBlueprint(ctx, id)) })

if tCase.fabricSettings.Ipv6Enabled != nil && *tCase.fabricSettings.Ipv6Enabled == true {
if tCase.ipv6 {
bpClient, err := client.NewTwoStageL3ClosClient(ctx, id)
require.NoError(t, err)

require.NoError(t, bpClient.SetFabricSettings(ctx, &tCase.fabricSettings))
fs, err := bpClient.GetFabricSettings(ctx)
require.NoError(t, err)

fs.Ipv6Enabled = utils.ToPtr(true)
err = bpClient.SetFabricSettings(ctx, fs)
require.NoError(t, err)
}

// add unpredictable name and ID to existing checks
Expand Down
Loading