// Code generated by "gen/generator.go"; DO NOT EDIT.
// In order to regenerate this file execute `go generate` from the repository root.
// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md).

package provider

import (
	"regexp"
	"testing"

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

func TestAccDataSourceFvBDWithFvTenant(t *testing.T) {

	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t, "apic", "1.0(1e)-") },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			{
				Config:             testConfigFvBDDataSourceDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "name", "test_name"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "arp_flooding", "no"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "bridge_domain_type", "regular"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "clear_remote_mac_entries", "no"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "custom_mac_address", "00:22:BD:F8:19:FF"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "description", ""),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "enable_intersite_bum_traffic", "no"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "endpoint_move_detection_mode", ""),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "intersite_l2_stretch", "no"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "ip_learning", "yes"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "l2_unknown_unicast_flooding", "proxy"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "l3_unknown_multicast_flooding", "flood"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "limit_ip_learn_to_subnets", "yes"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "link_local_ipv6_address", "::"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "multi_destination_flooding", "bd-flood"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "name_alias", ""),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "optimize_wan_bandwidth", "no"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "owner_key", ""),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "owner_tag", ""),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "pim", "no"),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "unicast_routing", "yes"),
					composeAggregateTestCheckFuncWithVersion(t, "4.0(1h)-", "inside",
						resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "advertise_host_routes", "no")),
					composeAggregateTestCheckFuncWithVersion(t, "4.1(1i)-", "inside",
						resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "ipv6_l3_unknown_multicast_flooding", "flood")),
					composeAggregateTestCheckFuncWithVersion(t, "4.2(1i)-", "inside",
						resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "pim_ipv6", "no")),
					composeAggregateTestCheckFuncWithVersion(t, "5.2(5c)-", "inside",
						resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "drop_arp_with_multicast_smac", "yes")),
					composeAggregateTestCheckFuncWithVersion(t, "6.0(4c)-", "inside",
						resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "service_bd_routing_disable", "no")),
					resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "virtual_mac_address", "not-applicable"),
					resource.TestCheckResourceAttrSet("data.aci_bridge_domain.test", "pc_tag"),
					resource.TestCheckResourceAttrSet("data.aci_bridge_domain.test", "scope"),
					resource.TestCheckResourceAttrSet("data.aci_bridge_domain.test", "segment"),
				),
			},
			{
				Config:      testConfigFvBDNotExistingFvTenant + testConfigDataSourceSystem,
				ExpectError: regexp.MustCompile("Failed to read aci_bridge_domain data source"),
			},
		},
	})
}

const testConfigFvBDDataSourceDependencyWithFvTenant = testConfigFvBDMinDependencyWithFvTenant + `
data "aci_bridge_domain" "test" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
  depends_on = [aci_bridge_domain.test]
}
`

const testConfigFvBDNotExistingFvTenant = testConfigFvTenantMin + `
data "aci_bridge_domain" "test_non_existing" {
  parent_dn = aci_tenant.test.id
  name = "non_existing_name"
}
`
