// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
// All rights reserved.
//
// Licensed under the Mozilla Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://mozilla.org/MPL/2.0/
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: MPL-2.0

// Code generated by "gen/generator.go"; DO NOT EDIT.

package provider

// Section below is generated&owned by "gen/generator.go". //template:begin imports
import (
	"fmt"
	"os"
	"testing"

	"github.com/hashicorp/terraform-plugin-testing/helper/resource"
	"github.com/hashicorp/terraform-plugin-testing/terraform"
)

// End of section. //template:end imports

// Section below is generated&owned by "gen/generator.go". //template:begin testAcc

func TestAccIosxeErrdisable(t *testing.T) {
	var checks []resource.TestCheckFunc
	if os.Getenv("IOSXE1712") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_all", "true"))
	}
	if os.Getenv("C9000V") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_arp_inspection", "true"))
	}
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_dhcp_rate_limit", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_dtp_flap", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_l2ptguard", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_link_flap", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_pppoe_ia_rate_limit", "true"))
	if os.Getenv("C9000V") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_security_violation_shutdown_vlan", "true"))
	}
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "detect_cause_loopdetect", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "flap_setting_cause_dtp_flap_max_flaps", "80"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "flap_setting_cause_dtp_flap_time", "90"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "flap_setting_cause_link_flap_max_flaps", "80"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "flap_setting_cause_link_flap_time", "90"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "flap_setting_cause_pagp_flap_max_flaps", "80"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "flap_setting_cause_pagp_flap_time", "90"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_interval", "855"))
	if os.Getenv("IOSXE1712") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_all", "true"))
	}
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_arp_inspection", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_bpduguard", "true"))
	if os.Getenv("C9000V") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_channel_misconfig", "true"))
	}
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_dhcp_rate_limit", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_dtp_flap", "true"))
	if os.Getenv("C9000V") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_gbic_invalid", "true"))
	}
	if os.Getenv("C9000V") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_inline_power", "true"))
	}
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_l2ptguard", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_link_flap", "true"))
	if os.Getenv("C9000V") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_link_monitor_failure", "true"))
	}
	if os.Getenv("C9000V") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_loopback", "true"))
	}
	if os.Getenv("C9000V") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_mac_limit", "true"))
	}
	if os.Getenv("C9000V") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_pagp_flap", "true"))
	}
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_port_mode_failure", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_pppoe_ia_rate_limit", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_psp", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_psecure_violation", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_security_violation", "true"))
	if os.Getenv("C9000V") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_sfp_config_mismatch", "true"))
	}
	if os.Getenv("C9000V") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_storm_control", "true"))
	}
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_udld", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("iosxe_errdisable.test", "recovery_cause_loopdetect", "true"))
	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t) },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			{
				Config: testAccIosxeErrdisableConfig_minimum(),
			},
			{
				Config: testAccIosxeErrdisableConfig_all(),
				Check:  resource.ComposeTestCheckFunc(checks...),
			},
			{
				ResourceName:            "iosxe_errdisable.test",
				ImportState:             true,
				ImportStateVerify:       true,
				ImportStateIdFunc:       iosxeErrdisableImportStateIdFunc("iosxe_errdisable.test"),
				ImportStateVerifyIgnore: []string{"detect_cause_all", "detect_cause_arp_inspection", "detect_cause_bpduguard", "detect_cause_gbic_invalid", "detect_cause_inline_power", "detect_cause_loopback", "detect_cause_mlacp_minlink", "detect_cause_pagp_flap", "detect_cause_security_violation_shutdown_vlan", "detect_cause_sfp_config_mismatch", "detect_cause_small_frame", "recovery_cause_all", "recovery_cause_channel_misconfig", "recovery_cause_gbic_invalid", "recovery_cause_inline_power", "recovery_cause_link_monitor_failure", "recovery_cause_loopback", "recovery_cause_mac_limit", "recovery_cause_mlacp_minlink", "recovery_cause_pagp_flap", "recovery_cause_sfp_config_mismatch", "recovery_cause_small_frame", "recovery_cause_storm_control", "recovery_cause_unicast_flood", "recovery_cause_vmps", "recovery_cause_oam_remote_failure", "recovery_cause_mrp_miscabling"},
				Check:                   resource.ComposeTestCheckFunc(checks...),
			},
		},
	})
}

// End of section. //template:end testAcc

// Section below is generated&owned by "gen/generator.go". //template:begin importStateIdFunc

func iosxeErrdisableImportStateIdFunc(resourceName string) resource.ImportStateIdFunc {
	return func(s *terraform.State) (string, error) {

		return fmt.Sprintf(""), nil
	}
}

// End of section. //template:end importStateIdFunc

// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
// End of section. //template:end testPrerequisites

// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimal

func testAccIosxeErrdisableConfig_minimum() string {
	config := `resource "iosxe_errdisable" "test" {` + "\n"
	config += `}` + "\n"
	return config
}

// End of section. //template:end testAccConfigMinimal

// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll

func testAccIosxeErrdisableConfig_all() string {
	config := `resource "iosxe_errdisable" "test" {` + "\n"
	if os.Getenv("IOSXE1712") != "" {
		config += `	detect_cause_all = true` + "\n"
	}
	if os.Getenv("C9000V") != "" {
		config += `	detect_cause_arp_inspection = true` + "\n"
	}
	config += `	detect_cause_dhcp_rate_limit = true` + "\n"
	config += `	detect_cause_dtp_flap = true` + "\n"
	config += `	detect_cause_l2ptguard = true` + "\n"
	config += `	detect_cause_link_flap = true` + "\n"
	config += `	detect_cause_pppoe_ia_rate_limit = true` + "\n"
	if os.Getenv("C9000V") != "" {
		config += `	detect_cause_security_violation_shutdown_vlan = true` + "\n"
	}
	config += `	detect_cause_loopdetect = true` + "\n"
	config += `	flap_setting_cause_dtp_flap_max_flaps = 80` + "\n"
	config += `	flap_setting_cause_dtp_flap_time = 90` + "\n"
	config += `	flap_setting_cause_link_flap_max_flaps = 80` + "\n"
	config += `	flap_setting_cause_link_flap_time = 90` + "\n"
	config += `	flap_setting_cause_pagp_flap_max_flaps = 80` + "\n"
	config += `	flap_setting_cause_pagp_flap_time = 90` + "\n"
	config += `	recovery_interval = 855` + "\n"
	if os.Getenv("IOSXE1712") != "" {
		config += `	recovery_cause_all = true` + "\n"
	}
	config += `	recovery_cause_arp_inspection = true` + "\n"
	config += `	recovery_cause_bpduguard = true` + "\n"
	if os.Getenv("C9000V") != "" {
		config += `	recovery_cause_channel_misconfig = true` + "\n"
	}
	config += `	recovery_cause_dhcp_rate_limit = true` + "\n"
	config += `	recovery_cause_dtp_flap = true` + "\n"
	if os.Getenv("C9000V") != "" {
		config += `	recovery_cause_gbic_invalid = true` + "\n"
	}
	if os.Getenv("C9000V") != "" {
		config += `	recovery_cause_inline_power = true` + "\n"
	}
	config += `	recovery_cause_l2ptguard = true` + "\n"
	config += `	recovery_cause_link_flap = true` + "\n"
	if os.Getenv("C9000V") != "" {
		config += `	recovery_cause_link_monitor_failure = true` + "\n"
	}
	if os.Getenv("C9000V") != "" {
		config += `	recovery_cause_loopback = true` + "\n"
	}
	if os.Getenv("C9000V") != "" {
		config += `	recovery_cause_mac_limit = true` + "\n"
	}
	if os.Getenv("C9000V") != "" {
		config += `	recovery_cause_pagp_flap = true` + "\n"
	}
	config += `	recovery_cause_port_mode_failure = true` + "\n"
	config += `	recovery_cause_pppoe_ia_rate_limit = true` + "\n"
	config += `	recovery_cause_psp = true` + "\n"
	config += `	recovery_cause_psecure_violation = true` + "\n"
	config += `	recovery_cause_security_violation = true` + "\n"
	if os.Getenv("C9000V") != "" {
		config += `	recovery_cause_sfp_config_mismatch = true` + "\n"
	}
	if os.Getenv("C9000V") != "" {
		config += `	recovery_cause_storm_control = true` + "\n"
	}
	config += `	recovery_cause_udld = true` + "\n"
	config += `	recovery_cause_loopdetect = true` + "\n"
	config += `}` + "\n"
	return config
}

// End of section. //template:end testAccConfigAll
