// 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 (
	"os"
	"testing"

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

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

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

func TestAccDataSourceIosxeSystem(t *testing.T) {
	var checks []resource.TestCheckFunc
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "hostname", "ROUTER-1"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_bgp_community_new_format", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ipv6_unicast_routing", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_source_route", "false"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_domain_lookup", "false"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_domain_name", "test.com"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "login_delay", "10"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "login_on_failure", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "login_on_failure_log", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "login_on_success", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "login_on_success_log", "true"))
	if os.Getenv("C8000V") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_multicast_routing", "true"))
	}
	if os.Getenv("C9000V") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "multicast_routing_switch", "true"))
	}
	if os.Getenv("C8000V") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_multicast_routing_distributed", "true"))
	}
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "multicast_routing_vrfs.0.vrf", "VRF1"))
	if os.Getenv("C8000V") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "multicast_routing_vrfs.0.distributed", "true"))
	}
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_name_servers.0", "1.2.3.4"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_name_servers_vrf.0.vrf", "VRF1"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_name_servers_vrf.0.servers.0", "2.3.4.5"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "diagnostic_bootup_level", "minimal"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "memory_free_low_watermark_processor", "203038"))
	if os.Getenv("IOSXE1715") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_forward_protocol_nd", "true"))
	}
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_ssh_time_out", "120"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_ssh_authentication_retries", "3"))
	if os.Getenv("IOSXE1715") != "" {
		checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_hosts.0.name", "test.router.com"))
		checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_hosts.0.ips.0", "3.3.3.3"))
	}
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "call_home_contact_email", "email@test.com"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "call_home_cisco_tac_1_profile_active", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "call_home_cisco_tac_1_destination_transport_method", "email"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_nbar_classification_dns_classify_by_domain", "true"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_multicast_route_limit", "200000"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_domain_list_vrf_domain", "example.com"))
	checks = append(checks, resource.TestCheckResourceAttr("data.iosxe_system.test", "ip_domain_list_vrf", "VRF1"))
	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t) },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			{
				Config: testAccDataSourceIosxeSystemPrerequisitesConfig + testAccDataSourceIosxeSystemConfig(),
				Check:  resource.ComposeTestCheckFunc(checks...),
			},
		},
	})
}

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

// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
const testAccDataSourceIosxeSystemPrerequisitesConfig = `
resource "iosxe_restconf" "PreReq0" {
	path = "Cisco-IOS-XE-native:native/vrf/definition=VRF1"
	delete = false
	attributes = {
		"name" = "VRF1"
		"address-family/ipv4" = ""
	}
}

`

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

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

func testAccDataSourceIosxeSystemConfig() string {
	config := `resource "iosxe_system" "test" {` + "\n"
	config += `	hostname = "ROUTER-1"` + "\n"
	config += `	ip_bgp_community_new_format = true` + "\n"
	config += `	ipv6_unicast_routing = true` + "\n"
	config += `	ip_source_route = false` + "\n"
	config += `	ip_domain_lookup = false` + "\n"
	config += `	ip_domain_name = "test.com"` + "\n"
	config += `	login_delay = 10` + "\n"
	config += `	login_on_failure = true` + "\n"
	config += `	login_on_failure_log = true` + "\n"
	config += `	login_on_success = true` + "\n"
	config += `	login_on_success_log = true` + "\n"
	if os.Getenv("C8000V") != "" {
		config += `	ip_multicast_routing = true` + "\n"
	}
	if os.Getenv("C9000V") != "" {
		config += `	multicast_routing_switch = true` + "\n"
	}
	if os.Getenv("C8000V") != "" {
		config += `	ip_multicast_routing_distributed = true` + "\n"
	}
	config += `	multicast_routing_vrfs = [{` + "\n"
	config += `		vrf = "VRF1"` + "\n"
	if os.Getenv("C8000V") != "" {
		config += `		distributed = true` + "\n"
	}
	config += `	}]` + "\n"
	config += `	ip_name_servers = ["1.2.3.4"]` + "\n"
	config += `	ip_name_servers_vrf = [{` + "\n"
	config += `		vrf = "VRF1"` + "\n"
	config += `		servers = ["2.3.4.5"]` + "\n"
	config += `	}]` + "\n"
	config += `	diagnostic_bootup_level = "minimal"` + "\n"
	config += `	memory_free_low_watermark_processor = 203038` + "\n"
	if os.Getenv("IOSXE1715") != "" {
		config += `	ip_forward_protocol_nd = true` + "\n"
	}
	config += `	ip_ssh_time_out = 120` + "\n"
	config += `	ip_ssh_authentication_retries = 3` + "\n"
	if os.Getenv("IOSXE1715") != "" {
		config += `	ip_hosts = [{` + "\n"
		config += `		name = "test.router.com"` + "\n"
		config += `		ips = ["3.3.3.3"]` + "\n"
		config += `	}]` + "\n"
	}
	config += `	call_home_contact_email = "email@test.com"` + "\n"
	config += `	call_home_cisco_tac_1_profile_active = true` + "\n"
	config += `	call_home_cisco_tac_1_destination_transport_method = "email"` + "\n"
	config += `	ip_nbar_classification_dns_classify_by_domain = true` + "\n"
	config += `	ip_multicast_route_limit = 200000` + "\n"
	config += `	ip_domain_list_vrf_domain = "example.com"` + "\n"
	config += `	ip_domain_list_vrf = "VRF1"` + "\n"
	config += `	depends_on = [iosxe_restconf.PreReq0, ]` + "\n"
	config += `}` + "\n"

	config += `
		data "iosxe_system" "test" {
			depends_on = [iosxe_system.test]
		}
	`
	return config
}

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