From af352fe518298bbf81d1a46cde5bbf1110387a80 Mon Sep 17 00:00:00 2001 From: akinross Date: Tue, 17 Sep 2024 10:47:53 +0200 Subject: [PATCH] tmp commit --reset soft --- docs/data-sources/annotation.md | 6 +- docs/data-sources/bridge_domain.md | 148 + .../data-sources/first_hop_security_policy.md | 80 + docs/data-sources/igmp_snooping_policy.md | 72 + docs/data-sources/mld_snooping_policy.md | 72 + .../neighbor_discovery_interface_policy.md | 74 + ...lation_from_bridge_domain_to_l3_outside.md | 65 + ...bridge_domain_to_netflow_monitor_policy.md | 68 + docs/data-sources/rogue_coop_exception.md | 62 + docs/data-sources/tag.md | 6 +- docs/resources/annotation.md | 6 +- docs/resources/bridge_domain.md | 416 ++ docs/resources/first_hop_security_policy.md | 184 + docs/resources/igmp_snooping_policy.md | 153 + docs/resources/mld_snooping_policy.md | 153 + .../neighbor_discovery_interface_policy.md | 162 + ...lation_from_bridge_domain_to_l3_outside.md | 124 + ...bridge_domain_to_netflow_monitor_policy.md | 128 + docs/resources/rogue_coop_exception.md | 124 + docs/resources/tag.md | 6 +- .../aci_bridge_domain/data-source.tf | 5 + .../aci_bridge_domain/provider.tf | 14 + .../data-source.tf | 5 + .../aci_first_hop_security_policy/provider.tf | 14 + .../aci_igmp_snooping_policy/data-source.tf | 5 + .../aci_igmp_snooping_policy/provider.tf | 14 + .../aci_mld_snooping_policy/data-source.tf | 5 + .../aci_mld_snooping_policy/provider.tf | 14 + .../data-source.tf | 5 + .../provider.tf | 14 + .../data-source.tf | 5 + .../provider.tf | 14 + .../data-source.tf | 6 + .../provider.tf | 14 + .../aci_rogue_coop_exception/data-source.tf | 5 + .../aci_rogue_coop_exception/provider.tf | 14 + .../resources/aci_bridge_domain/provider.tf | 14 + .../resource-all-attributes.tf | 113 + .../resources/aci_bridge_domain/resource.tf | 5 + .../aci_first_hop_security_policy/provider.tf | 14 + .../resource-all-attributes.tf | 40 + .../aci_first_hop_security_policy/resource.tf | 5 + .../aci_igmp_snooping_policy/provider.tf | 14 + .../resource-all-attributes.tf | 30 + .../aci_igmp_snooping_policy/resource.tf | 5 + .../aci_mld_snooping_policy/provider.tf | 14 + .../resource-all-attributes.tf | 30 + .../aci_mld_snooping_policy/resource.tf | 5 + .../provider.tf | 14 + .../resource-all-attributes.tf | 34 + .../resource.tf | 5 + .../provider.tf | 14 + .../resource-all-attributes.tf | 18 + .../resource.tf | 5 + .../provider.tf | 14 + .../resource-all-attributes.tf | 19 + .../resource.tf | 6 + .../aci_rogue_coop_exception/provider.tf | 14 + .../resource-all-attributes.tf | 21 + .../aci_rogue_coop_exception/resource.tf | 5 + gen/definitions/classes.yaml | 118 +- gen/definitions/properties.yaml | 300 +- gen/generator.go | 38 +- gen/meta/fhsBDPol.json | 855 ++++ ...{fvRsBdFloodTo.json => fhsRaGuardPol.json} | 805 ++-- gen/meta/fvAccP.json | 720 +++ gen/meta/fvRogueExceptionMac.json | 650 +++ gen/meta/igmpSnoopPol.json | 1063 +++++ gen/meta/mldSnoopPol.json | 1057 +++++ gen/meta/ndIfPol.json | 1210 +++++ gen/templates/resource.go.tmpl | 31 +- gen/templates/resource.md.tmpl | 2 +- gen/testvars/fhsBDPol.yaml | 68 + gen/testvars/fvBD.yaml | 172 + gen/testvars/fvRogueExceptionMac.yaml | 45 + gen/testvars/fvRsBDToNetflowMonitorPol.yaml | 44 + gen/testvars/fvRsBDToOut.yaml | 39 + gen/testvars/igmpSnoopPol.yaml | 65 + gen/testvars/mldSnoopPol.yaml | 65 + gen/testvars/ndIfPol.yaml | 72 + .../provider/data_source_aci_bridge_domain.go | 605 +++ .../data_source_aci_bridge_domain_test.go | 75 + ...ta_source_aci_first_hop_security_policy.go | 235 + ...urce_aci_first_hop_security_policy_test.go | 56 + .../data_source_aci_igmp_snooping_policy.go | 199 + ...ta_source_aci_igmp_snooping_policy_test.go | 61 + .../data_source_aci_mld_snooping_policy.go | 199 + ...ata_source_aci_mld_snooping_policy_test.go | 61 + ...aci_neighbor_discovery_interface_policy.go | 215 + ...eighbor_discovery_interface_policy_test.go | 65 + ...lation_from_bridge_domain_to_l3_outside.go | 149 + ...n_from_bridge_domain_to_l3_outside_test.go | 49 + ...bridge_domain_to_netflow_monitor_policy.go | 153 + ...e_domain_to_netflow_monitor_policy_test.go | 53 + .../data_source_aci_rogue_coop_exception.go | 161 + ...ta_source_aci_rogue_coop_exception_test.go | 52 + internal/provider/provider.go | 16 + .../provider/resource_aci_application_epg.go | 17 +- .../provider/resource_aci_bridge_domain.go | 4224 +++++++++++++++++ .../resource_aci_bridge_domain_test.go | 900 ++++ .../resource_aci_endpoint_security_group.go | 4 +- .../resource_aci_first_hop_security_policy.go | 1100 +++++ ...urce_aci_first_hop_security_policy_test.go | 436 ++ .../resource_aci_igmp_snooping_policy.go | 869 ++++ .../resource_aci_igmp_snooping_policy_test.go | 398 ++ .../resource_aci_mld_snooping_policy.go | 869 ++++ .../resource_aci_mld_snooping_policy_test.go | 398 ++ ...aci_neighbor_discovery_interface_policy.go | 931 ++++ ...eighbor_discovery_interface_policy_test.go | 437 ++ ...lation_from_bridge_domain_to_l3_outside.go | 643 +++ ...n_from_bridge_domain_to_l3_outside_test.go | 276 ++ ...bridge_domain_to_netflow_monitor_policy.go | 666 +++ ...e_domain_to_netflow_monitor_policy_test.go | 294 ++ .../resource_aci_rogue_coop_exception.go | 694 +++ .../resource_aci_rogue_coop_exception_test.go | 306 ++ 115 files changed, 25584 insertions(+), 421 deletions(-) create mode 100644 docs/data-sources/bridge_domain.md create mode 100644 docs/data-sources/first_hop_security_policy.md create mode 100644 docs/data-sources/igmp_snooping_policy.md create mode 100644 docs/data-sources/mld_snooping_policy.md create mode 100644 docs/data-sources/neighbor_discovery_interface_policy.md create mode 100644 docs/data-sources/relation_from_bridge_domain_to_l3_outside.md create mode 100644 docs/data-sources/relation_from_bridge_domain_to_netflow_monitor_policy.md create mode 100644 docs/data-sources/rogue_coop_exception.md create mode 100644 docs/resources/bridge_domain.md create mode 100644 docs/resources/first_hop_security_policy.md create mode 100644 docs/resources/igmp_snooping_policy.md create mode 100644 docs/resources/mld_snooping_policy.md create mode 100644 docs/resources/neighbor_discovery_interface_policy.md create mode 100644 docs/resources/relation_from_bridge_domain_to_l3_outside.md create mode 100644 docs/resources/relation_from_bridge_domain_to_netflow_monitor_policy.md create mode 100644 docs/resources/rogue_coop_exception.md create mode 100644 examples/data-sources/aci_bridge_domain/data-source.tf create mode 100644 examples/data-sources/aci_bridge_domain/provider.tf create mode 100644 examples/data-sources/aci_first_hop_security_policy/data-source.tf create mode 100644 examples/data-sources/aci_first_hop_security_policy/provider.tf create mode 100644 examples/data-sources/aci_igmp_snooping_policy/data-source.tf create mode 100644 examples/data-sources/aci_igmp_snooping_policy/provider.tf create mode 100644 examples/data-sources/aci_mld_snooping_policy/data-source.tf create mode 100644 examples/data-sources/aci_mld_snooping_policy/provider.tf create mode 100644 examples/data-sources/aci_neighbor_discovery_interface_policy/data-source.tf create mode 100644 examples/data-sources/aci_neighbor_discovery_interface_policy/provider.tf create mode 100644 examples/data-sources/aci_relation_from_bridge_domain_to_l3_outside/data-source.tf create mode 100644 examples/data-sources/aci_relation_from_bridge_domain_to_l3_outside/provider.tf create mode 100644 examples/data-sources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/data-source.tf create mode 100644 examples/data-sources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/provider.tf create mode 100644 examples/data-sources/aci_rogue_coop_exception/data-source.tf create mode 100644 examples/data-sources/aci_rogue_coop_exception/provider.tf create mode 100644 examples/resources/aci_bridge_domain/provider.tf create mode 100644 examples/resources/aci_bridge_domain/resource-all-attributes.tf create mode 100644 examples/resources/aci_bridge_domain/resource.tf create mode 100644 examples/resources/aci_first_hop_security_policy/provider.tf create mode 100644 examples/resources/aci_first_hop_security_policy/resource-all-attributes.tf create mode 100644 examples/resources/aci_first_hop_security_policy/resource.tf create mode 100644 examples/resources/aci_igmp_snooping_policy/provider.tf create mode 100644 examples/resources/aci_igmp_snooping_policy/resource-all-attributes.tf create mode 100644 examples/resources/aci_igmp_snooping_policy/resource.tf create mode 100644 examples/resources/aci_mld_snooping_policy/provider.tf create mode 100644 examples/resources/aci_mld_snooping_policy/resource-all-attributes.tf create mode 100644 examples/resources/aci_mld_snooping_policy/resource.tf create mode 100644 examples/resources/aci_neighbor_discovery_interface_policy/provider.tf create mode 100644 examples/resources/aci_neighbor_discovery_interface_policy/resource-all-attributes.tf create mode 100644 examples/resources/aci_neighbor_discovery_interface_policy/resource.tf create mode 100644 examples/resources/aci_relation_from_bridge_domain_to_l3_outside/provider.tf create mode 100644 examples/resources/aci_relation_from_bridge_domain_to_l3_outside/resource-all-attributes.tf create mode 100644 examples/resources/aci_relation_from_bridge_domain_to_l3_outside/resource.tf create mode 100644 examples/resources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/provider.tf create mode 100644 examples/resources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/resource-all-attributes.tf create mode 100644 examples/resources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/resource.tf create mode 100644 examples/resources/aci_rogue_coop_exception/provider.tf create mode 100644 examples/resources/aci_rogue_coop_exception/resource-all-attributes.tf create mode 100644 examples/resources/aci_rogue_coop_exception/resource.tf create mode 100644 gen/meta/fhsBDPol.json rename gen/meta/{fvRsBdFloodTo.json => fhsRaGuardPol.json} (67%) create mode 100644 gen/meta/fvAccP.json create mode 100644 gen/meta/fvRogueExceptionMac.json create mode 100644 gen/meta/igmpSnoopPol.json create mode 100644 gen/meta/mldSnoopPol.json create mode 100644 gen/meta/ndIfPol.json create mode 100644 gen/testvars/fhsBDPol.yaml create mode 100644 gen/testvars/fvBD.yaml create mode 100644 gen/testvars/fvRogueExceptionMac.yaml create mode 100644 gen/testvars/fvRsBDToNetflowMonitorPol.yaml create mode 100644 gen/testvars/fvRsBDToOut.yaml create mode 100644 gen/testvars/igmpSnoopPol.yaml create mode 100644 gen/testvars/mldSnoopPol.yaml create mode 100644 gen/testvars/ndIfPol.yaml create mode 100644 internal/provider/data_source_aci_bridge_domain.go create mode 100644 internal/provider/data_source_aci_bridge_domain_test.go create mode 100644 internal/provider/data_source_aci_first_hop_security_policy.go create mode 100644 internal/provider/data_source_aci_first_hop_security_policy_test.go create mode 100644 internal/provider/data_source_aci_igmp_snooping_policy.go create mode 100644 internal/provider/data_source_aci_igmp_snooping_policy_test.go create mode 100644 internal/provider/data_source_aci_mld_snooping_policy.go create mode 100644 internal/provider/data_source_aci_mld_snooping_policy_test.go create mode 100644 internal/provider/data_source_aci_neighbor_discovery_interface_policy.go create mode 100644 internal/provider/data_source_aci_neighbor_discovery_interface_policy_test.go create mode 100644 internal/provider/data_source_aci_relation_from_bridge_domain_to_l3_outside.go create mode 100644 internal/provider/data_source_aci_relation_from_bridge_domain_to_l3_outside_test.go create mode 100644 internal/provider/data_source_aci_relation_from_bridge_domain_to_netflow_monitor_policy.go create mode 100644 internal/provider/data_source_aci_relation_from_bridge_domain_to_netflow_monitor_policy_test.go create mode 100644 internal/provider/data_source_aci_rogue_coop_exception.go create mode 100644 internal/provider/data_source_aci_rogue_coop_exception_test.go create mode 100644 internal/provider/resource_aci_bridge_domain.go create mode 100644 internal/provider/resource_aci_bridge_domain_test.go create mode 100644 internal/provider/resource_aci_first_hop_security_policy.go create mode 100644 internal/provider/resource_aci_first_hop_security_policy_test.go create mode 100644 internal/provider/resource_aci_igmp_snooping_policy.go create mode 100644 internal/provider/resource_aci_igmp_snooping_policy_test.go create mode 100644 internal/provider/resource_aci_mld_snooping_policy.go create mode 100644 internal/provider/resource_aci_mld_snooping_policy_test.go create mode 100644 internal/provider/resource_aci_neighbor_discovery_interface_policy.go create mode 100644 internal/provider/resource_aci_neighbor_discovery_interface_policy_test.go create mode 100644 internal/provider/resource_aci_relation_from_bridge_domain_to_l3_outside.go create mode 100644 internal/provider/resource_aci_relation_from_bridge_domain_to_l3_outside_test.go create mode 100644 internal/provider/resource_aci_relation_from_bridge_domain_to_netflow_monitor_policy.go create mode 100644 internal/provider/resource_aci_relation_from_bridge_domain_to_netflow_monitor_policy_test.go create mode 100644 internal/provider/resource_aci_rogue_coop_exception.go create mode 100644 internal/provider/resource_aci_rogue_coop_exception_test.go diff --git a/docs/data-sources/annotation.md b/docs/data-sources/annotation.md index be846d4f5..8f4d88e9c 100644 --- a/docs/data-sources/annotation.md +++ b/docs/data-sources/annotation.md @@ -57,6 +57,8 @@ data "aci_annotation" "example_application_epg" { - [aci_cloud_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_epg) ([cloudEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudEPg/overview)) - [aci_cloud_external_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_external_epg) ([cloudExtEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudExtEPg/overview)) - [aci_cloud_service_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_service_epg) ([cloudSvcEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudSvcEPg/overview)) + - [aci_dhcp_relay_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/dhcp_relay_policy) ([dhcpRelayP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/dhcpRelayP/overview)) + - [aci_first_hop_security_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/first_hop_security_policy) ([fhsBDPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsBDPol/overview)) - [aci_trust_control_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/trust_control_policy) ([fhsTrustCtrlPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsTrustCtrlPol/overview)) - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) - [aci_application_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_profile) ([fvAp](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAp/overview)) @@ -67,13 +69,11 @@ data "aci_annotation" "example_application_epg" { - [aci_endpoint_security_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_security_group) ([fvESg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvESg/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) - [aci_endpoint_tag_mac](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_mac) ([fvEpMacTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpMacTag/overview)) + - [aci_end_point_retention_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/end_point_retention_policy) ([fvEpRetPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpRetPol/overview)) - [aci_vrf_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group) ([fvFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRGroup/overview)) - [aci_vrf_fallback_route_group_member](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group_member) ([fvFBRMember](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRMember/overview)) - [aci_vrf_fallback_route](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route) ([fvFBRoute](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRoute/overview)) - [aci_epg_useg_ad_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ad_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) - - [aci_epg_useg_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) - - [aci_epg_useg_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) - - [aci_relation_to_consumed_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_contract) ([fvRsCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCons/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. ### Read-Only ### diff --git a/docs/data-sources/bridge_domain.md b/docs/data-sources/bridge_domain.md new file mode 100644 index 000000000..b1b11d3e7 --- /dev/null +++ b/docs/data-sources/bridge_domain.md @@ -0,0 +1,148 @@ +--- +# Documentation 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). +subcategory: "Networking" +layout: "aci" +page_title: "ACI: aci_bridge_domain" +sidebar_current: "docs-aci-data-source-aci_bridge_domain" +description: |- + Data source for ACI Bridge Domain +--- + +# aci_bridge_domain # + +Data source for ACI Bridge Domain + +## API Information ## + +* Class: [fvBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvBD/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Format: `uni/tn-{name}/BD-{name}` + +## GUI Information ## + +* Location: `Tenants -> Networking -> Bridge Domains` + +## Example Usage ## + +```hcl + +data "aci_bridge_domain" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) +* `name` (name) - (string) The name of the Bridge Domain object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Bridge Domain object. +* `optimize_wan_bandwidth` (OptimizeWanBandwidth) - (string) Optimize WAN Bandwidth for the Bridge Domain object. +* `annotation` (annotation) - (string) The annotation of the Bridge Domain object. +* `arp_flooding` (arpFlood) - (string) Enable ARP flooding for the Bridge Domain object. If flooding is disabled, unicast routing will be performed on the target IP address. +* `description` (descr) - (string) The description of the Bridge Domain object. +* `enable_rogue_exception_mac` (enableRogueExceptMac) - (string) Enable rogue exception based on MAC wildcard for the Bridge Domain object. +* `clear_remote_mac_entries` (epClear) - (string) Clear all End-Points in leafs for the Bridge Domain object. +* `endpoint_move_detection_mode` (epMoveDetectMode) - (string) The End Point move detection option uses the Gratuitous Address Resolution Protocol (GARP). A gratuitous ARP is an ARP broadcast-type of packet that is used to verify that no other device on the network has the same IP address as the sending device. +* `advertise_host_routes` (hostBasedRouting) - (string) Advertise host routes (/32 prefixes) out of the L3Out(s) associated to the Bridge Domain object. +* `intersite_bum_traffic_allow` (intersiteBumTrafficAllow) - (string) Enable intersite Broadcast, Unknown-Unicast and Multicast (BUM) traffic between sites for the Bridge Domain object. +* `intersite_l2_stretch` (intersiteL2Stretch) - (string) Enable L2 stretch between sites for the Bridge Domain object. +* `ip_learning` (ipLearning) - (string) The IP learning setting of the Bridge Domain object. +* `pim_ipv6` (ipv6McastAllow) - (string) Enable IPv6 multicast traffic for the Bridge Domain object. +* `limit_ip_learn_to_subnets` (limitIpLearnToSubnets) - (string) Limit IP address learning to subnets for the Bridge Domain object. Every %!s(MISSING) object can have multiple subnets associated with it. +* `link_local_ipv6_address` (llAddr) - (string) The override of the system generated IPv6 link-local address. +* `custom_mac_address` (mac) - (string) The MAC address of the Bridge Domain object. +* `drop_arp_with_multicast_smac` (mcastARPDrop) - (string) Drop roque multicast ARP packets for the Bridge Domain object. +* `pim` (mcastAllow) - (string) Enable IPv4 multicast traffic for the Bridge Domain object. +* `multi_destination_flooding` (multiDstPktAct) - (string) The multiple destination forwarding method for L2 Multicast, Broadcast, and Link Layer traffic types. +* `name_alias` (nameAlias) - (string) The name alias of the Bridge Domain object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `bridge_domain_type` (type) - (string) domain type. +* `unicast_routing` (unicastRoute) - (string) Enable the forwarding method based on predefined forwarding criteria (IP or MAC address). +* `l2_unknown_unicast_flooding` (unkMacUcastAct) - (string) The forwarding method for unknown layer 2 destinations. +* `l3_unknown_multicast_flooding` (unkMcastAct) - (string) The forwarding method for unknown layer multicast destinations. +* `ipv6_l3_unknown_multicast_flooding` (v6unkMcastAct) - (string) The forwarding method for unknown IPv6 multicast destinations. +* `virtual_mac_address` (vmac) - (string) Virtual MAC address of the BD/SVI. This is used when the BD is extended to multiple sites using l2 Outside. + +* `legacy_mode` - (map) A map of Legacy Mode (ACI object [fvAccP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAccP/overview)). + * `annotation` (annotation) - (string) The annotation of the Legacy Mode object. + * `description` (descr) - (string) The description of the Legacy Mode object. + * `encapsulation` (encap) - (string) The VLAN or VXLAN encapsulation of the Legacy Mode object. + * `name` (name) - (string) The name of the Legacy Mode object. + * `name_alias` (nameAlias) - (string) The name alias of the Legacy Mode object. + * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. + * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. + +* `rogue_coop_exceptions` - (list) A list of Rogue Coop Exceptions (ACI object [fvRogueExceptionMac](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRogueExceptionMac/overview)). This attribute is supported in ACI versions: 5.2(3e) and later. + * `annotation` (annotation) - (string) The annotation of the Rogue Coop Exception object. + * `description` (descr) - (string) The description of the Rogue Coop Exception object. + * `mac` (mac) - (string) The MAC address of the Rogue Coop Exception object. + * `name` (name) - (string) The name of the Rogue Coop Exception object. + * `name_alias` (nameAlias) - (string) The name alias of the Rogue Coop Exception object. + +* `relation_to_monitor_policy` - (map) A map of Relation From Bridge Domain To Monitoring Policy (ACI object [fvRsABDPolMonPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsABDPolMonPol/overview)) pointing to Monitoring Policy (ACI Object [monEPGPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/monEPGPol/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To Monitoring Policy object. + * `monitoring_policy_name` (tnMonEPGPolName) - (string) The name of the Monitoring Policy object. + +* `relation_to_first_hop_security_policy` - (map) A map of Relation From Bridge Domain To First Hop Security Policy (ACI object [fvRsBDToFhs](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToFhs/overview)) pointing to First Hop Security Policy (ACI Object [fhsBDPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsBDPol/overview)). This attribute is supported in ACI versions: 3.0(1k) and later. + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To First Hop Security Policy object. + * `first_hop_security_policy_name` (tnFhsBDPolName) - (string) The name of the First Hop Security Policy object. + +* `relation_to_neighbor_discovery_interface_policy` - (map) A map of Relation From Bridge Domain To Neighbor Discovery Interface Policy (ACI object [fvRsBDToNdP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToNdP/overview)) pointing to Neighbor Discovery Interface Policy (ACI Object [ndIfPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/ndIfPol/overview)). This attribute is supported in ACI versions: 1.1(1j) and later. + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To Neighbor Discovery Interface Policy object. + * `neighbor_discovery_interface_policy_name` (tnNdIfPolName) - (string) The name of the Neighbor Discovery Interface Policy object. + +* `relation_to_netflow_monitor_policy` - (list) A list of Relation From Bridge Domain To NetFlow Monitor Policys (ACI object [fvRsBDToNetflowMonitorPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToNetflowMonitorPol/overview)) pointing to NetFlow Monitor Policy (ACI Object [netflowMonitorPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowMonitorPol/overview)). This attribute is supported in ACI versions: 2.2(1k) and later. + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To NetFlow Monitor Policy object. + * `filter_type` (fltType) - (string) The filter type of the NetFlow Monitor Policy object. + * `netflow_monitor_policy_name` (tnNetflowMonitorPolName) - (string) The name of the NetFlow Monitor Policy object. + +* `relation_to_l3_outsides` - (list) A list of Relation From Bridge Domain To L3 Outsides (ACI object [fvRsBDToOut](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToOut/overview)) pointing to L3 Outside (ACI Object [l3extOut](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extOut/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To L3 Outside object. + * `l3_outside_name` (tnL3extOutName) - (string) The name of the L3 Outside object. + +* `relation_to_route_control_profile` - (map) A map of Relation From Bridge Domain To Route Control Profile (ACI object [fvRsBDToProfile](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToProfile/overview)) pointing to Route Control Profile (ACI Object [rtctrlProfile](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/rtctrlProfile/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To Route Control Profile object. + * `l3_outside_name` (tnL3extOutName) - (string) The name of the L3 Outside object. + * `route_control_profile_name` (tnRtctrlProfileName) - (string) The name of the Route Control Profile object. + +* `relation_to_dhcp_relay_policy` - (map) A map of Relation From Bridge Domain To Dhcp Relay Policy (ACI object [fvRsBDToRelayP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToRelayP/overview)) pointing to Dhcp Relay Policy (ACI Object [dhcpRelayP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/dhcpRelayP/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To Dhcp Relay Policy object. + * `dhcp_relay_policy_name` (tnDhcpRelayPName) - (string) The name of the DHCP Relay Policy object. + +* `relation_to_end_point_retention_policy` - (map) A map of Relation From Bridge Domain To End Point Retention Policy (ACI object [fvRsBdToEpRet](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBdToEpRet/overview)) pointing to End Point Retention Policy (ACI Object [fvEpRetPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpRetPol/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To End Point Retention Policy object. + * `resolve_act` (resolveAct) - (string) null. + * `end_point_retention_policy_name` (tnFvEpRetPolName) - (string) The End Point Retention policy name associated with the bridge domain. + +* `relation_to_vrf` - (map) A map of Relation To VRF (ACI object [fvRsCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCtx/overview)) pointing to VRF (ACI Object [fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation To VRF object. + * `vrf_name` (tnFvCtxName) - (string) The name of the VRF object. + +* `relation_to_igmp_snooping_policy` - (map) A map of Relation To IGMP Snooping Policy (ACI object [fvRsIgmpsn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsIgmpsn/overview)) pointing to IGMP Snooping Policy (ACI Object [igmpSnoopPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/igmpSnoopPol/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation To IGMP Snooping Policy object. + * `igmp_snooping_policy_name` (tnIgmpSnoopPolName) - (string) The name of the IGMP Snooping Policy object. + +* `relation_to_mld_snooping_policy` - (map) A map of Relation To MLD Snooping Policy (ACI object [fvRsMldsn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsMldsn/overview)) pointing to MLD Snooping Policy (ACI Object [mldSnoopPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mldSnoopPol/overview)). This attribute is supported in ACI versions: 4.1(1i) and later. + * `annotation` (annotation) - (string) The annotation of the Relation To MLD Snooping Policy object. + * `mld_snooping_policy_name` (tnMldSnoopPolName) - (string) The name of the MLD Snooping Policy object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/first_hop_security_policy.md b/docs/data-sources/first_hop_security_policy.md new file mode 100644 index 000000000..c4f05705e --- /dev/null +++ b/docs/data-sources/first_hop_security_policy.md @@ -0,0 +1,80 @@ +--- +# Documentation 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). +subcategory: "Generic" +layout: "aci" +page_title: "ACI: aci_first_hop_security_policy" +sidebar_current: "docs-aci-data-source-aci_first_hop_security_policy" +description: |- + Data source for ACI First Hop Security Policy +--- + +# aci_first_hop_security_policy # + +Data source for ACI First Hop Security Policy + +## API Information ## + +* Class: [fhsBDPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsBDPol/overview) + + +* Distinguished Name Format: `uni/tn-{name}/bdpol-{name}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +```hcl + +data "aci_first_hop_security_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) +* `name` (name) - (string) The name of the First Hop Security Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the First Hop Security Policy object. +* `annotation` (annotation) - (string) The annotation of the First Hop Security Policy object. +* `description` (descr) - (string) The description of the First Hop Security Policy object. +* `ip_inspection` (ipInspectAdminSt) - (string) IP Inspection Admin Status. +* `name_alias` (nameAlias) - (string) The name alias of the First Hop Security Policy object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `router_advertisement` (raGuardAdminSt) - (string) Router Advertisement Guard Admin Status. +* `source_guard` (srcGuardAdminSt) - (string) Source Guard Admin Status. + +* `route_advertisement_guard_policy` - (map) A map of Route Advertisement Guard Policy (ACI object [fhsRaGuardPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsRaGuardPol/overview)). This attribute is supported in ACI versions: 3.0(1k) and later. + * `annotation` (annotation) - (string) The annotation of the Route Advertisement Guard Policy object. + * `description` (descr) - (string) The description of the Route Advertisement Guard Policy object. + * `managed_config_check` (managedConfigCheck) - (string) Perform Managed config flag check. + * `managed_config_flag` (managedConfigFlag) - (string) Managed config flag settting. + * `max_hop_limit` (maxHopLimit) - (string) Max allowed hop limit. + * `max_router_pref` (maxRouterPref) - (string) Allowed max router preference. + * `min_hop_limit` (minHopLimit) - (string) Min allowed hop limit. + * `name` (name) - (string) The name of the Route Advertisement Guard Policy object. + * `name_alias` (nameAlias) - (string) The name alias of the Route Advertisement Guard Policy object. + * `other_config_check` (otherConfigCheck) - (string) Perform Other config flag check. + * `other_config_flag` (otherConfigFlag) - (string) Other config flag settting. + * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. + * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/igmp_snooping_policy.md b/docs/data-sources/igmp_snooping_policy.md new file mode 100644 index 000000000..2ef267fba --- /dev/null +++ b/docs/data-sources/igmp_snooping_policy.md @@ -0,0 +1,72 @@ +--- +# Documentation 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). +subcategory: "Generic" +layout: "aci" +page_title: "ACI: aci_igmp_snooping_policy" +sidebar_current: "docs-aci-data-source-aci_igmp_snooping_policy" +description: |- + Data source for ACI IGMP Snooping Policy +--- + +# aci_igmp_snooping_policy # + +Data source for ACI IGMP Snooping Policy + +## API Information ## + +* Class: [igmpSnoopPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/igmpSnoopPol/overview) + + +* Distinguished Name Formats: + - `uni/fabric/snPol-{name}` + - `uni/tn-{name}/snPol-{name}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +```hcl + +data "aci_igmp_snooping_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) +* `name` (name) - (string) The name of the IGMP Snooping Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the IGMP Snooping Policy object. +* `admin_state` (adminSt) - (string) Administrative State. +* `annotation` (annotation) - (string) The annotation of the IGMP Snooping Policy object. +* `control` (ctrl) - (list) +* `description` (descr) - (string) The description of the IGMP Snooping Policy object. +* `last_member_interval` (lastMbrIntvl) - (string) When the last member query interval parameter is configured, the software removes the group state if no host responds before the timeout. +* `name_alias` (nameAlias) - (string) The name alias of the IGMP Snooping Policy object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `query_interval` (queryIntvl) - (string) +* `response_interval` (rspIntvl) - (string) The IGMP snooping query response interval. +* `start_query_count` (startQueryCnt) - (string) The interval before the IGMP query begins. +* `start_query_interval` (startQueryIntvl) - (string) The startup query interval. This configures the IGMP snooping query interval at startup. +* `querier_version` (ver) - (string) Version. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/mld_snooping_policy.md b/docs/data-sources/mld_snooping_policy.md new file mode 100644 index 000000000..afe3a73b9 --- /dev/null +++ b/docs/data-sources/mld_snooping_policy.md @@ -0,0 +1,72 @@ +--- +# Documentation 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). +subcategory: "Generic" +layout: "aci" +page_title: "ACI: aci_mld_snooping_policy" +sidebar_current: "docs-aci-data-source-aci_mld_snooping_policy" +description: |- + Data source for ACI MLD Snooping Policy +--- + +# aci_mld_snooping_policy # + +Data source for ACI MLD Snooping Policy + +## API Information ## + +* Class: [mldSnoopPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mldSnoopPol/overview) + + +* Distinguished Name Formats: + - `uni/fabric/mldsnoopPol-{name}` + - `uni/tn-{name}/mldsnoopPol-{name}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +```hcl + +data "aci_mld_snooping_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) +* `name` (name) - (string) The name of the MLD Snooping Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the MLD Snooping Policy object. +* `admin_state` (adminSt) - (string) +* `annotation` (annotation) - (string) The annotation of the MLD Snooping Policy object. +* `control` (ctrl) - (list) Controls for MLD Snoop Policy. +* `description` (descr) - (string) The description of the MLD Snooping Policy object. +* `last_member_interval` (lastMbrIntvl) - (string) When the last member query interval parameter is configured, the software removes the group state if no host responds before the timeout. +* `name_alias` (nameAlias) - (string) The name alias of the MLD Snooping Policy object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `query_interval` (queryIntvl) - (string) Query interval. +* `response_interval` (rspIntvl) - (string) The snooping query response interval. +* `start_query_count` (startQueryCnt) - (string) The interval before the query begins. +* `start_query_interval` (startQueryIntvl) - (string) The startup query interval. This configures the snooping query interval at startup. +* `ver` (ver) - (string) Version. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/neighbor_discovery_interface_policy.md b/docs/data-sources/neighbor_discovery_interface_policy.md new file mode 100644 index 000000000..86aba8a44 --- /dev/null +++ b/docs/data-sources/neighbor_discovery_interface_policy.md @@ -0,0 +1,74 @@ +--- +# Documentation 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). +subcategory: "Generic" +layout: "aci" +page_title: "ACI: aci_neighbor_discovery_interface_policy" +sidebar_current: "docs-aci-data-source-aci_neighbor_discovery_interface_policy" +description: |- + Data source for ACI Neighbor Discovery Interface Policy +--- + +# aci_neighbor_discovery_interface_policy # + +Data source for ACI Neighbor Discovery Interface Policy + +## API Information ## + +* Class: [ndIfPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/ndIfPol/overview) + + +* Distinguished Name Format: `uni/tn-{name}/ndifpol-{name}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +```hcl + +data "aci_neighbor_discovery_interface_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) +* `name` (name) - (string) The name of the Neighbor Discovery Interface Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Neighbor Discovery Interface Policy object. +* `annotation` (annotation) - (string) The annotation of the Neighbor Discovery Interface Policy object. +* `controller_state` (ctrl) - (list) The control state. +* `description` (descr) - (string) The description of the Neighbor Discovery Interface Policy object. +* `hop_limit` (hopLimit) - (string) The hop limit is used by hosts in outgoing packets and link parameters such as the link MTU. This facilitates centralized administration of critical parameters that can be set on routers and automatically propagated to all attached hosts. +* `mtu` (mtu) - (string) In the RA message, the maximum transmission unit (MTU) value that a host should use in packets that it originates. +* `name_alias` (nameAlias) - (string) The name alias of the Neighbor Discovery Interface Policy object. +* `neighbor_solicitation_interval` (nsIntvl) - (string) The neighbor solicitation interval is sent by a node to determine the link-layer address of a neighbor, or to verify that a neighbor is still reachable through a cached link-layer address. Neighbor solicitations are also used for duplicate address detection. +* `neighbor_solicitation_retries` (nsRetries) - (string) The retransmission retry count for for sending neighbor solicitation messages. +* `nud_retry_base` (nudRetryBase) - (string) Retransmission base for NUD neighbor solication messages. +* `nud_retry_interval` (nudRetryInterval) - (string) Retransmission interval between NUD neighbor solication messages. +* `nud_retry_max_attempts` (nudRetryMaxAttempts) - (string) Retransmission maximum number of attempts for NUD neighbor solication messages. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `router_advertisement_interval` (raIntvl) - (string) The interval for sending router advertisement messages. +* `router_advertisement_lifetime` (raLifetime) - (string) The lifetime associated with the default router. +* `reachable_time` (reachableTime) - (string) The reachable time, which is the time in milliseconds that a node assumes a neighbor is reachable after receiving a reachability confirmation. +* `retransmit_timer` (retransTimer) - (string) The retransmit timer has the time in milliseconds between retransmitted neighbor solicitation messages. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/relation_from_bridge_domain_to_l3_outside.md b/docs/data-sources/relation_from_bridge_domain_to_l3_outside.md new file mode 100644 index 000000000..abfb35d83 --- /dev/null +++ b/docs/data-sources/relation_from_bridge_domain_to_l3_outside.md @@ -0,0 +1,65 @@ +--- +# Documentation 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). +subcategory: "Generic" +layout: "aci" +page_title: "ACI: aci_relation_from_bridge_domain_to_l3_outside" +sidebar_current: "docs-aci-data-source-aci_relation_from_bridge_domain_to_l3_outside" +description: |- + Data source for ACI Relation From Bridge Domain To L3 Outside +--- + +# aci_relation_from_bridge_domain_to_l3_outside # + +Data source for ACI Relation From Bridge Domain To L3 Outside + +## API Information ## + +* Class: [fvRsBDToOut](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToOut/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Formats: + - `uni/tn-{name}/BD-{name}/rsBDToOut-{tnL3extOutName}` + - `uni/tn-{name}/rsBDToOut-{tnL3extOutName}` + - `uni/tn-{name}/svcBD-{name}/rsBDToOut-{tnL3extOutName}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +```hcl + +data "aci_relation_from_bridge_domain_to_l3_outside" "example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + l3_outside_name = aci_l3_outside.example.name +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/bridge_domain) ([fvBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvBD/overview)) + - The distinguished name (DN) of classes below can be used but currently there is no available resource for it: + - [fvSvcBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSvcBD/overview) + +* `l3_outside_name` (tnL3extOutName) - (string) The name of the L3 Outside object. This attribute can be referenced from a [resource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3_outside) with `aci_l3_outside.example.name` or from a [datasource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/data-sources/l3_outside) with `data.aci_l3_outside.example.name`. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Relation From Bridge Domain To L3 Outside object. +* `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To L3 Outside object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/relation_from_bridge_domain_to_netflow_monitor_policy.md b/docs/data-sources/relation_from_bridge_domain_to_netflow_monitor_policy.md new file mode 100644 index 000000000..c27bd7611 --- /dev/null +++ b/docs/data-sources/relation_from_bridge_domain_to_netflow_monitor_policy.md @@ -0,0 +1,68 @@ +--- +# Documentation 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). +subcategory: "Generic" +layout: "aci" +page_title: "ACI: aci_relation_from_bridge_domain_to_netflow_monitor_policy" +sidebar_current: "docs-aci-data-source-aci_relation_from_bridge_domain_to_netflow_monitor_policy" +description: |- + Data source for ACI Relation From Bridge Domain To NetFlow Monitor Policy +--- + +# aci_relation_from_bridge_domain_to_netflow_monitor_policy # + +Data source for ACI Relation From Bridge Domain To NetFlow Monitor Policy + +## API Information ## + +* Class: [fvRsBDToNetflowMonitorPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToNetflowMonitorPol/overview) + +* Supported in ACI versions: 2.2(1k) and later. + +* Distinguished Name Formats: + - `uni/tn-{name}/BD-{name}/rsBDToNetflowMonitorPol-[{tnNetflowMonitorPolName}]-{fltType}` + - `uni/tn-{name}/rsBDToNetflowMonitorPol-[{tnNetflowMonitorPolName}]-{fltType}` + - `uni/tn-{name}/svcBD-{name}/rsBDToNetflowMonitorPol-[{tnNetflowMonitorPolName}]-{fltType}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +```hcl + +data "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + filter_type = "ipv4" + netflow_monitor_policy_name = aci_netflow_monitor_policy.example.name +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/bridge_domain) ([fvBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvBD/overview)) + - The distinguished name (DN) of classes below can be used but currently there is no available resource for it: + - [fvSvcBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSvcBD/overview) + +* `filter_type` (fltType) - (string) The filter type of the NetFlow Monitor Policy object. + - Valid Values: `ce`, `ipv4`, `ipv6`, `unspecified`. +* `netflow_monitor_policy_name` (tnNetflowMonitorPolName) - (string) The name of the NetFlow Monitor Policy object. This attribute can be referenced from a [resource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/netflow_monitor_policy) with `aci_netflow_monitor_policy.example.name` or from a [datasource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/data-sources/netflow_monitor_policy) with `data.aci_netflow_monitor_policy.example.name`. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Relation From Bridge Domain To NetFlow Monitor Policy object. +* `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To NetFlow Monitor Policy object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/rogue_coop_exception.md b/docs/data-sources/rogue_coop_exception.md new file mode 100644 index 000000000..f4c1b203b --- /dev/null +++ b/docs/data-sources/rogue_coop_exception.md @@ -0,0 +1,62 @@ +--- +# Documentation 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). +subcategory: "Generic" +layout: "aci" +page_title: "ACI: aci_rogue_coop_exception" +sidebar_current: "docs-aci-data-source-aci_rogue_coop_exception" +description: |- + Data source for ACI Rogue Coop Exception +--- + +# aci_rogue_coop_exception # + +Data source for ACI Rogue Coop Exception + +## API Information ## + +* Class: [fvRogueExceptionMac](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRogueExceptionMac/overview) + +* Supported in ACI versions: 5.2(3e) and later. + +* Distinguished Name Format: `uni/tn-{name}/BD-{name}/rgexpmac-{mac}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +```hcl + +data "aci_rogue_coop_exception" "example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + mac = "00:00:00:00:00:01" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/bridge_domain) ([fvBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvBD/overview)) +* `mac` (mac) - (string) The MAC address of the Rogue Coop Exception object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Rogue Coop Exception object. +* `annotation` (annotation) - (string) The annotation of the Rogue Coop Exception object. +* `description` (descr) - (string) The description of the Rogue Coop Exception object. +* `name` (name) - (string) The name of the Rogue Coop Exception object. +* `name_alias` (nameAlias) - (string) The name alias of the Rogue Coop Exception object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/tag.md b/docs/data-sources/tag.md index 270bbed8a..1fe9f1e50 100644 --- a/docs/data-sources/tag.md +++ b/docs/data-sources/tag.md @@ -57,6 +57,8 @@ data "aci_tag" "example_application_epg" { - [aci_cloud_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_epg) ([cloudEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudEPg/overview)) - [aci_cloud_external_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_external_epg) ([cloudExtEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudExtEPg/overview)) - [aci_cloud_service_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_service_epg) ([cloudSvcEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudSvcEPg/overview)) + - [aci_dhcp_relay_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/dhcp_relay_policy) ([dhcpRelayP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/dhcpRelayP/overview)) + - [aci_first_hop_security_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/first_hop_security_policy) ([fhsBDPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsBDPol/overview)) - [aci_trust_control_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/trust_control_policy) ([fhsTrustCtrlPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsTrustCtrlPol/overview)) - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) - [aci_application_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_profile) ([fvAp](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAp/overview)) @@ -67,13 +69,11 @@ data "aci_tag" "example_application_epg" { - [aci_endpoint_security_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_security_group) ([fvESg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvESg/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) - [aci_endpoint_tag_mac](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_mac) ([fvEpMacTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpMacTag/overview)) + - [aci_end_point_retention_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/end_point_retention_policy) ([fvEpRetPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpRetPol/overview)) - [aci_vrf_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group) ([fvFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRGroup/overview)) - [aci_vrf_fallback_route_group_member](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group_member) ([fvFBRMember](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRMember/overview)) - [aci_vrf_fallback_route](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route) ([fvFBRoute](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRoute/overview)) - [aci_epg_useg_ad_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ad_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) - - [aci_epg_useg_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) - - [aci_epg_useg_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) - - [aci_relation_to_consumed_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_contract) ([fvRsCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCons/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. ### Read-Only ### diff --git a/docs/resources/annotation.md b/docs/resources/annotation.md index f4d7cd03f..437de855f 100644 --- a/docs/resources/annotation.md +++ b/docs/resources/annotation.md @@ -66,6 +66,8 @@ All examples for the Annotation resource can be found in the [examples](https:// - [aci_cloud_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_epg) ([cloudEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudEPg/overview)) - [aci_cloud_external_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_external_epg) ([cloudExtEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudExtEPg/overview)) - [aci_cloud_service_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_service_epg) ([cloudSvcEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudSvcEPg/overview)) + - [aci_dhcp_relay_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/dhcp_relay_policy) ([dhcpRelayP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/dhcpRelayP/overview)) + - [aci_first_hop_security_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/first_hop_security_policy) ([fhsBDPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsBDPol/overview)) - [aci_trust_control_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/trust_control_policy) ([fhsTrustCtrlPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsTrustCtrlPol/overview)) - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) - [aci_application_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_profile) ([fvAp](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAp/overview)) @@ -76,13 +78,11 @@ All examples for the Annotation resource can be found in the [examples](https:// - [aci_endpoint_security_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_security_group) ([fvESg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvESg/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) - [aci_endpoint_tag_mac](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_mac) ([fvEpMacTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpMacTag/overview)) + - [aci_end_point_retention_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/end_point_retention_policy) ([fvEpRetPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpRetPol/overview)) - [aci_vrf_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group) ([fvFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRGroup/overview)) - [aci_vrf_fallback_route_group_member](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group_member) ([fvFBRMember](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRMember/overview)) - [aci_vrf_fallback_route](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route) ([fvFBRoute](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRoute/overview)) - [aci_epg_useg_ad_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ad_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) - - [aci_epg_useg_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) - - [aci_epg_useg_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) - - [aci_relation_to_consumed_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_contract) ([fvRsCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCons/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. * `value` (value) - (string) The value of the property. diff --git a/docs/resources/bridge_domain.md b/docs/resources/bridge_domain.md new file mode 100644 index 000000000..1d2dd5f9a --- /dev/null +++ b/docs/resources/bridge_domain.md @@ -0,0 +1,416 @@ +--- +# Documentation 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). +subcategory: "Networking" +layout: "aci" +page_title: "ACI: aci_bridge_domain" +sidebar_current: "docs-aci-resource-aci_bridge_domain" +description: |- + Manages ACI Bridge Domain +--- + +# aci_bridge_domain # + +Manages ACI Bridge Domain + + + +## API Information ## + +* Class: [fvBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvBD/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Format: `uni/tn-{name}/BD-{name}` + +## GUI Information ## + +* Location: `Tenants -> Networking -> Bridge Domains` + +## Example Usage ## + +The configuration snippet below creates a Bridge Domain with only required attributes. + +```hcl + +resource "aci_bridge_domain" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` +The configuration snippet below shows all possible attributes of the Bridge Domain. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_bridge_domain" "full_example_tenant" { + parent_dn = aci_tenant.example.id + optimize_wan_bandwidth = "no" + annotation = "annotation" + arp_flooding = "no" + description = "description_1" + enable_rogue_exception_mac = "no" + clear_remote_mac_entries = "no" + endpoint_move_detection_mode = "garp" + advertise_host_routes = "no" + intersite_bum_traffic_allow = "no" + intersite_l2_stretch = "no" + ip_learning = "no" + pim_ipv6 = "no" + limit_ip_learn_to_subnets = "no" + link_local_ipv6_address = "fe80::1" + custom_mac_address = "00:22:BD:F8:19:FE" + drop_arp_with_multicast_smac = "no" + pim = "no" + multi_destination_flooding = "bd-flood" + name = "test_name" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + bridge_domain_type = "fc" + unicast_routing = "no" + l2_unknown_unicast_flooding = "proxy" + l3_unknown_multicast_flooding = "flood" + ipv6_l3_unknown_multicast_flooding = "flood" + virtual_mac_address = "00:22:BD:F8:19:FB" + legacy_mode = { + annotation = "annotation_1" + description = "description_1" + encapsulation = "vlan-100" + name = "name_1" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + } + rogue_coop_exceptions = [ + { + annotation = "annotation_1" + description = "description_1" + mac = "00:00:00:00:00:00" + name = "name_1" + name_alias = "name_alias_1" + } + ] + relation_to_monitor_policy = { + annotation = "annotation_1" + monitoring_policy_name = aci_monitoring_policy.example.name + } + relation_to_first_hop_security_policy = { + annotation = "annotation_1" + first_hop_security_policy_name = aci_first_hop_security_policy.example.name + } + relation_to_neighbor_discovery_interface_policy = { + annotation = "annotation_1" + neighbor_discovery_interface_policy_name = aci_neighbor_discovery_interface_policy.example.name + } + relation_to_netflow_monitor_policy = [ + { + annotation = "annotation_1" + filter_type = "ce" + netflow_monitor_policy_name = aci_netflow_monitor_policy.example.name + } + ] + relation_to_l3_outsides = [ + { + annotation = "annotation_1" + l3_outside_name = aci_l3_outside.example.name + } + ] + relation_to_route_control_profile = { + annotation = "annotation_1" + l3_outside_name = aci_l3_outside.example.name + route_control_profile_name = aci_route_control_profile.example.name + } + relation_to_dhcp_relay_policy = { + annotation = "annotation_1" + dhcp_relay_policy_name = aci_dhcp_relay_policy.example.name + } + relation_to_end_point_retention_policy = { + annotation = "annotation_1" + resolve_act = "inherit" + end_point_retention_policy_name = aci_end_point_retention_policy.example.name + } + relation_to_vrf = { + annotation = "annotation_1" + vrf_name = aci_vrf.example.name + } + relation_to_igmp_snooping_policy = { + annotation = "annotation_1" + igmp_snooping_policy_name = aci_igmp_snooping_policy.example.name + } + relation_to_mld_snooping_policy = { + annotation = "annotation_1" + mld_snooping_policy_name = aci_mld_snooping_policy.example.name + } + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the Bridge Domain resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_bridge_domain) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) +* `name` (name) - (string) The name of the Bridge Domain object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Bridge Domain object. + +### Optional ### + +* `optimize_wan_bandwidth` (OptimizeWanBandwidth) - (string) Optimize WAN Bandwidth for the Bridge Domain object. + - Default: `no` + - Valid Values: `no`, `yes`. +* `annotation` (annotation) - (string) The annotation of the Bridge Domain object. + - Default: `orchestrator:terraform` +* `arp_flooding` (arpFlood) - (string) Enable ARP flooding for the Bridge Domain object. If flooding is disabled, unicast routing will be performed on the target IP address. + - Default: `no` + - Valid Values: `no`, `yes`. +* `description` (descr) - (string) The description of the Bridge Domain object. +* `enable_rogue_exception_mac` (enableRogueExceptMac) - (string) Enable rogue exception based on MAC wildcard for the Bridge Domain object. + - Default: `no` + - Valid Values: `no`, `yes`. +* `clear_remote_mac_entries` (epClear) - (string) Clear all End-Points in leafs for the Bridge Domain object. + - Default: `no` + - Valid Values: `no`, `yes`. +* `endpoint_move_detection_mode` (epMoveDetectMode) - (string) The End Point move detection option uses the Gratuitous Address Resolution Protocol (GARP). A gratuitous ARP is an ARP broadcast-type of packet that is used to verify that no other device on the network has the same IP address as the sending device. + - Valid Values: ``, `garp`. +* `advertise_host_routes` (hostBasedRouting) - (string) Advertise host routes (/32 prefixes) out of the L3Out(s) associated to the Bridge Domain object. + - Default: `no` + - Valid Values: `no`, `yes`. +* `intersite_bum_traffic_allow` (intersiteBumTrafficAllow) - (string) Enable intersite Broadcast, Unknown-Unicast and Multicast (BUM) traffic between sites for the Bridge Domain object. + - Default: `no` + - Valid Values: `no`, `yes`. +* `intersite_l2_stretch` (intersiteL2Stretch) - (string) Enable L2 stretch between sites for the Bridge Domain object. + - Default: `no` + - Valid Values: `no`, `yes`. +* `ip_learning` (ipLearning) - (string) The IP learning setting of the Bridge Domain object. + - Default: `yes` + - Valid Values: `no`, `yes`. +* `pim_ipv6` (ipv6McastAllow) - (string) Enable IPv6 multicast traffic for the Bridge Domain object. + - Default: `no` + - Valid Values: `no`, `yes`. +* `limit_ip_learn_to_subnets` (limitIpLearnToSubnets) - (string) Limit IP address learning to subnets for the Bridge Domain object. Every %!s(MISSING) object can have multiple subnets associated with it. + - Default: `yes` + - Valid Values: `no`, `yes`. +* `link_local_ipv6_address` (llAddr) - (string) The override of the system generated IPv6 link-local address. +* `custom_mac_address` (mac) - (string) The MAC address of the Bridge Domain object. + - Default: `280487012409856` +* `drop_arp_with_multicast_smac` (mcastARPDrop) - (string) Drop roque multicast ARP packets for the Bridge Domain object. + - Default: `yes` + - Valid Values: `no`, `yes`. +* `pim` (mcastAllow) - (string) Enable IPv4 multicast traffic for the Bridge Domain object. + - Default: `no` + - Valid Values: `no`, `yes`. +* `multi_destination_flooding` (multiDstPktAct) - (string) The multiple destination forwarding method for L2 Multicast, Broadcast, and Link Layer traffic types. + - Default: `bd-flood` + - Valid Values: `bd-flood`, `drop`, `encap-flood`. +* `name_alias` (nameAlias) - (string) The name alias of the Bridge Domain object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `bridge_domain_type` (type) - (string) domain type. + - Default: `regular` + - Valid Values: `fc`, `regular`. +* `unicast_routing` (unicastRoute) - (string) Enable the forwarding method based on predefined forwarding criteria (IP or MAC address). + - Default: `yes` + - Valid Values: `no`, `yes`. +* `l2_unknown_unicast_flooding` (unkMacUcastAct) - (string) The forwarding method for unknown layer 2 destinations. + - Default: `proxy` + - Valid Values: `flood`, `proxy`. +* `l3_unknown_multicast_flooding` (unkMcastAct) - (string) The forwarding method for unknown layer multicast destinations. + - Default: `flood` + - Valid Values: `flood`, `opt-flood`. +* `ipv6_l3_unknown_multicast_flooding` (v6unkMcastAct) - (string) The forwarding method for unknown IPv6 multicast destinations. + - Default: `flood` + - Valid Values: `flood`, `opt-flood`. +* `virtual_mac_address` (vmac) - (string) Virtual MAC address of the BD/SVI. This is used when the BD is extended to multiple sites using l2 Outside. + - Default: `not-applicable` + +* `legacy_mode` - (map) A map of Legacy Mode (ACI object [fvAccP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAccP/overview)). + + #### Required #### + + * `encapsulation` (encap) - (string) The VLAN or VXLAN encapsulation of the Legacy Mode object. + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Legacy Mode object. + - Default: `orchestrator:terraform` + * `description` (descr) - (string) The description of the Legacy Mode object. + * `name` (name) - (string) The name of the Legacy Mode object. + * `name_alias` (nameAlias) - (string) The name alias of the Legacy Mode object. + * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. + * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. + +* `rogue_coop_exceptions` - (list) A list of Rogue Coop Exceptions (ACI object [fvRogueExceptionMac](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRogueExceptionMac/overview)). Rogue Coop Exceptions can also be configured using a separate [aci_rogue_coop_exception](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/rogue_coop_exception) resource. This attribute is supported in ACI versions: 5.2(3e) and later. + + #### Required #### + + * `mac` (mac) - (string) The MAC address of the Rogue Coop Exception object. + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Rogue Coop Exception object. + - Default: `orchestrator:terraform` + * `description` (descr) - (string) The description of the Rogue Coop Exception object. + * `name` (name) - (string) The name of the Rogue Coop Exception object. + * `name_alias` (nameAlias) - (string) The name alias of the Rogue Coop Exception object. + +* `relation_to_monitor_policy` - (map) A map of Relation From Bridge Domain To Monitoring Policy (ACI object [fvRsABDPolMonPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsABDPolMonPol/overview)) pointing to Monitoring Policy (ACI Object [monEPGPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/monEPGPol/overview)) which can be configured using the [aci_monitoring_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/monitoring_policy) resource. + + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To Monitoring Policy object. + - Default: `orchestrator:terraform` + * `monitoring_policy_name` (tnMonEPGPolName) - (string) The name of the Monitoring Policy object. + +* `relation_to_first_hop_security_policy` - (map) A map of Relation From Bridge Domain To First Hop Security Policy (ACI object [fvRsBDToFhs](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToFhs/overview)) pointing to First Hop Security Policy (ACI Object [fhsBDPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsBDPol/overview)) which can be configured using the [aci_first_hop_security_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/first_hop_security_policy) resource. This attribute is supported in ACI versions: 3.0(1k) and later. + + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To First Hop Security Policy object. + - Default: `orchestrator:terraform` + * `first_hop_security_policy_name` (tnFhsBDPolName) - (string) The name of the First Hop Security Policy object. + +* `relation_to_neighbor_discovery_interface_policy` - (map) A map of Relation From Bridge Domain To Neighbor Discovery Interface Policy (ACI object [fvRsBDToNdP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToNdP/overview)) pointing to Neighbor Discovery Interface Policy (ACI Object [ndIfPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/ndIfPol/overview)) which can be configured using the [aci_neighbor_discovery_interface_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/neighbor_discovery_interface_policy) resource. This attribute is supported in ACI versions: 1.1(1j) and later. + + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To Neighbor Discovery Interface Policy object. + - Default: `orchestrator:terraform` + * `neighbor_discovery_interface_policy_name` (tnNdIfPolName) - (string) The name of the Neighbor Discovery Interface Policy object. + +* `relation_to_netflow_monitor_policy` - (list) A list of Relation From Bridge Domain To NetFlow Monitor Policys (ACI object [fvRsBDToNetflowMonitorPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToNetflowMonitorPol/overview)) pointing to NetFlow Monitor Policy (ACI Object [netflowMonitorPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowMonitorPol/overview)) which can be configured using the [aci_netflow_monitor_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/netflow_monitor_policy) resource. This attribute is supported in ACI versions: 2.2(1k) and later. + + #### Required #### + + * `filter_type` (fltType) - (string) The filter type of the NetFlow Monitor Policy object. + * `netflow_monitor_policy_name` (tnNetflowMonitorPolName) - (string) The name of the NetFlow Monitor Policy object. This attribute can be referenced from a [resource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/netflow_monitor_policy) with `aci_netflow_monitor_policy.example.name` or from a [datasource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/data-sources/netflow_monitor_policy) with `data.aci_netflow_monitor_policy.example.name`. + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To NetFlow Monitor Policy object. + - Default: `orchestrator:terraform` + +* `relation_to_l3_outsides` - (list) A list of Relation From Bridge Domain To L3 Outsides (ACI object [fvRsBDToOut](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToOut/overview)) pointing to L3 Outside (ACI Object [l3extOut](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extOut/overview)) which can be configured using the [aci_l3_outside](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3_outside) resource. + + #### Required #### + + * `l3_outside_name` (tnL3extOutName) - (string) The name of the L3 Outside object. This attribute can be referenced from a [resource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3_outside) with `aci_l3_outside.example.name` or from a [datasource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/data-sources/l3_outside) with `data.aci_l3_outside.example.name`. + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To L3 Outside object. + - Default: `orchestrator:terraform` + +* `relation_to_route_control_profile` - (map) A map of Relation From Bridge Domain To Route Control Profile (ACI object [fvRsBDToProfile](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToProfile/overview)) pointing to Route Control Profile (ACI Object [rtctrlProfile](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/rtctrlProfile/overview)) which can be configured using the [aci_route_control_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/route_control_profile) resource. + + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To Route Control Profile object. + - Default: `orchestrator:terraform` + * `l3_outside_name` (tnL3extOutName) - (string) The name of the L3 Outside object. + * `route_control_profile_name` (tnRtctrlProfileName) - (string) The name of the Route Control Profile object. + +* `relation_to_dhcp_relay_policy` - (map) A map of Relation From Bridge Domain To Dhcp Relay Policy (ACI object [fvRsBDToRelayP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToRelayP/overview)) pointing to Dhcp Relay Policy (ACI Object [dhcpRelayP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/dhcpRelayP/overview)) which can be configured using the [aci_dhcp_relay_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/dhcp_relay_policy) resource. + + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To Dhcp Relay Policy object. + - Default: `orchestrator:terraform` + * `dhcp_relay_policy_name` (tnDhcpRelayPName) - (string) The name of the DHCP Relay Policy object. + +* `relation_to_end_point_retention_policy` - (map) A map of Relation From Bridge Domain To End Point Retention Policy (ACI object [fvRsBdToEpRet](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBdToEpRet/overview)) pointing to End Point Retention Policy (ACI Object [fvEpRetPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpRetPol/overview)) which can be configured using the [aci_end_point_retention_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/end_point_retention_policy) resource. + + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To End Point Retention Policy object. + - Default: `orchestrator:terraform` + * `resolve_act` (resolveAct) - (string) null. + - Default: `resolve` + - Valid Values: `inherit`, `resolve`. + * `end_point_retention_policy_name` (tnFvEpRetPolName) - (string) The End Point Retention policy name associated with the bridge domain. + +* `relation_to_vrf` - (map) A map of Relation To VRF (ACI object [fvRsCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCtx/overview)) pointing to VRF (ACI Object [fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) which can be configured using the [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) resource. + + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To VRF object. + - Default: `orchestrator:terraform` + * `vrf_name` (tnFvCtxName) - (string) The name of the VRF object. + +* `relation_to_igmp_snooping_policy` - (map) A map of Relation To IGMP Snooping Policy (ACI object [fvRsIgmpsn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsIgmpsn/overview)) pointing to IGMP Snooping Policy (ACI Object [igmpSnoopPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/igmpSnoopPol/overview)) which can be configured using the [aci_igmp_snooping_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/igmp_snooping_policy) resource. + + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To IGMP Snooping Policy object. + - Default: `orchestrator:terraform` + * `igmp_snooping_policy_name` (tnIgmpSnoopPolName) - (string) The name of the IGMP Snooping Policy object. + +* `relation_to_mld_snooping_policy` - (map) A map of Relation To MLD Snooping Policy (ACI object [fvRsMldsn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsMldsn/overview)) pointing to MLD Snooping Policy (ACI Object [mldSnoopPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mldSnoopPol/overview)) which can be configured using the [aci_mld_snooping_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/mld_snooping_policy) resource. This attribute is supported in ACI versions: 4.1(1i) and later. + + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To MLD Snooping Policy object. + - Default: `orchestrator:terraform` + * `mld_snooping_policy_name` (tnMldSnoopPolName) - (string) The name of the MLD Snooping Policy object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing Bridge Domain can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: + +``` +terraform import aci_bridge_domain.example_tenant uni/tn-{name}/BD-{name} +``` + +Starting in Terraform version 1.5, an existing Bridge Domain can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/BD-{name}" + to = aci_bridge_domain.example_tenant +} +``` diff --git a/docs/resources/first_hop_security_policy.md b/docs/resources/first_hop_security_policy.md new file mode 100644 index 000000000..dd45ba06e --- /dev/null +++ b/docs/resources/first_hop_security_policy.md @@ -0,0 +1,184 @@ +--- +# Documentation 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). +subcategory: "Generic" +layout: "aci" +page_title: "ACI: aci_first_hop_security_policy" +sidebar_current: "docs-aci-resource-aci_first_hop_security_policy" +description: |- + Manages ACI First Hop Security Policy +--- + +# aci_first_hop_security_policy # + +Manages ACI First Hop Security Policy + + + +## API Information ## + +* Class: [fhsBDPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsBDPol/overview) + + +* Distinguished Name Format: `uni/tn-{name}/bdpol-{name}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +The configuration snippet below creates a First Hop Security Policy with only required attributes. + +```hcl + +resource "aci_first_hop_security_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` +The configuration snippet below shows all possible attributes of the First Hop Security Policy. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_first_hop_security_policy" "full_example_tenant" { + parent_dn = aci_tenant.example.id + annotation = "annotation" + description = "description_1" + ip_inspection = "disabled" + name = "test_name" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + router_advertisement = "disabled" + source_guard = "disabled" + route_advertisement_guard_policy = { + annotation = "annotation_1" + description = "description_1" + managed_config_check = "no" + managed_config_flag = "no" + max_hop_limit = "10" + max_router_pref = "disabled" + min_hop_limit = "1" + name = "name_1" + name_alias = "name_alias_1" + other_config_check = "no" + other_config_flag = "no" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + } + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the First Hop Security Policy resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_first_hop_security_policy) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) +* `name` (name) - (string) The name of the First Hop Security Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the First Hop Security Policy object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the First Hop Security Policy object. + - Default: `orchestrator:terraform` +* `description` (descr) - (string) The description of the First Hop Security Policy object. +* `ip_inspection` (ipInspectAdminSt) - (string) IP Inspection Admin Status. + - Default: `enabled-both` + - Valid Values: `disabled`, `enabled-both`, `enabled-ipv4`, `enabled-ipv6`. +* `name_alias` (nameAlias) - (string) The name alias of the First Hop Security Policy object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `router_advertisement` (raGuardAdminSt) - (string) Router Advertisement Guard Admin Status. + - Default: `enabled` + - Valid Values: `disabled`, `enabled`. +* `source_guard` (srcGuardAdminSt) - (string) Source Guard Admin Status. + - Default: `enabled-both` + - Valid Values: `disabled`, `enabled-both`, `enabled-ipv4`, `enabled-ipv6`. + +* `route_advertisement_guard_policy` - (map) A map of Route Advertisement Guard Policy (ACI object [fhsRaGuardPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsRaGuardPol/overview)). This attribute is supported in ACI versions: 3.0(1k) and later. + + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Route Advertisement Guard Policy object. + - Default: `orchestrator:terraform` + * `description` (descr) - (string) The description of the Route Advertisement Guard Policy object. + * `managed_config_check` (managedConfigCheck) - (string) Perform Managed config flag check. + - Default: `false` + - Valid Values: `no`, `yes`. + * `managed_config_flag` (managedConfigFlag) - (string) Managed config flag settting. + - Default: `false` + - Valid Values: `no`, `yes`. + * `max_hop_limit` (maxHopLimit) - (string) Max allowed hop limit. + - Default: `0.000000` + * `max_router_pref` (maxRouterPref) - (string) Allowed max router preference. + - Default: `disabled` + - Valid Values: `disabled`, `high`, `low`, `medium`. + * `min_hop_limit` (minHopLimit) - (string) Min allowed hop limit. + - Default: `0.000000` + * `name` (name) - (string) The name of the Route Advertisement Guard Policy object. + * `name_alias` (nameAlias) - (string) The name alias of the Route Advertisement Guard Policy object. + * `other_config_check` (otherConfigCheck) - (string) Perform Other config flag check. + - Default: `false` + - Valid Values: `no`, `yes`. + * `other_config_flag` (otherConfigFlag) - (string) Other config flag settting. + - Default: `false` + - Valid Values: `no`, `yes`. + * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. + * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing First Hop Security Policy can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: + +``` +terraform import aci_first_hop_security_policy.example_tenant uni/tn-{name}/bdpol-{name} +``` + +Starting in Terraform version 1.5, an existing First Hop Security Policy can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/bdpol-{name}" + to = aci_first_hop_security_policy.example_tenant +} +``` diff --git a/docs/resources/igmp_snooping_policy.md b/docs/resources/igmp_snooping_policy.md new file mode 100644 index 000000000..f75da62ed --- /dev/null +++ b/docs/resources/igmp_snooping_policy.md @@ -0,0 +1,153 @@ +--- +# Documentation 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). +subcategory: "Generic" +layout: "aci" +page_title: "ACI: aci_igmp_snooping_policy" +sidebar_current: "docs-aci-resource-aci_igmp_snooping_policy" +description: |- + Manages ACI IGMP Snooping Policy +--- + +# aci_igmp_snooping_policy # + +Manages ACI IGMP Snooping Policy + + + +## API Information ## + +* Class: [igmpSnoopPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/igmpSnoopPol/overview) + + +* Distinguished Name Formats: + - `uni/fabric/snPol-{name}` + - `uni/tn-{name}/snPol-{name}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +The configuration snippet below creates a IGMP Snooping Policy with only required attributes. + +```hcl + +resource "aci_igmp_snooping_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` +The configuration snippet below shows all possible attributes of the IGMP Snooping Policy. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_igmp_snooping_policy" "full_example_tenant" { + parent_dn = aci_tenant.example.id + admin_state = "disabled" + annotation = "annotation" + control = ["fast-leave", "querier"] + description = "description_1" + last_member_interval = "3" + name = "test_name" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + query_interval = "140" + response_interval = "11" + start_query_count = "9" + start_query_interval = "2" + querier_version = "v2" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the IGMP Snooping Policy resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_igmp_snooping_policy) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) +* `name` (name) - (string) The name of the IGMP Snooping Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the IGMP Snooping Policy object. + +### Optional ### + +* `admin_state` (adminSt) - (string) Administrative State. + - Default: `enabled` + - Valid Values: `disabled`, `enabled`. +* `annotation` (annotation) - (string) The annotation of the IGMP Snooping Policy object. + - Default: `orchestrator:terraform` +* `control` (ctrl) - (list) + - Valid Values: `fast-leave`, `opt-flood`, `querier`, `routing`. +* `description` (descr) - (string) The description of the IGMP Snooping Policy object. +* `last_member_interval` (lastMbrIntvl) - (string) When the last member query interval parameter is configured, the software removes the group state if no host responds before the timeout. + - Default: `1.000000` +* `name_alias` (nameAlias) - (string) The name alias of the IGMP Snooping Policy object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `query_interval` (queryIntvl) - (string) + - Default: `125.000000` +* `response_interval` (rspIntvl) - (string) The IGMP snooping query response interval. + - Default: `10.000000` +* `start_query_count` (startQueryCnt) - (string) The interval before the IGMP query begins. + - Default: `2.000000` +* `start_query_interval` (startQueryIntvl) - (string) The startup query interval. This configures the IGMP snooping query interval at startup. + - Default: `31.000000` +* `querier_version` (ver) - (string) Version. + - Default: `v3` + - Valid Values: `unspecified`, `v1`, `v2`, `v3`. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing IGMP Snooping Policy can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: + +``` +terraform import aci_igmp_snooping_policy.example_tenant uni/tn-{name}/snPol-{name} +``` + +Starting in Terraform version 1.5, an existing IGMP Snooping Policy can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/snPol-{name}" + to = aci_igmp_snooping_policy.example_tenant +} +``` diff --git a/docs/resources/mld_snooping_policy.md b/docs/resources/mld_snooping_policy.md new file mode 100644 index 000000000..aed0dff32 --- /dev/null +++ b/docs/resources/mld_snooping_policy.md @@ -0,0 +1,153 @@ +--- +# Documentation 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). +subcategory: "Generic" +layout: "aci" +page_title: "ACI: aci_mld_snooping_policy" +sidebar_current: "docs-aci-resource-aci_mld_snooping_policy" +description: |- + Manages ACI MLD Snooping Policy +--- + +# aci_mld_snooping_policy # + +Manages ACI MLD Snooping Policy + + + +## API Information ## + +* Class: [mldSnoopPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mldSnoopPol/overview) + + +* Distinguished Name Formats: + - `uni/fabric/mldsnoopPol-{name}` + - `uni/tn-{name}/mldsnoopPol-{name}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +The configuration snippet below creates a MLD Snooping Policy with only required attributes. + +```hcl + +resource "aci_mld_snooping_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` +The configuration snippet below shows all possible attributes of the MLD Snooping Policy. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_mld_snooping_policy" "full_example_tenant" { + parent_dn = aci_tenant.example.id + admin_state = "disabled" + annotation = "annotation" + control = ["fast-leave", "querier"] + description = "description_1" + last_member_interval = "3" + name = "test_name" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + query_interval = "140" + response_interval = "11" + start_query_count = "9" + start_query_interval = "2" + ver = "unspecified" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the MLD Snooping Policy resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_mld_snooping_policy) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) +* `name` (name) - (string) The name of the MLD Snooping Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the MLD Snooping Policy object. + +### Optional ### + +* `admin_state` (adminSt) - (string) + - Default: `disabled` + - Valid Values: `disabled`, `enabled`. +* `annotation` (annotation) - (string) The annotation of the MLD Snooping Policy object. + - Default: `orchestrator:terraform` +* `control` (ctrl) - (list) Controls for MLD Snoop Policy. + - Valid Values: `fast-leave`, `opt-flood`, `querier`, `routing`. +* `description` (descr) - (string) The description of the MLD Snooping Policy object. +* `last_member_interval` (lastMbrIntvl) - (string) When the last member query interval parameter is configured, the software removes the group state if no host responds before the timeout. + - Default: `1.000000` +* `name_alias` (nameAlias) - (string) The name alias of the MLD Snooping Policy object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `query_interval` (queryIntvl) - (string) Query interval. + - Default: `125.000000` +* `response_interval` (rspIntvl) - (string) The snooping query response interval. + - Default: `10.000000` +* `start_query_count` (startQueryCnt) - (string) The interval before the query begins. + - Default: `2.000000` +* `start_query_interval` (startQueryIntvl) - (string) The startup query interval. This configures the snooping query interval at startup. + - Default: `31.000000` +* `ver` (ver) - (string) Version. + - Default: `v2` + - Valid Values: `unspecified`, `v1`, `v2`. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing MLD Snooping Policy can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: + +``` +terraform import aci_mld_snooping_policy.example_tenant uni/tn-{name}/mldsnoopPol-{name} +``` + +Starting in Terraform version 1.5, an existing MLD Snooping Policy can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/mldsnoopPol-{name}" + to = aci_mld_snooping_policy.example_tenant +} +``` diff --git a/docs/resources/neighbor_discovery_interface_policy.md b/docs/resources/neighbor_discovery_interface_policy.md new file mode 100644 index 000000000..c306a9469 --- /dev/null +++ b/docs/resources/neighbor_discovery_interface_policy.md @@ -0,0 +1,162 @@ +--- +# Documentation 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). +subcategory: "Generic" +layout: "aci" +page_title: "ACI: aci_neighbor_discovery_interface_policy" +sidebar_current: "docs-aci-resource-aci_neighbor_discovery_interface_policy" +description: |- + Manages ACI Neighbor Discovery Interface Policy +--- + +# aci_neighbor_discovery_interface_policy # + +Manages ACI Neighbor Discovery Interface Policy + + + +## API Information ## + +* Class: [ndIfPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/ndIfPol/overview) + + +* Distinguished Name Format: `uni/tn-{name}/ndifpol-{name}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +The configuration snippet below creates a Neighbor Discovery Interface Policy with only required attributes. + +```hcl + +resource "aci_neighbor_discovery_interface_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` +The configuration snippet below shows all possible attributes of the Neighbor Discovery Interface Policy. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_neighbor_discovery_interface_policy" "full_example_tenant" { + parent_dn = aci_tenant.example.id + annotation = "annotation" + controller_state = ["managed-cfg"] + description = "description_1" + hop_limit = "40" + mtu = "8700" + name = "test_name" + name_alias = "name_alias_1" + neighbor_solicitation_interval = "1500" + neighbor_solicitation_retries = "6" + nud_retry_base = "2" + nud_retry_interval = "1300" + nud_retry_max_attempts = "5" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + router_advertisement_interval = "500" + router_advertisement_lifetime = "1500" + reachable_time = "2" + retransmit_timer = "2" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the Neighbor Discovery Interface Policy resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_neighbor_discovery_interface_policy) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) +* `name` (name) - (string) The name of the Neighbor Discovery Interface Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Neighbor Discovery Interface Policy object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the Neighbor Discovery Interface Policy object. + - Default: `orchestrator:terraform` +* `controller_state` (ctrl) - (list) The control state. + - Default: `unspecified`. + - Valid Values: `managed-cfg`, `other-cfg`, `suppress-ra`, `suppress-ra-mtu`, `unsolicit-na-glean`, `unspecified`. +* `description` (descr) - (string) The description of the Neighbor Discovery Interface Policy object. +* `hop_limit` (hopLimit) - (string) The hop limit is used by hosts in outgoing packets and link parameters such as the link MTU. This facilitates centralized administration of critical parameters that can be set on routers and automatically propagated to all attached hosts. + - Default: `64.000000` +* `mtu` (mtu) - (string) In the RA message, the maximum transmission unit (MTU) value that a host should use in packets that it originates. + - Default: `9000.000000` +* `name_alias` (nameAlias) - (string) The name alias of the Neighbor Discovery Interface Policy object. +* `neighbor_solicitation_interval` (nsIntvl) - (string) The neighbor solicitation interval is sent by a node to determine the link-layer address of a neighbor, or to verify that a neighbor is still reachable through a cached link-layer address. Neighbor solicitations are also used for duplicate address detection. + - Default: `1000.000000` +* `neighbor_solicitation_retries` (nsRetries) - (string) The retransmission retry count for for sending neighbor solicitation messages. + - Default: `3.000000` +* `nud_retry_base` (nudRetryBase) - (string) Retransmission base for NUD neighbor solication messages. + - Default: `1.000000` +* `nud_retry_interval` (nudRetryInterval) - (string) Retransmission interval between NUD neighbor solication messages. + - Default: `1000.000000` +* `nud_retry_max_attempts` (nudRetryMaxAttempts) - (string) Retransmission maximum number of attempts for NUD neighbor solication messages. + - Default: `3.000000` +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `router_advertisement_interval` (raIntvl) - (string) The interval for sending router advertisement messages. + - Default: `600.000000` +* `router_advertisement_lifetime` (raLifetime) - (string) The lifetime associated with the default router. + - Default: `1800.000000` +* `reachable_time` (reachableTime) - (string) The reachable time, which is the time in milliseconds that a node assumes a neighbor is reachable after receiving a reachability confirmation. + - Default: `0.000000` +* `retransmit_timer` (retransTimer) - (string) The retransmit timer has the time in milliseconds between retransmitted neighbor solicitation messages. + - Default: `0.000000` + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing Neighbor Discovery Interface Policy can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: + +``` +terraform import aci_neighbor_discovery_interface_policy.example_tenant uni/tn-{name}/ndifpol-{name} +``` + +Starting in Terraform version 1.5, an existing Neighbor Discovery Interface Policy can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/ndifpol-{name}" + to = aci_neighbor_discovery_interface_policy.example_tenant +} +``` diff --git a/docs/resources/relation_from_bridge_domain_to_l3_outside.md b/docs/resources/relation_from_bridge_domain_to_l3_outside.md new file mode 100644 index 000000000..a600a7c74 --- /dev/null +++ b/docs/resources/relation_from_bridge_domain_to_l3_outside.md @@ -0,0 +1,124 @@ +--- +# Documentation 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). +subcategory: "Generic" +layout: "aci" +page_title: "ACI: aci_relation_from_bridge_domain_to_l3_outside" +sidebar_current: "docs-aci-resource-aci_relation_from_bridge_domain_to_l3_outside" +description: |- + Manages ACI Relation From Bridge Domain To L3 Outside +--- + +# aci_relation_from_bridge_domain_to_l3_outside # + +Manages ACI Relation From Bridge Domain To L3 Outside + + + +## API Information ## + +* Class: [fvRsBDToOut](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToOut/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Formats: + - `uni/tn-{name}/BD-{name}/rsBDToOut-{tnL3extOutName}` + - `uni/tn-{name}/rsBDToOut-{tnL3extOutName}` + - `uni/tn-{name}/svcBD-{name}/rsBDToOut-{tnL3extOutName}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +The configuration snippet below creates a Relation From Bridge Domain To L3 Outside with only required attributes. + +```hcl + +resource "aci_relation_from_bridge_domain_to_l3_outside" "example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + l3_outside_name = aci_l3_outside.example.name +} + +``` +The configuration snippet below shows all possible attributes of the Relation From Bridge Domain To L3 Outside. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_relation_from_bridge_domain_to_l3_outside" "full_example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + annotation = "annotation" + l3_outside_name = aci_l3_outside.example.name + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the Relation From Bridge Domain To L3 Outside resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_relation_from_bridge_domain_to_l3_outside) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/bridge_domain) ([fvBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvBD/overview)) + - The distinguished name (DN) of classes below can be used but currently there is no available resource for it: + - [fvSvcBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSvcBD/overview) + +* `l3_outside_name` (tnL3extOutName) - (string) The name of the L3 Outside object. This attribute can be referenced from a [resource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3_outside) with `aci_l3_outside.example.name` or from a [datasource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/data-sources/l3_outside) with `data.aci_l3_outside.example.name`. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Relation From Bridge Domain To L3 Outside object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To L3 Outside object. + - Default: `orchestrator:terraform` + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing Relation From Bridge Domain To L3 Outside can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: + +``` +terraform import aci_relation_from_bridge_domain_to_l3_outside.example_bridge_domain uni/tn-{name}/svcBD-{name}/rsBDToOut-{tnL3extOutName} +``` + +Starting in Terraform version 1.5, an existing Relation From Bridge Domain To L3 Outside can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/svcBD-{name}/rsBDToOut-{tnL3extOutName}" + to = aci_relation_from_bridge_domain_to_l3_outside.example_bridge_domain +} +``` diff --git a/docs/resources/relation_from_bridge_domain_to_netflow_monitor_policy.md b/docs/resources/relation_from_bridge_domain_to_netflow_monitor_policy.md new file mode 100644 index 000000000..b8ff1d2db --- /dev/null +++ b/docs/resources/relation_from_bridge_domain_to_netflow_monitor_policy.md @@ -0,0 +1,128 @@ +--- +# Documentation 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). +subcategory: "Generic" +layout: "aci" +page_title: "ACI: aci_relation_from_bridge_domain_to_netflow_monitor_policy" +sidebar_current: "docs-aci-resource-aci_relation_from_bridge_domain_to_netflow_monitor_policy" +description: |- + Manages ACI Relation From Bridge Domain To NetFlow Monitor Policy +--- + +# aci_relation_from_bridge_domain_to_netflow_monitor_policy # + +Manages ACI Relation From Bridge Domain To NetFlow Monitor Policy + + + +## API Information ## + +* Class: [fvRsBDToNetflowMonitorPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBDToNetflowMonitorPol/overview) + +* Supported in ACI versions: 2.2(1k) and later. + +* Distinguished Name Formats: + - `uni/tn-{name}/BD-{name}/rsBDToNetflowMonitorPol-[{tnNetflowMonitorPolName}]-{fltType}` + - `uni/tn-{name}/rsBDToNetflowMonitorPol-[{tnNetflowMonitorPolName}]-{fltType}` + - `uni/tn-{name}/svcBD-{name}/rsBDToNetflowMonitorPol-[{tnNetflowMonitorPolName}]-{fltType}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +The configuration snippet below creates a Relation From Bridge Domain To NetFlow Monitor Policy with only required attributes. + +```hcl + +resource "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + filter_type = "ipv4" + netflow_monitor_policy_name = aci_netflow_monitor_policy.example.name +} + +``` +The configuration snippet below shows all possible attributes of the Relation From Bridge Domain To NetFlow Monitor Policy. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "full_example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + annotation = "annotation" + filter_type = "ipv4" + netflow_monitor_policy_name = aci_netflow_monitor_policy.example.name + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the Relation From Bridge Domain To NetFlow Monitor Policy resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_relation_from_bridge_domain_to_netflow_monitor_policy) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/bridge_domain) ([fvBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvBD/overview)) + - The distinguished name (DN) of classes below can be used but currently there is no available resource for it: + - [fvSvcBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSvcBD/overview) + +* `filter_type` (fltType) - (string) The filter type of the NetFlow Monitor Policy object. + - Valid Values: `ce`, `ipv4`, `ipv6`, `unspecified`. +* `netflow_monitor_policy_name` (tnNetflowMonitorPolName) - (string) The name of the NetFlow Monitor Policy object. This attribute can be referenced from a [resource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/netflow_monitor_policy) with `aci_netflow_monitor_policy.example.name` or from a [datasource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/data-sources/netflow_monitor_policy) with `data.aci_netflow_monitor_policy.example.name`. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Relation From Bridge Domain To NetFlow Monitor Policy object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the Relation From Bridge Domain To NetFlow Monitor Policy object. + - Default: `orchestrator:terraform` + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing Relation From Bridge Domain To NetFlow Monitor Policy can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: + +``` +terraform import aci_relation_from_bridge_domain_to_netflow_monitor_policy.example_bridge_domain uni/tn-{name}/svcBD-{name}/rsBDToNetflowMonitorPol-[{tnNetflowMonitorPolName}]-{fltType} +``` + +Starting in Terraform version 1.5, an existing Relation From Bridge Domain To NetFlow Monitor Policy can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/svcBD-{name}/rsBDToNetflowMonitorPol-[{tnNetflowMonitorPolName}]-{fltType}" + to = aci_relation_from_bridge_domain_to_netflow_monitor_policy.example_bridge_domain +} +``` diff --git a/docs/resources/rogue_coop_exception.md b/docs/resources/rogue_coop_exception.md new file mode 100644 index 000000000..26d90c59d --- /dev/null +++ b/docs/resources/rogue_coop_exception.md @@ -0,0 +1,124 @@ +--- +# Documentation 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). +subcategory: "Generic" +layout: "aci" +page_title: "ACI: aci_rogue_coop_exception" +sidebar_current: "docs-aci-resource-aci_rogue_coop_exception" +description: |- + Manages ACI Rogue Coop Exception +--- + +# aci_rogue_coop_exception # + +Manages ACI Rogue Coop Exception + + + +## API Information ## + +* Class: [fvRogueExceptionMac](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRogueExceptionMac/overview) + +* Supported in ACI versions: 5.2(3e) and later. + +* Distinguished Name Format: `uni/tn-{name}/BD-{name}/rgexpmac-{mac}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +The configuration snippet below creates a Rogue Coop Exception with only required attributes. + +```hcl + +resource "aci_rogue_coop_exception" "example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + mac = "00:00:00:00:00:01" +} + +``` +The configuration snippet below shows all possible attributes of the Rogue Coop Exception. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_rogue_coop_exception" "full_example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + annotation = "annotation" + description = "description_1" + mac = "00:00:00:00:00:01" + name = "name_1" + name_alias = "name_alias_1" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the Rogue Coop Exception resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_rogue_coop_exception) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/bridge_domain) ([fvBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvBD/overview)) +* `mac` (mac) - (string) The MAC address of the Rogue Coop Exception object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Rogue Coop Exception object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the Rogue Coop Exception object. + - Default: `orchestrator:terraform` +* `description` (descr) - (string) The description of the Rogue Coop Exception object. +* `name` (name) - (string) The name of the Rogue Coop Exception object. +* `name_alias` (nameAlias) - (string) The name alias of the Rogue Coop Exception object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing Rogue Coop Exception can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: + +``` +terraform import aci_rogue_coop_exception.example_bridge_domain uni/tn-{name}/BD-{name}/rgexpmac-{mac} +``` + +Starting in Terraform version 1.5, an existing Rogue Coop Exception can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/BD-{name}/rgexpmac-{mac}" + to = aci_rogue_coop_exception.example_bridge_domain +} +``` diff --git a/docs/resources/tag.md b/docs/resources/tag.md index b441f4d80..8c3b2682c 100644 --- a/docs/resources/tag.md +++ b/docs/resources/tag.md @@ -66,6 +66,8 @@ All examples for the Tag resource can be found in the [examples](https://github. - [aci_cloud_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_epg) ([cloudEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudEPg/overview)) - [aci_cloud_external_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_external_epg) ([cloudExtEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudExtEPg/overview)) - [aci_cloud_service_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_service_epg) ([cloudSvcEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudSvcEPg/overview)) + - [aci_dhcp_relay_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/dhcp_relay_policy) ([dhcpRelayP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/dhcpRelayP/overview)) + - [aci_first_hop_security_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/first_hop_security_policy) ([fhsBDPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsBDPol/overview)) - [aci_trust_control_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/trust_control_policy) ([fhsTrustCtrlPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsTrustCtrlPol/overview)) - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) - [aci_application_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_profile) ([fvAp](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAp/overview)) @@ -76,13 +78,11 @@ All examples for the Tag resource can be found in the [examples](https://github. - [aci_endpoint_security_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_security_group) ([fvESg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvESg/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) - [aci_endpoint_tag_mac](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_mac) ([fvEpMacTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpMacTag/overview)) + - [aci_end_point_retention_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/end_point_retention_policy) ([fvEpRetPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpRetPol/overview)) - [aci_vrf_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group) ([fvFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRGroup/overview)) - [aci_vrf_fallback_route_group_member](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group_member) ([fvFBRMember](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRMember/overview)) - [aci_vrf_fallback_route](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route) ([fvFBRoute](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRoute/overview)) - [aci_epg_useg_ad_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ad_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) - - [aci_epg_useg_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) - - [aci_epg_useg_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) - - [aci_relation_to_consumed_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_contract) ([fvRsCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCons/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. * `value` (value) - (string) The value of the property. diff --git a/examples/data-sources/aci_bridge_domain/data-source.tf b/examples/data-sources/aci_bridge_domain/data-source.tf new file mode 100644 index 000000000..b61747669 --- /dev/null +++ b/examples/data-sources/aci_bridge_domain/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_bridge_domain" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/examples/data-sources/aci_bridge_domain/provider.tf b/examples/data-sources/aci_bridge_domain/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_bridge_domain/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_first_hop_security_policy/data-source.tf b/examples/data-sources/aci_first_hop_security_policy/data-source.tf new file mode 100644 index 000000000..a523c4293 --- /dev/null +++ b/examples/data-sources/aci_first_hop_security_policy/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_first_hop_security_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/examples/data-sources/aci_first_hop_security_policy/provider.tf b/examples/data-sources/aci_first_hop_security_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_first_hop_security_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_igmp_snooping_policy/data-source.tf b/examples/data-sources/aci_igmp_snooping_policy/data-source.tf new file mode 100644 index 000000000..ae02d70f2 --- /dev/null +++ b/examples/data-sources/aci_igmp_snooping_policy/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_igmp_snooping_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/examples/data-sources/aci_igmp_snooping_policy/provider.tf b/examples/data-sources/aci_igmp_snooping_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_igmp_snooping_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_mld_snooping_policy/data-source.tf b/examples/data-sources/aci_mld_snooping_policy/data-source.tf new file mode 100644 index 000000000..844660a52 --- /dev/null +++ b/examples/data-sources/aci_mld_snooping_policy/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_mld_snooping_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/examples/data-sources/aci_mld_snooping_policy/provider.tf b/examples/data-sources/aci_mld_snooping_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_mld_snooping_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_neighbor_discovery_interface_policy/data-source.tf b/examples/data-sources/aci_neighbor_discovery_interface_policy/data-source.tf new file mode 100644 index 000000000..5ace94308 --- /dev/null +++ b/examples/data-sources/aci_neighbor_discovery_interface_policy/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_neighbor_discovery_interface_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/examples/data-sources/aci_neighbor_discovery_interface_policy/provider.tf b/examples/data-sources/aci_neighbor_discovery_interface_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_neighbor_discovery_interface_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_relation_from_bridge_domain_to_l3_outside/data-source.tf b/examples/data-sources/aci_relation_from_bridge_domain_to_l3_outside/data-source.tf new file mode 100644 index 000000000..9de7c40e5 --- /dev/null +++ b/examples/data-sources/aci_relation_from_bridge_domain_to_l3_outside/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_relation_from_bridge_domain_to_l3_outside" "example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + l3_outside_name = aci_l3_outside.example.name +} diff --git a/examples/data-sources/aci_relation_from_bridge_domain_to_l3_outside/provider.tf b/examples/data-sources/aci_relation_from_bridge_domain_to_l3_outside/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_relation_from_bridge_domain_to_l3_outside/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/data-source.tf b/examples/data-sources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/data-source.tf new file mode 100644 index 000000000..2bc075c19 --- /dev/null +++ b/examples/data-sources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/data-source.tf @@ -0,0 +1,6 @@ + +data "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + filter_type = "ipv4" + netflow_monitor_policy_name = aci_netflow_monitor_policy.example.name +} diff --git a/examples/data-sources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/provider.tf b/examples/data-sources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_rogue_coop_exception/data-source.tf b/examples/data-sources/aci_rogue_coop_exception/data-source.tf new file mode 100644 index 000000000..39e00a03c --- /dev/null +++ b/examples/data-sources/aci_rogue_coop_exception/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_rogue_coop_exception" "example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + mac = "00:00:00:00:00:01" +} diff --git a/examples/data-sources/aci_rogue_coop_exception/provider.tf b/examples/data-sources/aci_rogue_coop_exception/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_rogue_coop_exception/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_bridge_domain/provider.tf b/examples/resources/aci_bridge_domain/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_bridge_domain/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_bridge_domain/resource-all-attributes.tf b/examples/resources/aci_bridge_domain/resource-all-attributes.tf new file mode 100644 index 000000000..b1fc4e5f3 --- /dev/null +++ b/examples/resources/aci_bridge_domain/resource-all-attributes.tf @@ -0,0 +1,113 @@ + +resource "aci_bridge_domain" "full_example_tenant" { + parent_dn = aci_tenant.example.id + optimize_wan_bandwidth = "no" + annotation = "annotation" + arp_flooding = "no" + description = "description_1" + enable_rogue_exception_mac = "no" + clear_remote_mac_entries = "no" + endpoint_move_detection_mode = "garp" + advertise_host_routes = "no" + intersite_bum_traffic_allow = "no" + intersite_l2_stretch = "no" + ip_learning = "no" + pim_ipv6 = "no" + limit_ip_learn_to_subnets = "no" + link_local_ipv6_address = "fe80::1" + custom_mac_address = "00:22:BD:F8:19:FE" + drop_arp_with_multicast_smac = "no" + pim = "no" + multi_destination_flooding = "bd-flood" + name = "test_name" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + bridge_domain_type = "fc" + unicast_routing = "no" + l2_unknown_unicast_flooding = "proxy" + l3_unknown_multicast_flooding = "flood" + ipv6_l3_unknown_multicast_flooding = "flood" + virtual_mac_address = "00:22:BD:F8:19:FB" + legacy_mode = { + annotation = "annotation_1" + description = "description_1" + encapsulation = "vlan-100" + name = "name_1" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + } + rogue_coop_exceptions = [ + { + annotation = "annotation_1" + description = "description_1" + mac = "00:00:00:00:00:00" + name = "name_1" + name_alias = "name_alias_1" + } + ] + relation_to_monitor_policy = { + annotation = "annotation_1" + monitoring_policy_name = aci_monitoring_policy.example.name + } + relation_to_first_hop_security_policy = { + annotation = "annotation_1" + first_hop_security_policy_name = aci_first_hop_security_policy.example.name + } + relation_to_neighbor_discovery_interface_policy = { + annotation = "annotation_1" + neighbor_discovery_interface_policy_name = aci_neighbor_discovery_interface_policy.example.name + } + relation_to_netflow_monitor_policy = [ + { + annotation = "annotation_1" + filter_type = "ce" + netflow_monitor_policy_name = aci_netflow_monitor_policy.example.name + } + ] + relation_to_l3_outsides = [ + { + annotation = "annotation_1" + l3_outside_name = aci_l3_outside.example.name + } + ] + relation_to_route_control_profile = { + annotation = "annotation_1" + l3_outside_name = aci_l3_outside.example.name + route_control_profile_name = aci_route_control_profile.example.name + } + relation_to_dhcp_relay_policy = { + annotation = "annotation_1" + dhcp_relay_policy_name = aci_dhcp_relay_policy.example.name + } + relation_to_end_point_retention_policy = { + annotation = "annotation_1" + resolve_act = "inherit" + end_point_retention_policy_name = aci_end_point_retention_policy.example.name + } + relation_to_vrf = { + annotation = "annotation_1" + vrf_name = aci_vrf.example.name + } + relation_to_igmp_snooping_policy = { + annotation = "annotation_1" + igmp_snooping_policy_name = aci_igmp_snooping_policy.example.name + } + relation_to_mld_snooping_policy = { + annotation = "annotation_1" + mld_snooping_policy_name = aci_mld_snooping_policy.example.name + } + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_bridge_domain/resource.tf b/examples/resources/aci_bridge_domain/resource.tf new file mode 100644 index 000000000..d1f50b82f --- /dev/null +++ b/examples/resources/aci_bridge_domain/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_bridge_domain" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/examples/resources/aci_first_hop_security_policy/provider.tf b/examples/resources/aci_first_hop_security_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_first_hop_security_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_first_hop_security_policy/resource-all-attributes.tf b/examples/resources/aci_first_hop_security_policy/resource-all-attributes.tf new file mode 100644 index 000000000..e5862cd71 --- /dev/null +++ b/examples/resources/aci_first_hop_security_policy/resource-all-attributes.tf @@ -0,0 +1,40 @@ + +resource "aci_first_hop_security_policy" "full_example_tenant" { + parent_dn = aci_tenant.example.id + annotation = "annotation" + description = "description_1" + ip_inspection = "disabled" + name = "test_name" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + router_advertisement = "disabled" + source_guard = "disabled" + route_advertisement_guard_policy = { + annotation = "annotation_1" + description = "description_1" + managed_config_check = "no" + managed_config_flag = "no" + max_hop_limit = "10" + max_router_pref = "disabled" + min_hop_limit = "1" + name = "name_1" + name_alias = "name_alias_1" + other_config_check = "no" + other_config_flag = "no" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + } + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_first_hop_security_policy/resource.tf b/examples/resources/aci_first_hop_security_policy/resource.tf new file mode 100644 index 000000000..b377d6f94 --- /dev/null +++ b/examples/resources/aci_first_hop_security_policy/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_first_hop_security_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/examples/resources/aci_igmp_snooping_policy/provider.tf b/examples/resources/aci_igmp_snooping_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_igmp_snooping_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_igmp_snooping_policy/resource-all-attributes.tf b/examples/resources/aci_igmp_snooping_policy/resource-all-attributes.tf new file mode 100644 index 000000000..453eb6a91 --- /dev/null +++ b/examples/resources/aci_igmp_snooping_policy/resource-all-attributes.tf @@ -0,0 +1,30 @@ + +resource "aci_igmp_snooping_policy" "full_example_tenant" { + parent_dn = aci_tenant.example.id + admin_state = "disabled" + annotation = "annotation" + control = ["fast-leave", "querier"] + description = "description_1" + last_member_interval = "3" + name = "test_name" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + query_interval = "140" + response_interval = "11" + start_query_count = "9" + start_query_interval = "2" + querier_version = "v2" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_igmp_snooping_policy/resource.tf b/examples/resources/aci_igmp_snooping_policy/resource.tf new file mode 100644 index 000000000..c9f03e96d --- /dev/null +++ b/examples/resources/aci_igmp_snooping_policy/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_igmp_snooping_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/examples/resources/aci_mld_snooping_policy/provider.tf b/examples/resources/aci_mld_snooping_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_mld_snooping_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_mld_snooping_policy/resource-all-attributes.tf b/examples/resources/aci_mld_snooping_policy/resource-all-attributes.tf new file mode 100644 index 000000000..47169c771 --- /dev/null +++ b/examples/resources/aci_mld_snooping_policy/resource-all-attributes.tf @@ -0,0 +1,30 @@ + +resource "aci_mld_snooping_policy" "full_example_tenant" { + parent_dn = aci_tenant.example.id + admin_state = "disabled" + annotation = "annotation" + control = ["fast-leave", "querier"] + description = "description_1" + last_member_interval = "3" + name = "test_name" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + query_interval = "140" + response_interval = "11" + start_query_count = "9" + start_query_interval = "2" + ver = "unspecified" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_mld_snooping_policy/resource.tf b/examples/resources/aci_mld_snooping_policy/resource.tf new file mode 100644 index 000000000..e5145c4db --- /dev/null +++ b/examples/resources/aci_mld_snooping_policy/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_mld_snooping_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/examples/resources/aci_neighbor_discovery_interface_policy/provider.tf b/examples/resources/aci_neighbor_discovery_interface_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_neighbor_discovery_interface_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_neighbor_discovery_interface_policy/resource-all-attributes.tf b/examples/resources/aci_neighbor_discovery_interface_policy/resource-all-attributes.tf new file mode 100644 index 000000000..f7d6e0fb4 --- /dev/null +++ b/examples/resources/aci_neighbor_discovery_interface_policy/resource-all-attributes.tf @@ -0,0 +1,34 @@ + +resource "aci_neighbor_discovery_interface_policy" "full_example_tenant" { + parent_dn = aci_tenant.example.id + annotation = "annotation" + controller_state = ["managed-cfg"] + description = "description_1" + hop_limit = "40" + mtu = "8700" + name = "test_name" + name_alias = "name_alias_1" + neighbor_solicitation_interval = "1500" + neighbor_solicitation_retries = "6" + nud_retry_base = "2" + nud_retry_interval = "1300" + nud_retry_max_attempts = "5" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + router_advertisement_interval = "500" + router_advertisement_lifetime = "1500" + reachable_time = "2" + retransmit_timer = "2" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_neighbor_discovery_interface_policy/resource.tf b/examples/resources/aci_neighbor_discovery_interface_policy/resource.tf new file mode 100644 index 000000000..a5f127067 --- /dev/null +++ b/examples/resources/aci_neighbor_discovery_interface_policy/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_neighbor_discovery_interface_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/examples/resources/aci_relation_from_bridge_domain_to_l3_outside/provider.tf b/examples/resources/aci_relation_from_bridge_domain_to_l3_outside/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_relation_from_bridge_domain_to_l3_outside/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_relation_from_bridge_domain_to_l3_outside/resource-all-attributes.tf b/examples/resources/aci_relation_from_bridge_domain_to_l3_outside/resource-all-attributes.tf new file mode 100644 index 000000000..db8cf9580 --- /dev/null +++ b/examples/resources/aci_relation_from_bridge_domain_to_l3_outside/resource-all-attributes.tf @@ -0,0 +1,18 @@ + +resource "aci_relation_from_bridge_domain_to_l3_outside" "full_example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + annotation = "annotation" + l3_outside_name = aci_l3_outside.example.name + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_relation_from_bridge_domain_to_l3_outside/resource.tf b/examples/resources/aci_relation_from_bridge_domain_to_l3_outside/resource.tf new file mode 100644 index 000000000..41a275cf0 --- /dev/null +++ b/examples/resources/aci_relation_from_bridge_domain_to_l3_outside/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_relation_from_bridge_domain_to_l3_outside" "example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + l3_outside_name = aci_l3_outside.example.name +} diff --git a/examples/resources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/provider.tf b/examples/resources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/resource-all-attributes.tf b/examples/resources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/resource-all-attributes.tf new file mode 100644 index 000000000..48b8ca477 --- /dev/null +++ b/examples/resources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/resource-all-attributes.tf @@ -0,0 +1,19 @@ + +resource "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "full_example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + annotation = "annotation" + filter_type = "ipv4" + netflow_monitor_policy_name = aci_netflow_monitor_policy.example.name + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/resource.tf b/examples/resources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/resource.tf new file mode 100644 index 000000000..ab4ea3a1a --- /dev/null +++ b/examples/resources/aci_relation_from_bridge_domain_to_netflow_monitor_policy/resource.tf @@ -0,0 +1,6 @@ + +resource "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + filter_type = "ipv4" + netflow_monitor_policy_name = aci_netflow_monitor_policy.example.name +} diff --git a/examples/resources/aci_rogue_coop_exception/provider.tf b/examples/resources/aci_rogue_coop_exception/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_rogue_coop_exception/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_rogue_coop_exception/resource-all-attributes.tf b/examples/resources/aci_rogue_coop_exception/resource-all-attributes.tf new file mode 100644 index 000000000..cdeadc327 --- /dev/null +++ b/examples/resources/aci_rogue_coop_exception/resource-all-attributes.tf @@ -0,0 +1,21 @@ + +resource "aci_rogue_coop_exception" "full_example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + annotation = "annotation" + description = "description_1" + mac = "00:00:00:00:00:01" + name = "name_1" + name_alias = "name_alias_1" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_rogue_coop_exception/resource.tf b/examples/resources/aci_rogue_coop_exception/resource.tf new file mode 100644 index 000000000..4cc6b6128 --- /dev/null +++ b/examples/resources/aci_rogue_coop_exception/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_rogue_coop_exception" "example_bridge_domain" { + parent_dn = aci_bridge_domain.example.id + mac = "00:00:00:00:00:01" +} diff --git a/gen/definitions/classes.yaml b/gen/definitions/classes.yaml index 0733b2f12..2e43b84ae 100644 --- a/gen/definitions/classes.yaml +++ b/gen/definitions/classes.yaml @@ -8,9 +8,6 @@ global: fvTenant: resource_name: "tenant" -fvBD: - resource_name: "bridge_domain" - fvAEPg: resource_name: "application_epg" ui_locations: @@ -310,6 +307,7 @@ fvFBRMember: fvFBRoute: resource_name: "vrf_fallback_route" max_one_class_allowed: true + include: true ui_locations: - "Tenants -> Networking -> VRFs -> Policy -> Fallback Route Group -> Fallback Routes" sub_category: "Networking" @@ -649,3 +647,117 @@ topSystem: sub_category: "Fabric Inventory" dn_formats: - "topology/pod-{id}/node-{id}/sys" + +fvBD: + resource_name: "bridge_domain" + ui_locations: + - "Tenants -> Networking -> Bridge Domains" + sub_category: "Networking" + children: + - "fvRogueExceptionMac" + - "fvAccP" + migration_version: 1 + migration_blocks: + fvBD: + tenant_dn: parent_dn + arp_flood: arp_flooding + ep_clear: clear_remote_mac_entries + ep_move_detect_mode: endpoint_move_detection_mode + host_based_routing: advertise_host_routes + ipv6_mcast_allow: pim_ipv6 + ll_addr: link_local_ipv6_address + mac: custom_mac_address + mcast_allow: pim + multi_dst_pkt_act: multi_destination_flooding + unicast_route: unicast_routing + unk_mac_ucast_act: l2_unknown_unicast_flooding + unk_mcast_act: l3_unknown_multicast_flooding + v6unk_mcast_act: ipv6_l3_unknown_multicast_flooding + vmac: virtual_mac_address + fvRsABDPolMonPol: + relation_fv_rs_abd_pol_mon_pol: relation_to_monitor_policy.monitoring_policy_name + fvRsBdToEpRet: + relation_fv_rs_bd_to_ep_ret: relation_to_end_point_retention_policy.end_point_retention_policy_name + fvRsBDToFhs: + relation_fv_rs_bd_to_fhs: relation_to_first_hop_security_policy.first_hop_security_policy_name + fvRsBDToNdP: + relation_fv_rs_bd_to_nd_p: relation_to_neighbor_discovery_interface_policy.neighbor_discovery_interface_policy_name + fvRsBDToNetflowMonitorPol: + relation_fv_rs_bd_to_netflow_monitor_pol: relation_to_netflow_monitor_policy + tn_netflow_monitor_pol_name: relation_to_netflow_monitor_policy.netflow_monitor_policy_name + flt_type: relation_to_netflow_monitor_policy.filter_type + fvRsBDToOut: + relation_fv_rs_bd_to_out: relation_to_l3_outsides.l3_outside_name + fvRsBDToProfile: + relation_fv_rs_bd_to_profile: relation_to_route_control_profile.route_control_profile_name + fvRsBDToRelayP: + relation_fv_rs_bd_to_relay_p: relation_to_relay_policy.dhcp_relay_policy_name + fvRsCtx: + relation_fv_rs_ctx: relation_to_vrf.vrf_name + fvRsIgmpsn: + relation_fv_rs_igmpsn: relation_to_igmp_snooping_policy.igmp_snooping_policy_name + fvRsMldsn: + relation_fv_rs_mldsn: relation_to_mld_snooping_policy.mld_snooping_policy_name + +fvRsABDPolMonPol: + resource_name: "relation_from_bridge_domain_to_monitoring_policy" + +fvRsBdToEpRet: + resource_name: "relation_from_bridge_domain_to_end_point_retention_policy" + +fvRsBDToFhs: + resource_name: "relation_from_bridge_domain_to_first_hop_security_policy" + +fvRsBDToNdP: + resource_name: "relation_from_bridge_domain_to_neighbor_discovery_interface_policy" + +fvRsBDToNetflowMonitorPol: + resource_name: "relation_from_bridge_domain_to_netflow_monitor_policy" + +fvRsBDToOut: + resource_name: "relation_from_bridge_domain_to_l3_outside" + +fvRsBDToProfile: + resource_name: "relation_from_bridge_domain_to_route_control_profile" + +fvRsBDToRelayP: + resource_name: "relation_from_bridge_domain_to_dhcp_relay_policy" + +fvRsCtx: + resource_name: "relation_to_vrf" + +fvRsIgmpsn: + resource_name: "relation_to_igmp_snooping_policy" + +fvRsMldsn: + resource_name: "relation_to_mld_snooping_policy" + +fvEpRetPol: + resource_name: "end_point_retention_policy" + +igmpSnoopPol: + resource_name: "igmp_snooping_policy" + +mldSnoopPol: + resource_name: "mld_snooping_policy" + +dhcpRelayP: + resource_name: "dhcp_relay_policy" + +ndIfPol: + resource_name: "neighbor_discovery_interface_policy" + +fhsBDPol: + resource_name: "first_hop_security_policy" + +vzFilter: + resource_name: "filter" + +fvAccP: + resource_name: "legacy_mode" + +fvRogueExceptionMac: + resource_name: "rogue_coop_exception" + +fhsRaGuardPol: + resource_name: "route_advertisement_guard_policy" \ No newline at end of file diff --git a/gen/definitions/properties.yaml b/gen/definitions/properties.yaml index 0722fde84..343090c17 100644 --- a/gen/definitions/properties.yaml +++ b/gen/definitions/properties.yaml @@ -16,6 +16,7 @@ global: matchT: "The provider label match criteria." instrImedcy: "The deployment immediacy of the %s object. Specifies when the policy is pushed into the hardware policy content-addressable memory (CAM)" resImedcy: "The resolution immediacy of the %s object. Specifies if policies are resolved immmediately or when needed." + tnL3extOutName: "The name of the L3 Outside object." overwrites: count: "apic_count" # count is a terraform reserved schema entry provider: "prov" # provider is a terraform reserved schema entry @@ -37,9 +38,10 @@ global: num_ports: "number_of_ports" class_pref: "class_preference" resource_name_doc_overwrite: - Vrf: VRF + Vrf: "VRF" Sid: "SR-MPLS Segment ID" Epg: "EPG" + Epgs: "EPGs" Useg: "uSeg" Vm: "VM" Dns: "DNS" @@ -47,9 +49,13 @@ global: Ip: "IP" Ad: "AD" Esg: "ESG" - "External Network Instance Profile": "External EPG" - L3out: L3Out + External Network Instance Profile: "External EPG" + L3out: "L3Out" Netflow: "NetFlow" + Bd: "BD" + Nd: "Neighbor Discovery (ND)" + Mld: "MLD" + Igmp: "IGMP" ignores: - "userdom" @@ -1235,3 +1241,291 @@ topSystem: unicastXrEpLearnDisable: "Indicates whether the learning of unicast endpoints for external routing is disabled." version: "The version for this system." virtualMode: "The virtual mode of this system." + +fvBD: + remove_valid_values: + vmac: + - "not-applicable" + add_valid_values: + epMoveDetectMode: + - "" + default_values: + hostBasedRouting: "no" + mcastARPDrop: "yes" + enableRogueExceptMac: "no" + intersiteBumTrafficAllow: "no" + ipLearning: "yes" + limitIpLearnToSubnets: "yes" + mcastAllow: "no" + ipv6McastAllow: "no" + overwrites: + arp_flood: "arp_flooding" + host_based_routing: "advertise_host_routes" + unk_mac_ucast_act: "l2_unknown_unicast_flooding" + unk_mcast_act: "l3_unknown_multicast_flooding" + v6unk_mcast_act: "ipv6_l3_unknown_multicast_flooding" + ipv6_mcast_allow: "pim_ipv6" + multi_dst_pkt_act: "multi_destination_flooding" + unicast_route: "unicast_routing" + mac: "custom_mac_address" + vmac: "virtual_mac_address" + ll_addr: "link_local_ipv6_address" + mcast_allow: "pim" + mcast_arp_drop: "drop_arp_with_multicast_smac" + ep_clear: "clear_remote_mac_entries" + ep_move_detect_mode: "endpoint_move_detection_mode" + enable_rogue_except_mac: "enable_rogue_exception_mac" + type: "bridge_domain_type" + documentation: + OptimizeWanBandwidth: "Optimize WAN Bandwidth for the %s object." + arpFlood: "Enable ARP flooding for the %s object. If flooding is disabled, unicast routing will be performed on the target IP address." + enableRogueExceptMac: "Enable rogue exception based on MAC wildcard for the %s object." + epClear: "Clear all End-Points in leafs for the %s object." + hostBasedRouting: "Advertise host routes (/32 prefixes) out of the L3Out(s) associated to the %s object." + intersiteBumTrafficAllow: "Enable intersite Broadcast, Unknown-Unicast and Multicast (BUM) traffic between sites for the %s object." + intersiteL2Stretch: "Enable L2 stretch between sites for the %s object." + ipLearning: "The IP learning setting of the %s object." + ipv6McastAllow: "Enable IPv6 multicast traffic for the %s object." + limitIpLearnToSubnets: "Limit IP address learning to subnets for the %s object. Every %s object can have multiple subnets associated with it" + mcastARPDrop: "Drop roque multicast ARP packets for the %s object." + mcastAllow: "Enable IPv4 multicast traffic for the %s object." + bridge_domain_type: "The domain type of the %s object." + unicastRoute: "Enable the forwarding method based on predefined forwarding criteria (IP or MAC address)." + unkMcastAct: "The forwarding method for unknown layer multicast destinations." + v6unkMcastAct: "The forwarding method for unknown IPv6 multicast destinations." + vmas: "The virtual MAC address of the %s object. This is used when the the %s object is extended to multiple sites using L2 Outside." + type_overwrites: + epMoveDetectMode: "string" + test_values: + default: + endpoint_move_detection_mode: "" + custom_mac_address: "00:22:BD:F8:19:FF" + virtual_mac_address: "not-applicable" + link_local_ipv6_address: "::" + l2_unknown_unicast_flooding: "proxy" + all: + custom_mac_address: "00:22:BD:F8:19:FE" + virtual_mac_address: "00:22:BD:F8:19:FB" + link_local_ipv6_address: "fe80::1" + endpoint_move_detection_mode: "garp" + l2_unknown_unicast_flooding: "proxy" + parents: + - class_name: "fvTenant" + parent_dependency: "" + parent_dn: "aci_tenant.test.id" + +fvRsABDPolMonPol: + overwrites: + relation_from_bridge_domain_to_monitoring_policy: "relation_to_monitor_policy" + documentation: + tnMonEPGPolName: "The name of the Monitoring Policy object." + +fvRsBdToEpRet: + overwrites: + relation_from_bridge_domain_to_end_point_retention_policy: "relation_to_end_point_retention_policy" + +fvRsBDToFhs: + overwrites: + relation_from_bridge_domain_to_first_hop_security_policy: "relation_to_first_hop_security_policy" + documentation: + tnFhsBDPolName: "The name of the First Hop Security Policy object." + +fvRsBDToNdP: + overwrites: + relation_from_bridge_domain_to_neighbor_discovery_interface_policy: "relation_to_neighbor_discovery_interface_policy" + documentation: + tnNdIfPolName: "The name of the Neighbor Discovery Interface Policy object." + +fvRsBDToNetflowMonitorPol: + overwrites: + relation_from_bridge_domain_to_netflow_monitor_policys: "relation_to_netflow_monitor_policy" + flt_type: "filter_type" + documentation: + tnNetflowMonitorPolName: "The name of the NetFlow Monitor Policy object." + fltType: "The filter type of the NetFlow Monitor Policy object." + test_values: + default: + filter_type: "ipv4" + all: + filter_type: "ce" + resource_required: + filter_type: "ipv4" + datasource_required: + filter_type: "ipv4" + parents: + - class_name: "fvBD" + parent_dependency: "fvTenant" + parent_dn: "aci_bridge_domain.test.id" + +fvRsBDToOut: + overwrites: + relation_from_bridge_domain_to_l3_outsides: "relation_to_l3_outsides" + parents: + - class_name: "fvBD" + parent_dependency: "fvTenant" + parent_dn: "aci_bridge_domain.test.id" + +fvRsBDToProfile: + overwrites: + relation_from_bridge_domain_to_route_control_profile: "relation_to_route_control_profile" + +fvRsBDToRelayP: + overwrites: + relation_from_bridge_domain_to_dhcp_relay_policy: "relation_to_dhcp_relay_policy" + documentation: + tnDhcpRelayPName: "The name of the DHCP Relay Policy object." + +fvRsCtx: + documentation: + tnFvCtxName: "The name of the VRF object." + +fvRsIgmpsn: + documentation: + tnIgmpSnoopPolName: "The name of the IGMP Snooping Policy object." + +fvRsMldsn: + documentation: + tnMldSnoopPolName: "The name of the MLD Snooping Policy object." + +fvEpRetPol: + overwrites: + resolve_act: "resolve_action" + documentation: + tnFvEpRetPolName: "The name of the Endpoint Retention Policy object." + resolveAct: "The action to take for resolving the Endpoint Retention Policy object." + +fvRogueExceptionMac: + test_values: + default: + mac: "00:00:00:00:00:00" + resource_required: + mac: "00:00:00:00:00:01" + datasource_required: + mac: "00:00:00:00:00:01" + all: + mac: "00:00:00:00:00:01" + test_values_for_parent: + - mac: "00:00:00:00:00:00" + - mac: "00:00:00:00:00:01" + parents: + - class_name: "fvBD" + parent_dependency: "fvTenant" + parent_dn: "aci_bridge_domain.test.id" + +fvAccP: + resource_required: + - "encapsulation" + documentation: + encap: "The VLAN or VXLAN encapsulation of the %s object." + test_values: + default: + encapsulation: "vlan-101" + all: + encapsulation: "vlan-100" + resource_required: + encapsulation: "vlan-101" + +igmpSnoopPol: + overwrites: + ctrl: "control" + admin_st: "admin_state" + last_mbr_intvl: "last_member_interval" + query_intvl: "query_interval" + rsp_intvl: "response_interval" + start_query_cnt: "start_query_count" + start_query_intvl: "start_query_interval" + ver: "querier_version" + test_values: + default: + control: [] + query_interval: "125" + response_interval: "10" + start_query_count: "2" + start_query_interval: "31" + last_member_interval: "1" + querier_version: "v3" + all: + control: ["fast-leave", "querier"] + query_interval: "140" + response_interval: "11" + start_query_count: "9" + start_query_interval: "2" + last_member_interval: "3" + querier_version: "v2" + +mldSnoopPol: + overwrites: + ctrl: "control" + admin_st: "admin_state" + last_mbr_intvl: "last_member_interval" + query_intvl: "query_interval" + rsp_intvl: "response_interval" + start_query_cnt: "start_query_count" + start_query_intvl: "start_query_interval" + test_values: + default: + control: [] + query_interval: "125" + response_interval: "10" + start_query_count: "2" + start_query_interval: "31" + last_member_interval: "1" + all: + control: ["fast-leave", "querier"] + query_interval: "140" + response_interval: "11" + start_query_count: "9" + start_query_interval: "2" + last_member_interval: "3" + +ndIfPol: + overwrites: + ctrl: "controller_state" + ns_intvl: "neighbor_solicitation_interval" + ns_retries: "neighbor_solicitation_retries" + ra_intvl: "router_advertisement_interval" + ra_lifetime: "router_advertisement_lifetime" + retrans_timer: "retransmit_timer" + test_values: + default: + controller_state: [] + hop_limit: "64" + mtu: "9000" + neighbor_solicitation_interval: "1000" + neighbor_solicitation_retries: "3" + nud_retry_base: "1" + nud_retry_interval: "1000" + nud_retry_max_attempts: "3" + router_advertisement_interval: "600" + router_advertisement_lifetime: "1800" + reachable_time: "0" + retransmit_timer: "0" + all: + controller_state: ["managed-cfg"] + hop_limit: "40" + mtu: "8700" + neighbor_solicitation_interval: "1500" + neighbor_solicitation_retries: "6" + nud_retry_base: "2" + nud_retry_interval: "1300" + nud_retry_max_attempts: "5" + router_advertisement_interval: "500" + router_advertisement_lifetime: "1500" + reachable_time: "2" + retransmit_timer: "2" + +fhsBDPol: + overwrites: + ip_inspect_admin_st: "ip_inspection" + ra_guard_admin_st: "router_advertisement" + src_guard_admin_st: "source_guard" + +fhsRaGuardPol: + test_values: + default: + max_hop_limit: "0" + min_hop_limit: "0" + all: + max_hop_limit: "10" + min_hop_limit: "1" + \ No newline at end of file diff --git a/gen/generator.go b/gen/generator.go index de07f8ed0..af87e4534 100644 --- a/gen/generator.go +++ b/gen/generator.go @@ -128,6 +128,7 @@ var templateFuncs = template.FuncMap{ "containsSingleNestedChildren": ContainsSingleNestedChildren, "isResourceClass": IsResourceClass, "getOldType": GetOldType, + "isNewNamedClassAttributeMatch": IsNewNamedClassAttributeMatch, } func ContainsRequired(properties map[string]Property) bool { @@ -187,6 +188,11 @@ func IsNewNamedClassAttribute(attributeName string) bool { return strings.HasSuffix(attributeName, "_name") } +func IsNewNamedClassAttributeMatch(attributeName, resourceName string) bool { + // Function to determine the correct named attribute when multiple named attributes are present but only 1 in legacy configuration + return strings.Contains(resourceName, attributeName[:len(attributeName)-5]) +} + func GetConflictingAttributeName(attributeName string) string { return strings.Split(attributeName, ".")[0] } @@ -270,7 +276,14 @@ func IsResourceClass(className string) bool { func GetResourceNameAsDescription(s string, definitions Definitions) string { resourceName := cases.Title(language.English).String(strings.ReplaceAll(s, "_", " ")) for k, v := range definitions.Properties["global"].(map[interface{}]interface{})["resource_name_doc_overwrite"].(map[interface{}]interface{}) { - resourceName = strings.ReplaceAll(resourceName, k.(string), v.(string)) + matchList := strings.Split(resourceName, " ") + // Always replace when the key is containing of multiple words + // Replace only individual word on exact match of key, in order to prevent partial word replacement + if len(strings.Split(k.(string), " ")) > 1 { + resourceName = strings.ReplaceAll(resourceName, k.(string), v.(string)) + } else if len(matchList) >= 1 && slices.Contains(matchList, k.(string)) { + resourceName = strings.ReplaceAll(resourceName, k.(string), v.(string)) + } } return resourceName } @@ -1495,6 +1508,10 @@ func (m *Model) SetClassProperties(classDetails interface{}) { property.ValidValuesMap[validValueKey] = validValueName } } + addValidValuesList := GetValidValuesToAdd(m.PkgName, propertyName, m.Definitions) + for _, validValueName := range addValidValuesList { + property.ValidValues = append(property.ValidValues, validValueName.(string)) + } if len(property.ValidValues) > 0 { m.HasValidValues = true } @@ -2490,6 +2507,25 @@ func GetValidValuesToRemove(classPkgName, propertyName string, definitions Defin return removedValidValuesSlice } +func GetValidValuesToAdd(classPkgName, propertyName string, definitions Definitions) []interface{} { + precedenceList := []string{classPkgName, "global"} + addValidValuesSlice := make([]interface{}, 0) + for _, precedence := range precedenceList { + if classDetails, ok := definitions.Properties[precedence]; ok { + for key, value := range classDetails.(map[interface{}]interface{}) { + if key.(string) == "add_valid_values" { + for k, v := range value.(map[interface{}]interface{}) { + if k.(string) == propertyName { + addValidValuesSlice = append(addValidValuesSlice, v.([]interface{})...) + } + } + } + } + } + } + return addValidValuesSlice +} + func IsRequiredInTestValue(classPkgName, propertyName string, definitions Definitions, testType string) bool { if classDetails, ok := definitions.Properties[classPkgName]; ok { for key, value := range classDetails.(map[interface{}]interface{}) { diff --git a/gen/meta/fhsBDPol.json b/gen/meta/fhsBDPol.json new file mode 100644 index 000000000..014e13b5e --- /dev/null +++ b/gen/meta/fhsBDPol.json @@ -0,0 +1,855 @@ +{ + "fhs:BDPol": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Delegate": "", + "fhs:RaGuardPol": "", + "fhs:RtBDToFhs": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "fd-": "fault:Delegate", + "raguardpol": "fhs:RaGuardPol", + "rbacDom-": "aaa:RbacAnnotation", + "rtfvBDToFhs-": "fhs:RtBDToFhs", + "tagKey-": "tag:Tag" + }, + "identifiedBy": [ + "name" + ], + "rnFormat": "bdpol-{name}", + "containedBy": { + "fv:Tenant": "" + }, + "superClasses": [ + "fhs:ABDPol", + "pol:Def", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + "fhs:RtBDToFhs": "fv:ABDPol" + }, + "relationTo": { + + }, + "dnFormats": [ + "uni/tn-{name}/bdpol-{name}" + ], + "writeAccess": [ + "admin" + ], + "readAccess": [ + "admin", + "tenant-connectivity" + ], + "faults": { + + }, + "events": { + "E4213858": "creation||fhs:BDPol", + "E4213859": "modification||fhs:BDPol", + "E4213860": "deletion||fhs:BDPol" + }, + "stats": { + + }, + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": false, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": false, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "logical", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + + ], + "classId": "10752", + "className": "BDPol", + "classPkg": "fhs", + "featureTag": "", + "moCategory": "Regular", + "label": "FHS BD Policy", + "properties": { + "annotation": { + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "38717", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "deleteAll "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "deleteNonPresent "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "comment": [ + "Specifies a description of the policy definition." + ], + "isConfigurable": true, + "propGlobalId": "5579", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "naming:Described:descr", + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "40856", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "msc "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ipInspectAdminSt": { + "isConfigurable": true, + "propGlobalId": "33492", + "propLocalId": "8018", + "label": "IP Inspection Admin Status", + "baseType": "scalar:Enum8", + "modelType": "fhs:AdminSt", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "enabled-both", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "3", "localName": "disabled", + "platformFlavors": [ + + ], + "comment": [ + "disable" + ], + "label": "Disable "}, + { "value": "0", "localName": "enabled-both", + "platformFlavors": [ + + ], + "comment": [ + "enable both" + ], + "label": "Enable Both IPv4 and IPv6 "}, + { "value": "1", "localName": "enabled-ipv4", + "platformFlavors": [ + + ], + "comment": [ + "enable IPv4 only" + ], + "label": "Enable IPv4 only "}, + { "value": "2", "localName": "enabled-ipv6", + "platformFlavors": [ + + ], + "comment": [ + "enable IPv6 only" + ], + "label": "Enable IPv6 only "} + ], + "default": "enabled-both", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "ResolvedOnBehalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "name": { + "comment": [ + "The name of the object." + ], + "isConfigurable": true, + "propGlobalId": "33495", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": false, + "readOnly": false, + "isNaming": true, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 1, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerKey": { + "comment": [ + "The key for enabling clients to own their data for entity correlation." + ], + "isConfigurable": true, + "propGlobalId": "15230", + "propLocalId": "4100", + "label": "ownerKey", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerTag": { + "comment": [ + "A tag for enabling clients to add their own data. For example, to indicate who created this object." + ], + "isConfigurable": true, + "propGlobalId": "15231", + "propLocalId": "4101", + "label": "ownerTag", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "raGuardAdminSt": { + "isConfigurable": true, + "propGlobalId": "33494", + "propLocalId": "8020", + "label": "Router Advertisement Guard Admin Status", + "baseType": "scalar:Enum8", + "modelType": "nw:AdminSt", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "enabled", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "disabled", + "platformFlavors": [ + + ], + "comment": [ + "Disabled" + ], + "label": "Disabled "}, + { "value": "1", "localName": "enabled", + "platformFlavors": [ + + ], + "comment": [ + "Enabled" + ], + "label": "Enabled "} + ], + "default": "enabled", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "srcGuardAdminSt": { + "isConfigurable": true, + "propGlobalId": "33493", + "propLocalId": "8019", + "label": "Source Guard Admin Status", + "baseType": "scalar:Enum8", + "modelType": "fhs:AdminSt", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "enabled-both", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "3", "localName": "disabled", + "platformFlavors": [ + + ], + "comment": [ + "disable" + ], + "label": "Disable "}, + { "value": "0", "localName": "enabled-both", + "platformFlavors": [ + + ], + "comment": [ + "enable both" + ], + "label": "Enable Both IPv4 and IPv6 "}, + { "value": "1", "localName": "enabled-ipv4", + "platformFlavors": [ + + ], + "comment": [ + "enable IPv4 only" + ], + "label": "Enable IPv4 only "}, + { "value": "2", "localName": "enabled-ipv6", + "platformFlavors": [ + + ], + "comment": [ + "enable IPv6 only" + ], + "label": "Enable IPv6 only "} + ], + "default": "enabled-both", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/meta/fvRsBdFloodTo.json b/gen/meta/fhsRaGuardPol.json similarity index 67% rename from gen/meta/fvRsBdFloodTo.json rename to gen/meta/fhsRaGuardPol.json index 7ce41cdf9..201fb6ea6 100644 --- a/gen/meta/fvRsBdFloodTo.json +++ b/gen/meta/fhsRaGuardPol.json @@ -1,71 +1,60 @@ { - "fv:RsBdFloodTo": { + "fhs:RaGuardPol": { "contains": { "aaa:RbacAnnotation": "", - "fault:Counts": "", - "fault:Inst": "", - "health:Inst": "", + "fault:Delegate": "", "tag:Annotation": "", "tag:Tag": "" }, "rnMap": { "annotationKey-": "tag:Annotation", - "fault-": "fault:Inst", - "fltCnts": "fault:Counts", - "health": "health:Inst", + "fd-": "fault:Delegate", "rbacDom-": "aaa:RbacAnnotation", "tagKey-": "tag:Tag" }, "identifiedBy": [ - "tDn" + ], - "rnFormat": "rsbdFloodTo-[{tDn}]", + "rnFormat": "raguardpol", "containedBy": { - "fv:BD": "", - "fv:SvcBD": "" + "fhs:BDPol": "" }, "superClasses": [ - "reln:To", - "reln:Inst" + "fhs:ARaGuardPol", + "pol:Def", + "pol:Obj", + "naming:NamedObject" ], "subClasses": { }, - "relationInfo": { - "type": "explicit", - "cardinality": "n-to-m", - "fromMo": "fv:ABDPol", - "fromRelMo": "fv:RsBdFloodTo", - "toMo": "vz:Filter", - "toRelMo": "vz:RtBdFloodTo", - "enforceable": true, - "resolvable": true + "relationFrom": { + + }, + "relationTo": { + }, "dnFormats": [ - "uni/tn-{name}/svcBD-{name}/rsbdFloodTo-[{tDn}]", - "uni/tn-{name}/BD-{name}/rsbdFloodTo-[{tDn}]", - "uni/tn-{name}/rsbdFloodTo-[{tDn}]" + "uni/tn-{name}/bdpol-{name}/raguardpol" ], "writeAccess": [ - "admin", - "tenant-connectivity" + "admin" ], "readAccess": [ - "admin", - "tenant-connectivity" + "admin" ], "faults": { - "F0950": "fltFvRsBdFloodToResolveFail" + }, "events": { - "E4214153": "creation||fv:RsBdFloodTo", - "E4214154": "modification||fv:RsBdFloodTo", - "E4214155": "deletion||fv:RsBdFloodTo" + "E4213783": "creation||fhs:RaGuardPol", + "E4213784": "modification||fhs:RaGuardPol", + "E4213785": "deletion||fhs:RaGuardPol" }, "stats": { }, - "versions": "1.0(1e)-", + "versions": "3.0(1k)-", "isAbstract": false, "isConfigurable": true, "isContextRoot": false, @@ -76,92 +65,36 @@ "isExportable": true, "isPersistent": true, "isSubjectToQuota": false, - "isObservable": true, + "isObservable": false, "hasStats": false, "isStat": false, - "isFaultable": true, + "isFaultable": false, "isDomainable": false, - "isHealthScorable": true, + "isHealthScorable": false, "shouldCollectHealthStats": false, "healthCollectionSource": "faults", "hasEventRules": false, - "abstractionLayer": "regular", + "abstractionLayer": "logical", "apicNxProcessing": false, "monitoringPolicySource": "Parent", "isCreatableDeletable": "always", "platformFlavors": [ ], - "classId": "1879", - "className": "RsBdFloodTo", - "classPkg": "fv", + "classId": "9295", + "className": "RaGuardPol", + "classPkg": "fhs", "featureTag": "", - "moCategory": "RelationshipToLocal", - "label": "Filter", - "comment": [ - "A source relation to a filter. A filter is a group of resolvable filter entries. Each filter entry is a combination of network traffic classification properties. This is an internal object." - ], + "moCategory": "Regular", + "label": "RA Guard Policy", "properties": { - "action": { - "versions": "1.0(1e)-", - "comment": [ - "The action required when the condition is met." - ], - "isConfigurable": true, - "propGlobalId": "12179", - "propLocalId": "291", - "label": "action", - "baseType": "scalar:Enum8", - "modelType": "vz:BinaryAction", - "needsPropDelimiters": false, - "uitype": "enum", - "createOnly": false, - "readWrite": true, - "readOnly": false, - "isNaming": false, - "secure": false, - "implicit": false, - "mandatory": false, - "isOverride": false, - "isLike": false, - "validValues": [ - { "value": "permit", "localName": "defaultValue", - "platformFlavors": [ - - ], - "comment": [ - "Default is permit" - ], - "label": " "}, - { "value": "0", "localName": "deny", - "platformFlavors": [ - - ], - "comment": [ - "deny" - ], - "label": "Deny "}, - { "value": "1", "localName": "permit", - "platformFlavors": [ - - ], - "label": "Permit "} - ], - "default": "permit", - "platformFlavors": [ - - ], - "isNxosConverged": false, - "isDeprecated": false, - "isHidden": false - }, "annotation": { "versions": "3.2(1l)-", "comment": [ "User annotation. Suggested format orchestrator:value" ], "isConfigurable": true, - "propGlobalId": "37644", + "propGlobalId": "38560", "propLocalId": "8719", "label": "Annotation", "baseType": "string:Basic", @@ -237,6 +170,43 @@ "isDeprecated": false, "isHidden": false }, + "descr": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies a description of the policy definition." + ], + "isConfigurable": true, + "propGlobalId": "5579", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "naming:Described:descr", + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, "dn": { "versions": "1.0(1e)-", "comment": [ @@ -272,7 +242,7 @@ "Indicates which orchestrator is managing this MO" ], "isConfigurable": false, - "propGlobalId": "39783", + "propGlobalId": "40699", "propLocalId": "8023", "label": "Managed By", "baseType": "scalar:Bitmask32", @@ -313,53 +283,6 @@ "isDeprecated": false, "isHidden": false }, - "forceResolve": { - "versions": "1.0(1e)-", - "comment": [ - "Whether the relation should force pull the target." - ], - "isConfigurable": false, - "propGlobalId": "107", - "propLocalId": "83", - "label": "Force Resolve", - "baseType": "scalar:Bool", - "modelType": "scalar:Bool", - "needsPropDelimiters": false, - "uitype": "auto", - "createOnly": false, - "readWrite": false, - "readOnly": true, - "isNaming": false, - "secure": false, - "implicit": true, - "mandatory": false, - "isOverride": false, - "isLike": false, - "validValues": [ - { "value": "true", "localName": "defaultValue", - "platformFlavors": [ - - ], - "label": " "}, - { "value": "false", "localName": "no", - "platformFlavors": [ - - ], - "label": "No "}, - { "value": "true", "localName": "yes", - "platformFlavors": [ - - ], - "label": "Yes "} - ], - "default": "yes", - "platformFlavors": [ - - ], - "isNxosConverged": false, - "isDeprecated": false, - "isHidden": false - }, "lcOwn": { "versions": "1.0(1e)-", "comment": [ @@ -422,70 +345,43 @@ "isDeprecated": false, "isHidden": false }, - "modTs": { - "versions": "1.0(1e)-", - "comment": [ - "The time when this object was last modified." - ], - "isConfigurable": false, - "propGlobalId": "7", - "propLocalId": "7", - "label": "modTs", - "baseType": "scalar:Date", - "modelType": "mo:TStamp", + "managedConfigCheck": { + "versions": "3.0(1k)-", + "isConfigurable": true, + "propGlobalId": "34112", + "propLocalId": "8077", + "label": "Perform Managed config flag check", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", "needsPropDelimiters": false, - "uitype": "auto", + "uitype": "boolean", "createOnly": false, - "readWrite": false, - "readOnly": true, + "readWrite": true, + "readOnly": false, "isNaming": false, "secure": false, - "implicit": true, + "implicit": false, "mandatory": false, "isOverride": false, "isLike": false, "validValues": [ - { "value": "never", "localName": "defaultValue", + { "value": "false", "localName": "defaultValue", "platformFlavors": [ ], "label": " "}, - { "value": "0", "localName": "never", + { "value": "false", "localName": "no", "platformFlavors": [ ], - "label": "Never "} - ], - "default": "never", - "platformFlavors": [ + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + ], + "label": "Yes "} ], - "isNxosConverged": false, - "isDeprecated": false, - "isHidden": false - }, - "monPolDn": { - "versions": "1.0(1e)-", - "comment": [ - "The monitoring policy attached to this observable object." - ], - "isConfigurable": false, - "propGlobalId": "14247", - "propLocalId": "228", - "label": "Monitoring Policy", - "baseType": "reference:BinRef", - "modelType": "reference:BinRef", - "needsPropDelimiters": true, - "uitype": "auto", - "createOnly": false, - "readWrite": false, - "readOnly": true, - "isNaming": false, - "secure": false, - "implicit": true, - "mandatory": false, - "isOverride": false, - "isLike": false, + "default": "false", "platformFlavors": [ ], @@ -493,51 +389,43 @@ "isDeprecated": false, "isHidden": false }, - "rType": { - "versions": "1.0(1e)-", - "comment": [ - "Represents the type of resolver." - ], - "isConfigurable": false, - "propGlobalId": "106", - "propLocalId": "82", - "label": "Resolver Type", - "baseType": "scalar:Enum8", - "modelType": "reln:ResolverType", + "managedConfigFlag": { + "versions": "3.0(1k)-", + "isConfigurable": true, + "propGlobalId": "27537", + "propLocalId": "6434", + "label": "Managed config flag settting", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", "needsPropDelimiters": false, - "uitype": "enum", + "uitype": "boolean", "createOnly": false, - "readWrite": false, - "readOnly": true, + "readWrite": true, + "readOnly": false, "isNaming": false, "secure": false, - "implicit": true, + "implicit": false, "mandatory": false, "isOverride": false, "isLike": false, "validValues": [ - { "value": "mo", "localName": "defaultValue", + { "value": "false", "localName": "defaultValue", "platformFlavors": [ ], "label": " "}, - { "value": "3", "localName": "local", - "platformFlavors": [ - - ], - "label": "Local "}, - { "value": "1", "localName": "mo", + { "value": "false", "localName": "no", "platformFlavors": [ ], - "label": "MO "}, - { "value": "2", "localName": "service", + "label": "No "}, + { "value": "true", "localName": "yes", "platformFlavors": [ ], - "label": "Service "} + "label": "Yes "} ], - "default": "mo", + "default": "false", "platformFlavors": [ ], @@ -545,28 +433,40 @@ "isDeprecated": false, "isHidden": false }, - "rn": { - "versions": "1.0(1e)-", - "comment": [ - "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." - ], - "isConfigurable": false, - "propGlobalId": "2", - "propLocalId": "3", - "label": "rn", - "baseType": "reference:BinRN", - "modelType": "reference:BinRN", - "needsPropDelimiters": true, - "uitype": "auto", + "maxHopLimit": { + "versions": "3.0(1k)-", + "isConfigurable": true, + "propGlobalId": "27541", + "propLocalId": "6410", + "label": "Max allowed hop limit", + "baseType": "scalar:Uint16", + "modelType": "fhs:RAGuardHopLimit", + "needsPropDelimiters": false, + "uitype": "number", "createOnly": false, - "readWrite": false, - "readOnly": true, + "readWrite": true, + "readOnly": false, "isNaming": false, "secure": false, - "implicit": true, + "implicit": false, "mandatory": false, "isOverride": false, - "isLike": false, + "isLike": true, + "likeProp": "fhs:RaGuard:maxHopLimit", + "validators": [ + {"min" : 1, "max": 255 } + ], + "validValues": [ + { "value": "0", "localName": "defaultValue", + "platformFlavors": [ + + ], + "comment": [ + "By default check is not enabled" + ], + "label": " "} + ], + "default": 0, "platformFlavors": [ ], @@ -574,76 +474,110 @@ "isDeprecated": false, "isHidden": false }, - "state": { - "versions": "1.0(1e)-", - "comment": [ - "Represents the state of the relationship." - ], - "isConfigurable": false, - "propGlobalId": "103", - "propLocalId": "26", - "label": "State", + "maxRouterPref": { + "versions": "3.0(1k)-", + "isConfigurable": true, + "propGlobalId": "27539", + "propLocalId": "6408", + "label": "Allowed max router preference", "baseType": "scalar:Enum8", - "modelType": "reln:State", + "modelType": "fhs:RAGuardMaxRouterPref", "needsPropDelimiters": false, "uitype": "enum", "createOnly": false, - "readWrite": false, - "readOnly": true, + "readWrite": true, + "readOnly": false, "isNaming": false, "secure": false, - "implicit": true, + "implicit": false, "mandatory": false, "isOverride": false, - "isLike": false, + "isLike": true, + "likeProp": "fhs:RaGuard:maxRouterPref", "validValues": [ - { "value": "5", "localName": "cardinality-violation", + { "value": "disabled", "localName": "defaultValue", "platformFlavors": [ ], "comment": [ - "cardinality violation - When relations are created such that\n they violate the cardinality, state of the relation would be\n set to this." + "By default check is not enabled" ], - "label": "Cardinality Violation "}, - { "value": "unformed", "localName": "defaultValue", + "label": " "}, + { "value": "0", "localName": "disabled", "platformFlavors": [ ], - "label": " "}, - { "value": "1", "localName": "formed", + "comment": [ + "Check is not enabled" + ], + "label": "Allowed max router preference check disabled "}, + { "value": "3", "localName": "high", "platformFlavors": [ ], "comment": [ - "the relationship is formed with the target object" + "Allowed Max Router Preference High" ], - "label": "Formed "}, - { "value": "4", "localName": "invalid-target", + "label": "Allowed max router preference high "}, + { "value": "1", "localName": "low", "platformFlavors": [ ], "comment": [ - "invalid target DN" + "Allowed Max Router Preference Low" ], - "label": "Invalid Target "}, - { "value": "2", "localName": "missing-target", + "label": "Allowed max router preference low "}, + { "value": "2", "localName": "medium", "platformFlavors": [ ], "comment": [ - "target does not exist" + "Allowed Max Router Preference Medium" ], - "label": "Missing Target "}, - { "value": "0", "localName": "unformed", + "label": "Allowed max router preference medium "} + ], + "default": "disabled", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "minHopLimit": { + "versions": "3.0(1k)-", + "isConfigurable": true, + "propGlobalId": "27540", + "propLocalId": "6409", + "label": "Min allowed hop limit", + "baseType": "scalar:Uint16", + "modelType": "fhs:RAGuardHopLimit", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "fhs:RaGuard:minHopLimit", + "validators": [ + {"min" : 1, "max": 255 } + ], + "validValues": [ + { "value": "0", "localName": "defaultValue", "platformFlavors": [ ], "comment": [ - "the relationship is not formed" + "By default check is not enabled" ], - "label": "Unformed "} + "label": " "} ], - "default": "unformed", + "default": 0, "platformFlavors": [ ], @@ -651,19 +585,19 @@ "isDeprecated": false, "isHidden": false }, - "stateQual": { + "modTs": { "versions": "1.0(1e)-", "comment": [ - "Represents the state qualifier of the relationship." + "The time when this object was last modified." ], "isConfigurable": false, - "propGlobalId": "104", - "propLocalId": "80", - "label": "State Qualifier", - "baseType": "scalar:Enum8", - "modelType": "reln:StateQual", + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", "needsPropDelimiters": false, - "uitype": "enum", + "uitype": "auto", "createOnly": false, "readWrite": false, "readOnly": true, @@ -674,37 +608,18 @@ "isOverride": false, "isLike": false, "validValues": [ - { "value": "2", "localName": "default-target", - "platformFlavors": [ - - ], - "comment": [ - "target not specified, using default" - ], - "label": "Target Not Specified "}, - { "value": "none", "localName": "defaultValue", + { "value": "never", "localName": "defaultValue", "platformFlavors": [ ], "label": " "}, - { "value": "1", "localName": "mismatch-target", - "platformFlavors": [ - - ], - "comment": [ - "target not found, using default" - ], - "label": "Target Not Found "}, - { "value": "0", "localName": "none", + { "value": "0", "localName": "never", "platformFlavors": [ ], - "comment": [ - "no issue" - ], - "label": "None "} + "label": "Never "} ], - "default": "none", + "default": "never", "platformFlavors": [ ], @@ -712,54 +627,112 @@ "isDeprecated": false, "isHidden": false }, - "status": { + "name": { "versions": "1.0(1e)-", "comment": [ - "The upgrade status. This property is for internal use only." + "null" ], - "isConfigurable": false, - "propGlobalId": "3", - "propLocalId": "4", - "label": "status", - "baseType": "scalar:Bitmask32", - "modelType": "mo:ModificationStatus", + "isConfigurable": true, + "propGlobalId": "4991", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", "needsPropDelimiters": false, - "uitype": "bitmask", + "uitype": "string", "createOnly": false, - "readWrite": false, - "readOnly": true, + "readWrite": true, + "readOnly": false, "isNaming": false, "secure": false, - "implicit": true, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "versions": "2.2(1k)-", + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "otherConfigCheck": { + "versions": "3.0(1k)-", + "isConfigurable": true, + "propGlobalId": "34113", + "propLocalId": "8078", + "label": "Perform Other config flag check", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "boolean", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, "mandatory": false, "isOverride": false, "isLike": false, "validValues": [ - { "value": "2", "localName": "created", + { "value": "false", "localName": "defaultValue", "platformFlavors": [ ], - "comment": [ - "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" - ], - "label": "Created "}, - { "value": "8", "localName": "deleted", + "label": " "}, + { "value": "false", "localName": "no", "platformFlavors": [ ], - "comment": [ - "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" - ], - "label": "Deleted "}, - { "value": "4", "localName": "modified", + "label": "No "}, + { "value": "true", "localName": "yes", "platformFlavors": [ ], - "comment": [ - "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" - ], - "label": "Modified "} + "label": "Yes "} ], + "default": "false", "platformFlavors": [ ], @@ -767,46 +740,43 @@ "isDeprecated": false, "isHidden": false }, - "tCl": { - "versions": "1.0(1e)-", - "comment": [ - "null" - ], - "isConfigurable": false, - "propGlobalId": "12178", - "propLocalId": "78", - "label": "Target Class", - "baseType": "scalar:Enum16", - "modelType": "reln:ClassId", + "otherConfigFlag": { + "versions": "3.0(1k)-", + "isConfigurable": true, + "propGlobalId": "27538", + "propLocalId": "6435", + "label": "Other config flag settting", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", "needsPropDelimiters": false, - "uitype": "enum", + "uitype": "boolean", "createOnly": false, - "readWrite": false, - "readOnly": true, + "readWrite": true, + "readOnly": false, "isNaming": false, "secure": false, - "implicit": true, + "implicit": false, "mandatory": false, - "isOverride": true, + "isOverride": false, "isLike": false, "validValues": [ - { "value": "1362", "localName": "defaultValue", + { "value": "false", "localName": "defaultValue", "platformFlavors": [ ], "label": " "}, - { "value": "0", "localName": "unspecified", + { "value": "false", "localName": "no", "platformFlavors": [ ], - "label": "unspecified "}, - { "value": "1362", "localName": "vzFilter", + "label": "No "}, + { "value": "true", "localName": "yes", "platformFlavors": [ ], - "label": " "} + "label": "Yes "} ], - "default": "vzFilter", + "default": "false", "platformFlavors": [ ], @@ -814,28 +784,35 @@ "isDeprecated": false, "isHidden": false }, - "tDn": { + "ownerKey": { "versions": "1.0(1e)-", "comment": [ - "null" + "The key for enabling clients to own their data for entity correlation." ], "isConfigurable": true, - "propGlobalId": "12177", - "propLocalId": "77", - "label": "Target-dn", - "baseType": "reference:BinRef", - "modelType": "reln:Dn", - "needsPropDelimiters": true, + "propGlobalId": "15230", + "propLocalId": "4100", + "label": "ownerKey", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, "uitype": "string", "createOnly": false, - "readWrite": false, + "readWrite": true, "readOnly": false, - "isNaming": true, + "isNaming": false, "secure": false, "implicit": false, "mandatory": false, - "isOverride": true, + "isOverride": false, "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], "platformFlavors": [ ], @@ -843,19 +820,84 @@ "isDeprecated": false, "isHidden": false }, - "tType": { + "ownerTag": { "versions": "1.0(1e)-", "comment": [ - "The type of target." + "A tag for enabling clients to add their own data. For example, to indicate who created this object." + ], + "isConfigurable": true, + "propGlobalId": "15231", + "propLocalId": "4101", + "label": "ownerTag", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "versions": "1.0(1e)-", + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." ], "isConfigurable": false, - "propGlobalId": "105", - "propLocalId": "81", - "label": "Target Type", - "baseType": "scalar:Enum8", - "modelType": "reln:TargetType", + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "versions": "1.0(1e)-", + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", "needsPropDelimiters": false, - "uitype": "enum", + "uitype": "bitmask", "createOnly": false, "readWrite": false, "readOnly": true, @@ -866,28 +908,31 @@ "isOverride": false, "isLike": false, "validValues": [ - { "value": "2", "localName": "all", + { "value": "2", "localName": "created", "platformFlavors": [ ], - "label": "All "}, - { "value": "mo", "localName": "defaultValue", - "platformFlavors": [ - + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" ], - "label": " "}, - { "value": "1", "localName": "mo", + "label": "Created "}, + { "value": "8", "localName": "deleted", "platformFlavors": [ ], - "label": "MO "}, - { "value": "0", "localName": "name", + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "Deleted "}, + { "value": "4", "localName": "modified", "platformFlavors": [ ], - "label": "Name "} + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "Modified "} ], - "default": "mo", "platformFlavors": [ ], diff --git a/gen/meta/fvAccP.json b/gen/meta/fvAccP.json new file mode 100644 index 000000000..ceab33a12 --- /dev/null +++ b/gen/meta/fvAccP.json @@ -0,0 +1,720 @@ +{ + "fv:AccP": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Delegate": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "fd-": "fault:Delegate", + "rbacDom-": "aaa:RbacAnnotation", + "tagKey-": "tag:Tag" + }, + "identifiedBy": [ + + ], + "rnFormat": "accp", + "containedBy": { + "fv:BD": "" + }, + "superClasses": [ + "pol:Def", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + + }, + "relationTo": { + + }, + "dnFormats": [ + "uni/tn-{name}/BD-{name}/accp" + ], + "writeAccess": [ + "admin", + "tenant-connectivity" + ], + "readAccess": [ + "admin", + "tenant-connectivity" + ], + "faults": { + + }, + "events": { + "E4211939": "creation||fv:AccP", + "E4211940": "modification||fv:AccP", + "E4211941": "deletion||fv:AccP" + }, + "stats": { + + }, + "versions": "1.0(1e)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": false, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": false, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "logical", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + "apic" + ], + "classId": "5185", + "className": "AccP", + "classPkg": "fv", + "featureTag": "", + "moCategory": "Regular", + "label": "Legacy Mode", + "comment": [ + "The bridge domain (BD) access profile. When created over a BD, contracts are not enforced for the BD, and the encap will be applied to all endpoint groups on this BD." + ], + "properties": { + "annotation": { + "versions": "3.2(1l)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "38078", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "versions": "1.0(1e)-", + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "Delete All "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "Delete Non Present "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "Ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies a description of the policy definition." + ], + "isConfigurable": true, + "propGlobalId": "5579", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "naming:Described:descr", + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "versions": "1.0(1e)-", + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "encap": { + "versions": "1.0(1e)-", + "comment": [ + "The selected VLAN for bridge domain access port encapsulation." + ], + "isConfigurable": true, + "propGlobalId": "15219", + "propLocalId": "143", + "label": "BD Access Encap", + "baseType": "base:Encap", + "modelType": "base:Encap", + "needsPropDelimiters": true, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "versions": "3.2(1l)-", + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "40217", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "MSC "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "Undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "versions": "1.0(1e)-", + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "Resolved On Behalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "versions": "1.0(1e)-", + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "Never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "name": { + "versions": "1.0(1e)-", + "comment": [ + "null" + ], + "isConfigurable": true, + "propGlobalId": "4991", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "versions": "2.2(1k)-", + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerKey": { + "versions": "1.0(1e)-", + "comment": [ + "The key for enabling clients to own their data for entity correlation." + ], + "isConfigurable": true, + "propGlobalId": "15230", + "propLocalId": "4100", + "label": "ownerKey", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerTag": { + "versions": "1.0(1e)-", + "comment": [ + "A tag for enabling clients to add their own data. For example, to indicate who created this object." + ], + "isConfigurable": true, + "propGlobalId": "15231", + "propLocalId": "4101", + "label": "ownerTag", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "versions": "1.0(1e)-", + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "versions": "1.0(1e)-", + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "Created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "Deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "Modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "versions": "1.0(1e)-", + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "versions": "5.0(1k)-", + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/meta/fvRogueExceptionMac.json b/gen/meta/fvRogueExceptionMac.json new file mode 100644 index 000000000..a1fc173d4 --- /dev/null +++ b/gen/meta/fvRogueExceptionMac.json @@ -0,0 +1,650 @@ +{ + "fv:RogueExceptionMac": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Delegate": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "fd-": "fault:Delegate", + "rbacDom-": "aaa:RbacAnnotation", + "tagKey-": "tag:Tag" + }, + "identifiedBy": [ + "mac" + ], + "rnFormat": "rgexpmac-{mac}", + "containedBy": { + "fv:BD": "" + }, + "superClasses": [ + "fv:ARogueExceptionMac", + "pol:Comp", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + + }, + "relationTo": { + + }, + "dnFormats": [ + "uni/tn-{name}/BD-{name}/rgexpmac-{mac}" + ], + "writeAccess": [ + "admin", + "tenant-connectivity" + ], + "readAccess": [ + "admin", + "tenant-connectivity" + ], + "faults": { + + }, + "events": { + "E4218363": "creation||fv:RogueExceptionMac", + "E4218364": "modification||fv:RogueExceptionMac", + "E4218365": "deletion||fv:RogueExceptionMac" + }, + "stats": { + + }, + "versions": "5.2(3e)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": false, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": false, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "logical", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + "apic" + ], + "classId": "18775", + "className": "RogueExceptionMac", + "classPkg": "fv", + "featureTag": "", + "moCategory": "Regular", + "label": "Rogue Exception MAc", + "comment": [ + "Configuration of MAC address to be excepted from Rogue processing" + ], + "properties": { + "annotation": { + "versions": "5.2(3e)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "63883", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "versions": "1.0(1e)-", + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "Delete All "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "Delete Non Present "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "Ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies the description of a policy component." + ], + "isConfigurable": true, + "propGlobalId": "5582", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "naming:Described:descr", + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "versions": "1.0(1e)-", + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "versions": "5.2(3e)-", + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "63884", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "MSC "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "Undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "versions": "1.0(1e)-", + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "Resolved On Behalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "mac": { + "versions": "5.2(3e)-", + "comment": [ + "MAC address to except from Rogue processing" + ], + "isConfigurable": true, + "propGlobalId": "63881", + "propLocalId": "480", + "label": "Exception Mac", + "baseType": "address:MAC", + "modelType": "address:MAC", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": false, + "readOnly": false, + "isNaming": true, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validateAsMAC": true, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "versions": "1.0(1e)-", + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "Never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "name": { + "versions": "1.0(1e)-", + "comment": [ + "null" + ], + "isConfigurable": true, + "propGlobalId": "4991", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "versions": "2.2(1k)-", + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "versions": "1.0(1e)-", + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "versions": "1.0(1e)-", + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "Created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "Deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "Modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "versions": "1.0(1e)-", + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "versions": "5.0(1k)-", + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/meta/igmpSnoopPol.json b/gen/meta/igmpSnoopPol.json new file mode 100644 index 000000000..9a203184a --- /dev/null +++ b/gen/meta/igmpSnoopPol.json @@ -0,0 +1,1063 @@ +{ + "igmp:SnoopPol": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Delegate": "", + "igmp:RtIgmpsn": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "fd-": "fault:Delegate", + "rbacDom-": "aaa:RbacAnnotation", + "rtfvIgmpsn-": "igmp:RtIgmpsn", + "tagKey-": "tag:Tag" + }, + "identifiedBy": [ + "name" + ], + "rnFormat": "snPol-{name}", + "containedBy": { + "fabric:Inst": "", + "fv:Tenant": "" + }, + "superClasses": [ + "igmp:ASnoopPol", + "fabric:L2DomPol", + "fabric:ProtoDomPol", + "fabric:ProtoPol", + "pol:Def", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + "igmp:RtIgmpsn": "fv:ABDPol" + }, + "relationTo": { + + }, + "dnFormats": [ + "uni/tn-{name}/snPol-{name}", + "uni/fabric/snPol-{name}" + ], + "writeAccess": [ + "admin", + "tenant-protocol" + ], + "readAccess": [ + "admin", + "tenant-connectivity", + "tenant-protocol" + ], + "faults": { + + }, + "events": { + "E4214225": "creation||igmp:SnoopPol", + "E4214226": "modification||igmp:SnoopPol", + "E4214227": "deletion||igmp:SnoopPol" + }, + "stats": { + + }, + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": false, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": false, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "ambiguous", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + + ], + "classId": "1662", + "className": "SnoopPol", + "classPkg": "igmp", + "featureTag": "", + "moCategory": "Regular", + "label": "IGMP Snoop Policy", + "comment": [ + "The IGMP snooping policy streamlines multicast traffic handling for VLANs. By examining (snooping) IGMP membership report messages from interested hosts, multicast traffic is limited to the subset of VLAN interfaces on which the hosts reside." + ], + "properties": { + "adminSt": { + "comment": [ + "Administrative State" + ], + "isConfigurable": true, + "propGlobalId": "24381", + "propLocalId": "46", + "label": "Admin State", + "baseType": "scalar:Enum8", + "modelType": "nw:AdminSt", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "ipmcsnoop:Dom:adminSt", + "validValues": [ + { "value": "enabled", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "disabled", + "platformFlavors": [ + + ], + "comment": [ + "Disabled" + ], + "label": "Disabled "}, + { "value": "1", "localName": "enabled", + "platformFlavors": [ + + ], + "comment": [ + "Enabled" + ], + "label": "Enabled "} + ], + "default": "enabled", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "annotation": { + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "37562", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "deleteAll "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "deleteNonPresent "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ctrl": { + "comment": [ + "" + ], + "isConfigurable": true, + "propGlobalId": "1506", + "propLocalId": "182", + "label": "Controls", + "baseType": "scalar:Bitmask8", + "modelType": "ipmcsnoop:DomControl", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "ipmcsnoop:Dom:ctrl", + "validValues": [ + { "value": "", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "fast-leave", + "platformFlavors": [ + + ], + "comment": [ + "Fast leave - If this knob is turned on, when the\n switch receives a igmp/mld leave, it removes the \n interface from the multicast outgoing flood list \n for this group" + ], + "label": "Fast leave "}, + { "value": "4", "localName": "opt-flood", + "platformFlavors": [ + + ], + "comment": [ + "@deprecated: THIS FLAG IS A NO-OP" + ], + "label": "Optimize flooding "}, + { "value": "1", "localName": "querier", + "platformFlavors": [ + + ], + "comment": [ + "Enable querier" + ], + "label": "Enable querier "}, + { "value": "8", "localName": "routing", + "platformFlavors": [ + + ], + "comment": [ + "Enable routing on the Dom" + ], + "label": "Enable Routing "} + ], + "default": "", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "comment": [ + "Specifies a description of the policy definition." + ], + "isConfigurable": true, + "propGlobalId": "5579", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "naming:Described:descr", + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "39701", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "msc "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lastMbrIntvl": { + "comment": [ + "When the last member query interval parameter is configured, the software removes the group state if no host responds before the timeout." + ], + "isConfigurable": true, + "propGlobalId": "1509", + "propLocalId": "796", + "label": "Last Member Query Interval", + "baseType": "scalar:Uint16", + "modelType": "mcast:LastMbrQueryIntvl", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "ipmcsnoop:QuerierP:lastMbrIntvl", + "validators": [ + {"min" : 1, "max": 25 } + ], + "validValues": [ + { "value": "1", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 1, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "ResolvedOnBehalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "name": { + "comment": [ + "The name of the IGMP Snoop policy" + ], + "isConfigurable": true, + "propGlobalId": "6605", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": false, + "readOnly": false, + "isNaming": true, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 1, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerKey": { + "comment": [ + "The key for enabling clients to own their data for entity correlation." + ], + "isConfigurable": true, + "propGlobalId": "15230", + "propLocalId": "4100", + "label": "ownerKey", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerTag": { + "comment": [ + "A tag for enabling clients to add their own data. For example, to indicate who created this object." + ], + "isConfigurable": true, + "propGlobalId": "15231", + "propLocalId": "4101", + "label": "ownerTag", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "queryIntvl": { + "comment": [ + "" + ], + "isConfigurable": true, + "propGlobalId": "1507", + "propLocalId": "794", + "label": "Query Interval", + "baseType": "scalar:Uint16", + "modelType": "mcast:QueryIntvl", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "mcast:AQuerier:queryIntvl", + "validators": [ + {"min" : 1, "max": 18000 } + ], + "validValues": [ + { "value": "125", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 125, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rspIntvl": { + "comment": [ + "The IGMP snooping query response interval." + ], + "isConfigurable": true, + "propGlobalId": "1508", + "propLocalId": "795", + "label": "Response Interval", + "baseType": "scalar:Uint16", + "modelType": "mcast:QueryRspIntvl", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "mcast:AQuerier:rspIntvl", + "validators": [ + {"min" : 1, "max": 25 } + ], + "validValues": [ + { "value": "10", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 10, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "startQueryCnt": { + "comment": [ + "The interval before the IGMP query begins." + ], + "isConfigurable": true, + "propGlobalId": "1511", + "propLocalId": "798", + "label": "Startup Query Count", + "baseType": "scalar:UByte", + "modelType": "mcast:QueryCnt", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "mcast:AQuerier:startQueryCnt", + "validators": [ + {"min" : 1, "max": 10 } + ], + "validValues": [ + { "value": "2", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 2, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "startQueryIntvl": { + "comment": [ + "The startup query interval. This configures the IGMP snooping query interval at startup." + ], + "isConfigurable": true, + "propGlobalId": "1510", + "propLocalId": "797", + "label": "Startup Query Interval", + "baseType": "scalar:Uint16", + "modelType": "mcast:StartQueryIntvl", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "mcast:AQuerier:startQueryIntvl", + "validators": [ + {"min" : 1, "max": 18000 } + ], + "validValues": [ + { "value": "31", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 31, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ver": { + "comment": [ + "Version" + ], + "isConfigurable": true, + "propGlobalId": "61461", + "propLocalId": "811", + "label": "Version", + "baseType": "scalar:Enum8", + "modelType": "mcast:Ver", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "igmpsnoop:QuerierP:ver", + "validValues": [ + { "value": "v3", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "Unspecified "}, + { "value": "1", "localName": "v1", + "platformFlavors": [ + + ], + "label": "Version 1 "}, + { "value": "2", "localName": "v2", + "platformFlavors": [ + + ], + "label": "Version 2 "}, + { "value": "3", "localName": "v3", + "platformFlavors": [ + + ], + "label": "Version 3 "} + ], + "default": "v3", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/meta/mldSnoopPol.json b/gen/meta/mldSnoopPol.json new file mode 100644 index 000000000..69e3767c5 --- /dev/null +++ b/gen/meta/mldSnoopPol.json @@ -0,0 +1,1057 @@ +{ + "mld:SnoopPol": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Delegate": "", + "mld:RtMldsn": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "fd-": "fault:Delegate", + "rbacDom-": "aaa:RbacAnnotation", + "rtfvMldsn-": "mld:RtMldsn", + "tagKey-": "tag:Tag" + }, + "identifiedBy": [ + "name" + ], + "rnFormat": "mldsnoopPol-{name}", + "containedBy": { + "fabric:Inst": "", + "fv:Tenant": "" + }, + "superClasses": [ + "mld:ASnoopPol", + "fabric:L2DomPol", + "fabric:ProtoDomPol", + "fabric:ProtoPol", + "pol:Def", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + "mld:RtMldsn": "fv:ABDPol" + }, + "relationTo": { + + }, + "dnFormats": [ + "uni/tn-{name}/mldsnoopPol-{name}", + "uni/fabric/mldsnoopPol-{name}" + ], + "writeAccess": [ + "admin", + "tenant-protocol" + ], + "readAccess": [ + "admin", + "tenant-connectivity", + "tenant-protocol" + ], + "faults": { + + }, + "events": { + "E4216055": "creation||mld:SnoopPol", + "E4216056": "modification||mld:SnoopPol", + "E4216057": "deletion||mld:SnoopPol" + }, + "stats": { + + }, + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": false, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": false, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "ambiguous", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + + ], + "classId": "13614", + "className": "SnoopPol", + "classPkg": "mld", + "featureTag": "", + "moCategory": "Regular", + "label": "MLD Snoop Policy", + "comment": [ + "The MLD snooping policy streamlines multicast traffic handling for VLANs. By examining (snooping) MLD membership report messages from interested hosts, multicast traffic is limited to the subset of VLAN interfaces on which the hosts reside." + ], + "properties": { + "adminSt": { + "comment": [ + "" + ], + "isConfigurable": true, + "propGlobalId": "49947", + "propLocalId": "46", + "label": "Admin State", + "baseType": "scalar:Enum8", + "modelType": "nw:AdminSt", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validValues": [ + { "value": "disabled", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "disabled", + "platformFlavors": [ + + ], + "comment": [ + "Disabled" + ], + "label": "Disabled "}, + { "value": "1", "localName": "enabled", + "platformFlavors": [ + + ], + "comment": [ + "Enabled" + ], + "label": "Enabled "} + ], + "default": "disabled", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "annotation": { + "comment": [ + "" + ], + "isConfigurable": true, + "propGlobalId": "47385", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "deleteAll "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "deleteNonPresent "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ctrl": { + "comment": [ + "Controls for MLD Snoop Policy" + ], + "isConfigurable": true, + "propGlobalId": "47362", + "propLocalId": "182", + "label": "Controls", + "baseType": "scalar:Bitmask8", + "modelType": "ipmcsnoop:DomControl", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "ipmcsnoop:Dom:ctrl", + "validValues": [ + { "value": "", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "fast-leave", + "platformFlavors": [ + + ], + "comment": [ + "Fast leave - If this knob is turned on, when the\n switch receives a igmp/mld leave, it removes the \n interface from the multicast outgoing flood list \n for this group" + ], + "label": "Fast leave "}, + { "value": "4", "localName": "opt-flood", + "platformFlavors": [ + + ], + "comment": [ + "@deprecated: THIS FLAG IS A NO-OP" + ], + "label": "Optimize flooding "}, + { "value": "1", "localName": "querier", + "platformFlavors": [ + + ], + "comment": [ + "Enable querier" + ], + "label": "Enable querier "}, + { "value": "8", "localName": "routing", + "platformFlavors": [ + + ], + "comment": [ + "Enable routing on the Dom" + ], + "label": "Enable Routing "} + ], + "default": "", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "comment": [ + "Specifies a description of the policy definition." + ], + "isConfigurable": true, + "propGlobalId": "5579", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "naming:Described:descr", + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "comment": [ + "" + ], + "isConfigurable": false, + "propGlobalId": "47386", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "msc "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lastMbrIntvl": { + "comment": [ + "When the last member query interval parameter is configured, the software removes the group state if no host responds before the timeout." + ], + "isConfigurable": true, + "propGlobalId": "47365", + "propLocalId": "796", + "label": "Last Member Query Interval", + "baseType": "scalar:Uint16", + "modelType": "mcast:LastMbrQueryIntvl", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "ipmcsnoop:QuerierP:lastMbrIntvl", + "validators": [ + {"min" : 1, "max": 25 } + ], + "validValues": [ + { "value": "1", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 1, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "ResolvedOnBehalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "name": { + "comment": [ + "The name of the MLD Snoop policy" + ], + "isConfigurable": true, + "propGlobalId": "47372", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": false, + "readOnly": false, + "isNaming": true, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 1, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerKey": { + "comment": [ + "The key for enabling clients to own their data for entity correlation." + ], + "isConfigurable": true, + "propGlobalId": "15230", + "propLocalId": "4100", + "label": "ownerKey", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerTag": { + "comment": [ + "A tag for enabling clients to add their own data. For example, to indicate who created this object." + ], + "isConfigurable": true, + "propGlobalId": "15231", + "propLocalId": "4101", + "label": "ownerTag", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "queryIntvl": { + "comment": [ + "Query interval" + ], + "isConfigurable": true, + "propGlobalId": "47363", + "propLocalId": "794", + "label": "Query Interval", + "baseType": "scalar:Uint16", + "modelType": "mcast:QueryIntvl", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "mcast:AQuerier:queryIntvl", + "validators": [ + {"min" : 1, "max": 18000 } + ], + "validValues": [ + { "value": "125", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 125, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rspIntvl": { + "comment": [ + "The snooping query response interval." + ], + "isConfigurable": true, + "propGlobalId": "47364", + "propLocalId": "795", + "label": "Response Interval", + "baseType": "scalar:Uint16", + "modelType": "mcast:QueryRspIntvl", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "mcast:AQuerier:rspIntvl", + "validators": [ + {"min" : 1, "max": 25 } + ], + "validValues": [ + { "value": "10", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 10, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "startQueryCnt": { + "comment": [ + "The interval before the query begins." + ], + "isConfigurable": true, + "propGlobalId": "47367", + "propLocalId": "798", + "label": "Startup Query Count", + "baseType": "scalar:UByte", + "modelType": "mcast:QueryCnt", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "mcast:AQuerier:startQueryCnt", + "validators": [ + {"min" : 1, "max": 10 } + ], + "validValues": [ + { "value": "2", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 2, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "startQueryIntvl": { + "comment": [ + "The startup query interval. This configures the snooping query interval at startup." + ], + "isConfigurable": true, + "propGlobalId": "47366", + "propLocalId": "797", + "label": "Startup Query Interval", + "baseType": "scalar:Uint16", + "modelType": "mcast:StartQueryIntvl", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "mcast:AQuerier:startQueryIntvl", + "validators": [ + {"min" : 1, "max": 18000 } + ], + "validValues": [ + { "value": "31", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 31, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ver": { + "comment": [ + "Version" + ], + "isConfigurable": true, + "propGlobalId": "61464", + "propLocalId": "811", + "label": "Version", + "baseType": "scalar:Enum8", + "modelType": "mcast:Ver", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "mldsnoop:QuerierP:ver", + "validValues": [ + { "value": "v2", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "Unspecified "}, + { "value": "1", "localName": "v1", + "platformFlavors": [ + + ], + "label": "Version 1 "}, + { "value": "2", "localName": "v2", + "platformFlavors": [ + + ], + "label": "Version 2 "} + ], + "default": "v2", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/meta/ndIfPol.json b/gen/meta/ndIfPol.json new file mode 100644 index 000000000..85acf6889 --- /dev/null +++ b/gen/meta/ndIfPol.json @@ -0,0 +1,1210 @@ +{ + "nd:IfPol": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Delegate": "", + "nd:RtBDToNdP": "", + "nd:RtNdIfPol": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "fd-": "fault:Delegate", + "rbacDom-": "aaa:RbacAnnotation", + "rtfvBDToNdP-": "nd:RtBDToNdP", + "rtl3extNdIfPol-": "nd:RtNdIfPol", + "tagKey-": "tag:Tag" + }, + "identifiedBy": [ + "name" + ], + "rnFormat": "ndifpol-{name}", + "containedBy": { + "fv:Tenant": "" + }, + "superClasses": [ + "nd:AIfPol", + "fabric:L3IfPol", + "fabric:ProtoIfPol", + "fabric:ProtoPol", + "pol:Def", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + "nd:RtBDToNdP": "fv:ABDPol", + "nd:RtNdIfPol": "l3ext:LIfP" + }, + "relationTo": { + + }, + "dnFormats": [ + "uni/tn-{name}/ndifpol-{name}" + ], + "writeAccess": [ + "admin", + "tenant-connectivity" + ], + "readAccess": [ + "admin", + "tenant-connectivity", + "tenant-ext-connectivity" + ], + "faults": { + + }, + "events": { + "E4212692": "creation||nd:IfPol", + "E4212693": "modification||nd:IfPol", + "E4212694": "deletion||nd:IfPol" + }, + "stats": { + + }, + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": false, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": false, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "logical", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + + ], + "classId": "5977", + "className": "IfPol", + "classPkg": "nd", + "featureTag": "", + "moCategory": "Regular", + "label": "ND Interface Policy", + "comment": [ + "The neighbor discovery interface policy defines a common configuration that will apply to one or more neighbor discovery interfaces." + ], + "properties": { + "annotation": { + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "38159", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "deleteAll "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "deleteNonPresent "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ctrl": { + "comment": [ + "The control state." + ], + "isConfigurable": true, + "propGlobalId": "17791", + "propLocalId": "182", + "label": "Controls", + "baseType": "scalar:Bitmask16", + "modelType": "nd:IfControl", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "nd:If:ctrl", + "validValues": [ + { "value": "unspecified", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "managed-cfg", + "platformFlavors": [ + + ], + "comment": [ + "redirectsNot Supported Managed config, this flag is advertised in ICMPv6 RA messages to use stateful address auto-configuration to obtain address information\n" + ], + "label": "Managed config "}, + { "value": "4", "localName": "other-cfg", + "platformFlavors": [ + + ], + "comment": [ + "Other config, this flag is advertised in ICMPv6 RA\n messages that hosts use stateful auto configuration\n to obtain non address related information" + ], + "label": "Other config "}, + { "value": "8", "localName": "suppress-ra", + "platformFlavors": [ + + ], + "comment": [ + "suppress-ra" + ], + "label": "Suppress RA "}, + { "value": "16", "localName": "suppress-ra-mtu", + "platformFlavors": [ + + ], + "comment": [ + "suppress-ra mtu" + ], + "label": "Suppress RA mtu "}, + { "value": "32", "localName": "unsolicit-na-glean", + "platformFlavors": [ + + ], + "comment": [ + "unsolicit-na-glean, enable neighbor gleaning on receipt of unsolicit NA" + ], + "label": "Unsolicit NA Glean "}, + { "value": "0", "localName": "unspecified", + "platformFlavors": [ + + ], + "comment": [ + "Unspecified" + ], + "label": "Unspecified "} + ], + "default": "unspecified", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "comment": [ + "Specifies a description of the policy definition." + ], + "isConfigurable": true, + "propGlobalId": "5579", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "naming:Described:descr", + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "40298", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "msc "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "hopLimit": { + "comment": [ + "The hop limit is used by hosts in outgoing packets and link parameters such as the link MTU. This facilitates centralized administration of critical parameters that can be set on routers and automatically propagated to all attached hosts." + ], + "isConfigurable": true, + "propGlobalId": "17795", + "propLocalId": "4424", + "label": "Hop limit", + "baseType": "scalar:UByte", + "modelType": "nd:HopLimit", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "nd:If:hopLimit", + "validators": [ + {"min" : 0, "max": 255 } + ], + "validValues": [ + { "value": "64", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 64, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "ResolvedOnBehalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "mtu": { + "comment": [ + "In the RA message, the maximum transmission unit (MTU) value that a host should use in packets that it originates." + ], + "isConfigurable": true, + "propGlobalId": "17796", + "propLocalId": "171", + "label": "MTU", + "baseType": "scalar:Uint16", + "modelType": "nd:Mtu", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "nd:If:mtu", + "validators": [ + {"min" : 1280, "max": 9000 } + ], + "validValues": [ + { "value": "9000", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 9000, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "name": { + "comment": [ + "The name of the object." + ], + "isConfigurable": true, + "propGlobalId": "17809", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": false, + "readOnly": false, + "isNaming": true, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 1, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nsIntvl": { + "comment": [ + "The neighbor solicitation interval is sent by a node to determine the link-layer address of a neighbor, or to verify that a neighbor is still reachable through a cached link-layer address. Neighbor solicitations are also used for duplicate address detection." + ], + "isConfigurable": true, + "propGlobalId": "17792", + "propLocalId": "4420", + "label": "Neighbor Solicit Interval", + "baseType": "scalar:Uint32", + "modelType": "nd:NsIntvl", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "nd:If:nsIntvl", + "validators": [ + {"min" : 1000, "max": 3600000 } + ], + "validValues": [ + { "value": "1000", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 1000, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nsRetries": { + "comment": [ + "The retransmission retry count for for sending neighbor solicitation messages." + ], + "isConfigurable": true, + "propGlobalId": "17793", + "propLocalId": "4421", + "label": "Neighbor Solicit Retry count", + "baseType": "scalar:UByte", + "modelType": "nd:NsRetries", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "nd:If:nsRetries", + "validators": [ + {"min" : 1, "max": 100 } + ], + "validValues": [ + { "value": "3", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 3, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nudRetryBase": { + "comment": [ + "Retransmission base for NUD neighbor solication\n messages" + ], + "isConfigurable": true, + "propGlobalId": "61515", + "propLocalId": "13340", + "label": "Neighbor Unreachability Detection Retry Base", + "baseType": "scalar:UByte", + "modelType": "nd:NudRetryBase", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "nd:If:nudRetryBase", + "validators": [ + {"min" : 1, "max": 3 } + ], + "validValues": [ + { "value": "1", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 1, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nudRetryInterval": { + "comment": [ + "Retransmission interval between NUD neighbor\n solication messages" + ], + "isConfigurable": true, + "propGlobalId": "61516", + "propLocalId": "13341", + "label": "Neighbor Unreachability Detection Retry Interval", + "baseType": "scalar:Uint32", + "modelType": "nd:NudRetryInterval", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "nd:If:nudRetryInterval", + "validators": [ + {"min" : 1000, "max": 10000 } + ], + "validValues": [ + { "value": "1000", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 1000, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nudRetryMaxAttempts": { + "comment": [ + "Retransmission maximum number of attempts for NUD neighbor\n solication messages" + ], + "isConfigurable": true, + "propGlobalId": "61517", + "propLocalId": "13342", + "label": "Neighbor Unreachability Detection Retry Maximum Attempts", + "baseType": "scalar:UByte", + "modelType": "nd:NudRetryMaxAttempts", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "nd:If:nudRetryMaxAttempts", + "validators": [ + {"min" : 1, "max": 10 } + ], + "validValues": [ + { "value": "3", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 3, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerKey": { + "comment": [ + "The key for enabling clients to own their data for entity correlation." + ], + "isConfigurable": true, + "propGlobalId": "15230", + "propLocalId": "4100", + "label": "ownerKey", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerTag": { + "comment": [ + "A tag for enabling clients to add their own data. For example, to indicate who created this object." + ], + "isConfigurable": true, + "propGlobalId": "15231", + "propLocalId": "4101", + "label": "ownerTag", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "raIntvl": { + "comment": [ + "The interval for sending router advertisement messages." + ], + "isConfigurable": true, + "propGlobalId": "17794", + "propLocalId": "4422", + "label": "Router Advertisement Interval", + "baseType": "scalar:Uint16", + "modelType": "nd:RaIntvl", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "nd:If:raIntvl", + "validators": [ + {"min" : 200, "max": 1800 } + ], + "validValues": [ + { "value": "600", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 600, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "raLifetime": { + "comment": [ + "The lifetime associated with the default router." + ], + "isConfigurable": true, + "propGlobalId": "17797", + "propLocalId": "4425", + "label": "Router Advertisement lifetime", + "baseType": "scalar:Uint16", + "modelType": "nd:RaLifetime", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "nd:If:raLifetime", + "validators": [ + {"min" : 0, "max": 9000 } + ], + "validValues": [ + { "value": "1800", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 1800, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "reachableTime": { + "comment": [ + "The reachable time, which is the time in milliseconds that a node assumes a neighbor is reachable after receiving a reachability confirmation." + ], + "isConfigurable": true, + "propGlobalId": "17798", + "propLocalId": "4426", + "label": "Reachable time", + "baseType": "scalar:Uint32", + "modelType": "nd:ReachableTime", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "nd:If:reachableTime", + "validators": [ + {"min" : 0, "max": 3600000 } + ], + "validValues": [ + { "value": "0", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 0, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "retransTimer": { + "comment": [ + "The retransmit timer has the time in milliseconds between retransmitted neighbor solicitation messages." + ], + "isConfigurable": true, + "propGlobalId": "17799", + "propLocalId": "4427", + "label": "Retransmit timer", + "baseType": "scalar:Uint32", + "modelType": "nd:RetransTimer", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "nd:If:retransTimer", + "validators": [ + {"min" : 0, "max": 0 } + ], + "validValues": [ + { "value": "0", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 0, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/templates/resource.go.tmpl b/gen/templates/resource.go.tmpl index 778444608..bc681d4fe 100644 --- a/gen/templates/resource.go.tmpl +++ b/gen/templates/resource.go.tmpl @@ -322,7 +322,7 @@ func (r *{{.ResourceClassName}}Resource) UpgradeState(ctx context.Context) map[i {{- end }} } - {{ range .Children}} + {{ range .Children}}{{ $ResourceName := .ResourceName }} {{- if isLegacyChild .PkgName $.LegacyChildren}}{{ $PkgName := .PkgName}} {{- $childClassType := getValueFromMap .PkgName $.MigrationClassTypes}} {{- if or (not .IdentifiedBy) .MaxOneClassAllowed}} @@ -335,7 +335,11 @@ func (r *{{.ResourceClassName}}Resource) UpgradeState(ctx context.Context) map[i {{ .Name }}: basetypes.NewStringNull(), {{- else}} {{- if isNewNamedClassAttribute $Overwrite }} + {{- if isNewNamedClassAttributeMatch $Overwrite $ResourceName}} {{ .Name }}: basetypes.NewStringValue(GetMOName(priorStateData.{{ $AttributeName }}.ValueString())), + {{- else}} + {{ .Name }}: basetypes.NewStringNull(), + {{- end }} {{- else}} {{ .Name }}: priorStateData.{{ $AttributeName }}, {{- end}} @@ -438,7 +442,6 @@ func (r *{{.ResourceClassName}}Resource) UpgradeState(ctx context.Context) map[i {{- end}} {{ else}} {{- if or (not .IdentifiedBy) .MaxOneClassAllowed}} - // {{ .ResourceClassName }} is a child of {{ $.ResourceClassName }}. upgradedStateData.{{ .ResourceClassName }} = types.ObjectNull({{ .ResourceClassName }}{{$.ResourceClassName}}Type) {{- else}} upgradedStateData.{{ .ResourceClassName }} = types.SetNull( @@ -517,18 +520,18 @@ func set{{ .ResourceClassName }}LegacyAttributes(ctx context.Context, diags *dia for _, child := range children { for childClassName, childClassDetails := range child.(map[string]interface{}) { childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) - {{- range .Children}}{{- if isLegacyChild .PkgName $.LegacyChildren}} + {{- range .Children}}{{- if isLegacyChild .PkgName $.LegacyChildren}}{{$ResourceName := .ResourceName}} {{- $childClassType := getValueFromMap .PkgName $.MigrationClassTypes}}{{- if eq $childClassType "string" }} if childClassName == "{{ .PkgName }}" { for childAttributeName, childAttributeValue := range childAttributes { {{- range .Properties}} {{- $Overwrite := overwriteProperty .PkgName .SnakeCaseName $.Definitions}} {{- $AttributeName := getLegacyChildAttribute .PkgName $Overwrite . $.LegacyAttributes $.LegacyBlocks}} - {{- if eq $AttributeName (capitalize .PkgName)}} + {{- if and (eq $AttributeName (capitalize .PkgName)) (isNewNamedClassAttributeMatch $Overwrite $ResourceName)}} if childAttributeName == "tDn" { data.Deprecated{{.ResourceClassName}} = basetypes.NewStringValue(childAttributeValue.(string)) } - {{- else if ne $AttributeName ""}} + {{- else if and (ne $AttributeName "") (isNewNamedClassAttributeMatch $Overwrite $ResourceName)}} if childAttributeName == "{{.PropertyName}}" { data.Deprecated{{.ResourceClassName}} = basetypes.NewStringValue(childAttributeValue.(string)) } @@ -543,7 +546,7 @@ func set{{ .ResourceClassName }}LegacyAttributes(ctx context.Context, diags *dia {{- $Overwrite := overwriteProperty .PkgName .SnakeCaseName $.Definitions}} {{- $AttributeName := getLegacyChildAttribute .PkgName $Overwrite . $.LegacyAttributes $.LegacyBlocks}} {{- if eq $AttributeName (capitalize .PkgName)}} - if childAttributeName == "tDn" && childAttributeValue != "" { + if childAttributeName == "tDn" && childAttributeValue != "" && !ContainsString(Deprecated{{.ResourceClassName}}{{$.ResourceClassName}}List, childAttributeValue.(string)) { Deprecated{{.ResourceClassName}}{{$.ResourceClassName}}List = append(Deprecated{{.ResourceClassName}}{{$.ResourceClassName}}List, childAttributeValue.(string)) }{{break}} {{- else if ne $AttributeName ""}} @@ -642,7 +645,7 @@ func (r *{{.ResourceClassName}}Resource) ModifyPlan(ctx context.Context, req res } {{- end}} {{- else if and (ne .ReplacedBy.AttributeName "") (eq (getMigrationType .ValueType) "String") }} - {{- range $.Children}} + {{- range $.Children}}{{$ResourceName := .ResourceName}} {{- if or (not .IdentifiedBy) .MaxOneClassAllowed}} {{- if eq $SetName (capitalize .PkgName)}} if !configData.{{ $SetName }}.IsNull() && stateData != nil { @@ -655,13 +658,13 @@ func (r *{{.ResourceClassName}}Resource) ModifyPlan(ctx context.Context, req res {{- range .Properties}} {{- $Overwrite := overwriteProperty .PkgName .SnakeCaseName $.Definitions}} {{- $AttributeName := getLegacyChildAttribute .PkgName $Overwrite . $.LegacyAttributes $.LegacyBlocks}} - {{- if ne $AttributeName ""}} + {{- if and (ne $AttributeName "") (isNewNamedClassAttributeMatch $Overwrite $ResourceName)}} if GetMOName(stateData.Deprecated{{$SetName}}.ValueString()) == attributeValues.{{ .Name }}.ValueString() && !attributeValues.{{ .Name }}.IsNull() { planData.Deprecated{{$SetName}} = stateData.Deprecated{{$SetName}} } - } {{- end}} {{- end}} + } } else if !configData.Deprecated{{ $SetName }}.IsNull() { {{$SetName}} := {{$SetName}}{{$.ResourceClassName}}ResourceModel{ {{- range .Properties}} @@ -672,7 +675,15 @@ func (r *{{.ResourceClassName}}Resource) ModifyPlan(ctx context.Context, req res {{- else if eq $AttributeName ""}} {{ .Name }}: basetypes.NewStringNull(), {{- else}} - {{ .Name }}: {{- if isNewNamedClassAttribute $Overwrite }}basetypes.NewStringValue(GetMOName(configData.Deprecated{{ $AttributeName }}.ValueString())){{- else }}configData.Deprecated{{ .Name }}{{- end }}, + {{- if isNewNamedClassAttribute $Overwrite }} + {{- if isNewNamedClassAttributeMatch $Overwrite $ResourceName}} + {{ .Name }}: basetypes.NewStringValue(GetMOName(configData.Deprecated{{ $AttributeName }}.ValueString())), + {{- else}} + {{ .Name }}: basetypes.NewStringValue(""), + {{- end }} + {{- else}} + {{ .Name }}: configData.Deprecated{{ .Name }}, + {{- end}} {{- end}} {{- end}} } diff --git a/gen/templates/resource.md.tmpl b/gen/templates/resource.md.tmpl index 26ae95c1f..6164e0d51 100644 --- a/gen/templates/resource.md.tmpl +++ b/gen/templates/resource.md.tmpl @@ -145,7 +145,7 @@ All examples for the {{.ResourceNameAsDescription}} resource can be found in the {{- end}} {{- else}} {{- if or (not .IdentifiedBy) .MaxOneClassAllowed}} -* `{{- overwriteProperty .PkgName .ResourceName $.Definitions}}` - (map) A map of {{getResourceNameAsDescription .ResourceName $.Definitions}} (ACI object {{getDevnetDocForClass .PkgName}}). {{getResourceNameAsDescription .ResourceName $.Definitions}} can also be configured using a separate [aci_{{.ResourceNameDocReference}}](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/{{.ResourceNameDocReference}}) resource.{{if and (ne $.Versions .Versions) (ne .Versions "")}} This attribute is supported in ACI versions: {{ .Versions}}{{- end}} +* `{{- overwriteProperty .PkgName .ResourceName $.Definitions}}` - (map) A map of {{getResourceNameAsDescription .ResourceName $.Definitions}} (ACI object {{getDevnetDocForClass .PkgName}}).{{if .Include}} {{getResourceNameAsDescription .ResourceName $.Definitions}} can also be configured using a separate [aci_{{.ResourceNameDocReference}}](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/{{.ResourceNameDocReference}}) resource.{{end}}{{if and (ne $.Versions .Versions) (ne .Versions "")}} This attribute is supported in ACI versions: {{ .Versions}}{{- end}} {{- else}} * `{{- overwriteProperty .PkgName .ResourceName $.Definitions}}` - (list) A list of {{getResourceNameAsDescription .ResourceName $.Definitions}} (ACI object {{getDevnetDocForClass .PkgName}}). {{getResourceNameAsDescription .ResourceName $.Definitions}} can also be configured using a separate [aci_{{.ResourceNameDocReference}}](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/{{.ResourceNameDocReference}}) resource.{{if and (ne $.Versions .Versions) (ne .Versions "")}} This attribute is supported in ACI versions: {{ .Versions}}{{- end}} {{- end}} diff --git a/gen/testvars/fhsBDPol.yaml b/gen/testvars/fhsBDPol.yaml new file mode 100644 index 000000000..dcf8703a3 --- /dev/null +++ b/gen/testvars/fhsBDPol.yaml @@ -0,0 +1,68 @@ +# 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). + +default: + annotation: "orchestrator:terraform" + description: "" + ip_inspection: "enabled-both" + name_alias: "" + owner_key: "" + owner_tag: "" + router_advertisement: "enabled" + source_guard: "enabled-both" + +datasource_non_existing: + name: "non_existing_name" + +datasource_required: + name: "test_name" + +resource_required: + name: "test_name" + +all: + annotation: "annotation" + description: "description_1" + ip_inspection: "disabled" + name_alias: "name_alias_1" + owner_key: "owner_key_1" + owner_tag: "owner_tag_1" + router_advertisement: "disabled" + source_guard: "disabled" + +children: + route_advertisement_guard_policy: + - annotation: "annotation_1" + description: "description_1" + managed_config_check: "no" + managed_config_flag: "no" + max_hop_limit: "10" + max_router_pref: "disabled" + min_hop_limit: "1" + name: "name_1" + name_alias: "name_alias_1" + other_config_check: "no" + other_config_flag: "no" + owner_key: "owner_key_1" + owner_tag: "owner_tag_1" + deletable_child: true + annotations: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + + tags: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + +parents: + - class_name: "fvTenant" + parent_dependency: "" + parent_dn: "aci_tenant.test.id" + class_in_parent: false diff --git a/gen/testvars/fvBD.yaml b/gen/testvars/fvBD.yaml new file mode 100644 index 000000000..9e86f435b --- /dev/null +++ b/gen/testvars/fvBD.yaml @@ -0,0 +1,172 @@ +# 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). + +default: + optimize_wan_bandwidth: "no" + annotation: "orchestrator:terraform" + arp_flooding: "no" + description: "" + enable_rogue_exception_mac: "no" + clear_remote_mac_entries: "no" + endpoint_move_detection_mode: "" + advertise_host_routes: "no" + intersite_bum_traffic_allow: "no" + intersite_l2_stretch: "no" + ip_learning: "yes" + pim_ipv6: "no" + limit_ip_learn_to_subnets: "yes" + link_local_ipv6_address: "::" + custom_mac_address: "00:22:BD:F8:19:FF" + drop_arp_with_multicast_smac: "yes" + pim: "no" + multi_destination_flooding: "bd-flood" + name_alias: "" + owner_key: "" + owner_tag: "" + bridge_domain_type: "regular" + unicast_routing: "yes" + l2_unknown_unicast_flooding: "proxy" + l3_unknown_multicast_flooding: "flood" + ipv6_l3_unknown_multicast_flooding: "flood" + virtual_mac_address: "not-applicable" + +datasource_non_existing: + name: "non_existing_name" + +datasource_required: + name: "test_name" + +resource_required: + name: "test_name" + +all: + optimize_wan_bandwidth: "no" + annotation: "annotation" + arp_flooding: "no" + description: "description_1" + enable_rogue_exception_mac: "no" + clear_remote_mac_entries: "no" + endpoint_move_detection_mode: "garp" + advertise_host_routes: "no" + intersite_bum_traffic_allow: "no" + intersite_l2_stretch: "no" + ip_learning: "no" + pim_ipv6: "no" + limit_ip_learn_to_subnets: "no" + link_local_ipv6_address: "fe80::1" + custom_mac_address: "00:22:BD:F8:19:FE" + drop_arp_with_multicast_smac: "no" + pim: "no" + multi_destination_flooding: "bd-flood" + name_alias: "name_alias_1" + owner_key: "owner_key_1" + owner_tag: "owner_tag_1" + bridge_domain_type: "fc" + unicast_routing: "no" + l2_unknown_unicast_flooding: "proxy" + l3_unknown_multicast_flooding: "flood" + ipv6_l3_unknown_multicast_flooding: "flood" + virtual_mac_address: "00:22:BD:F8:19:FB" + +children: + legacy_mode: + - annotation: "annotation_1" + description: "description_1" + encapsulation: "vlan-100" + name: "name_1" + name_alias: "name_alias_1" + owner_key: "owner_key_1" + owner_tag: "owner_tag_1" + deletable_child: true + rogue_coop_exceptions: + - annotation: "annotation_1" + description: "description_1" + mac: "00:00:00:00:00:00" + name: "name_1" + name_alias: "name_alias_1" + + - annotation: "annotation_2" + description: "description_2" + mac: "00:00:00:00:00:01" + name: "name_2" + name_alias: "name_alias_2" + + relation_to_monitor_policy: + - annotation: "annotation_1" + monitoring_policy_name: "monitoring_policy_name_1" + deletable_child: true + relation_to_first_hop_security_policy: + - annotation: "annotation_1" + first_hop_security_policy_name: "first_hop_security_policy_name_1" + deletable_child: true + relation_to_neighbor_discovery_interface_policy: + - annotation: "annotation_1" + neighbor_discovery_interface_policy_name: "neighbor_discovery_interface_policy_name_1" + deletable_child: false + + relation_to_netflow_monitor_policy: + - annotation: "annotation_1" + filter_type: "ce" + netflow_monitor_policy_name: "netflow_monitor_policy_name_0" + + - annotation: "annotation_2" + filter_type: "ipv4" + netflow_monitor_policy_name: "netflow_monitor_policy_name_1" + + relation_to_l3_outsides: + - annotation: "annotation_1" + l3_outside_name: "l3_outside_name_0" + + - annotation: "annotation_2" + l3_outside_name: "l3_outside_name_1" + + relation_to_route_control_profile: + - annotation: "annotation_1" + l3_outside_name: "l3_outside_name_1" + route_control_profile_name: "route_control_profile_name_1" + deletable_child: true + relation_to_dhcp_relay_policy: + - annotation: "annotation_1" + dhcp_relay_policy_name: "dhcp_relay_policy_name_1" + deletable_child: true + relation_to_end_point_retention_policy: + - annotation: "annotation_1" + resolve_act: "inherit" + end_point_retention_policy_name: "end_point_retention_policy_name_1" + deletable_child: false + + relation_to_vrf: + - annotation: "annotation_1" + vrf_name: "vrf_name_1" + deletable_child: false + + relation_to_igmp_snooping_policy: + - annotation: "annotation_1" + igmp_snooping_policy_name: "igmp_snooping_policy_name_1" + deletable_child: false + + relation_to_mld_snooping_policy: + - annotation: "annotation_1" + mld_snooping_policy_name: "mld_snooping_policy_name_1" + deletable_child: false + + annotations: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + + tags: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + +parents: + - class_name: "fvTenant" + parent_dependency: "" + parent_dn: "aci_tenant.test.id" + class_in_parent: false diff --git a/gen/testvars/fvRogueExceptionMac.yaml b/gen/testvars/fvRogueExceptionMac.yaml new file mode 100644 index 000000000..80b60adec --- /dev/null +++ b/gen/testvars/fvRogueExceptionMac.yaml @@ -0,0 +1,45 @@ +# 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). + +default: + annotation: "orchestrator:terraform" + description: "" + name: "" + name_alias: "" + +datasource_non_existing: + mac: "non_existing_mac" + +datasource_required: + mac: "00:00:00:00:00:01" + +resource_required: + mac: "00:00:00:00:00:01" + +all: + annotation: "annotation" + description: "description_1" + name: "name_1" + name_alias: "name_alias_1" + +children: + annotations: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + + tags: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + +parents: + - class_name: "fvBD" + parent_dependency: "fvTenant" + parent_dn: "aci_bridge_domain.test.id" + class_in_parent: false diff --git a/gen/testvars/fvRsBDToNetflowMonitorPol.yaml b/gen/testvars/fvRsBDToNetflowMonitorPol.yaml new file mode 100644 index 000000000..0d34e7b77 --- /dev/null +++ b/gen/testvars/fvRsBDToNetflowMonitorPol.yaml @@ -0,0 +1,44 @@ +# 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). + +default: + annotation: "orchestrator:terraform" + filter_type: "ipv4" + +datasource_non_existing: + filter_type: "non_existing_flt_type" + netflow_monitor_policy_name: "non_existing_tn_netflow_monitor_pol_name" + +datasource_required: + filter_type: "ipv4" + netflow_monitor_policy_name: "test_tn_netflow_monitor_pol_name" + +resource_required: + filter_type: "ipv4" + netflow_monitor_policy_name: "test_tn_netflow_monitor_pol_name" + +all: + annotation: "annotation" + filter_type: "ce" + +children: + annotations: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + + tags: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + +parents: + - class_name: "fvBD" + parent_dependency: "fvTenant" + parent_dn: "aci_bridge_domain.test.id" + class_in_parent: false diff --git a/gen/testvars/fvRsBDToOut.yaml b/gen/testvars/fvRsBDToOut.yaml new file mode 100644 index 000000000..3f3ad30f3 --- /dev/null +++ b/gen/testvars/fvRsBDToOut.yaml @@ -0,0 +1,39 @@ +# 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). + +default: + annotation: "orchestrator:terraform" + +datasource_non_existing: + l3_outside_name: "non_existing_tn_l3ext_out_name" + +datasource_required: + l3_outside_name: "test_tn_l3ext_out_name" + +resource_required: + l3_outside_name: "test_tn_l3ext_out_name" + +all: + annotation: "annotation" + +children: + annotations: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + + tags: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + +parents: + - class_name: "fvBD" + parent_dependency: "fvTenant" + parent_dn: "aci_bridge_domain.test.id" + class_in_parent: false diff --git a/gen/testvars/igmpSnoopPol.yaml b/gen/testvars/igmpSnoopPol.yaml new file mode 100644 index 000000000..a139cdef4 --- /dev/null +++ b/gen/testvars/igmpSnoopPol.yaml @@ -0,0 +1,65 @@ +# 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). + +default: + admin_state: "enabled" + annotation: "orchestrator:terraform" + control: [] + description: "" + last_member_interval: "1" + name_alias: "" + owner_key: "" + owner_tag: "" + query_interval: "125" + response_interval: "10" + start_query_count: "2" + start_query_interval: "31" + querier_version: "v3" + +datasource_non_existing: + name: "non_existing_name" + +datasource_required: + name: "test_name" + +resource_required: + name: "test_name" + +all: + admin_state: "disabled" + annotation: "annotation" + control: + - "fast-leave" + - "querier" + description: "description_1" + last_member_interval: "3" + name_alias: "name_alias_1" + owner_key: "owner_key_1" + owner_tag: "owner_tag_1" + query_interval: "140" + response_interval: "11" + start_query_count: "9" + start_query_interval: "2" + querier_version: "v2" + +children: + annotations: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + + tags: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + +parents: + - class_name: "fvTenant" + parent_dependency: "" + parent_dn: "aci_tenant.test.id" + class_in_parent: false diff --git a/gen/testvars/mldSnoopPol.yaml b/gen/testvars/mldSnoopPol.yaml new file mode 100644 index 000000000..cf5277024 --- /dev/null +++ b/gen/testvars/mldSnoopPol.yaml @@ -0,0 +1,65 @@ +# 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). + +default: + admin_state: "disabled" + annotation: "orchestrator:terraform" + control: [] + description: "" + last_member_interval: "1" + name_alias: "" + owner_key: "" + owner_tag: "" + query_interval: "125" + response_interval: "10" + start_query_count: "2" + start_query_interval: "31" + ver: "v2" + +datasource_non_existing: + name: "non_existing_name" + +datasource_required: + name: "test_name" + +resource_required: + name: "test_name" + +all: + admin_state: "disabled" + annotation: "annotation" + control: + - "fast-leave" + - "querier" + description: "description_1" + last_member_interval: "3" + name_alias: "name_alias_1" + owner_key: "owner_key_1" + owner_tag: "owner_tag_1" + query_interval: "140" + response_interval: "11" + start_query_count: "9" + start_query_interval: "2" + ver: "unspecified" + +children: + annotations: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + + tags: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + +parents: + - class_name: "fvTenant" + parent_dependency: "" + parent_dn: "aci_tenant.test.id" + class_in_parent: false diff --git a/gen/testvars/ndIfPol.yaml b/gen/testvars/ndIfPol.yaml new file mode 100644 index 000000000..13f8e32e6 --- /dev/null +++ b/gen/testvars/ndIfPol.yaml @@ -0,0 +1,72 @@ +# 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). + +default: + annotation: "orchestrator:terraform" + controller_state: [] + description: "" + hop_limit: "64" + mtu: "9000" + name_alias: "" + neighbor_solicitation_interval: "1000" + neighbor_solicitation_retries: "3" + nud_retry_base: "1" + nud_retry_interval: "1000" + nud_retry_max_attempts: "3" + owner_key: "" + owner_tag: "" + router_advertisement_interval: "600" + router_advertisement_lifetime: "1800" + reachable_time: "0" + retransmit_timer: "0" + +datasource_non_existing: + name: "non_existing_name" + +datasource_required: + name: "test_name" + +resource_required: + name: "test_name" + +all: + annotation: "annotation" + controller_state: + - "managed-cfg" + description: "description_1" + hop_limit: "40" + mtu: "8700" + name_alias: "name_alias_1" + neighbor_solicitation_interval: "1500" + neighbor_solicitation_retries: "6" + nud_retry_base: "2" + nud_retry_interval: "1300" + nud_retry_max_attempts: "5" + owner_key: "owner_key_1" + owner_tag: "owner_tag_1" + router_advertisement_interval: "500" + router_advertisement_lifetime: "1500" + reachable_time: "2" + retransmit_timer: "2" + +children: + annotations: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + + tags: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "test_value" + +parents: + - class_name: "fvTenant" + parent_dependency: "" + parent_dn: "aci_tenant.test.id" + class_in_parent: false diff --git a/internal/provider/data_source_aci_bridge_domain.go b/internal/provider/data_source_aci_bridge_domain.go new file mode 100644 index 000000000..797854f42 --- /dev/null +++ b/internal/provider/data_source_aci_bridge_domain.go @@ -0,0 +1,605 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvBDDataSource{} + +func NewFvBDDataSource() datasource.DataSource { + return &FvBDDataSource{} +} + +// FvBDDataSource defines the data source implementation. +type FvBDDataSource struct { + client *client.Client +} + +func (d *FvBDDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_bridge_domain") + resp.TypeName = req.ProviderTypeName + "_bridge_domain" + tflog.Debug(ctx, "End metadata of datasource: aci_bridge_domain") +} + +func (d *FvBDDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_bridge_domain") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The bridge_domain datasource for the 'fvBD' class", + + Attributes: map[string]schema.Attribute{ + // Deprecated attributes + "arp_flood": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'arp_flood' will be deprecated soon, please refer to 'arp_flooding' instead", + }, + "ep_clear": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'ep_clear' will be deprecated soon, please refer to 'clear_remote_mac_entries' instead", + }, + "ep_move_detect_mode": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'ep_move_detect_mode' will be deprecated soon, please refer to 'endpoint_move_detection_mode' instead", + }, + "host_based_routing": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'host_based_routing' will be deprecated soon, please refer to 'advertise_host_routes' instead", + }, + "ipv6_mcast_allow": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'ipv6_mcast_allow' will be deprecated soon, please refer to 'pim_ipv6' instead", + }, + "ll_addr": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'll_addr' will be deprecated soon, please refer to 'link_local_ipv6_address' instead", + }, + "mac": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'mac' will be deprecated soon, please refer to 'custom_mac_address' instead", + }, + "mcast_allow": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'mcast_allow' will be deprecated soon, please refer to 'pim' instead", + }, + "multi_dst_pkt_act": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'multi_dst_pkt_act' will be deprecated soon, please refer to 'multi_destination_flooding' instead", + }, + "tenant_dn": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'tenant_dn' will be deprecated soon, please refer to 'parent_dn' instead", + }, + "unicast_route": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'unicast_route' will be deprecated soon, please refer to 'unicast_routing' instead", + }, + "unk_mac_ucast_act": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'unk_mac_ucast_act' will be deprecated soon, please refer to 'l2_unknown_unicast_flooding' instead", + }, + "unk_mcast_act": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'unk_mcast_act' will be deprecated soon, please refer to 'l3_unknown_multicast_flooding' instead", + }, + "v6unk_mcast_act": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'v6unk_mcast_act' will be deprecated soon, please refer to 'ipv6_l3_unknown_multicast_flooding' instead", + }, + "vmac": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'vmac' will be deprecated soon, please refer to 'virtual_mac_address' instead", + }, + "relation_fv_rs_bd_to_ep_ret": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_bd_to_ep_ret' will be deprecated soon, please refer to 'relation_to_end_point_retention_policy.end_point_retention_policy_name' instead", + }, + "relation_fv_rs_bd_to_fhs": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_bd_to_fhs' will be deprecated soon, please refer to 'relation_to_first_hop_security_policy.first_hop_security_policy_name' instead", + }, + "relation_fv_rs_igmpsn": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_igmpsn' will be deprecated soon, please refer to 'relation_to_igmp_snooping_policy.igmp_snooping_policy_name' instead", + }, + "relation_fv_rs_bd_to_out": schema.SetAttribute{ + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_bd_to_out' will be deprecated soon, please refer to 'relation_to_l3_outsides.l3_outside_name' instead", + }, + "relation_fv_rs_mldsn": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_mldsn' will be deprecated soon, please refer to 'relation_to_mld_snooping_policy.mld_snooping_policy_name' instead", + }, + "relation_fv_rs_abd_pol_mon_pol": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_abd_pol_mon_pol' will be deprecated soon, please refer to 'relation_to_monitor_policy.monitoring_policy_name' instead", + }, + "relation_fv_rs_bd_to_nd_p": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_bd_to_nd_p' will be deprecated soon, please refer to 'relation_to_neighbor_discovery_interface_policy.neighbor_discovery_interface_policy_name' instead", + }, + "relation_fv_rs_bd_to_relay_p": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_bd_to_relay_p' will be deprecated soon, please refer to 'relation_to_relay_policy.dhcp_relay_policy_name' instead", + }, + "relation_fv_rs_bd_to_profile": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_bd_to_profile' will be deprecated soon, please refer to 'relation_to_route_control_profile.route_control_profile_name' instead", + }, + "relation_fv_rs_ctx": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_ctx' will be deprecated soon, please refer to 'relation_to_vrf.vrf_name' instead", + }, + // End of deprecated attributes + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Bridge Domain object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "optimize_wan_bandwidth": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Optimize WAN Bandwidth for the Bridge Domain object.`, + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Bridge Domain object.`, + }, + "arp_flooding": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Enable ARP flooding for the Bridge Domain object. If flooding is disabled, unicast routing will be performed on the target IP address.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Bridge Domain object.`, + }, + "enable_rogue_exception_mac": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Enable rogue exception based on MAC wildcard for the Bridge Domain object.`, + }, + "clear_remote_mac_entries": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Clear all End-Points in leafs for the Bridge Domain object.`, + }, + "endpoint_move_detection_mode": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The End Point move detection option uses the Gratuitous Address Resolution Protocol (GARP). A gratuitous ARP is an ARP broadcast-type of packet that is used to verify that no other device on the network has the same IP address as the sending device.`, + }, + "advertise_host_routes": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Advertise host routes (/32 prefixes) out of the L3Out(s) associated to the Bridge Domain object.`, + }, + "intersite_bum_traffic_allow": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Enable intersite Broadcast, Unknown-Unicast and Multicast (BUM) traffic between sites for the Bridge Domain object.`, + }, + "intersite_l2_stretch": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Enable L2 stretch between sites for the Bridge Domain object.`, + }, + "ip_learning": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The IP learning setting of the Bridge Domain object.`, + }, + "pim_ipv6": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Enable IPv6 multicast traffic for the Bridge Domain object.`, + }, + "limit_ip_learn_to_subnets": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Limit IP address learning to subnets for the Bridge Domain object. Every %!s(MISSING) object can have multiple subnets associated with it.`, + }, + "link_local_ipv6_address": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The override of the system generated IPv6 link-local address.`, + }, + "custom_mac_address": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The MAC address of the Bridge Domain object.`, + }, + "drop_arp_with_multicast_smac": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Drop roque multicast ARP packets for the Bridge Domain object.`, + }, + "pim": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Enable IPv4 multicast traffic for the Bridge Domain object.`, + }, + "multi_destination_flooding": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The multiple destination forwarding method for L2 Multicast, Broadcast, and Link Layer traffic types.`, + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the Bridge Domain object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the Bridge Domain object.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "bridge_domain_type": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `domain type.`, + }, + "unicast_routing": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Enable the forwarding method based on predefined forwarding criteria (IP or MAC address).`, + }, + "l2_unknown_unicast_flooding": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The forwarding method for unknown layer 2 destinations.`, + }, + "l3_unknown_multicast_flooding": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The forwarding method for unknown layer multicast destinations.`, + }, + "ipv6_l3_unknown_multicast_flooding": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The forwarding method for unknown IPv6 multicast destinations.`, + }, + "virtual_mac_address": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Virtual MAC address of the BD/SVI. This is used when the BD is extended to multiple sites using l2 Outside.`, + }, + "legacy_mode": schema.SingleNestedAttribute{ + MarkdownDescription: `The bridge domain (BD) access profile. When created over a BD, contracts are not enforced for the BD, and the encap will be applied to all endpoint groups on this BD.`, + Computed: true, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Legacy Mode object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Legacy Mode object.`, + }, + "encapsulation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The VLAN or VXLAN encapsulation of the Legacy Mode object.`, + }, + "name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the Legacy Mode object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the Legacy Mode object.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + }, + }, + "rogue_coop_exceptions": schema.SetNestedAttribute{ + MarkdownDescription: `Configuration of MAC address to be excepted from Rogue processing`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Rogue Coop Exception object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Rogue Coop Exception object.`, + }, + "mac": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The MAC address of the Rogue Coop Exception object.`, + }, + "name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the Rogue Coop Exception object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the Rogue Coop Exception object.`, + }, + }, + }, + }, + "relation_to_monitor_policy": schema.SingleNestedAttribute{ + MarkdownDescription: `A source relation to the monitoring policy model for the endpoint group semantic scope. This is an internal object.`, + Computed: true, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To Monitoring Policy object.`, + }, + "monitoring_policy_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the Monitoring Policy object.`, + }, + }, + }, + "relation_to_first_hop_security_policy": schema.SingleNestedAttribute{ + MarkdownDescription: `Relation to FHS BD policy`, + Computed: true, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To First Hop Security Policy object.`, + }, + "first_hop_security_policy_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the First Hop Security Policy object.`, + }, + }, + }, + "relation_to_neighbor_discovery_interface_policy": schema.SingleNestedAttribute{ + MarkdownDescription: `The neighbor discovery policy.`, + Computed: true, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To Neighbor Discovery Interface Policy object.`, + }, + "neighbor_discovery_interface_policy_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the Neighbor Discovery Interface Policy object.`, + }, + }, + }, + "relation_to_netflow_monitor_policy": schema.SetNestedAttribute{ + MarkdownDescription: `Relation to Netflow Monitor policy`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To NetFlow Monitor Policy object.`, + }, + "filter_type": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The filter type of the NetFlow Monitor Policy object.`, + }, + "netflow_monitor_policy_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the NetFlow Monitor Policy object.`, + }, + }, + }, + }, + "relation_to_l3_outsides": schema.SetNestedAttribute{ + MarkdownDescription: `A source relation to the policy controlling connectivity to the outside. This is an internal object.`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To L3 Outside object.`, + }, + "l3_outside_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the L3 Outside object.`, + }, + }, + }, + }, + "relation_to_route_control_profile": schema.SingleNestedAttribute{ + MarkdownDescription: `A source relation to external networks that are routed via Layer 3 networks outside the fabric that are reachable by a tenant's applications. This is an internal object.`, + Computed: true, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To Route Control Profile object.`, + }, + "l3_outside_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the L3 Outside object.`, + }, + "route_control_profile_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the Route Control Profile object.`, + }, + }, + }, + "relation_to_dhcp_relay_policy": schema.SingleNestedAttribute{ + MarkdownDescription: `A source relation to the DHCP relay profile. This is an internal object.`, + Computed: true, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To Dhcp Relay Policy object.`, + }, + "dhcp_relay_policy_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the DHCP Relay Policy object.`, + }, + }, + }, + "relation_to_end_point_retention_policy": schema.SingleNestedAttribute{ + MarkdownDescription: `A source relation to the endpoint retention policy providing the parameters for the lifecycle of the endpoint group. This is an internal object.`, + Computed: true, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To End Point Retention Policy object.`, + }, + "resolve_act": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `null.`, + }, + "end_point_retention_policy_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The End Point Retention policy name associated with the bridge domain.`, + }, + }, + }, + "relation_to_vrf": schema.SingleNestedAttribute{ + MarkdownDescription: `A source relation to a private layer 3 network context that either belongs to a specific tenant or is shared. This is an internal object.`, + Computed: true, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To VRF object.`, + }, + "vrf_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the VRF object.`, + }, + }, + }, + "relation_to_igmp_snooping_policy": schema.SingleNestedAttribute{ + MarkdownDescription: `A source relation to the Internet Group Management Protocol (IGMP) snooping policy. This is an internal object.`, + Computed: true, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To IGMP Snooping Policy object.`, + }, + "igmp_snooping_policy_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the IGMP Snooping Policy object.`, + }, + }, + }, + "relation_to_mld_snooping_policy": schema.SingleNestedAttribute{ + MarkdownDescription: `Relation to an MLD Snoop policy`, + Computed: true, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To MLD Snooping Policy object.`, + }, + "mld_snooping_policy_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the MLD Snooping Policy object.`, + }, + }, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + Blocks: map[string]schema.Block{ + "relation_fv_rs_bd_to_netflow_monitor_pol": schema.SetNestedBlock{ + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "flt_type": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'flt_type' will be deprecated soon, please refer to 'relation_to_netflow_monitor_policy.filter_type' instead", + }, + "tn_netflow_monitor_pol_name": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'tn_netflow_monitor_pol_name' will be deprecated soon, please refer to 'relation_to_netflow_monitor_policy.netflow_monitor_policy_name' instead", + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_bridge_domain") +} + +func (d *FvBDDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_bridge_domain") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_bridge_domain") +} + +func (d *FvBDDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_bridge_domain") + var data *FvBDResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvBDId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvBDAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_bridge_domain with id '%s'", data.Id.ValueString())) + + getAndSetFvBDAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_bridge_domain data source", + fmt.Sprintf("The aci_bridge_domain data source with id '%s' has not been found", cachedId), + ) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_bridge_domain with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_bridge_domain_test.go b/internal/provider/data_source_aci_bridge_domain_test.go new file mode 100644 index 000000000..0d2e1dbba --- /dev/null +++ b/internal/provider/data_source_aci_bridge_domain_test.go @@ -0,0 +1,75 @@ +// 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) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvBDDataSourceDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "name", "test_name"), + resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "advertise_host_routes", "no"), + 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", "drop_arp_with_multicast_smac", "yes"), + resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "enable_rogue_exception_mac", "no"), + resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "endpoint_move_detection_mode", ""), + resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "intersite_bum_traffic_allow", "no"), + 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", "ipv6_l3_unknown_multicast_flooding", "flood"), + 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", "pim_ipv6", "no"), + resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "unicast_routing", "yes"), + resource.TestCheckResourceAttr("data.aci_bridge_domain.test", "virtual_mac_address", "not-applicable"), + ), + }, + { + Config: testConfigFvBDNotExistingFvTenant, + 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" +} +` diff --git a/internal/provider/data_source_aci_first_hop_security_policy.go b/internal/provider/data_source_aci_first_hop_security_policy.go new file mode 100644 index 000000000..27d68e444 --- /dev/null +++ b/internal/provider/data_source_aci_first_hop_security_policy.go @@ -0,0 +1,235 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FhsBDPolDataSource{} + +func NewFhsBDPolDataSource() datasource.DataSource { + return &FhsBDPolDataSource{} +} + +// FhsBDPolDataSource defines the data source implementation. +type FhsBDPolDataSource struct { + client *client.Client +} + +func (d *FhsBDPolDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_first_hop_security_policy") + resp.TypeName = req.ProviderTypeName + "_first_hop_security_policy" + tflog.Debug(ctx, "End metadata of datasource: aci_first_hop_security_policy") +} + +func (d *FhsBDPolDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_first_hop_security_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The first_hop_security_policy datasource for the 'fhsBDPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the First Hop Security Policy object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the First Hop Security Policy object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the First Hop Security Policy object.`, + }, + "ip_inspection": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `IP Inspection Admin Status.`, + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the First Hop Security Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the First Hop Security Policy object.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "router_advertisement": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Router Advertisement Guard Admin Status.`, + }, + "source_guard": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Source Guard Admin Status.`, + }, + "route_advertisement_guard_policy": schema.SingleNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Route Advertisement Guard Policy object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Route Advertisement Guard Policy object.`, + }, + "managed_config_check": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Perform Managed config flag check.`, + }, + "managed_config_flag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Managed config flag settting.`, + }, + "max_hop_limit": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Max allowed hop limit.`, + }, + "max_router_pref": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Allowed max router preference.`, + }, + "min_hop_limit": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Min allowed hop limit.`, + }, + "name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the Route Advertisement Guard Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the Route Advertisement Guard Policy object.`, + }, + "other_config_check": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Perform Other config flag check.`, + }, + "other_config_flag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Other config flag settting.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + }, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_first_hop_security_policy") +} + +func (d *FhsBDPolDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_first_hop_security_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_first_hop_security_policy") +} + +func (d *FhsBDPolDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_first_hop_security_policy") + var data *FhsBDPolResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFhsBDPolId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFhsBDPolAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_first_hop_security_policy with id '%s'", data.Id.ValueString())) + + getAndSetFhsBDPolAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_first_hop_security_policy data source", + fmt.Sprintf("The aci_first_hop_security_policy data source with id '%s' has not been found", cachedId), + ) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_first_hop_security_policy with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_first_hop_security_policy_test.go b/internal/provider/data_source_aci_first_hop_security_policy_test.go new file mode 100644 index 000000000..6d386d48e --- /dev/null +++ b/internal/provider/data_source_aci_first_hop_security_policy_test.go @@ -0,0 +1,56 @@ +// 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 TestAccDataSourceFhsBDPolWithFvTenant(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFhsBDPolDataSourceDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_first_hop_security_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("data.aci_first_hop_security_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_first_hop_security_policy.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_first_hop_security_policy.test", "ip_inspection", "enabled-both"), + resource.TestCheckResourceAttr("data.aci_first_hop_security_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_first_hop_security_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_first_hop_security_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_first_hop_security_policy.test", "router_advertisement", "enabled"), + resource.TestCheckResourceAttr("data.aci_first_hop_security_policy.test", "source_guard", "enabled-both"), + ), + }, + { + Config: testConfigFhsBDPolNotExistingFvTenant, + ExpectError: regexp.MustCompile("Failed to read aci_first_hop_security_policy data source"), + }, + }, + }) +} + +const testConfigFhsBDPolDataSourceDependencyWithFvTenant = testConfigFhsBDPolMinDependencyWithFvTenant + ` +data "aci_first_hop_security_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + depends_on = [aci_first_hop_security_policy.test] +} +` + +const testConfigFhsBDPolNotExistingFvTenant = testConfigFvTenantMin + ` +data "aci_first_hop_security_policy" "test_non_existing" { + parent_dn = aci_tenant.test.id + name = "non_existing_name" +} +` diff --git a/internal/provider/data_source_aci_igmp_snooping_policy.go b/internal/provider/data_source_aci_igmp_snooping_policy.go new file mode 100644 index 000000000..5f60e362f --- /dev/null +++ b/internal/provider/data_source_aci_igmp_snooping_policy.go @@ -0,0 +1,199 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &IgmpSnoopPolDataSource{} + +func NewIgmpSnoopPolDataSource() datasource.DataSource { + return &IgmpSnoopPolDataSource{} +} + +// IgmpSnoopPolDataSource defines the data source implementation. +type IgmpSnoopPolDataSource struct { + client *client.Client +} + +func (d *IgmpSnoopPolDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_igmp_snooping_policy") + resp.TypeName = req.ProviderTypeName + "_igmp_snooping_policy" + tflog.Debug(ctx, "End metadata of datasource: aci_igmp_snooping_policy") +} + +func (d *IgmpSnoopPolDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_igmp_snooping_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The igmp_snooping_policy datasource for the 'igmpSnoopPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the IGMP Snooping Policy object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "admin_state": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Administrative State.`, + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the IGMP Snooping Policy object.`, + }, + "control": schema.SetAttribute{ + Computed: true, + MarkdownDescription: ``, + ElementType: types.StringType, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the IGMP Snooping Policy object.`, + }, + "last_member_interval": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `When the last member query interval parameter is configured, the software removes the group state if no host responds before the timeout.`, + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the IGMP Snooping Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the IGMP Snooping Policy object.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "query_interval": schema.StringAttribute{ + Computed: true, + MarkdownDescription: ``, + }, + "response_interval": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The IGMP snooping query response interval.`, + }, + "start_query_count": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The interval before the IGMP query begins.`, + }, + "start_query_interval": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The startup query interval. This configures the IGMP snooping query interval at startup.`, + }, + "querier_version": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Version.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_igmp_snooping_policy") +} + +func (d *IgmpSnoopPolDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_igmp_snooping_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_igmp_snooping_policy") +} + +func (d *IgmpSnoopPolDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_igmp_snooping_policy") + var data *IgmpSnoopPolResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setIgmpSnoopPolId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetIgmpSnoopPolAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_igmp_snooping_policy with id '%s'", data.Id.ValueString())) + + getAndSetIgmpSnoopPolAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_igmp_snooping_policy data source", + fmt.Sprintf("The aci_igmp_snooping_policy data source with id '%s' has not been found", cachedId), + ) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_igmp_snooping_policy with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_igmp_snooping_policy_test.go b/internal/provider/data_source_aci_igmp_snooping_policy_test.go new file mode 100644 index 000000000..0b5f20022 --- /dev/null +++ b/internal/provider/data_source_aci_igmp_snooping_policy_test.go @@ -0,0 +1,61 @@ +// 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 TestAccDataSourceIgmpSnoopPolWithFvTenant(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigIgmpSnoopPolDataSourceDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_igmp_snooping_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("data.aci_igmp_snooping_policy.test", "admin_state", "enabled"), + resource.TestCheckResourceAttr("data.aci_igmp_snooping_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_igmp_snooping_policy.test", "control.#", "0"), + resource.TestCheckResourceAttr("data.aci_igmp_snooping_policy.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_igmp_snooping_policy.test", "last_member_interval", "1"), + resource.TestCheckResourceAttr("data.aci_igmp_snooping_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_igmp_snooping_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_igmp_snooping_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_igmp_snooping_policy.test", "querier_version", "v3"), + resource.TestCheckResourceAttr("data.aci_igmp_snooping_policy.test", "query_interval", "125"), + resource.TestCheckResourceAttr("data.aci_igmp_snooping_policy.test", "response_interval", "10"), + resource.TestCheckResourceAttr("data.aci_igmp_snooping_policy.test", "start_query_count", "2"), + resource.TestCheckResourceAttr("data.aci_igmp_snooping_policy.test", "start_query_interval", "31"), + ), + }, + { + Config: testConfigIgmpSnoopPolNotExistingFvTenant, + ExpectError: regexp.MustCompile("Failed to read aci_igmp_snooping_policy data source"), + }, + }, + }) +} + +const testConfigIgmpSnoopPolDataSourceDependencyWithFvTenant = testConfigIgmpSnoopPolMinDependencyWithFvTenant + ` +data "aci_igmp_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + depends_on = [aci_igmp_snooping_policy.test] +} +` + +const testConfigIgmpSnoopPolNotExistingFvTenant = testConfigFvTenantMin + ` +data "aci_igmp_snooping_policy" "test_non_existing" { + parent_dn = aci_tenant.test.id + name = "non_existing_name" +} +` diff --git a/internal/provider/data_source_aci_mld_snooping_policy.go b/internal/provider/data_source_aci_mld_snooping_policy.go new file mode 100644 index 000000000..b221931d6 --- /dev/null +++ b/internal/provider/data_source_aci_mld_snooping_policy.go @@ -0,0 +1,199 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &MldSnoopPolDataSource{} + +func NewMldSnoopPolDataSource() datasource.DataSource { + return &MldSnoopPolDataSource{} +} + +// MldSnoopPolDataSource defines the data source implementation. +type MldSnoopPolDataSource struct { + client *client.Client +} + +func (d *MldSnoopPolDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_mld_snooping_policy") + resp.TypeName = req.ProviderTypeName + "_mld_snooping_policy" + tflog.Debug(ctx, "End metadata of datasource: aci_mld_snooping_policy") +} + +func (d *MldSnoopPolDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_mld_snooping_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The mld_snooping_policy datasource for the 'mldSnoopPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the MLD Snooping Policy object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "admin_state": schema.StringAttribute{ + Computed: true, + MarkdownDescription: ``, + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the MLD Snooping Policy object.`, + }, + "control": schema.SetAttribute{ + Computed: true, + MarkdownDescription: `Controls for MLD Snoop Policy.`, + ElementType: types.StringType, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the MLD Snooping Policy object.`, + }, + "last_member_interval": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `When the last member query interval parameter is configured, the software removes the group state if no host responds before the timeout.`, + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the MLD Snooping Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the MLD Snooping Policy object.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "query_interval": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Query interval.`, + }, + "response_interval": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The snooping query response interval.`, + }, + "start_query_count": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The interval before the query begins.`, + }, + "start_query_interval": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The startup query interval. This configures the snooping query interval at startup.`, + }, + "ver": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Version.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_mld_snooping_policy") +} + +func (d *MldSnoopPolDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_mld_snooping_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_mld_snooping_policy") +} + +func (d *MldSnoopPolDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_mld_snooping_policy") + var data *MldSnoopPolResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setMldSnoopPolId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetMldSnoopPolAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_mld_snooping_policy with id '%s'", data.Id.ValueString())) + + getAndSetMldSnoopPolAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_mld_snooping_policy data source", + fmt.Sprintf("The aci_mld_snooping_policy data source with id '%s' has not been found", cachedId), + ) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_mld_snooping_policy with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_mld_snooping_policy_test.go b/internal/provider/data_source_aci_mld_snooping_policy_test.go new file mode 100644 index 000000000..be5678f7a --- /dev/null +++ b/internal/provider/data_source_aci_mld_snooping_policy_test.go @@ -0,0 +1,61 @@ +// 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 TestAccDataSourceMldSnoopPolWithFvTenant(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigMldSnoopPolDataSourceDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_mld_snooping_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("data.aci_mld_snooping_policy.test", "admin_state", "disabled"), + resource.TestCheckResourceAttr("data.aci_mld_snooping_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_mld_snooping_policy.test", "control.#", "0"), + resource.TestCheckResourceAttr("data.aci_mld_snooping_policy.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_mld_snooping_policy.test", "last_member_interval", "1"), + resource.TestCheckResourceAttr("data.aci_mld_snooping_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_mld_snooping_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_mld_snooping_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_mld_snooping_policy.test", "query_interval", "125"), + resource.TestCheckResourceAttr("data.aci_mld_snooping_policy.test", "response_interval", "10"), + resource.TestCheckResourceAttr("data.aci_mld_snooping_policy.test", "start_query_count", "2"), + resource.TestCheckResourceAttr("data.aci_mld_snooping_policy.test", "start_query_interval", "31"), + resource.TestCheckResourceAttr("data.aci_mld_snooping_policy.test", "ver", "v2"), + ), + }, + { + Config: testConfigMldSnoopPolNotExistingFvTenant, + ExpectError: regexp.MustCompile("Failed to read aci_mld_snooping_policy data source"), + }, + }, + }) +} + +const testConfigMldSnoopPolDataSourceDependencyWithFvTenant = testConfigMldSnoopPolMinDependencyWithFvTenant + ` +data "aci_mld_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + depends_on = [aci_mld_snooping_policy.test] +} +` + +const testConfigMldSnoopPolNotExistingFvTenant = testConfigFvTenantMin + ` +data "aci_mld_snooping_policy" "test_non_existing" { + parent_dn = aci_tenant.test.id + name = "non_existing_name" +} +` diff --git a/internal/provider/data_source_aci_neighbor_discovery_interface_policy.go b/internal/provider/data_source_aci_neighbor_discovery_interface_policy.go new file mode 100644 index 000000000..63bd65f3a --- /dev/null +++ b/internal/provider/data_source_aci_neighbor_discovery_interface_policy.go @@ -0,0 +1,215 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &NdIfPolDataSource{} + +func NewNdIfPolDataSource() datasource.DataSource { + return &NdIfPolDataSource{} +} + +// NdIfPolDataSource defines the data source implementation. +type NdIfPolDataSource struct { + client *client.Client +} + +func (d *NdIfPolDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_neighbor_discovery_interface_policy") + resp.TypeName = req.ProviderTypeName + "_neighbor_discovery_interface_policy" + tflog.Debug(ctx, "End metadata of datasource: aci_neighbor_discovery_interface_policy") +} + +func (d *NdIfPolDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_neighbor_discovery_interface_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The neighbor_discovery_interface_policy datasource for the 'ndIfPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Neighbor Discovery Interface Policy object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Neighbor Discovery Interface Policy object.`, + }, + "controller_state": schema.SetAttribute{ + Computed: true, + MarkdownDescription: `The control state.`, + ElementType: types.StringType, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Neighbor Discovery Interface Policy object.`, + }, + "hop_limit": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The hop limit is used by hosts in outgoing packets and link parameters such as the link MTU. This facilitates centralized administration of critical parameters that can be set on routers and automatically propagated to all attached hosts.`, + }, + "mtu": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `In the RA message, the maximum transmission unit (MTU) value that a host should use in packets that it originates.`, + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the Neighbor Discovery Interface Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the Neighbor Discovery Interface Policy object.`, + }, + "neighbor_solicitation_interval": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The neighbor solicitation interval is sent by a node to determine the link-layer address of a neighbor, or to verify that a neighbor is still reachable through a cached link-layer address. Neighbor solicitations are also used for duplicate address detection.`, + }, + "neighbor_solicitation_retries": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The retransmission retry count for for sending neighbor solicitation messages.`, + }, + "nud_retry_base": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Retransmission base for NUD neighbor solication messages.`, + }, + "nud_retry_interval": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Retransmission interval between NUD neighbor solication messages.`, + }, + "nud_retry_max_attempts": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Retransmission maximum number of attempts for NUD neighbor solication messages.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "router_advertisement_interval": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The interval for sending router advertisement messages.`, + }, + "router_advertisement_lifetime": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The lifetime associated with the default router.`, + }, + "reachable_time": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The reachable time, which is the time in milliseconds that a node assumes a neighbor is reachable after receiving a reachability confirmation.`, + }, + "retransmit_timer": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The retransmit timer has the time in milliseconds between retransmitted neighbor solicitation messages.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_neighbor_discovery_interface_policy") +} + +func (d *NdIfPolDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_neighbor_discovery_interface_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_neighbor_discovery_interface_policy") +} + +func (d *NdIfPolDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_neighbor_discovery_interface_policy") + var data *NdIfPolResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setNdIfPolId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetNdIfPolAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_neighbor_discovery_interface_policy with id '%s'", data.Id.ValueString())) + + getAndSetNdIfPolAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_neighbor_discovery_interface_policy data source", + fmt.Sprintf("The aci_neighbor_discovery_interface_policy data source with id '%s' has not been found", cachedId), + ) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_neighbor_discovery_interface_policy with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_neighbor_discovery_interface_policy_test.go b/internal/provider/data_source_aci_neighbor_discovery_interface_policy_test.go new file mode 100644 index 000000000..8f6e473a5 --- /dev/null +++ b/internal/provider/data_source_aci_neighbor_discovery_interface_policy_test.go @@ -0,0 +1,65 @@ +// 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 TestAccDataSourceNdIfPolWithFvTenant(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigNdIfPolDataSourceDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "controller_state.#", "0"), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "hop_limit", "64"), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "mtu", "9000"), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "neighbor_solicitation_interval", "1000"), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "neighbor_solicitation_retries", "3"), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "nud_retry_base", "1"), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "nud_retry_interval", "1000"), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "nud_retry_max_attempts", "3"), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "reachable_time", "0"), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "retransmit_timer", "0"), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "router_advertisement_interval", "600"), + resource.TestCheckResourceAttr("data.aci_neighbor_discovery_interface_policy.test", "router_advertisement_lifetime", "1800"), + ), + }, + { + Config: testConfigNdIfPolNotExistingFvTenant, + ExpectError: regexp.MustCompile("Failed to read aci_neighbor_discovery_interface_policy data source"), + }, + }, + }) +} + +const testConfigNdIfPolDataSourceDependencyWithFvTenant = testConfigNdIfPolMinDependencyWithFvTenant + ` +data "aci_neighbor_discovery_interface_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + depends_on = [aci_neighbor_discovery_interface_policy.test] +} +` + +const testConfigNdIfPolNotExistingFvTenant = testConfigFvTenantMin + ` +data "aci_neighbor_discovery_interface_policy" "test_non_existing" { + parent_dn = aci_tenant.test.id + name = "non_existing_name" +} +` diff --git a/internal/provider/data_source_aci_relation_from_bridge_domain_to_l3_outside.go b/internal/provider/data_source_aci_relation_from_bridge_domain_to_l3_outside.go new file mode 100644 index 000000000..9dc37f919 --- /dev/null +++ b/internal/provider/data_source_aci_relation_from_bridge_domain_to_l3_outside.go @@ -0,0 +1,149 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvRsBDToOutDataSource{} + +func NewFvRsBDToOutDataSource() datasource.DataSource { + return &FvRsBDToOutDataSource{} +} + +// FvRsBDToOutDataSource defines the data source implementation. +type FvRsBDToOutDataSource struct { + client *client.Client +} + +func (d *FvRsBDToOutDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_relation_from_bridge_domain_to_l3_outside") + resp.TypeName = req.ProviderTypeName + "_relation_from_bridge_domain_to_l3_outside" + tflog.Debug(ctx, "End metadata of datasource: aci_relation_from_bridge_domain_to_l3_outside") +} + +func (d *FvRsBDToOutDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_relation_from_bridge_domain_to_l3_outside") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The relation_from_bridge_domain_to_l3_outside datasource for the 'fvRsBDToOut' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Relation From Bridge Domain To L3 Outside object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To L3 Outside object.`, + }, + "l3_outside_name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the L3 Outside object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_relation_from_bridge_domain_to_l3_outside") +} + +func (d *FvRsBDToOutDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_relation_from_bridge_domain_to_l3_outside") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_relation_from_bridge_domain_to_l3_outside") +} + +func (d *FvRsBDToOutDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_relation_from_bridge_domain_to_l3_outside") + var data *FvRsBDToOutResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvRsBDToOutId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvRsBDToOutAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_relation_from_bridge_domain_to_l3_outside with id '%s'", data.Id.ValueString())) + + getAndSetFvRsBDToOutAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_relation_from_bridge_domain_to_l3_outside data source", + fmt.Sprintf("The aci_relation_from_bridge_domain_to_l3_outside data source with id '%s' has not been found", cachedId), + ) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_relation_from_bridge_domain_to_l3_outside with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_relation_from_bridge_domain_to_l3_outside_test.go b/internal/provider/data_source_aci_relation_from_bridge_domain_to_l3_outside_test.go new file mode 100644 index 000000000..9d4b5fb54 --- /dev/null +++ b/internal/provider/data_source_aci_relation_from_bridge_domain_to_l3_outside_test.go @@ -0,0 +1,49 @@ +// 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 TestAccDataSourceFvRsBDToOutWithFvBD(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvRsBDToOutDataSourceDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_relation_from_bridge_domain_to_l3_outside.test", "l3_outside_name", "test_tn_l3ext_out_name"), + resource.TestCheckResourceAttr("data.aci_relation_from_bridge_domain_to_l3_outside.test", "annotation", "orchestrator:terraform"), + ), + }, + { + Config: testConfigFvRsBDToOutNotExistingFvBD, + ExpectError: regexp.MustCompile("Failed to read aci_relation_from_bridge_domain_to_l3_outside data source"), + }, + }, + }) +} + +const testConfigFvRsBDToOutDataSourceDependencyWithFvBD = testConfigFvRsBDToOutMinDependencyWithFvBD + ` +data "aci_relation_from_bridge_domain_to_l3_outside" "test" { + parent_dn = aci_bridge_domain.test.id + l3_outside_name = "test_tn_l3ext_out_name" + depends_on = [aci_relation_from_bridge_domain_to_l3_outside.test] +} +` + +const testConfigFvRsBDToOutNotExistingFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +data "aci_relation_from_bridge_domain_to_l3_outside" "test_non_existing" { + parent_dn = aci_bridge_domain.test.id + l3_outside_name = "non_existing_tn_l3ext_out_name" +} +` diff --git a/internal/provider/data_source_aci_relation_from_bridge_domain_to_netflow_monitor_policy.go b/internal/provider/data_source_aci_relation_from_bridge_domain_to_netflow_monitor_policy.go new file mode 100644 index 000000000..0a6da7996 --- /dev/null +++ b/internal/provider/data_source_aci_relation_from_bridge_domain_to_netflow_monitor_policy.go @@ -0,0 +1,153 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvRsBDToNetflowMonitorPolDataSource{} + +func NewFvRsBDToNetflowMonitorPolDataSource() datasource.DataSource { + return &FvRsBDToNetflowMonitorPolDataSource{} +} + +// FvRsBDToNetflowMonitorPolDataSource defines the data source implementation. +type FvRsBDToNetflowMonitorPolDataSource struct { + client *client.Client +} + +func (d *FvRsBDToNetflowMonitorPolDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") + resp.TypeName = req.ProviderTypeName + "_relation_from_bridge_domain_to_netflow_monitor_policy" + tflog.Debug(ctx, "End metadata of datasource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") +} + +func (d *FvRsBDToNetflowMonitorPolDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The relation_from_bridge_domain_to_netflow_monitor_policy datasource for the 'fvRsBDToNetflowMonitorPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Relation From Bridge Domain To NetFlow Monitor Policy object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To NetFlow Monitor Policy object.`, + }, + "filter_type": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The filter type of the NetFlow Monitor Policy object.`, + }, + "netflow_monitor_policy_name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the NetFlow Monitor Policy object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") +} + +func (d *FvRsBDToNetflowMonitorPolDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") +} + +func (d *FvRsBDToNetflowMonitorPolDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") + var data *FvRsBDToNetflowMonitorPolResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvRsBDToNetflowMonitorPolId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvRsBDToNetflowMonitorPolAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_relation_from_bridge_domain_to_netflow_monitor_policy with id '%s'", data.Id.ValueString())) + + getAndSetFvRsBDToNetflowMonitorPolAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_relation_from_bridge_domain_to_netflow_monitor_policy data source", + fmt.Sprintf("The aci_relation_from_bridge_domain_to_netflow_monitor_policy data source with id '%s' has not been found", cachedId), + ) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_relation_from_bridge_domain_to_netflow_monitor_policy with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_relation_from_bridge_domain_to_netflow_monitor_policy_test.go b/internal/provider/data_source_aci_relation_from_bridge_domain_to_netflow_monitor_policy_test.go new file mode 100644 index 000000000..9df2a71e2 --- /dev/null +++ b/internal/provider/data_source_aci_relation_from_bridge_domain_to_netflow_monitor_policy_test.go @@ -0,0 +1,53 @@ +// 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 TestAccDataSourceFvRsBDToNetflowMonitorPolWithFvBD(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvRsBDToNetflowMonitorPolDataSourceDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "filter_type", "ipv4"), + resource.TestCheckResourceAttr("data.aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "netflow_monitor_policy_name", "test_tn_netflow_monitor_pol_name"), + resource.TestCheckResourceAttr("data.aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "filter_type", "ipv4"), + ), + }, + { + Config: testConfigFvRsBDToNetflowMonitorPolNotExistingFvBD, + ExpectError: regexp.MustCompile("Failed to read aci_relation_from_bridge_domain_to_netflow_monitor_policy data source"), + }, + }, + }) +} + +const testConfigFvRsBDToNetflowMonitorPolDataSourceDependencyWithFvBD = testConfigFvRsBDToNetflowMonitorPolMinDependencyWithFvBD + ` +data "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "test" { + parent_dn = aci_bridge_domain.test.id + filter_type = "ipv4" + netflow_monitor_policy_name = "test_tn_netflow_monitor_pol_name" + depends_on = [aci_relation_from_bridge_domain_to_netflow_monitor_policy.test] +} +` + +const testConfigFvRsBDToNetflowMonitorPolNotExistingFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +data "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "test_non_existing" { + parent_dn = aci_bridge_domain.test.id + filter_type = "non_existing_flt_type" + netflow_monitor_policy_name = "non_existing_tn_netflow_monitor_pol_name" +} +` diff --git a/internal/provider/data_source_aci_rogue_coop_exception.go b/internal/provider/data_source_aci_rogue_coop_exception.go new file mode 100644 index 000000000..0ec623133 --- /dev/null +++ b/internal/provider/data_source_aci_rogue_coop_exception.go @@ -0,0 +1,161 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvRogueExceptionMacDataSource{} + +func NewFvRogueExceptionMacDataSource() datasource.DataSource { + return &FvRogueExceptionMacDataSource{} +} + +// FvRogueExceptionMacDataSource defines the data source implementation. +type FvRogueExceptionMacDataSource struct { + client *client.Client +} + +func (d *FvRogueExceptionMacDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_rogue_coop_exception") + resp.TypeName = req.ProviderTypeName + "_rogue_coop_exception" + tflog.Debug(ctx, "End metadata of datasource: aci_rogue_coop_exception") +} + +func (d *FvRogueExceptionMacDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_rogue_coop_exception") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The rogue_coop_exception datasource for the 'fvRogueExceptionMac' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Rogue Coop Exception object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Rogue Coop Exception object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Rogue Coop Exception object.`, + }, + "mac": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The MAC address of the Rogue Coop Exception object.`, + }, + "name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the Rogue Coop Exception object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the Rogue Coop Exception object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_rogue_coop_exception") +} + +func (d *FvRogueExceptionMacDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_rogue_coop_exception") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_rogue_coop_exception") +} + +func (d *FvRogueExceptionMacDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_rogue_coop_exception") + var data *FvRogueExceptionMacResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvRogueExceptionMacId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvRogueExceptionMacAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_rogue_coop_exception with id '%s'", data.Id.ValueString())) + + getAndSetFvRogueExceptionMacAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_rogue_coop_exception data source", + fmt.Sprintf("The aci_rogue_coop_exception data source with id '%s' has not been found", cachedId), + ) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_rogue_coop_exception with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_rogue_coop_exception_test.go b/internal/provider/data_source_aci_rogue_coop_exception_test.go new file mode 100644 index 000000000..77568d481 --- /dev/null +++ b/internal/provider/data_source_aci_rogue_coop_exception_test.go @@ -0,0 +1,52 @@ +// 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 TestAccDataSourceFvRogueExceptionMacWithFvBD(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvRogueExceptionMacDataSourceDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_rogue_coop_exception.test", "mac", "00:00:00:00:00:01"), + resource.TestCheckResourceAttr("data.aci_rogue_coop_exception.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_rogue_coop_exception.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_rogue_coop_exception.test", "name", ""), + resource.TestCheckResourceAttr("data.aci_rogue_coop_exception.test", "name_alias", ""), + ), + }, + { + Config: testConfigFvRogueExceptionMacNotExistingFvBD, + ExpectError: regexp.MustCompile("Failed to read aci_rogue_coop_exception data source"), + }, + }, + }) +} + +const testConfigFvRogueExceptionMacDataSourceDependencyWithFvBD = testConfigFvRogueExceptionMacMinDependencyWithFvBD + ` +data "aci_rogue_coop_exception" "test" { + parent_dn = aci_bridge_domain.test.id + mac = "00:00:00:00:00:01" + depends_on = [aci_rogue_coop_exception.test] +} +` + +const testConfigFvRogueExceptionMacNotExistingFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +data "aci_rogue_coop_exception" "test_non_existing" { + parent_dn = aci_bridge_domain.test.id + mac = "non_existing_mac" +} +` diff --git a/internal/provider/provider.go b/internal/provider/provider.go index ff04aca37..8fbab8055 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -204,8 +204,10 @@ func (p *AciProvider) Configure(ctx context.Context, req provider.ConfigureReque func (p *AciProvider) Resources(ctx context.Context) []func() resource.Resource { return []func() resource.Resource{ + NewFhsBDPolResource, NewFhsTrustCtrlPolResource, NewFvAEPgResource, + NewFvBDResource, NewFvCrtrnResource, NewFvDnsAttrResource, NewFvESgResource, @@ -217,6 +219,9 @@ func (p *AciProvider) Resources(ctx context.Context) []func() resource.Resource NewFvIdGroupAttrResource, NewFvIpAttrResource, NewFvMacAttrResource, + NewFvRogueExceptionMacResource, + NewFvRsBDToNetflowMonitorPolResource, + NewFvRsBDToOutResource, NewFvRsConsResource, NewFvRsConsIfResource, NewFvRsDomAttResource, @@ -229,6 +234,7 @@ func (p *AciProvider) Resources(ctx context.Context) []func() resource.Resource NewFvRsSecInheritedResource, NewFvSCrtrnResource, NewFvVmAttrResource, + NewIgmpSnoopPolResource, NewInfraHPathSResource, NewL3extConsLblResource, NewL3extProvLblResource, @@ -239,7 +245,9 @@ func (p *AciProvider) Resources(ctx context.Context) []func() resource.Resource NewMgmtInstPResource, NewMgmtRsOoBConsResource, NewMgmtSubnetResource, + NewMldSnoopPolResource, NewMplsNodeSidPResource, + NewNdIfPolResource, NewNetflowExporterPolResource, NewNetflowMonitorPolResource, NewNetflowRecordPolResource, @@ -258,8 +266,10 @@ func (p *AciProvider) Resources(ctx context.Context) []func() resource.Resource func (p *AciProvider) DataSources(ctx context.Context) []func() datasource.DataSource { return []func() datasource.DataSource{ + NewFhsBDPolDataSource, NewFhsTrustCtrlPolDataSource, NewFvAEPgDataSource, + NewFvBDDataSource, NewFvCrtrnDataSource, NewFvDnsAttrDataSource, NewFvESgDataSource, @@ -271,6 +281,9 @@ func (p *AciProvider) DataSources(ctx context.Context) []func() datasource.DataS NewFvIdGroupAttrDataSource, NewFvIpAttrDataSource, NewFvMacAttrDataSource, + NewFvRogueExceptionMacDataSource, + NewFvRsBDToNetflowMonitorPolDataSource, + NewFvRsBDToOutDataSource, NewFvRsConsDataSource, NewFvRsConsIfDataSource, NewFvRsDomAttDataSource, @@ -283,6 +296,7 @@ func (p *AciProvider) DataSources(ctx context.Context) []func() datasource.DataS NewFvRsSecInheritedDataSource, NewFvSCrtrnDataSource, NewFvVmAttrDataSource, + NewIgmpSnoopPolDataSource, NewInfraHPathSDataSource, NewL3extConsLblDataSource, NewL3extProvLblDataSource, @@ -293,7 +307,9 @@ func (p *AciProvider) DataSources(ctx context.Context) []func() datasource.DataS NewMgmtInstPDataSource, NewMgmtRsOoBConsDataSource, NewMgmtSubnetDataSource, + NewMldSnoopPolDataSource, NewMplsNodeSidPDataSource, + NewNdIfPolDataSource, NewNetflowExporterPolDataSource, NewNetflowMonitorPolDataSource, NewNetflowRecordPolDataSource, diff --git a/internal/provider/resource_aci_application_epg.go b/internal/provider/resource_aci_application_epg.go index 40a416254..80e457fd2 100644 --- a/internal/provider/resource_aci_application_epg.go +++ b/internal/provider/resource_aci_application_epg.go @@ -965,7 +965,6 @@ func (r *FvAEPgResource) UpgradeState(ctx context.Context) map[int64]resource.St DeprecatedFvRsTrustCtrl: priorStateData.FvRsTrustCtrl, } - // FvCrtrn is a child of FvAEPg. upgradedStateData.FvCrtrn = types.ObjectNull(FvCrtrnFvAEPgType) FvRsAEPgMonPolObject := FvRsAEPgMonPolFvAEPgResourceModel{ @@ -1376,14 +1375,14 @@ func setFvAEPgLegacyAttributes(ctx context.Context, diags *diag.Diagnostics, dat } if childClassName == "fvRsCons" { for childAttributeName, childAttributeValue := range childAttributes { - if childAttributeName == "tDn" && childAttributeValue != "" { + if childAttributeName == "tDn" && childAttributeValue != "" && !ContainsString(DeprecatedFvRsConsFvAEPgList, childAttributeValue.(string)) { DeprecatedFvRsConsFvAEPgList = append(DeprecatedFvRsConsFvAEPgList, childAttributeValue.(string)) } } } if childClassName == "fvRsConsIf" { for childAttributeName, childAttributeValue := range childAttributes { - if childAttributeName == "tDn" && childAttributeValue != "" { + if childAttributeName == "tDn" && childAttributeValue != "" && !ContainsString(DeprecatedFvRsConsIfFvAEPgList, childAttributeValue.(string)) { DeprecatedFvRsConsIfFvAEPgList = append(DeprecatedFvRsConsIfFvAEPgList, childAttributeValue.(string)) } } @@ -1404,42 +1403,42 @@ func setFvAEPgLegacyAttributes(ctx context.Context, diags *diag.Diagnostics, dat } if childClassName == "fvRsFcPathAtt" { for childAttributeName, childAttributeValue := range childAttributes { - if childAttributeName == "tDn" && childAttributeValue != "" { + if childAttributeName == "tDn" && childAttributeValue != "" && !ContainsString(DeprecatedFvRsFcPathAttFvAEPgList, childAttributeValue.(string)) { DeprecatedFvRsFcPathAttFvAEPgList = append(DeprecatedFvRsFcPathAttFvAEPgList, childAttributeValue.(string)) } } } if childClassName == "fvRsIntraEpg" { for childAttributeName, childAttributeValue := range childAttributes { - if childAttributeName == "tDn" && childAttributeValue != "" { + if childAttributeName == "tDn" && childAttributeValue != "" && !ContainsString(DeprecatedFvRsIntraEpgFvAEPgList, childAttributeValue.(string)) { DeprecatedFvRsIntraEpgFvAEPgList = append(DeprecatedFvRsIntraEpgFvAEPgList, childAttributeValue.(string)) } } } if childClassName == "fvRsPathAtt" { for childAttributeName, childAttributeValue := range childAttributes { - if childAttributeName == "tDn" && childAttributeValue != "" { + if childAttributeName == "tDn" && childAttributeValue != "" && !ContainsString(DeprecatedFvRsPathAttFvAEPgList, childAttributeValue.(string)) { DeprecatedFvRsPathAttFvAEPgList = append(DeprecatedFvRsPathAttFvAEPgList, childAttributeValue.(string)) } } } if childClassName == "fvRsProtBy" { for childAttributeName, childAttributeValue := range childAttributes { - if childAttributeName == "tDn" && childAttributeValue != "" { + if childAttributeName == "tDn" && childAttributeValue != "" && !ContainsString(DeprecatedFvRsProtByFvAEPgList, childAttributeValue.(string)) { DeprecatedFvRsProtByFvAEPgList = append(DeprecatedFvRsProtByFvAEPgList, childAttributeValue.(string)) } } } if childClassName == "fvRsProv" { for childAttributeName, childAttributeValue := range childAttributes { - if childAttributeName == "tDn" && childAttributeValue != "" { + if childAttributeName == "tDn" && childAttributeValue != "" && !ContainsString(DeprecatedFvRsProvFvAEPgList, childAttributeValue.(string)) { DeprecatedFvRsProvFvAEPgList = append(DeprecatedFvRsProvFvAEPgList, childAttributeValue.(string)) } } } if childClassName == "fvRsSecInherited" { for childAttributeName, childAttributeValue := range childAttributes { - if childAttributeName == "tDn" && childAttributeValue != "" { + if childAttributeName == "tDn" && childAttributeValue != "" && !ContainsString(DeprecatedFvRsSecInheritedFvAEPgList, childAttributeValue.(string)) { DeprecatedFvRsSecInheritedFvAEPgList = append(DeprecatedFvRsSecInheritedFvAEPgList, childAttributeValue.(string)) } } diff --git a/internal/provider/resource_aci_bridge_domain.go b/internal/provider/resource_aci_bridge_domain.go new file mode 100644 index 000000000..7b4ce5fa1 --- /dev/null +++ b/internal/provider/resource_aci_bridge_domain.go @@ -0,0 +1,4224 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/setvalidator" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvBDResource{} +var _ resource.ResourceWithImportState = &FvBDResource{} + +func NewFvBDResource() resource.Resource { + return &FvBDResource{} +} + +// FvBDResource defines the resource implementation. +type FvBDResource struct { + client *client.Client +} + +// FvBDResourceModel describes the resource data model. +type FvBDResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + OptimizeWanBandwidth types.String `tfsdk:"optimize_wan_bandwidth"` + Annotation types.String `tfsdk:"annotation"` + ArpFlood types.String `tfsdk:"arp_flooding"` + Descr types.String `tfsdk:"description"` + EnableRogueExceptMac types.String `tfsdk:"enable_rogue_exception_mac"` + EpClear types.String `tfsdk:"clear_remote_mac_entries"` + EpMoveDetectMode types.String `tfsdk:"endpoint_move_detection_mode"` + HostBasedRouting types.String `tfsdk:"advertise_host_routes"` + IntersiteBumTrafficAllow types.String `tfsdk:"intersite_bum_traffic_allow"` + IntersiteL2Stretch types.String `tfsdk:"intersite_l2_stretch"` + IpLearning types.String `tfsdk:"ip_learning"` + Ipv6McastAllow types.String `tfsdk:"pim_ipv6"` + LimitIpLearnToSubnets types.String `tfsdk:"limit_ip_learn_to_subnets"` + LlAddr types.String `tfsdk:"link_local_ipv6_address"` + Mac types.String `tfsdk:"custom_mac_address"` + McastARPDrop types.String `tfsdk:"drop_arp_with_multicast_smac"` + McastAllow types.String `tfsdk:"pim"` + MultiDstPktAct types.String `tfsdk:"multi_destination_flooding"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` + Type types.String `tfsdk:"bridge_domain_type"` + UnicastRoute types.String `tfsdk:"unicast_routing"` + UnkMacUcastAct types.String `tfsdk:"l2_unknown_unicast_flooding"` + UnkMcastAct types.String `tfsdk:"l3_unknown_multicast_flooding"` + V6unkMcastAct types.String `tfsdk:"ipv6_l3_unknown_multicast_flooding"` + Vmac types.String `tfsdk:"virtual_mac_address"` + FvAccP types.Object `tfsdk:"legacy_mode"` + FvRogueExceptionMac types.Set `tfsdk:"rogue_coop_exceptions"` + FvRsABDPolMonPol types.Object `tfsdk:"relation_to_monitor_policy"` + FvRsBDToFhs types.Object `tfsdk:"relation_to_first_hop_security_policy"` + FvRsBDToNdP types.Object `tfsdk:"relation_to_neighbor_discovery_interface_policy"` + FvRsBDToNetflowMonitorPol types.Set `tfsdk:"relation_to_netflow_monitor_policy"` + FvRsBDToOut types.Set `tfsdk:"relation_to_l3_outsides"` + FvRsBDToProfile types.Object `tfsdk:"relation_to_route_control_profile"` + FvRsBDToRelayP types.Object `tfsdk:"relation_to_dhcp_relay_policy"` + FvRsBdToEpRet types.Object `tfsdk:"relation_to_end_point_retention_policy"` + FvRsCtx types.Object `tfsdk:"relation_to_vrf"` + FvRsIgmpsn types.Object `tfsdk:"relation_to_igmp_snooping_policy"` + FvRsMldsn types.Object `tfsdk:"relation_to_mld_snooping_policy"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` + DeprecatedArpFlood types.String `tfsdk:"arp_flood"` + DeprecatedEpClear types.String `tfsdk:"ep_clear"` + DeprecatedEpMoveDetectMode types.String `tfsdk:"ep_move_detect_mode"` + DeprecatedHostBasedRouting types.String `tfsdk:"host_based_routing"` + DeprecatedIpv6McastAllow types.String `tfsdk:"ipv6_mcast_allow"` + DeprecatedLlAddr types.String `tfsdk:"ll_addr"` + DeprecatedMac types.String `tfsdk:"mac"` + DeprecatedMcastAllow types.String `tfsdk:"mcast_allow"` + DeprecatedMultiDstPktAct types.String `tfsdk:"multi_dst_pkt_act"` + DeprecatedParentDn types.String `tfsdk:"tenant_dn"` + DeprecatedUnicastRoute types.String `tfsdk:"unicast_route"` + DeprecatedUnkMacUcastAct types.String `tfsdk:"unk_mac_ucast_act"` + DeprecatedUnkMcastAct types.String `tfsdk:"unk_mcast_act"` + DeprecatedV6unkMcastAct types.String `tfsdk:"v6unk_mcast_act"` + DeprecatedVmac types.String `tfsdk:"vmac"` + DeprecatedFvRsBdToEpRet types.String `tfsdk:"relation_fv_rs_bd_to_ep_ret"` + DeprecatedFvRsBDToFhs types.String `tfsdk:"relation_fv_rs_bd_to_fhs"` + DeprecatedFvRsIgmpsn types.String `tfsdk:"relation_fv_rs_igmpsn"` + DeprecatedFvRsBDToOut types.Set `tfsdk:"relation_fv_rs_bd_to_out"` + DeprecatedFvRsMldsn types.String `tfsdk:"relation_fv_rs_mldsn"` + DeprecatedFvRsABDPolMonPol types.String `tfsdk:"relation_fv_rs_abd_pol_mon_pol"` + DeprecatedFvRsBDToNdP types.String `tfsdk:"relation_fv_rs_bd_to_nd_p"` + DeprecatedFvRsBDToRelayP types.String `tfsdk:"relation_fv_rs_bd_to_relay_p"` + DeprecatedFvRsBDToProfile types.String `tfsdk:"relation_fv_rs_bd_to_profile"` + DeprecatedFvRsCtx types.String `tfsdk:"relation_fv_rs_ctx"` + DeprecatedFvRsBDToNetflowMonitorPol types.Set `tfsdk:"relation_fv_rs_bd_to_netflow_monitor_pol"` +} + +func getEmptyFvBDResourceModel() *FvBDResourceModel { + return &FvBDResourceModel{ + Id: basetypes.NewStringNull(), + ParentDn: basetypes.NewStringNull(), + OptimizeWanBandwidth: basetypes.NewStringNull(), + Annotation: basetypes.NewStringNull(), + ArpFlood: basetypes.NewStringNull(), + Descr: basetypes.NewStringNull(), + EnableRogueExceptMac: basetypes.NewStringNull(), + EpClear: basetypes.NewStringNull(), + EpMoveDetectMode: basetypes.NewStringNull(), + HostBasedRouting: basetypes.NewStringNull(), + IntersiteBumTrafficAllow: basetypes.NewStringNull(), + IntersiteL2Stretch: basetypes.NewStringNull(), + IpLearning: basetypes.NewStringNull(), + Ipv6McastAllow: basetypes.NewStringNull(), + LimitIpLearnToSubnets: basetypes.NewStringNull(), + LlAddr: basetypes.NewStringNull(), + Mac: basetypes.NewStringNull(), + McastARPDrop: basetypes.NewStringNull(), + McastAllow: basetypes.NewStringNull(), + MultiDstPktAct: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + OwnerKey: basetypes.NewStringNull(), + OwnerTag: basetypes.NewStringNull(), + Type: basetypes.NewStringNull(), + UnicastRoute: basetypes.NewStringNull(), + UnkMacUcastAct: basetypes.NewStringNull(), + UnkMcastAct: basetypes.NewStringNull(), + V6unkMcastAct: basetypes.NewStringNull(), + Vmac: basetypes.NewStringNull(), + FvAccP: types.ObjectNull(map[string]attr.Type{ + "annotation": types.StringType, + "description": types.StringType, + "encapsulation": types.StringType, + "name": types.StringType, + "name_alias": types.StringType, + "owner_key": types.StringType, + "owner_tag": types.StringType, + }), + FvRogueExceptionMac: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": types.StringType, + "description": types.StringType, + "mac": types.StringType, + "name": types.StringType, + "name_alias": types.StringType, + }, + }), + FvRsABDPolMonPol: types.ObjectNull(map[string]attr.Type{ + "annotation": types.StringType, + "monitoring_policy_name": types.StringType, + }), + FvRsBDToFhs: types.ObjectNull(map[string]attr.Type{ + "annotation": types.StringType, + "first_hop_security_policy_name": types.StringType, + }), + FvRsBDToNdP: types.ObjectNull(map[string]attr.Type{ + "annotation": types.StringType, + "neighbor_discovery_interface_policy_name": types.StringType, + }), + FvRsBDToNetflowMonitorPol: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": types.StringType, + "filter_type": types.StringType, + "netflow_monitor_policy_name": types.StringType, + }, + }), + FvRsBDToOut: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": types.StringType, + "l3_outside_name": types.StringType, + }, + }), + FvRsBDToProfile: types.ObjectNull(map[string]attr.Type{ + "annotation": types.StringType, + "l3_outside_name": types.StringType, + "route_control_profile_name": types.StringType, + }), + FvRsBDToRelayP: types.ObjectNull(map[string]attr.Type{ + "annotation": types.StringType, + "dhcp_relay_policy_name": types.StringType, + }), + FvRsBdToEpRet: types.ObjectNull(map[string]attr.Type{ + "annotation": types.StringType, + "resolve_act": types.StringType, + "end_point_retention_policy_name": types.StringType, + }), + FvRsCtx: types.ObjectNull(map[string]attr.Type{ + "annotation": types.StringType, + "vrf_name": types.StringType, + }), + FvRsIgmpsn: types.ObjectNull(map[string]attr.Type{ + "annotation": types.StringType, + "igmp_snooping_policy_name": types.StringType, + }), + FvRsMldsn: types.ObjectNull(map[string]attr.Type{ + "annotation": types.StringType, + "mld_snooping_policy_name": types.StringType, + }), + TagAnnotation: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + TagTag: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + DeprecatedArpFlood: types.String{}, + DeprecatedEpClear: types.String{}, + DeprecatedEpMoveDetectMode: types.String{}, + DeprecatedHostBasedRouting: types.String{}, + DeprecatedIpv6McastAllow: types.String{}, + DeprecatedLlAddr: types.String{}, + DeprecatedMac: types.String{}, + DeprecatedMcastAllow: types.String{}, + DeprecatedMultiDstPktAct: types.String{}, + DeprecatedParentDn: types.String{}, + DeprecatedUnicastRoute: types.String{}, + DeprecatedUnkMacUcastAct: types.String{}, + DeprecatedUnkMcastAct: types.String{}, + DeprecatedV6unkMcastAct: types.String{}, + DeprecatedVmac: types.String{}, + DeprecatedFvRsBdToEpRet: types.String{}, + DeprecatedFvRsBDToFhs: types.String{}, + DeprecatedFvRsIgmpsn: types.String{}, + DeprecatedFvRsBDToOut: types.SetNull(types.StringType), + DeprecatedFvRsMldsn: types.String{}, + DeprecatedFvRsABDPolMonPol: types.String{}, + DeprecatedFvRsBDToNdP: types.String{}, + DeprecatedFvRsBDToRelayP: types.String{}, + DeprecatedFvRsBDToProfile: types.String{}, + DeprecatedFvRsCtx: types.String{}, + DeprecatedFvRsBDToNetflowMonitorPol: types.SetNull(deprecatedFvRsBDToNetflowMonitorPolType), + } +} + +// FvAccPFvBDResourceModel describes the resource data model for the children without relation ships. +type FvAccPFvBDResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + Encap types.String `tfsdk:"encapsulation"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` +} + +func getEmptyFvAccPFvBDResourceModel() FvAccPFvBDResourceModel { + return FvAccPFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + Descr: basetypes.NewStringNull(), + Encap: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + OwnerKey: basetypes.NewStringNull(), + OwnerTag: basetypes.NewStringNull(), + } +} + +var FvAccPFvBDType = map[string]attr.Type{ + "annotation": types.StringType, + "description": types.StringType, + "encapsulation": types.StringType, + "name": types.StringType, + "name_alias": types.StringType, + "owner_key": types.StringType, + "owner_tag": types.StringType, +} + +// FvRogueExceptionMacFvBDResourceModel describes the resource data model for the children without relation ships. +type FvRogueExceptionMacFvBDResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + Mac types.String `tfsdk:"mac"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` +} + +func getEmptyFvRogueExceptionMacFvBDResourceModel() FvRogueExceptionMacFvBDResourceModel { + return FvRogueExceptionMacFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + Descr: basetypes.NewStringNull(), + Mac: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + } +} + +// FvRsABDPolMonPolFvBDResourceModel describes the resource data model for the children without relation ships. +type FvRsABDPolMonPolFvBDResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnMonEPGPolName types.String `tfsdk:"monitoring_policy_name"` +} + +func getEmptyFvRsABDPolMonPolFvBDResourceModel() FvRsABDPolMonPolFvBDResourceModel { + return FvRsABDPolMonPolFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnMonEPGPolName: basetypes.NewStringNull(), + } +} + +var FvRsABDPolMonPolFvBDType = map[string]attr.Type{ + "annotation": types.StringType, + "monitoring_policy_name": types.StringType, +} + +// FvRsBDToFhsFvBDResourceModel describes the resource data model for the children without relation ships. +type FvRsBDToFhsFvBDResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnFhsBDPolName types.String `tfsdk:"first_hop_security_policy_name"` +} + +func getEmptyFvRsBDToFhsFvBDResourceModel() FvRsBDToFhsFvBDResourceModel { + return FvRsBDToFhsFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnFhsBDPolName: basetypes.NewStringNull(), + } +} + +var FvRsBDToFhsFvBDType = map[string]attr.Type{ + "annotation": types.StringType, + "first_hop_security_policy_name": types.StringType, +} + +// FvRsBDToNdPFvBDResourceModel describes the resource data model for the children without relation ships. +type FvRsBDToNdPFvBDResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnNdIfPolName types.String `tfsdk:"neighbor_discovery_interface_policy_name"` +} + +func getEmptyFvRsBDToNdPFvBDResourceModel() FvRsBDToNdPFvBDResourceModel { + return FvRsBDToNdPFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnNdIfPolName: basetypes.NewStringNull(), + } +} + +var FvRsBDToNdPFvBDType = map[string]attr.Type{ + "annotation": types.StringType, + "neighbor_discovery_interface_policy_name": types.StringType, +} + +// FvRsBDToNetflowMonitorPolFvBDResourceModel describes the resource data model for the children without relation ships. +type FvRsBDToNetflowMonitorPolFvBDResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + FltType types.String `tfsdk:"filter_type"` + TnNetflowMonitorPolName types.String `tfsdk:"netflow_monitor_policy_name"` +} + +func getEmptyFvRsBDToNetflowMonitorPolFvBDResourceModel() FvRsBDToNetflowMonitorPolFvBDResourceModel { + return FvRsBDToNetflowMonitorPolFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + FltType: basetypes.NewStringNull(), + TnNetflowMonitorPolName: basetypes.NewStringNull(), + } +} + +// FvRsBDToOutFvBDResourceModel describes the resource data model for the children without relation ships. +type FvRsBDToOutFvBDResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnL3extOutName types.String `tfsdk:"l3_outside_name"` +} + +func getEmptyFvRsBDToOutFvBDResourceModel() FvRsBDToOutFvBDResourceModel { + return FvRsBDToOutFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnL3extOutName: basetypes.NewStringNull(), + } +} + +// FvRsBDToProfileFvBDResourceModel describes the resource data model for the children without relation ships. +type FvRsBDToProfileFvBDResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnL3extOutName types.String `tfsdk:"l3_outside_name"` + TnRtctrlProfileName types.String `tfsdk:"route_control_profile_name"` +} + +func getEmptyFvRsBDToProfileFvBDResourceModel() FvRsBDToProfileFvBDResourceModel { + return FvRsBDToProfileFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnL3extOutName: basetypes.NewStringNull(), + TnRtctrlProfileName: basetypes.NewStringNull(), + } +} + +var FvRsBDToProfileFvBDType = map[string]attr.Type{ + "annotation": types.StringType, + "l3_outside_name": types.StringType, + "route_control_profile_name": types.StringType, +} + +// FvRsBDToRelayPFvBDResourceModel describes the resource data model for the children without relation ships. +type FvRsBDToRelayPFvBDResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnDhcpRelayPName types.String `tfsdk:"dhcp_relay_policy_name"` +} + +func getEmptyFvRsBDToRelayPFvBDResourceModel() FvRsBDToRelayPFvBDResourceModel { + return FvRsBDToRelayPFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnDhcpRelayPName: basetypes.NewStringNull(), + } +} + +var FvRsBDToRelayPFvBDType = map[string]attr.Type{ + "annotation": types.StringType, + "dhcp_relay_policy_name": types.StringType, +} + +// FvRsBdToEpRetFvBDResourceModel describes the resource data model for the children without relation ships. +type FvRsBdToEpRetFvBDResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + ResolveAct types.String `tfsdk:"resolve_act"` + TnFvEpRetPolName types.String `tfsdk:"end_point_retention_policy_name"` +} + +func getEmptyFvRsBdToEpRetFvBDResourceModel() FvRsBdToEpRetFvBDResourceModel { + return FvRsBdToEpRetFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + ResolveAct: basetypes.NewStringNull(), + TnFvEpRetPolName: basetypes.NewStringNull(), + } +} + +var FvRsBdToEpRetFvBDType = map[string]attr.Type{ + "annotation": types.StringType, + "resolve_act": types.StringType, + "end_point_retention_policy_name": types.StringType, +} + +// FvRsCtxFvBDResourceModel describes the resource data model for the children without relation ships. +type FvRsCtxFvBDResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnFvCtxName types.String `tfsdk:"vrf_name"` +} + +func getEmptyFvRsCtxFvBDResourceModel() FvRsCtxFvBDResourceModel { + return FvRsCtxFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnFvCtxName: basetypes.NewStringNull(), + } +} + +var FvRsCtxFvBDType = map[string]attr.Type{ + "annotation": types.StringType, + "vrf_name": types.StringType, +} + +// FvRsIgmpsnFvBDResourceModel describes the resource data model for the children without relation ships. +type FvRsIgmpsnFvBDResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnIgmpSnoopPolName types.String `tfsdk:"igmp_snooping_policy_name"` +} + +func getEmptyFvRsIgmpsnFvBDResourceModel() FvRsIgmpsnFvBDResourceModel { + return FvRsIgmpsnFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnIgmpSnoopPolName: basetypes.NewStringNull(), + } +} + +var FvRsIgmpsnFvBDType = map[string]attr.Type{ + "annotation": types.StringType, + "igmp_snooping_policy_name": types.StringType, +} + +// FvRsMldsnFvBDResourceModel describes the resource data model for the children without relation ships. +type FvRsMldsnFvBDResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnMldSnoopPolName types.String `tfsdk:"mld_snooping_policy_name"` +} + +func getEmptyFvRsMldsnFvBDResourceModel() FvRsMldsnFvBDResourceModel { + return FvRsMldsnFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnMldSnoopPolName: basetypes.NewStringNull(), + } +} + +var FvRsMldsnFvBDType = map[string]attr.Type{ + "annotation": types.StringType, + "mld_snooping_policy_name": types.StringType, +} + +// TagAnnotationFvBDResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvBDResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagAnnotationFvBDResourceModel() TagAnnotationFvBDResourceModel { + return TagAnnotationFvBDResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +// TagTagFvBDResourceModel describes the resource data model for the children without relation ships. +type TagTagFvBDResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagTagFvBDResourceModel() TagTagFvBDResourceModel { + return TagTagFvBDResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +type FvBDIdentifier struct { + Name types.String +} + +var deprecatedFvRsBDToNetflowMonitorPolType = types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "flt_type": basetypes.StringType{}, + "tn_netflow_monitor_pol_name": basetypes.StringType{}, + }, +} + +type FvBDResourceModelV1 struct { + Annotation types.String `tfsdk:"annotation"` + ArpFlood types.String `tfsdk:"arp_flood"` + Descr types.String `tfsdk:"description"` + EpClear types.String `tfsdk:"ep_clear"` + EpMoveDetectMode types.String `tfsdk:"ep_move_detect_mode"` + HostBasedRouting types.String `tfsdk:"host_based_routing"` + Id types.String `tfsdk:"id"` + IntersiteBumTrafficAllow types.String `tfsdk:"intersite_bum_traffic_allow"` + IntersiteL2Stretch types.String `tfsdk:"intersite_l2_stretch"` + IpLearning types.String `tfsdk:"ip_learning"` + Ipv6McastAllow types.String `tfsdk:"ipv6_mcast_allow"` + LimitIpLearnToSubnets types.String `tfsdk:"limit_ip_learn_to_subnets"` + LlAddr types.String `tfsdk:"ll_addr"` + Mac types.String `tfsdk:"mac"` + McastAllow types.String `tfsdk:"mcast_allow"` + MultiDstPktAct types.String `tfsdk:"multi_dst_pkt_act"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OptimizeWanBandwidth types.String `tfsdk:"optimize_wan_bandwidth"` + ParentDn types.String `tfsdk:"tenant_dn"` + Type types.String `tfsdk:"bridge_domain_type"` + UnicastRoute types.String `tfsdk:"unicast_route"` + UnkMacUcastAct types.String `tfsdk:"unk_mac_ucast_act"` + UnkMcastAct types.String `tfsdk:"unk_mcast_act"` + V6unkMcastAct types.String `tfsdk:"v6unk_mcast_act"` + Vmac types.String `tfsdk:"vmac"` + Deprecated_relation_fv_rs_bd_flood_to types.Set `tfsdk:"relation_fv_rs_bd_flood_to"` + FvRsBdToEpRet types.String `tfsdk:"relation_fv_rs_bd_to_ep_ret"` + FvRsBDToFhs types.String `tfsdk:"relation_fv_rs_bd_to_fhs"` + FvRsIgmpsn types.String `tfsdk:"relation_fv_rs_igmpsn"` + FvRsBDToOut types.Set `tfsdk:"relation_fv_rs_bd_to_out"` + FvRsMldsn types.String `tfsdk:"relation_fv_rs_mldsn"` + FvRsABDPolMonPol types.String `tfsdk:"relation_fv_rs_abd_pol_mon_pol"` + FvRsBDToNdP types.String `tfsdk:"relation_fv_rs_bd_to_nd_p"` + FvRsBDToRelayP types.String `tfsdk:"relation_fv_rs_bd_to_relay_p"` + FvRsBDToProfile types.String `tfsdk:"relation_fv_rs_bd_to_profile"` + FvRsCtx types.String `tfsdk:"relation_fv_rs_ctx"` + FvRsBDToNetflowMonitorPol types.Set `tfsdk:"relation_fv_rs_bd_to_netflow_monitor_pol"` +} + +type FvRsBDToNetflowMonitorPolFvBDResourceModelV1 struct { + FltType types.String `tfsdk:"flt_type"` + TnNetflowMonitorPolName types.String `tfsdk:"tn_netflow_monitor_pol_name"` +} + +func (r *FvBDResource) UpgradeState(ctx context.Context) map[int64]resource.StateUpgrader { + return map[int64]resource.StateUpgrader{ + 1: { + PriorSchema: &schema.Schema{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "arp_flood": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "description": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "ep_clear": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "ep_move_detect_mode": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "host_based_routing": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "id": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "intersite_bum_traffic_allow": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "intersite_l2_stretch": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "ip_learning": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "ipv6_mcast_allow": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "limit_ip_learn_to_subnets": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "ll_addr": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "mac": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "mcast_allow": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "multi_dst_pkt_act": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "name": schema.StringAttribute{ + Required: true, + Optional: false, + Computed: false, + }, + "name_alias": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "optimize_wan_bandwidth": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "tenant_dn": schema.StringAttribute{ + Required: true, + Optional: false, + Computed: false, + }, + "bridge_domain_type": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "unicast_route": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "unk_mac_ucast_act": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "unk_mcast_act": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "v6unk_mcast_act": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "vmac": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "relation_fv_rs_bd_flood_to": schema.SetAttribute{ + Required: false, + Optional: true, + Computed: false, + ElementType: types.StringType, + }, + "relation_fv_rs_bd_to_ep_ret": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "relation_fv_rs_bd_to_fhs": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: false, + }, + "relation_fv_rs_igmpsn": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "relation_fv_rs_bd_to_out": schema.SetAttribute{ + Required: false, + Optional: true, + Computed: false, + ElementType: types.StringType, + }, + "relation_fv_rs_mldsn": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "relation_fv_rs_abd_pol_mon_pol": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: false, + }, + "relation_fv_rs_bd_to_nd_p": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "relation_fv_rs_bd_to_relay_p": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: false, + }, + "relation_fv_rs_bd_to_profile": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: false, + }, + "relation_fv_rs_ctx": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + }, + Blocks: map[string]schema.Block{ + "relation_fv_rs_bd_to_netflow_monitor_pol": schema.SetNestedBlock{ + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "flt_type": schema.StringAttribute{ + Required: true, + Optional: false, + Computed: false, + }, + "tn_netflow_monitor_pol_name": schema.StringAttribute{ + Required: true, + Optional: false, + Computed: false, + }, + }, + }, + }, + }, + }, + StateUpgrader: func(ctx context.Context, req resource.UpgradeStateRequest, resp *resource.UpgradeStateResponse) { + var priorStateData FvBDResourceModelV1 + + resp.Diagnostics.Append(req.State.Get(ctx, &priorStateData)...) + + if resp.Diagnostics.HasError() { + return + } + + upgradedStateData := FvBDResourceModel{ + Id: priorStateData.Id, + ParentDn: priorStateData.ParentDn, + OptimizeWanBandwidth: priorStateData.OptimizeWanBandwidth, + Annotation: priorStateData.Annotation, + ArpFlood: priorStateData.ArpFlood, + Descr: priorStateData.Descr, + EnableRogueExceptMac: basetypes.NewStringNull(), + EpClear: priorStateData.EpClear, + EpMoveDetectMode: priorStateData.EpMoveDetectMode, + HostBasedRouting: priorStateData.HostBasedRouting, + IntersiteBumTrafficAllow: priorStateData.IntersiteBumTrafficAllow, + IntersiteL2Stretch: priorStateData.IntersiteL2Stretch, + IpLearning: priorStateData.IpLearning, + Ipv6McastAllow: priorStateData.Ipv6McastAllow, + LimitIpLearnToSubnets: priorStateData.LimitIpLearnToSubnets, + LlAddr: priorStateData.LlAddr, + Mac: priorStateData.Mac, + McastARPDrop: basetypes.NewStringNull(), + McastAllow: priorStateData.McastAllow, + MultiDstPktAct: priorStateData.MultiDstPktAct, + Name: priorStateData.Name, + NameAlias: priorStateData.NameAlias, + OwnerKey: basetypes.NewStringNull(), + OwnerTag: basetypes.NewStringNull(), + Type: priorStateData.Type, + UnicastRoute: priorStateData.UnicastRoute, + UnkMacUcastAct: priorStateData.UnkMacUcastAct, + UnkMcastAct: priorStateData.UnkMcastAct, + V6unkMcastAct: priorStateData.V6unkMcastAct, + Vmac: priorStateData.Vmac, + DeprecatedArpFlood: priorStateData.ArpFlood, + DeprecatedEpClear: priorStateData.EpClear, + DeprecatedEpMoveDetectMode: priorStateData.EpMoveDetectMode, + DeprecatedHostBasedRouting: priorStateData.HostBasedRouting, + DeprecatedIpv6McastAllow: priorStateData.Ipv6McastAllow, + DeprecatedLlAddr: priorStateData.LlAddr, + DeprecatedMac: priorStateData.Mac, + DeprecatedMcastAllow: priorStateData.McastAllow, + DeprecatedMultiDstPktAct: priorStateData.MultiDstPktAct, + DeprecatedParentDn: priorStateData.ParentDn, + DeprecatedUnicastRoute: priorStateData.UnicastRoute, + DeprecatedUnkMacUcastAct: priorStateData.UnkMacUcastAct, + DeprecatedUnkMcastAct: priorStateData.UnkMcastAct, + DeprecatedV6unkMcastAct: priorStateData.V6unkMcastAct, + DeprecatedVmac: priorStateData.Vmac, + DeprecatedFvRsBdToEpRet: priorStateData.FvRsBdToEpRet, + DeprecatedFvRsBDToFhs: priorStateData.FvRsBDToFhs, + DeprecatedFvRsIgmpsn: priorStateData.FvRsIgmpsn, + DeprecatedFvRsMldsn: priorStateData.FvRsMldsn, + DeprecatedFvRsABDPolMonPol: priorStateData.FvRsABDPolMonPol, + DeprecatedFvRsBDToNdP: priorStateData.FvRsBDToNdP, + DeprecatedFvRsBDToRelayP: priorStateData.FvRsBDToRelayP, + DeprecatedFvRsBDToProfile: priorStateData.FvRsBDToProfile, + DeprecatedFvRsCtx: priorStateData.FvRsCtx, + } + + upgradedStateData.FvAccP = types.ObjectNull(FvAccPFvBDType) + + upgradedStateData.FvRogueExceptionMac = types.SetNull( + types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "description": basetypes.StringType{}, + "mac": basetypes.StringType{}, + "name": basetypes.StringType{}, + "name_alias": basetypes.StringType{}, + }, + }, + ) + + FvRsABDPolMonPolObject := FvRsABDPolMonPolFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnMonEPGPolName: basetypes.NewStringValue(GetMOName(priorStateData.FvRsABDPolMonPol.ValueString())), + } + fvRsABDPolMonPolObject, _ := types.ObjectValueFrom(ctx, FvRsABDPolMonPolFvBDType, FvRsABDPolMonPolObject) + upgradedStateData.FvRsABDPolMonPol = fvRsABDPolMonPolObject + + FvRsBDToFhsObject := FvRsBDToFhsFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnFhsBDPolName: basetypes.NewStringValue(GetMOName(priorStateData.FvRsBDToFhs.ValueString())), + } + fvRsBDToFhsObject, _ := types.ObjectValueFrom(ctx, FvRsBDToFhsFvBDType, FvRsBDToFhsObject) + upgradedStateData.FvRsBDToFhs = fvRsBDToFhsObject + + FvRsBDToNdPObject := FvRsBDToNdPFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnNdIfPolName: basetypes.NewStringValue(GetMOName(priorStateData.FvRsBDToNdP.ValueString())), + } + fvRsBDToNdPObject, _ := types.ObjectValueFrom(ctx, FvRsBDToNdPFvBDType, FvRsBDToNdPObject) + upgradedStateData.FvRsBDToNdP = fvRsBDToNdPObject + + FvRsBDToNetflowMonitorPolList := make([]FvRsBDToNetflowMonitorPolFvBDResourceModel, 0) + var priorStateDataFvRsBDToNetflowMonitorPolList []FvRsBDToNetflowMonitorPolFvBDResourceModelV1 + priorStateData.FvRsBDToNetflowMonitorPol.ElementsAs(ctx, &priorStateDataFvRsBDToNetflowMonitorPolList, false) + for _, priorStateDataFvRsBDToNetflowMonitorPol := range priorStateDataFvRsBDToNetflowMonitorPolList { + FvRsBDToNetflowMonitorPol := FvRsBDToNetflowMonitorPolFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + FltType: priorStateDataFvRsBDToNetflowMonitorPol.FltType, + TnNetflowMonitorPolName: priorStateDataFvRsBDToNetflowMonitorPol.TnNetflowMonitorPolName, + } + FvRsBDToNetflowMonitorPolList = append(FvRsBDToNetflowMonitorPolList, FvRsBDToNetflowMonitorPol) + } + FvRsBDToNetflowMonitorPolType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "filter_type": basetypes.StringType{}, + "netflow_monitor_policy_name": basetypes.StringType{}, + }, + } + FvRsBDToNetflowMonitorPolSet, _ := types.SetValueFrom(ctx, FvRsBDToNetflowMonitorPolType, FvRsBDToNetflowMonitorPolList) + upgradedStateData.FvRsBDToNetflowMonitorPol = FvRsBDToNetflowMonitorPolSet + + FvRsBDToOutList := make([]FvRsBDToOutFvBDResourceModel, 0) + var priorStateDataFvRsBDToOutList []string + priorStateData.FvRsBDToOut.ElementsAs(ctx, &priorStateDataFvRsBDToOutList, false) + for _, priorStateDataFvRsBDToOut := range priorStateDataFvRsBDToOutList { + FvRsBDToOut := FvRsBDToOutFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnL3extOutName: basetypes.NewStringValue(GetMOName(priorStateDataFvRsBDToOut)), + } + FvRsBDToOutList = append(FvRsBDToOutList, FvRsBDToOut) + } + FvRsBDToOutType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "l3_outside_name": basetypes.StringType{}, + }, + } + FvRsBDToOutSet, _ := types.SetValueFrom(ctx, FvRsBDToOutType, FvRsBDToOutList) + upgradedStateData.FvRsBDToOut = FvRsBDToOutSet + + FvRsBDToProfileObject := FvRsBDToProfileFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnL3extOutName: basetypes.NewStringNull(), + TnRtctrlProfileName: basetypes.NewStringValue(GetMOName(priorStateData.FvRsBDToProfile.ValueString())), + } + fvRsBDToProfileObject, _ := types.ObjectValueFrom(ctx, FvRsBDToProfileFvBDType, FvRsBDToProfileObject) + upgradedStateData.FvRsBDToProfile = fvRsBDToProfileObject + + FvRsBDToRelayPObject := FvRsBDToRelayPFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnDhcpRelayPName: basetypes.NewStringValue(GetMOName(priorStateData.FvRsBDToRelayP.ValueString())), + } + fvRsBDToRelayPObject, _ := types.ObjectValueFrom(ctx, FvRsBDToRelayPFvBDType, FvRsBDToRelayPObject) + upgradedStateData.FvRsBDToRelayP = fvRsBDToRelayPObject + + FvRsBdToEpRetObject := FvRsBdToEpRetFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + ResolveAct: basetypes.NewStringNull(), + TnFvEpRetPolName: basetypes.NewStringValue(GetMOName(priorStateData.FvRsBdToEpRet.ValueString())), + } + fvRsBdToEpRetObject, _ := types.ObjectValueFrom(ctx, FvRsBdToEpRetFvBDType, FvRsBdToEpRetObject) + upgradedStateData.FvRsBdToEpRet = fvRsBdToEpRetObject + + FvRsCtxObject := FvRsCtxFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnFvCtxName: basetypes.NewStringValue(GetMOName(priorStateData.FvRsCtx.ValueString())), + } + fvRsCtxObject, _ := types.ObjectValueFrom(ctx, FvRsCtxFvBDType, FvRsCtxObject) + upgradedStateData.FvRsCtx = fvRsCtxObject + + FvRsIgmpsnObject := FvRsIgmpsnFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnIgmpSnoopPolName: basetypes.NewStringValue(GetMOName(priorStateData.FvRsIgmpsn.ValueString())), + } + fvRsIgmpsnObject, _ := types.ObjectValueFrom(ctx, FvRsIgmpsnFvBDType, FvRsIgmpsnObject) + upgradedStateData.FvRsIgmpsn = fvRsIgmpsnObject + + FvRsMldsnObject := FvRsMldsnFvBDResourceModel{ + Annotation: basetypes.NewStringNull(), + TnMldSnoopPolName: basetypes.NewStringValue(GetMOName(priorStateData.FvRsMldsn.ValueString())), + } + fvRsMldsnObject, _ := types.ObjectValueFrom(ctx, FvRsMldsnFvBDType, FvRsMldsnObject) + upgradedStateData.FvRsMldsn = fvRsMldsnObject + + upgradedStateData.TagAnnotation = types.SetNull( + types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": basetypes.StringType{}, + "value": basetypes.StringType{}, + }, + }, + ) + + upgradedStateData.TagTag = types.SetNull( + types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": basetypes.StringType{}, + "value": basetypes.StringType{}, + }, + }, + ) + + var deprecatedFvRsBDToOutList []string + priorStateData.FvRsBDToOut.ElementsAs(ctx, &deprecatedFvRsBDToOutList, false) + DeprecatedFvRsBDToOutSet, _ := types.SetValueFrom(ctx, types.StringType, deprecatedFvRsBDToOutList) + upgradedStateData.DeprecatedFvRsBDToOut = DeprecatedFvRsBDToOutSet + + var FvRsBDToNetflowMonitorPolV1List []FvRsBDToNetflowMonitorPolFvBDResourceModelV1 + priorStateData.FvRsBDToNetflowMonitorPol.ElementsAs(ctx, &FvRsBDToNetflowMonitorPolV1List, false) + FvRsBDToNetflowMonitorPolV1Set, _ := types.SetValueFrom(ctx, deprecatedFvRsBDToNetflowMonitorPolType, FvRsBDToNetflowMonitorPolV1List) + upgradedStateData.DeprecatedFvRsBDToNetflowMonitorPol = FvRsBDToNetflowMonitorPolV1Set + + resp.Diagnostics.Append(resp.State.Set(ctx, upgradedStateData)...) + }, + }, + } +} + +func setFvBDLegacyAttributes(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, classReadInfo []interface{}) { + data.DeprecatedParentDn = data.ParentDn + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "arpFlood" { + data.DeprecatedArpFlood = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "epClear" { + data.DeprecatedEpClear = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "epMoveDetectMode" { + data.DeprecatedEpMoveDetectMode = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "hostBasedRouting" { + data.DeprecatedHostBasedRouting = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ipv6McastAllow" { + data.DeprecatedIpv6McastAllow = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "llAddr" { + data.DeprecatedLlAddr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "mac" { + data.DeprecatedMac = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "mcastAllow" { + data.DeprecatedMcastAllow = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "multiDstPktAct" { + data.DeprecatedMultiDstPktAct = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "unicastRoute" { + data.DeprecatedUnicastRoute = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "unkMacUcastAct" { + data.DeprecatedUnkMacUcastAct = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "unkMcastAct" { + data.DeprecatedUnkMcastAct = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "v6unkMcastAct" { + data.DeprecatedV6unkMcastAct = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "vmac" { + data.DeprecatedVmac = basetypes.NewStringValue(attributeValue.(string)) + } + } + data.DeprecatedFvRsABDPolMonPol = basetypes.NewStringNull() + data.DeprecatedFvRsBDToFhs = basetypes.NewStringNull() + data.DeprecatedFvRsBDToNdP = basetypes.NewStringNull() + DeprecatedFvRsBDToOutFvBDList := make([]string, 0) + data.DeprecatedFvRsBDToProfile = basetypes.NewStringNull() + data.DeprecatedFvRsBDToRelayP = basetypes.NewStringNull() + data.DeprecatedFvRsBdToEpRet = basetypes.NewStringNull() + data.DeprecatedFvRsCtx = basetypes.NewStringNull() + data.DeprecatedFvRsIgmpsn = basetypes.NewStringNull() + data.DeprecatedFvRsMldsn = basetypes.NewStringNull() + + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "fvRsABDPolMonPol" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" { + data.DeprecatedFvRsABDPolMonPol = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsBDToFhs" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" { + data.DeprecatedFvRsBDToFhs = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsBDToNdP" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" { + data.DeprecatedFvRsBDToNdP = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsBDToOut" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" && childAttributeValue != "" && !ContainsString(DeprecatedFvRsBDToOutFvBDList, childAttributeValue.(string)) { + DeprecatedFvRsBDToOutFvBDList = append(DeprecatedFvRsBDToOutFvBDList, childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsBDToProfile" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" { + data.DeprecatedFvRsBDToProfile = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsBDToRelayP" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" { + data.DeprecatedFvRsBDToRelayP = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsBdToEpRet" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" { + data.DeprecatedFvRsBdToEpRet = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsCtx" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" { + data.DeprecatedFvRsCtx = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsIgmpsn" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" { + data.DeprecatedFvRsIgmpsn = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsMldsn" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" { + data.DeprecatedFvRsMldsn = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + } + } + } + data.DeprecatedFvRsBDToNetflowMonitorPol = types.SetNull(deprecatedFvRsBDToNetflowMonitorPolType) + fvRsBDToOutSet, _ := types.SetValueFrom(ctx, data.DeprecatedFvRsBDToOut.ElementType(ctx), DeprecatedFvRsBDToOutFvBDList) + data.DeprecatedFvRsBDToOut = fvRsBDToOutSet + } +} + +func (r *FvBDResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) { + if !req.Plan.Raw.IsNull() { + var planData, stateData, configData *FvBDResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &planData)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + resp.Diagnostics.Append(req.Config.Get(ctx, &configData)...) + + if resp.Diagnostics.HasError() { + return + } + + if (planData.Id.IsUnknown() || planData.Id.IsNull()) && !planData.ParentDn.IsUnknown() && !planData.Name.IsUnknown() { + setFvBDId(ctx, planData) + } + + if stateData == nil && !globalAllowExistingOnCreate && !planData.Id.IsUnknown() && !planData.Id.IsNull() { + CheckDn(ctx, &resp.Diagnostics, r.client, "fvBD", planData.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + } + if !configData.FvAccP.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvAccP.Attributes()) { + FvAccPObject, _ := types.ObjectValueFrom(ctx, FvAccPFvBDType, getEmptyFvAccPFvBDResourceModel()) + planData.FvAccP = FvAccPObject + } + } + if !configData.FvRsABDPolMonPol.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsABDPolMonPol.Attributes()) { + FvRsABDPolMonPolObject, _ := types.ObjectValueFrom(ctx, FvRsABDPolMonPolFvBDType, getEmptyFvRsABDPolMonPolFvBDResourceModel()) + planData.FvRsABDPolMonPol = FvRsABDPolMonPolObject + } + } + if !configData.FvRsBDToFhs.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsBDToFhs.Attributes()) { + FvRsBDToFhsObject, _ := types.ObjectValueFrom(ctx, FvRsBDToFhsFvBDType, getEmptyFvRsBDToFhsFvBDResourceModel()) + planData.FvRsBDToFhs = FvRsBDToFhsObject + } + } + if !configData.FvRsBDToNdP.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsBDToNdP.Attributes()) { + FvRsBDToNdPObject, _ := types.ObjectValueFrom(ctx, FvRsBDToNdPFvBDType, getEmptyFvRsBDToNdPFvBDResourceModel()) + planData.FvRsBDToNdP = FvRsBDToNdPObject + } + } + if !configData.FvRsBDToProfile.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsBDToProfile.Attributes()) { + FvRsBDToProfileObject, _ := types.ObjectValueFrom(ctx, FvRsBDToProfileFvBDType, getEmptyFvRsBDToProfileFvBDResourceModel()) + planData.FvRsBDToProfile = FvRsBDToProfileObject + } + } + if !configData.FvRsBDToRelayP.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsBDToRelayP.Attributes()) { + FvRsBDToRelayPObject, _ := types.ObjectValueFrom(ctx, FvRsBDToRelayPFvBDType, getEmptyFvRsBDToRelayPFvBDResourceModel()) + planData.FvRsBDToRelayP = FvRsBDToRelayPObject + } + } + if !configData.FvRsBdToEpRet.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsBdToEpRet.Attributes()) { + FvRsBdToEpRetObject, _ := types.ObjectValueFrom(ctx, FvRsBdToEpRetFvBDType, getEmptyFvRsBdToEpRetFvBDResourceModel()) + planData.FvRsBdToEpRet = FvRsBdToEpRetObject + } + } + if !configData.FvRsCtx.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsCtx.Attributes()) { + FvRsCtxObject, _ := types.ObjectValueFrom(ctx, FvRsCtxFvBDType, getEmptyFvRsCtxFvBDResourceModel()) + planData.FvRsCtx = FvRsCtxObject + } + } + if !configData.FvRsIgmpsn.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsIgmpsn.Attributes()) { + FvRsIgmpsnObject, _ := types.ObjectValueFrom(ctx, FvRsIgmpsnFvBDType, getEmptyFvRsIgmpsnFvBDResourceModel()) + planData.FvRsIgmpsn = FvRsIgmpsnObject + } + } + if !configData.FvRsMldsn.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsMldsn.Attributes()) { + FvRsMldsnObject, _ := types.ObjectValueFrom(ctx, FvRsMldsnFvBDType, getEmptyFvRsMldsnFvBDResourceModel()) + planData.FvRsMldsn = FvRsMldsnObject + } + } + + if !configData.ArpFlood.IsNull() { + planData.DeprecatedArpFlood = configData.ArpFlood + } else if !configData.DeprecatedArpFlood.IsNull() { + planData.ArpFlood = configData.DeprecatedArpFlood + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedArpFlood = stateData.DeprecatedArpFlood + } + + if !configData.EpClear.IsNull() { + planData.DeprecatedEpClear = configData.EpClear + } else if !configData.DeprecatedEpClear.IsNull() { + planData.EpClear = configData.DeprecatedEpClear + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedEpClear = stateData.DeprecatedEpClear + } + + if !configData.EpMoveDetectMode.IsNull() { + planData.DeprecatedEpMoveDetectMode = configData.EpMoveDetectMode + } else if !configData.DeprecatedEpMoveDetectMode.IsNull() { + planData.EpMoveDetectMode = configData.DeprecatedEpMoveDetectMode + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedEpMoveDetectMode = stateData.DeprecatedEpMoveDetectMode + } + + if !configData.HostBasedRouting.IsNull() { + planData.DeprecatedHostBasedRouting = configData.HostBasedRouting + } else if !configData.DeprecatedHostBasedRouting.IsNull() { + planData.HostBasedRouting = configData.DeprecatedHostBasedRouting + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedHostBasedRouting = stateData.DeprecatedHostBasedRouting + } + + if !configData.Ipv6McastAllow.IsNull() { + planData.DeprecatedIpv6McastAllow = configData.Ipv6McastAllow + } else if !configData.DeprecatedIpv6McastAllow.IsNull() { + planData.Ipv6McastAllow = configData.DeprecatedIpv6McastAllow + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedIpv6McastAllow = stateData.DeprecatedIpv6McastAllow + } + + if !configData.LlAddr.IsNull() { + planData.DeprecatedLlAddr = configData.LlAddr + } else if !configData.DeprecatedLlAddr.IsNull() { + planData.LlAddr = configData.DeprecatedLlAddr + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedLlAddr = stateData.DeprecatedLlAddr + } + + if !configData.Mac.IsNull() { + planData.DeprecatedMac = configData.Mac + } else if !configData.DeprecatedMac.IsNull() { + planData.Mac = configData.DeprecatedMac + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedMac = stateData.DeprecatedMac + } + + if !configData.McastAllow.IsNull() { + planData.DeprecatedMcastAllow = configData.McastAllow + } else if !configData.DeprecatedMcastAllow.IsNull() { + planData.McastAllow = configData.DeprecatedMcastAllow + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedMcastAllow = stateData.DeprecatedMcastAllow + } + + if !configData.MultiDstPktAct.IsNull() { + planData.DeprecatedMultiDstPktAct = configData.MultiDstPktAct + } else if !configData.DeprecatedMultiDstPktAct.IsNull() { + planData.MultiDstPktAct = configData.DeprecatedMultiDstPktAct + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedMultiDstPktAct = stateData.DeprecatedMultiDstPktAct + } + + if !configData.ParentDn.IsNull() { + planData.DeprecatedParentDn = configData.ParentDn + } else if !configData.DeprecatedParentDn.IsNull() { + planData.ParentDn = configData.DeprecatedParentDn + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedParentDn = stateData.DeprecatedParentDn + } + + if !configData.UnicastRoute.IsNull() { + planData.DeprecatedUnicastRoute = configData.UnicastRoute + } else if !configData.DeprecatedUnicastRoute.IsNull() { + planData.UnicastRoute = configData.DeprecatedUnicastRoute + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedUnicastRoute = stateData.DeprecatedUnicastRoute + } + + if !configData.UnkMacUcastAct.IsNull() { + planData.DeprecatedUnkMacUcastAct = configData.UnkMacUcastAct + } else if !configData.DeprecatedUnkMacUcastAct.IsNull() { + planData.UnkMacUcastAct = configData.DeprecatedUnkMacUcastAct + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedUnkMacUcastAct = stateData.DeprecatedUnkMacUcastAct + } + + if !configData.UnkMcastAct.IsNull() { + planData.DeprecatedUnkMcastAct = configData.UnkMcastAct + } else if !configData.DeprecatedUnkMcastAct.IsNull() { + planData.UnkMcastAct = configData.DeprecatedUnkMcastAct + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedUnkMcastAct = stateData.DeprecatedUnkMcastAct + } + + if !configData.V6unkMcastAct.IsNull() { + planData.DeprecatedV6unkMcastAct = configData.V6unkMcastAct + } else if !configData.DeprecatedV6unkMcastAct.IsNull() { + planData.V6unkMcastAct = configData.DeprecatedV6unkMcastAct + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedV6unkMcastAct = stateData.DeprecatedV6unkMcastAct + } + + if !configData.Vmac.IsNull() { + planData.DeprecatedVmac = configData.Vmac + } else if !configData.DeprecatedVmac.IsNull() { + planData.Vmac = configData.DeprecatedVmac + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedVmac = stateData.DeprecatedVmac + } + + if !configData.FvRsBdToEpRet.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsBdToEpRet.Attributes()) { + planData.FvRsBdToEpRet = configData.FvRsBdToEpRet + planData.DeprecatedFvRsBdToEpRet = basetypes.NewStringNull() + } else { + var attributeValues FvRsBdToEpRetFvBDResourceModel + configData.FvRsBdToEpRet.As(ctx, &attributeValues, basetypes.ObjectAsOptions{}) + if GetMOName(stateData.DeprecatedFvRsBdToEpRet.ValueString()) == attributeValues.TnFvEpRetPolName.ValueString() && !attributeValues.TnFvEpRetPolName.IsNull() { + planData.DeprecatedFvRsBdToEpRet = stateData.DeprecatedFvRsBdToEpRet + } + } + } else if !configData.DeprecatedFvRsBdToEpRet.IsNull() { + FvRsBdToEpRet := FvRsBdToEpRetFvBDResourceModel{ + Annotation: planData.Annotation, + ResolveAct: basetypes.NewStringNull(), + TnFvEpRetPolName: basetypes.NewStringValue(GetMOName(configData.DeprecatedFvRsBdToEpRet.ValueString())), + } + FvRsBdToEpRetObject, _ := types.ObjectValueFrom(ctx, FvRsBdToEpRetFvBDType, FvRsBdToEpRet) + planData.FvRsBdToEpRet = FvRsBdToEpRetObject + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsBdToEpRet = stateData.DeprecatedFvRsBdToEpRet + } + + if !configData.FvRsBDToFhs.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsBDToFhs.Attributes()) { + planData.FvRsBDToFhs = configData.FvRsBDToFhs + planData.DeprecatedFvRsBDToFhs = basetypes.NewStringNull() + } else { + var attributeValues FvRsBDToFhsFvBDResourceModel + configData.FvRsBDToFhs.As(ctx, &attributeValues, basetypes.ObjectAsOptions{}) + if GetMOName(stateData.DeprecatedFvRsBDToFhs.ValueString()) == attributeValues.TnFhsBDPolName.ValueString() && !attributeValues.TnFhsBDPolName.IsNull() { + planData.DeprecatedFvRsBDToFhs = stateData.DeprecatedFvRsBDToFhs + } + } + } else if !configData.DeprecatedFvRsBDToFhs.IsNull() { + FvRsBDToFhs := FvRsBDToFhsFvBDResourceModel{ + Annotation: planData.Annotation, + TnFhsBDPolName: basetypes.NewStringValue(GetMOName(configData.DeprecatedFvRsBDToFhs.ValueString())), + } + FvRsBDToFhsObject, _ := types.ObjectValueFrom(ctx, FvRsBDToFhsFvBDType, FvRsBDToFhs) + planData.FvRsBDToFhs = FvRsBDToFhsObject + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsBDToFhs = stateData.DeprecatedFvRsBDToFhs + } + + if !configData.FvRsIgmpsn.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsIgmpsn.Attributes()) { + planData.FvRsIgmpsn = configData.FvRsIgmpsn + planData.DeprecatedFvRsIgmpsn = basetypes.NewStringNull() + } else { + var attributeValues FvRsIgmpsnFvBDResourceModel + configData.FvRsIgmpsn.As(ctx, &attributeValues, basetypes.ObjectAsOptions{}) + if GetMOName(stateData.DeprecatedFvRsIgmpsn.ValueString()) == attributeValues.TnIgmpSnoopPolName.ValueString() && !attributeValues.TnIgmpSnoopPolName.IsNull() { + planData.DeprecatedFvRsIgmpsn = stateData.DeprecatedFvRsIgmpsn + } + } + } else if !configData.DeprecatedFvRsIgmpsn.IsNull() { + FvRsIgmpsn := FvRsIgmpsnFvBDResourceModel{ + Annotation: planData.Annotation, + TnIgmpSnoopPolName: basetypes.NewStringValue(GetMOName(configData.DeprecatedFvRsIgmpsn.ValueString())), + } + FvRsIgmpsnObject, _ := types.ObjectValueFrom(ctx, FvRsIgmpsnFvBDType, FvRsIgmpsn) + planData.FvRsIgmpsn = FvRsIgmpsnObject + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsIgmpsn = stateData.DeprecatedFvRsIgmpsn + } + + if !configData.FvRsBDToOut.IsNull() && stateData != nil { + var attributeValues []FvRsBDToOutFvBDResourceModel + var newAttributeValues, stateAttributeValues []string + configData.FvRsBDToOut.ElementsAs(ctx, &attributeValues, false) + stateData.DeprecatedFvRsBDToOut.ElementsAs(ctx, &stateAttributeValues, false) + for _, attributeValue := range attributeValues { + newAttributeValues = append(newAttributeValues, attributeValue.TnL3extOutName.ValueString()) + } + + if len(newAttributeValues) == len(stateAttributeValues) { + allMatchState := true + for _, stateAttributeValue := range stateAttributeValues { + if !ContainsString(newAttributeValues, GetMOName(stateAttributeValue)) { + allMatchState = false + break + } + } + if allMatchState { + FvRsBDToOutSet, _ := types.SetValueFrom(ctx, basetypes.StringType{}, stateAttributeValues) + planData.DeprecatedFvRsBDToOut = FvRsBDToOutSet + } + } + } else if !configData.DeprecatedFvRsBDToOut.IsNull() { + FvRsBDToOutList := make([]FvRsBDToOutFvBDResourceModel, 0) + var attributeValues []string + var newAttributeValues []FvRsBDToOutFvBDResourceModel + configData.DeprecatedFvRsBDToOut.ElementsAs(ctx, &attributeValues, false) + if stateData != nil { + stateData.FvRsBDToOut.ElementsAs(ctx, &newAttributeValues, false) + } + for _, attributeValue := range attributeValues { + FvRsBDToOutValue := FvRsBDToOutFvBDResourceModel{} + foundAttributeValue := false + for _, newAttributeValue := range newAttributeValues { + if newAttributeValue.TnL3extOutName.ValueString() == GetMOName(attributeValue) { + FvRsBDToOutValue = newAttributeValue + foundAttributeValue = true + break + } + } + FvRsBDToOut := FvRsBDToOutFvBDResourceModel{ + TnL3extOutName: basetypes.NewStringValue(GetMOName(attributeValue)), + } + + if foundAttributeValue { + FvRsBDToOut.Annotation = FvRsBDToOutValue.Annotation + } else { + FvRsBDToOut.Annotation = planData.Annotation + } + FvRsBDToOutList = append(FvRsBDToOutList, FvRsBDToOut) + } + FvRsBDToOutType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "l3_outside_name": basetypes.StringType{}, + }, + } + FvRsBDToOutSet, _ := types.SetValueFrom(ctx, FvRsBDToOutType, FvRsBDToOutList) + planData.FvRsBDToOut = FvRsBDToOutSet + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsBDToOut = stateData.DeprecatedFvRsBDToOut + } + + if !configData.FvRsMldsn.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsMldsn.Attributes()) { + planData.FvRsMldsn = configData.FvRsMldsn + planData.DeprecatedFvRsMldsn = basetypes.NewStringNull() + } else { + var attributeValues FvRsMldsnFvBDResourceModel + configData.FvRsMldsn.As(ctx, &attributeValues, basetypes.ObjectAsOptions{}) + if GetMOName(stateData.DeprecatedFvRsMldsn.ValueString()) == attributeValues.TnMldSnoopPolName.ValueString() && !attributeValues.TnMldSnoopPolName.IsNull() { + planData.DeprecatedFvRsMldsn = stateData.DeprecatedFvRsMldsn + } + } + } else if !configData.DeprecatedFvRsMldsn.IsNull() { + FvRsMldsn := FvRsMldsnFvBDResourceModel{ + Annotation: planData.Annotation, + TnMldSnoopPolName: basetypes.NewStringValue(GetMOName(configData.DeprecatedFvRsMldsn.ValueString())), + } + FvRsMldsnObject, _ := types.ObjectValueFrom(ctx, FvRsMldsnFvBDType, FvRsMldsn) + planData.FvRsMldsn = FvRsMldsnObject + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsMldsn = stateData.DeprecatedFvRsMldsn + } + + if !configData.FvRsABDPolMonPol.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsABDPolMonPol.Attributes()) { + planData.FvRsABDPolMonPol = configData.FvRsABDPolMonPol + planData.DeprecatedFvRsABDPolMonPol = basetypes.NewStringNull() + } else { + var attributeValues FvRsABDPolMonPolFvBDResourceModel + configData.FvRsABDPolMonPol.As(ctx, &attributeValues, basetypes.ObjectAsOptions{}) + if GetMOName(stateData.DeprecatedFvRsABDPolMonPol.ValueString()) == attributeValues.TnMonEPGPolName.ValueString() && !attributeValues.TnMonEPGPolName.IsNull() { + planData.DeprecatedFvRsABDPolMonPol = stateData.DeprecatedFvRsABDPolMonPol + } + } + } else if !configData.DeprecatedFvRsABDPolMonPol.IsNull() { + FvRsABDPolMonPol := FvRsABDPolMonPolFvBDResourceModel{ + Annotation: planData.Annotation, + TnMonEPGPolName: basetypes.NewStringValue(GetMOName(configData.DeprecatedFvRsABDPolMonPol.ValueString())), + } + FvRsABDPolMonPolObject, _ := types.ObjectValueFrom(ctx, FvRsABDPolMonPolFvBDType, FvRsABDPolMonPol) + planData.FvRsABDPolMonPol = FvRsABDPolMonPolObject + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsABDPolMonPol = stateData.DeprecatedFvRsABDPolMonPol + } + + if !configData.FvRsBDToNdP.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsBDToNdP.Attributes()) { + planData.FvRsBDToNdP = configData.FvRsBDToNdP + planData.DeprecatedFvRsBDToNdP = basetypes.NewStringNull() + } else { + var attributeValues FvRsBDToNdPFvBDResourceModel + configData.FvRsBDToNdP.As(ctx, &attributeValues, basetypes.ObjectAsOptions{}) + if GetMOName(stateData.DeprecatedFvRsBDToNdP.ValueString()) == attributeValues.TnNdIfPolName.ValueString() && !attributeValues.TnNdIfPolName.IsNull() { + planData.DeprecatedFvRsBDToNdP = stateData.DeprecatedFvRsBDToNdP + } + } + } else if !configData.DeprecatedFvRsBDToNdP.IsNull() { + FvRsBDToNdP := FvRsBDToNdPFvBDResourceModel{ + Annotation: planData.Annotation, + TnNdIfPolName: basetypes.NewStringValue(GetMOName(configData.DeprecatedFvRsBDToNdP.ValueString())), + } + FvRsBDToNdPObject, _ := types.ObjectValueFrom(ctx, FvRsBDToNdPFvBDType, FvRsBDToNdP) + planData.FvRsBDToNdP = FvRsBDToNdPObject + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsBDToNdP = stateData.DeprecatedFvRsBDToNdP + } + + if !configData.FvRsBDToRelayP.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsBDToRelayP.Attributes()) { + planData.FvRsBDToRelayP = configData.FvRsBDToRelayP + planData.DeprecatedFvRsBDToRelayP = basetypes.NewStringNull() + } else { + var attributeValues FvRsBDToRelayPFvBDResourceModel + configData.FvRsBDToRelayP.As(ctx, &attributeValues, basetypes.ObjectAsOptions{}) + if GetMOName(stateData.DeprecatedFvRsBDToRelayP.ValueString()) == attributeValues.TnDhcpRelayPName.ValueString() && !attributeValues.TnDhcpRelayPName.IsNull() { + planData.DeprecatedFvRsBDToRelayP = stateData.DeprecatedFvRsBDToRelayP + } + } + } else if !configData.DeprecatedFvRsBDToRelayP.IsNull() { + FvRsBDToRelayP := FvRsBDToRelayPFvBDResourceModel{ + Annotation: planData.Annotation, + TnDhcpRelayPName: basetypes.NewStringValue(GetMOName(configData.DeprecatedFvRsBDToRelayP.ValueString())), + } + FvRsBDToRelayPObject, _ := types.ObjectValueFrom(ctx, FvRsBDToRelayPFvBDType, FvRsBDToRelayP) + planData.FvRsBDToRelayP = FvRsBDToRelayPObject + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsBDToRelayP = stateData.DeprecatedFvRsBDToRelayP + } + + if !configData.FvRsBDToProfile.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsBDToProfile.Attributes()) { + planData.FvRsBDToProfile = configData.FvRsBDToProfile + planData.DeprecatedFvRsBDToProfile = basetypes.NewStringNull() + } else { + var attributeValues FvRsBDToProfileFvBDResourceModel + configData.FvRsBDToProfile.As(ctx, &attributeValues, basetypes.ObjectAsOptions{}) + if GetMOName(stateData.DeprecatedFvRsBDToProfile.ValueString()) == attributeValues.TnRtctrlProfileName.ValueString() && !attributeValues.TnRtctrlProfileName.IsNull() { + planData.DeprecatedFvRsBDToProfile = stateData.DeprecatedFvRsBDToProfile + } + } + } else if !configData.DeprecatedFvRsBDToProfile.IsNull() { + FvRsBDToProfile := FvRsBDToProfileFvBDResourceModel{ + Annotation: planData.Annotation, + TnL3extOutName: basetypes.NewStringValue(""), + TnRtctrlProfileName: basetypes.NewStringValue(GetMOName(configData.DeprecatedFvRsBDToProfile.ValueString())), + } + FvRsBDToProfileObject, _ := types.ObjectValueFrom(ctx, FvRsBDToProfileFvBDType, FvRsBDToProfile) + planData.FvRsBDToProfile = FvRsBDToProfileObject + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsBDToProfile = stateData.DeprecatedFvRsBDToProfile + } + + if !configData.FvRsCtx.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FvRsCtx.Attributes()) { + planData.FvRsCtx = configData.FvRsCtx + planData.DeprecatedFvRsCtx = basetypes.NewStringNull() + } else { + var attributeValues FvRsCtxFvBDResourceModel + configData.FvRsCtx.As(ctx, &attributeValues, basetypes.ObjectAsOptions{}) + if GetMOName(stateData.DeprecatedFvRsCtx.ValueString()) == attributeValues.TnFvCtxName.ValueString() && !attributeValues.TnFvCtxName.IsNull() { + planData.DeprecatedFvRsCtx = stateData.DeprecatedFvRsCtx + } + } + } else if !configData.DeprecatedFvRsCtx.IsNull() { + FvRsCtx := FvRsCtxFvBDResourceModel{ + Annotation: planData.Annotation, + TnFvCtxName: basetypes.NewStringValue(GetMOName(configData.DeprecatedFvRsCtx.ValueString())), + } + FvRsCtxObject, _ := types.ObjectValueFrom(ctx, FvRsCtxFvBDType, FvRsCtx) + planData.FvRsCtx = FvRsCtxObject + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsCtx = stateData.DeprecatedFvRsCtx + } + + planData.DeprecatedFvRsBDToNetflowMonitorPol = types.SetNull(deprecatedFvRsBDToNetflowMonitorPolType) + if !configData.DeprecatedFvRsBDToNetflowMonitorPol.IsNull() && stateData != nil { + FvRsBDToNetflowMonitorPolList := make([]FvRsBDToNetflowMonitorPolFvBDResourceModel, 0) + var attributeValues []FvRsBDToNetflowMonitorPolFvBDResourceModelV1 + var newAttributeValues []FvRsBDToNetflowMonitorPolFvBDResourceModel + configData.DeprecatedFvRsBDToNetflowMonitorPol.ElementsAs(ctx, &attributeValues, false) + stateData.FvRsBDToNetflowMonitorPol.ElementsAs(ctx, &newAttributeValues, false) + for _, attributeValue := range attributeValues { + + FvRsBDToNetflowMonitorPol := FvRsBDToNetflowMonitorPolFvBDResourceModel{ + Annotation: planData.Annotation, + FltType: attributeValue.FltType, + } + + FvRsBDToNetflowMonitorPolList = append(FvRsBDToNetflowMonitorPolList, FvRsBDToNetflowMonitorPol) + } + + FvRsBDToNetflowMonitorPolType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "filter_type": basetypes.StringType{}, + "netflow_monitor_policy_name": basetypes.StringType{}, + }, + } + FvRsBDToNetflowMonitorPolSet, _ := types.SetValueFrom(ctx, FvRsBDToNetflowMonitorPolType, FvRsBDToNetflowMonitorPolList) + planData.FvRsBDToNetflowMonitorPol = FvRsBDToNetflowMonitorPolSet + } + + resp.Diagnostics.Append(resp.Plan.Set(ctx, &planData)...) + } +} + +func (r *FvBDResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_bridge_domain") + resp.TypeName = req.ProviderTypeName + "_bridge_domain" + tflog.Debug(ctx, "End metadata of resource: aci_bridge_domain") +} + +func (r *FvBDResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_bridge_domain") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The bridge_domain resource for the 'fvBD' class", + Version: 2, + + Attributes: map[string]schema.Attribute{ + // Deprecated attributes + "arp_flood": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'arp_flood' will be deprecated soon, please use 'arp_flooding' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("arp_flooding"), + }...), + }, + }, + "ep_clear": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'ep_clear' will be deprecated soon, please use 'clear_remote_mac_entries' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("clear_remote_mac_entries"), + }...), + }, + }, + "ep_move_detect_mode": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'ep_move_detect_mode' will be deprecated soon, please use 'endpoint_move_detection_mode' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("endpoint_move_detection_mode"), + }...), + }, + }, + "host_based_routing": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'host_based_routing' will be deprecated soon, please use 'advertise_host_routes' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("advertise_host_routes"), + }...), + }, + }, + "ipv6_mcast_allow": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'ipv6_mcast_allow' will be deprecated soon, please use 'pim_ipv6' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("pim_ipv6"), + }...), + }, + }, + "ll_addr": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'll_addr' will be deprecated soon, please use 'link_local_ipv6_address' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("link_local_ipv6_address"), + }...), + }, + }, + "mac": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'mac' will be deprecated soon, please use 'custom_mac_address' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("custom_mac_address"), + }...), + }, + }, + "mcast_allow": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'mcast_allow' will be deprecated soon, please use 'pim' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("pim"), + }...), + }, + }, + "multi_dst_pkt_act": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'multi_dst_pkt_act' will be deprecated soon, please use 'multi_destination_flooding' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("multi_destination_flooding"), + }...), + }, + }, + "tenant_dn": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'tenant_dn' will be deprecated soon, please use 'parent_dn' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("parent_dn"), + }...), + }, + }, + "unicast_route": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'unicast_route' will be deprecated soon, please use 'unicast_routing' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("unicast_routing"), + }...), + }, + }, + "unk_mac_ucast_act": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'unk_mac_ucast_act' will be deprecated soon, please use 'l2_unknown_unicast_flooding' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("l2_unknown_unicast_flooding"), + }...), + }, + }, + "unk_mcast_act": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'unk_mcast_act' will be deprecated soon, please use 'l3_unknown_multicast_flooding' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("l3_unknown_multicast_flooding"), + }...), + }, + }, + "v6unk_mcast_act": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'v6unk_mcast_act' will be deprecated soon, please use 'ipv6_l3_unknown_multicast_flooding' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("ipv6_l3_unknown_multicast_flooding"), + }...), + }, + }, + "vmac": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'vmac' will be deprecated soon, please use 'virtual_mac_address' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("virtual_mac_address"), + }...), + }, + }, + "relation_fv_rs_bd_to_ep_ret": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_bd_to_ep_ret' will be deprecated soon, please use 'relation_to_end_point_retention_policy.end_point_retention_policy_name' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_end_point_retention_policy"), + }...), + }, + }, + "relation_fv_rs_bd_to_fhs": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_bd_to_fhs' will be deprecated soon, please use 'relation_to_first_hop_security_policy.first_hop_security_policy_name' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_first_hop_security_policy"), + }...), + }, + }, + "relation_fv_rs_igmpsn": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_igmpsn' will be deprecated soon, please use 'relation_to_igmp_snooping_policy.igmp_snooping_policy_name' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_igmp_snooping_policy"), + }...), + }, + }, + "relation_fv_rs_bd_to_out": schema.SetAttribute{ + Optional: true, + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_bd_to_out' will be deprecated soon, please use 'relation_to_l3_outsides.l3_outside_name' instead", + Validators: []validator.Set{ + setvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_l3_outsides"), + }...), + }, + }, + "relation_fv_rs_mldsn": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_mldsn' will be deprecated soon, please use 'relation_to_mld_snooping_policy.mld_snooping_policy_name' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_mld_snooping_policy"), + }...), + }, + }, + "relation_fv_rs_abd_pol_mon_pol": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_abd_pol_mon_pol' will be deprecated soon, please use 'relation_to_monitor_policy.monitoring_policy_name' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_monitor_policy"), + }...), + }, + }, + "relation_fv_rs_bd_to_nd_p": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_bd_to_nd_p' will be deprecated soon, please use 'relation_to_neighbor_discovery_interface_policy.neighbor_discovery_interface_policy_name' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_neighbor_discovery_interface_policy"), + }...), + }, + }, + "relation_fv_rs_bd_to_relay_p": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_bd_to_relay_p' will be deprecated soon, please use 'relation_to_relay_policy.dhcp_relay_policy_name' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_relay_policy"), + }...), + }, + }, + "relation_fv_rs_bd_to_profile": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_bd_to_profile' will be deprecated soon, please use 'relation_to_route_control_profile.route_control_profile_name' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_route_control_profile"), + }...), + }, + }, + "relation_fv_rs_ctx": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_ctx' will be deprecated soon, please use 'relation_to_vrf.vrf_name' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_vrf"), + }...), + }, + }, + // End of deprecated attributes + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Bridge Domain object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Optional: true, + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + Validators: []validator.String{ + stringvalidator.AtLeastOneOf(path.Expressions{ + path.MatchRoot("tenant_dn"), + }...), + }, + }, + "optimize_wan_bandwidth": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Optimize WAN Bandwidth for the Bridge Domain object.`, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the Bridge Domain object.`, + }, + "arp_flooding": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Enable ARP flooding for the Bridge Domain object. If flooding is disabled, unicast routing will be performed on the target IP address.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The description of the Bridge Domain object.`, + }, + "enable_rogue_exception_mac": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Enable rogue exception based on MAC wildcard for the Bridge Domain object.`, + }, + "clear_remote_mac_entries": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Clear all End-Points in leafs for the Bridge Domain object.`, + }, + "endpoint_move_detection_mode": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("", "garp"), + }, + MarkdownDescription: `The End Point move detection option uses the Gratuitous Address Resolution Protocol (GARP). A gratuitous ARP is an ARP broadcast-type of packet that is used to verify that no other device on the network has the same IP address as the sending device.`, + }, + "advertise_host_routes": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Advertise host routes (/32 prefixes) out of the L3Out(s) associated to the Bridge Domain object.`, + }, + "intersite_bum_traffic_allow": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Enable intersite Broadcast, Unknown-Unicast and Multicast (BUM) traffic between sites for the Bridge Domain object.`, + }, + "intersite_l2_stretch": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Enable L2 stretch between sites for the Bridge Domain object.`, + }, + "ip_learning": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `The IP learning setting of the Bridge Domain object.`, + }, + "pim_ipv6": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Enable IPv6 multicast traffic for the Bridge Domain object.`, + }, + "limit_ip_learn_to_subnets": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Limit IP address learning to subnets for the Bridge Domain object. Every %!s(MISSING) object can have multiple subnets associated with it.`, + }, + "link_local_ipv6_address": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{}, + MarkdownDescription: `The override of the system generated IPv6 link-local address.`, + }, + "custom_mac_address": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{}, + MarkdownDescription: `The MAC address of the Bridge Domain object.`, + }, + "drop_arp_with_multicast_smac": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Drop roque multicast ARP packets for the Bridge Domain object.`, + }, + "pim": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Enable IPv4 multicast traffic for the Bridge Domain object.`, + }, + "multi_destination_flooding": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("bd-flood", "drop", "encap-flood"), + }, + MarkdownDescription: `The multiple destination forwarding method for L2 Multicast, Broadcast, and Link Layer traffic types.`, + }, + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the Bridge Domain object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The name alias of the Bridge Domain object.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "bridge_domain_type": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("fc", "regular"), + }, + MarkdownDescription: `domain type.`, + }, + "unicast_routing": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Enable the forwarding method based on predefined forwarding criteria (IP or MAC address).`, + }, + "l2_unknown_unicast_flooding": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("flood", "proxy"), + }, + MarkdownDescription: `The forwarding method for unknown layer 2 destinations.`, + }, + "l3_unknown_multicast_flooding": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("flood", "opt-flood"), + }, + MarkdownDescription: `The forwarding method for unknown layer multicast destinations.`, + }, + "ipv6_l3_unknown_multicast_flooding": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("flood", "opt-flood"), + }, + MarkdownDescription: `The forwarding method for unknown IPv6 multicast destinations.`, + }, + "virtual_mac_address": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{}, + MarkdownDescription: `Virtual MAC address of the BD/SVI. This is used when the BD is extended to multiple sites using l2 Outside.`, + }, + "legacy_mode": schema.SingleNestedAttribute{ + MarkdownDescription: `The bridge domain (BD) access profile. When created over a BD, contracts are not enforced for the BD, and the encap will be applied to all endpoint groups on this BD.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.Object{ + MakeSingleNestedAttributeRequiredAttributesNotProvidedValidator("legacy_mode", []string{"encapsulation"}), + }, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Legacy Mode object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the Legacy Mode object.`, + }, + "encapsulation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The VLAN or VXLAN encapsulation of the Legacy Mode object.`, + }, + "name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the Legacy Mode object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the Legacy Mode object.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + }, + }, + "rogue_coop_exceptions": schema.SetNestedAttribute{ + MarkdownDescription: `Configuration of MAC address to be excepted from Rogue processing`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Rogue Coop Exception object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the Rogue Coop Exception object.`, + }, + "mac": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The MAC address of the Rogue Coop Exception object.`, + }, + "name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the Rogue Coop Exception object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the Rogue Coop Exception object.`, + }, + }, + }, + }, + "relation_to_monitor_policy": schema.SingleNestedAttribute{ + MarkdownDescription: `A source relation to the monitoring policy model for the endpoint group semantic scope. This is an internal object.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.UseStateForUnknown(), + }, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To Monitoring Policy object.`, + }, + "monitoring_policy_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the Monitoring Policy object.`, + }, + }, + }, + "relation_to_first_hop_security_policy": schema.SingleNestedAttribute{ + MarkdownDescription: `Relation to FHS BD policy`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.UseStateForUnknown(), + }, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To First Hop Security Policy object.`, + }, + "first_hop_security_policy_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the First Hop Security Policy object.`, + }, + }, + }, + "relation_to_neighbor_discovery_interface_policy": schema.SingleNestedAttribute{ + MarkdownDescription: `The neighbor discovery policy.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.UseStateForUnknown(), + }, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To Neighbor Discovery Interface Policy object.`, + }, + "neighbor_discovery_interface_policy_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the Neighbor Discovery Interface Policy object.`, + }, + }, + }, + "relation_to_netflow_monitor_policy": schema.SetNestedAttribute{ + MarkdownDescription: `Relation to Netflow Monitor policy`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To NetFlow Monitor Policy object.`, + }, + "filter_type": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("ce", "ipv4", "ipv6", "unspecified"), + MakeStringRequired(), + }, + MarkdownDescription: `The filter type of the NetFlow Monitor Policy object.`, + }, + "netflow_monitor_policy_name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the NetFlow Monitor Policy object.`, + }, + }, + }, + }, + "relation_to_l3_outsides": schema.SetNestedAttribute{ + MarkdownDescription: `A source relation to the policy controlling connectivity to the outside. This is an internal object.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To L3 Outside object.`, + }, + "l3_outside_name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the L3 Outside object.`, + }, + }, + }, + }, + "relation_to_route_control_profile": schema.SingleNestedAttribute{ + MarkdownDescription: `A source relation to external networks that are routed via Layer 3 networks outside the fabric that are reachable by a tenant's applications. This is an internal object.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.UseStateForUnknown(), + }, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To Route Control Profile object.`, + }, + "l3_outside_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the L3 Outside object.`, + }, + "route_control_profile_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the Route Control Profile object.`, + }, + }, + }, + "relation_to_dhcp_relay_policy": schema.SingleNestedAttribute{ + MarkdownDescription: `A source relation to the DHCP relay profile. This is an internal object.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.UseStateForUnknown(), + }, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To Dhcp Relay Policy object.`, + }, + "dhcp_relay_policy_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the DHCP Relay Policy object.`, + }, + }, + }, + "relation_to_end_point_retention_policy": schema.SingleNestedAttribute{ + MarkdownDescription: `A source relation to the endpoint retention policy providing the parameters for the lifecycle of the endpoint group. This is an internal object.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.UseStateForUnknown(), + }, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation From Bridge Domain To End Point Retention Policy object.`, + }, + "resolve_act": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("inherit", "resolve"), + }, + MarkdownDescription: `null.`, + }, + "end_point_retention_policy_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The End Point Retention policy name associated with the bridge domain.`, + }, + }, + }, + "relation_to_vrf": schema.SingleNestedAttribute{ + MarkdownDescription: `A source relation to a private layer 3 network context that either belongs to a specific tenant or is shared. This is an internal object.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.UseStateForUnknown(), + }, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To VRF object.`, + }, + "vrf_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the VRF object.`, + }, + }, + }, + "relation_to_igmp_snooping_policy": schema.SingleNestedAttribute{ + MarkdownDescription: `A source relation to the Internet Group Management Protocol (IGMP) snooping policy. This is an internal object.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.UseStateForUnknown(), + }, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To IGMP Snooping Policy object.`, + }, + "igmp_snooping_policy_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the IGMP Snooping Policy object.`, + }, + }, + }, + "relation_to_mld_snooping_policy": schema.SingleNestedAttribute{ + MarkdownDescription: `Relation to an MLD Snoop policy`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.UseStateForUnknown(), + }, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To MLD Snooping Policy object.`, + }, + "mld_snooping_policy_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the MLD Snooping Policy object.`, + }, + }, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + Blocks: map[string]schema.Block{ + "relation_fv_rs_bd_to_netflow_monitor_pol": schema.SetNestedBlock{ + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "flt_type": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'flt_type' will be deprecated soon, please use 'relation_to_netflow_monitor_policy.filter_type' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_netflow_monitor_policy"), + }...), + }, + }, + "tn_netflow_monitor_pol_name": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'tn_netflow_monitor_pol_name' will be deprecated soon, please use 'relation_to_netflow_monitor_policy.netflow_monitor_policy_name' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_netflow_monitor_policy"), + }...), + }, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_bridge_domain") +} + +func (r *FvBDResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_bridge_domain") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_bridge_domain") +} + +func (r *FvBDResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_bridge_domain") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvBDResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + if stateData.Id.IsUnknown() || stateData.Id.IsNull() { + setFvBDId(ctx, stateData) + } + getAndSetFvBDAttributes(ctx, &resp.Diagnostics, r.client, stateData) + if !globalAllowExistingOnCreate && !stateData.Id.IsNull() { + resp.Diagnostics.AddError( + "Object Already Exists", + fmt.Sprintf("The fvBD object with DN '%s' already exists.", stateData.Id.ValueString()), + ) + return + } + + var data *FvBDResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + if data.Id.IsUnknown() || data.Id.IsNull() { + setFvBDId(ctx, data) + } + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_bridge_domain with id '%s'", data.Id.ValueString())) + + var fvAccPPlan, fvAccPState FvAccPFvBDResourceModel + data.FvAccP.As(ctx, &fvAccPPlan, basetypes.ObjectAsOptions{}) + stateData.FvAccP.As(ctx, &fvAccPState, basetypes.ObjectAsOptions{}) + var fvRogueExceptionMacPlan, fvRogueExceptionMacState []FvRogueExceptionMacFvBDResourceModel + data.FvRogueExceptionMac.ElementsAs(ctx, &fvRogueExceptionMacPlan, false) + stateData.FvRogueExceptionMac.ElementsAs(ctx, &fvRogueExceptionMacState, false) + var fvRsABDPolMonPolPlan, fvRsABDPolMonPolState FvRsABDPolMonPolFvBDResourceModel + data.FvRsABDPolMonPol.As(ctx, &fvRsABDPolMonPolPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsABDPolMonPol.As(ctx, &fvRsABDPolMonPolState, basetypes.ObjectAsOptions{}) + var fvRsBDToFhsPlan, fvRsBDToFhsState FvRsBDToFhsFvBDResourceModel + data.FvRsBDToFhs.As(ctx, &fvRsBDToFhsPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsBDToFhs.As(ctx, &fvRsBDToFhsState, basetypes.ObjectAsOptions{}) + var fvRsBDToNdPPlan, fvRsBDToNdPState FvRsBDToNdPFvBDResourceModel + data.FvRsBDToNdP.As(ctx, &fvRsBDToNdPPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsBDToNdP.As(ctx, &fvRsBDToNdPState, basetypes.ObjectAsOptions{}) + var fvRsBDToNetflowMonitorPolPlan, fvRsBDToNetflowMonitorPolState []FvRsBDToNetflowMonitorPolFvBDResourceModel + data.FvRsBDToNetflowMonitorPol.ElementsAs(ctx, &fvRsBDToNetflowMonitorPolPlan, false) + stateData.FvRsBDToNetflowMonitorPol.ElementsAs(ctx, &fvRsBDToNetflowMonitorPolState, false) + var fvRsBDToOutPlan, fvRsBDToOutState []FvRsBDToOutFvBDResourceModel + data.FvRsBDToOut.ElementsAs(ctx, &fvRsBDToOutPlan, false) + stateData.FvRsBDToOut.ElementsAs(ctx, &fvRsBDToOutState, false) + var fvRsBDToProfilePlan, fvRsBDToProfileState FvRsBDToProfileFvBDResourceModel + data.FvRsBDToProfile.As(ctx, &fvRsBDToProfilePlan, basetypes.ObjectAsOptions{}) + stateData.FvRsBDToProfile.As(ctx, &fvRsBDToProfileState, basetypes.ObjectAsOptions{}) + var fvRsBDToRelayPPlan, fvRsBDToRelayPState FvRsBDToRelayPFvBDResourceModel + data.FvRsBDToRelayP.As(ctx, &fvRsBDToRelayPPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsBDToRelayP.As(ctx, &fvRsBDToRelayPState, basetypes.ObjectAsOptions{}) + var fvRsBdToEpRetPlan, fvRsBdToEpRetState FvRsBdToEpRetFvBDResourceModel + data.FvRsBdToEpRet.As(ctx, &fvRsBdToEpRetPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsBdToEpRet.As(ctx, &fvRsBdToEpRetState, basetypes.ObjectAsOptions{}) + var fvRsCtxPlan, fvRsCtxState FvRsCtxFvBDResourceModel + data.FvRsCtx.As(ctx, &fvRsCtxPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsCtx.As(ctx, &fvRsCtxState, basetypes.ObjectAsOptions{}) + var fvRsIgmpsnPlan, fvRsIgmpsnState FvRsIgmpsnFvBDResourceModel + data.FvRsIgmpsn.As(ctx, &fvRsIgmpsnPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsIgmpsn.As(ctx, &fvRsIgmpsnState, basetypes.ObjectAsOptions{}) + var fvRsMldsnPlan, fvRsMldsnState FvRsMldsnFvBDResourceModel + data.FvRsMldsn.As(ctx, &fvRsMldsnPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsMldsn.As(ctx, &fvRsMldsnState, basetypes.ObjectAsOptions{}) + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvBDResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvBDResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvBDCreateJsonPayload(ctx, &resp.Diagnostics, true, data, fvAccPPlan, fvAccPState, fvRogueExceptionMacPlan, fvRogueExceptionMacState, fvRsABDPolMonPolPlan, fvRsABDPolMonPolState, fvRsBDToFhsPlan, fvRsBDToFhsState, fvRsBDToNdPPlan, fvRsBDToNdPState, fvRsBDToNetflowMonitorPolPlan, fvRsBDToNetflowMonitorPolState, fvRsBDToOutPlan, fvRsBDToOutState, fvRsBDToProfilePlan, fvRsBDToProfileState, fvRsBDToRelayPPlan, fvRsBDToRelayPState, fvRsBdToEpRetPlan, fvRsBdToEpRetState, fvRsCtxPlan, fvRsCtxState, fvRsIgmpsnPlan, fvRsIgmpsnState, fvRsMldsnPlan, fvRsMldsnState, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvBDAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_bridge_domain with id '%s'", data.Id.ValueString())) +} + +func (r *FvBDResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_bridge_domain") + var data *FvBDResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_bridge_domain with id '%s'", data.Id.ValueString())) + + getAndSetFvBDAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvBDResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_bridge_domain with id '%s'", data.Id.ValueString())) +} + +func (r *FvBDResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_bridge_domain") + var data *FvBDResourceModel + var stateData *FvBDResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + // Error out when child object fvRsBDToNdP is being deleted + if IsEmptySingleNestedAttribute(data.FvRsBDToNdP.Attributes()) && !IsEmptySingleNestedAttribute(stateData.FvRsBDToNdP.Attributes()) { + resp.Diagnostics.AddError( + "FvRsBDToNdP object cannot be deleted", + "deletion of child is only possible upon deletion of the parent", + ) + } + // Error out when child object fvRsBdToEpRet is being deleted + if IsEmptySingleNestedAttribute(data.FvRsBdToEpRet.Attributes()) && !IsEmptySingleNestedAttribute(stateData.FvRsBdToEpRet.Attributes()) { + resp.Diagnostics.AddError( + "FvRsBdToEpRet object cannot be deleted", + "deletion of child is only possible upon deletion of the parent", + ) + } + // Error out when child object fvRsCtx is being deleted + if IsEmptySingleNestedAttribute(data.FvRsCtx.Attributes()) && !IsEmptySingleNestedAttribute(stateData.FvRsCtx.Attributes()) { + resp.Diagnostics.AddError( + "FvRsCtx object cannot be deleted", + "deletion of child is only possible upon deletion of the parent", + ) + } + // Error out when child object fvRsIgmpsn is being deleted + if IsEmptySingleNestedAttribute(data.FvRsIgmpsn.Attributes()) && !IsEmptySingleNestedAttribute(stateData.FvRsIgmpsn.Attributes()) { + resp.Diagnostics.AddError( + "FvRsIgmpsn object cannot be deleted", + "deletion of child is only possible upon deletion of the parent", + ) + } + // Error out when child object fvRsMldsn is being deleted + if IsEmptySingleNestedAttribute(data.FvRsMldsn.Attributes()) && !IsEmptySingleNestedAttribute(stateData.FvRsMldsn.Attributes()) { + resp.Diagnostics.AddError( + "FvRsMldsn object cannot be deleted", + "deletion of child is only possible upon deletion of the parent", + ) + } + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_bridge_domain with id '%s'", data.Id.ValueString())) + + var fvAccPPlan, fvAccPState FvAccPFvBDResourceModel + data.FvAccP.As(ctx, &fvAccPPlan, basetypes.ObjectAsOptions{}) + stateData.FvAccP.As(ctx, &fvAccPState, basetypes.ObjectAsOptions{}) + var fvRogueExceptionMacPlan, fvRogueExceptionMacState []FvRogueExceptionMacFvBDResourceModel + data.FvRogueExceptionMac.ElementsAs(ctx, &fvRogueExceptionMacPlan, false) + stateData.FvRogueExceptionMac.ElementsAs(ctx, &fvRogueExceptionMacState, false) + var fvRsABDPolMonPolPlan, fvRsABDPolMonPolState FvRsABDPolMonPolFvBDResourceModel + data.FvRsABDPolMonPol.As(ctx, &fvRsABDPolMonPolPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsABDPolMonPol.As(ctx, &fvRsABDPolMonPolState, basetypes.ObjectAsOptions{}) + var fvRsBDToFhsPlan, fvRsBDToFhsState FvRsBDToFhsFvBDResourceModel + data.FvRsBDToFhs.As(ctx, &fvRsBDToFhsPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsBDToFhs.As(ctx, &fvRsBDToFhsState, basetypes.ObjectAsOptions{}) + var fvRsBDToNdPPlan, fvRsBDToNdPState FvRsBDToNdPFvBDResourceModel + data.FvRsBDToNdP.As(ctx, &fvRsBDToNdPPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsBDToNdP.As(ctx, &fvRsBDToNdPState, basetypes.ObjectAsOptions{}) + var fvRsBDToNetflowMonitorPolPlan, fvRsBDToNetflowMonitorPolState []FvRsBDToNetflowMonitorPolFvBDResourceModel + data.FvRsBDToNetflowMonitorPol.ElementsAs(ctx, &fvRsBDToNetflowMonitorPolPlan, false) + stateData.FvRsBDToNetflowMonitorPol.ElementsAs(ctx, &fvRsBDToNetflowMonitorPolState, false) + var fvRsBDToOutPlan, fvRsBDToOutState []FvRsBDToOutFvBDResourceModel + data.FvRsBDToOut.ElementsAs(ctx, &fvRsBDToOutPlan, false) + stateData.FvRsBDToOut.ElementsAs(ctx, &fvRsBDToOutState, false) + var fvRsBDToProfilePlan, fvRsBDToProfileState FvRsBDToProfileFvBDResourceModel + data.FvRsBDToProfile.As(ctx, &fvRsBDToProfilePlan, basetypes.ObjectAsOptions{}) + stateData.FvRsBDToProfile.As(ctx, &fvRsBDToProfileState, basetypes.ObjectAsOptions{}) + var fvRsBDToRelayPPlan, fvRsBDToRelayPState FvRsBDToRelayPFvBDResourceModel + data.FvRsBDToRelayP.As(ctx, &fvRsBDToRelayPPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsBDToRelayP.As(ctx, &fvRsBDToRelayPState, basetypes.ObjectAsOptions{}) + var fvRsBdToEpRetPlan, fvRsBdToEpRetState FvRsBdToEpRetFvBDResourceModel + data.FvRsBdToEpRet.As(ctx, &fvRsBdToEpRetPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsBdToEpRet.As(ctx, &fvRsBdToEpRetState, basetypes.ObjectAsOptions{}) + var fvRsCtxPlan, fvRsCtxState FvRsCtxFvBDResourceModel + data.FvRsCtx.As(ctx, &fvRsCtxPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsCtx.As(ctx, &fvRsCtxState, basetypes.ObjectAsOptions{}) + var fvRsIgmpsnPlan, fvRsIgmpsnState FvRsIgmpsnFvBDResourceModel + data.FvRsIgmpsn.As(ctx, &fvRsIgmpsnPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsIgmpsn.As(ctx, &fvRsIgmpsnState, basetypes.ObjectAsOptions{}) + var fvRsMldsnPlan, fvRsMldsnState FvRsMldsnFvBDResourceModel + data.FvRsMldsn.As(ctx, &fvRsMldsnPlan, basetypes.ObjectAsOptions{}) + stateData.FvRsMldsn.As(ctx, &fvRsMldsnState, basetypes.ObjectAsOptions{}) + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvBDResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvBDResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvBDCreateJsonPayload(ctx, &resp.Diagnostics, false, data, fvAccPPlan, fvAccPState, fvRogueExceptionMacPlan, fvRogueExceptionMacState, fvRsABDPolMonPolPlan, fvRsABDPolMonPolState, fvRsBDToFhsPlan, fvRsBDToFhsState, fvRsBDToNdPPlan, fvRsBDToNdPState, fvRsBDToNetflowMonitorPolPlan, fvRsBDToNetflowMonitorPolState, fvRsBDToOutPlan, fvRsBDToOutState, fvRsBDToProfilePlan, fvRsBDToProfileState, fvRsBDToRelayPPlan, fvRsBDToRelayPState, fvRsBdToEpRetPlan, fvRsBdToEpRetState, fvRsCtxPlan, fvRsCtxState, fvRsIgmpsnPlan, fvRsIgmpsnState, fvRsMldsnPlan, fvRsMldsnState, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvBDAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_bridge_domain with id '%s'", data.Id.ValueString())) +} + +func (r *FvBDResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_bridge_domain") + var data *FvBDResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_bridge_domain with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvBD", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_bridge_domain with id '%s'", data.Id.ValueString())) +} + +func (r *FvBDResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_bridge_domain") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvBDResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_bridge_domain with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_bridge_domain") +} + +func getAndSetFvBDAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvBDResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvBD,fvAccP,fvRogueExceptionMac,fvRsABDPolMonPol,fvRsBDToFhs,fvRsBDToNdP,fvRsBDToNetflowMonitorPol,fvRsBDToOut,fvRsBDToProfile,fvRsBDToRelayP,fvRsBdToEpRet,fvRsCtx,fvRsIgmpsn,fvRsMldsn,tagAnnotation,tagTag"), "GET", nil) + + *data = *getEmptyFvBDResourceModel() + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvBD").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvBD").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvBDParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "OptimizeWanBandwidth" { + data.OptimizeWanBandwidth = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "arpFlood" { + data.ArpFlood = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "enableRogueExceptMac" { + data.EnableRogueExceptMac = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "epClear" { + data.EpClear = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "epMoveDetectMode" { + data.EpMoveDetectMode = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "hostBasedRouting" { + data.HostBasedRouting = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "intersiteBumTrafficAllow" { + data.IntersiteBumTrafficAllow = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "intersiteL2Stretch" { + data.IntersiteL2Stretch = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ipLearning" { + data.IpLearning = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ipv6McastAllow" { + data.Ipv6McastAllow = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "limitIpLearnToSubnets" { + data.LimitIpLearnToSubnets = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "llAddr" { + data.LlAddr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "mac" { + data.Mac = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "mcastARPDrop" { + data.McastARPDrop = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "mcastAllow" { + data.McastAllow = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "multiDstPktAct" { + data.MultiDstPktAct = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerKey" { + data.OwnerKey = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerTag" { + data.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "type" { + data.Type = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "unicastRoute" { + data.UnicastRoute = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "unkMacUcastAct" { + data.UnkMacUcastAct = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "unkMcastAct" { + data.UnkMcastAct = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "v6unkMcastAct" { + data.V6unkMcastAct = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "vmac" { + data.Vmac = basetypes.NewStringValue(attributeValue.(string)) + } + } + FvAccPFvBDList := make([]FvAccPFvBDResourceModel, 0) + FvRogueExceptionMacFvBDList := make([]FvRogueExceptionMacFvBDResourceModel, 0) + FvRsABDPolMonPolFvBDList := make([]FvRsABDPolMonPolFvBDResourceModel, 0) + FvRsBDToFhsFvBDList := make([]FvRsBDToFhsFvBDResourceModel, 0) + FvRsBDToNdPFvBDList := make([]FvRsBDToNdPFvBDResourceModel, 0) + FvRsBDToNetflowMonitorPolFvBDList := make([]FvRsBDToNetflowMonitorPolFvBDResourceModel, 0) + FvRsBDToOutFvBDList := make([]FvRsBDToOutFvBDResourceModel, 0) + FvRsBDToProfileFvBDList := make([]FvRsBDToProfileFvBDResourceModel, 0) + FvRsBDToRelayPFvBDList := make([]FvRsBDToRelayPFvBDResourceModel, 0) + FvRsBdToEpRetFvBDList := make([]FvRsBdToEpRetFvBDResourceModel, 0) + FvRsCtxFvBDList := make([]FvRsCtxFvBDResourceModel, 0) + FvRsIgmpsnFvBDList := make([]FvRsIgmpsnFvBDResourceModel, 0) + FvRsMldsnFvBDList := make([]FvRsMldsnFvBDResourceModel, 0) + TagAnnotationFvBDList := make([]TagAnnotationFvBDResourceModel, 0) + TagTagFvBDList := make([]TagTagFvBDResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "fvAccP" { + FvAccPFvBD := getEmptyFvAccPFvBDResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvAccPFvBD.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "descr" { + FvAccPFvBD.Descr = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "encap" { + FvAccPFvBD.Encap = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "name" { + FvAccPFvBD.Name = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "nameAlias" { + FvAccPFvBD.NameAlias = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "ownerKey" { + FvAccPFvBD.OwnerKey = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "ownerTag" { + FvAccPFvBD.OwnerTag = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvAccPFvBDList = append(FvAccPFvBDList, FvAccPFvBD) + } + if childClassName == "fvRogueExceptionMac" { + FvRogueExceptionMacFvBD := getEmptyFvRogueExceptionMacFvBDResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRogueExceptionMacFvBD.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "descr" { + FvRogueExceptionMacFvBD.Descr = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "mac" { + FvRogueExceptionMacFvBD.Mac = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "name" { + FvRogueExceptionMacFvBD.Name = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "nameAlias" { + FvRogueExceptionMacFvBD.NameAlias = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRogueExceptionMacFvBDList = append(FvRogueExceptionMacFvBDList, FvRogueExceptionMacFvBD) + } + if childClassName == "fvRsABDPolMonPol" { + FvRsABDPolMonPolFvBD := getEmptyFvRsABDPolMonPolFvBDResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsABDPolMonPolFvBD.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnMonEPGPolName" { + FvRsABDPolMonPolFvBD.TnMonEPGPolName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsABDPolMonPolFvBDList = append(FvRsABDPolMonPolFvBDList, FvRsABDPolMonPolFvBD) + } + if childClassName == "fvRsBDToFhs" { + FvRsBDToFhsFvBD := getEmptyFvRsBDToFhsFvBDResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsBDToFhsFvBD.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnFhsBDPolName" { + FvRsBDToFhsFvBD.TnFhsBDPolName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsBDToFhsFvBDList = append(FvRsBDToFhsFvBDList, FvRsBDToFhsFvBD) + } + if childClassName == "fvRsBDToNdP" { + FvRsBDToNdPFvBD := getEmptyFvRsBDToNdPFvBDResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsBDToNdPFvBD.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnNdIfPolName" { + FvRsBDToNdPFvBD.TnNdIfPolName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsBDToNdPFvBDList = append(FvRsBDToNdPFvBDList, FvRsBDToNdPFvBD) + } + if childClassName == "fvRsBDToNetflowMonitorPol" { + FvRsBDToNetflowMonitorPolFvBD := getEmptyFvRsBDToNetflowMonitorPolFvBDResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsBDToNetflowMonitorPolFvBD.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "fltType" { + FvRsBDToNetflowMonitorPolFvBD.FltType = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnNetflowMonitorPolName" { + FvRsBDToNetflowMonitorPolFvBD.TnNetflowMonitorPolName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsBDToNetflowMonitorPolFvBDList = append(FvRsBDToNetflowMonitorPolFvBDList, FvRsBDToNetflowMonitorPolFvBD) + } + if childClassName == "fvRsBDToOut" { + FvRsBDToOutFvBD := getEmptyFvRsBDToOutFvBDResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsBDToOutFvBD.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnL3extOutName" { + FvRsBDToOutFvBD.TnL3extOutName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsBDToOutFvBDList = append(FvRsBDToOutFvBDList, FvRsBDToOutFvBD) + } + if childClassName == "fvRsBDToProfile" { + FvRsBDToProfileFvBD := getEmptyFvRsBDToProfileFvBDResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsBDToProfileFvBD.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnL3extOutName" { + FvRsBDToProfileFvBD.TnL3extOutName = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnRtctrlProfileName" { + FvRsBDToProfileFvBD.TnRtctrlProfileName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsBDToProfileFvBDList = append(FvRsBDToProfileFvBDList, FvRsBDToProfileFvBD) + } + if childClassName == "fvRsBDToRelayP" { + FvRsBDToRelayPFvBD := getEmptyFvRsBDToRelayPFvBDResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsBDToRelayPFvBD.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnDhcpRelayPName" { + FvRsBDToRelayPFvBD.TnDhcpRelayPName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsBDToRelayPFvBDList = append(FvRsBDToRelayPFvBDList, FvRsBDToRelayPFvBD) + } + if childClassName == "fvRsBdToEpRet" { + FvRsBdToEpRetFvBD := getEmptyFvRsBdToEpRetFvBDResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsBdToEpRetFvBD.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "resolveAct" { + FvRsBdToEpRetFvBD.ResolveAct = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnFvEpRetPolName" { + FvRsBdToEpRetFvBD.TnFvEpRetPolName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsBdToEpRetFvBDList = append(FvRsBdToEpRetFvBDList, FvRsBdToEpRetFvBD) + } + if childClassName == "fvRsCtx" { + FvRsCtxFvBD := getEmptyFvRsCtxFvBDResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsCtxFvBD.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnFvCtxName" { + FvRsCtxFvBD.TnFvCtxName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsCtxFvBDList = append(FvRsCtxFvBDList, FvRsCtxFvBD) + } + if childClassName == "fvRsIgmpsn" { + FvRsIgmpsnFvBD := getEmptyFvRsIgmpsnFvBDResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsIgmpsnFvBD.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnIgmpSnoopPolName" { + FvRsIgmpsnFvBD.TnIgmpSnoopPolName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsIgmpsnFvBDList = append(FvRsIgmpsnFvBDList, FvRsIgmpsnFvBD) + } + if childClassName == "fvRsMldsn" { + FvRsMldsnFvBD := getEmptyFvRsMldsnFvBDResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsMldsnFvBD.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnMldSnoopPolName" { + FvRsMldsnFvBD.TnMldSnoopPolName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsMldsnFvBDList = append(FvRsMldsnFvBDList, FvRsMldsnFvBD) + } + if childClassName == "tagAnnotation" { + TagAnnotationFvBD := getEmptyTagAnnotationFvBDResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvBD.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvBD.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvBDList = append(TagAnnotationFvBDList, TagAnnotationFvBD) + } + if childClassName == "tagTag" { + TagTagFvBD := getEmptyTagTagFvBDResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvBD.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvBD.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvBDList = append(TagTagFvBDList, TagTagFvBD) + } + } + } + } + if len(FvAccPFvBDList) == 1 { + fvAccPObject, _ := types.ObjectValueFrom(ctx, FvAccPFvBDType, FvAccPFvBDList[0]) + data.FvAccP = fvAccPObject + } else { + fvAccPObject, _ := types.ObjectValueFrom(ctx, FvAccPFvBDType, getEmptyFvAccPFvBDResourceModel()) + data.FvAccP = fvAccPObject + } + fvRogueExceptionMacSet, _ := types.SetValueFrom(ctx, data.FvRogueExceptionMac.ElementType(ctx), FvRogueExceptionMacFvBDList) + data.FvRogueExceptionMac = fvRogueExceptionMacSet + if len(FvRsABDPolMonPolFvBDList) == 1 { + fvRsABDPolMonPolObject, _ := types.ObjectValueFrom(ctx, FvRsABDPolMonPolFvBDType, FvRsABDPolMonPolFvBDList[0]) + data.FvRsABDPolMonPol = fvRsABDPolMonPolObject + } else { + fvRsABDPolMonPolObject, _ := types.ObjectValueFrom(ctx, FvRsABDPolMonPolFvBDType, getEmptyFvRsABDPolMonPolFvBDResourceModel()) + data.FvRsABDPolMonPol = fvRsABDPolMonPolObject + } + if len(FvRsBDToFhsFvBDList) == 1 { + fvRsBDToFhsObject, _ := types.ObjectValueFrom(ctx, FvRsBDToFhsFvBDType, FvRsBDToFhsFvBDList[0]) + data.FvRsBDToFhs = fvRsBDToFhsObject + } else { + fvRsBDToFhsObject, _ := types.ObjectValueFrom(ctx, FvRsBDToFhsFvBDType, getEmptyFvRsBDToFhsFvBDResourceModel()) + data.FvRsBDToFhs = fvRsBDToFhsObject + } + if len(FvRsBDToNdPFvBDList) == 1 { + fvRsBDToNdPObject, _ := types.ObjectValueFrom(ctx, FvRsBDToNdPFvBDType, FvRsBDToNdPFvBDList[0]) + data.FvRsBDToNdP = fvRsBDToNdPObject + } else { + fvRsBDToNdPObject, _ := types.ObjectValueFrom(ctx, FvRsBDToNdPFvBDType, getEmptyFvRsBDToNdPFvBDResourceModel()) + data.FvRsBDToNdP = fvRsBDToNdPObject + } + fvRsBDToNetflowMonitorPolSet, _ := types.SetValueFrom(ctx, data.FvRsBDToNetflowMonitorPol.ElementType(ctx), FvRsBDToNetflowMonitorPolFvBDList) + data.FvRsBDToNetflowMonitorPol = fvRsBDToNetflowMonitorPolSet + fvRsBDToOutSet, _ := types.SetValueFrom(ctx, data.FvRsBDToOut.ElementType(ctx), FvRsBDToOutFvBDList) + data.FvRsBDToOut = fvRsBDToOutSet + if len(FvRsBDToProfileFvBDList) == 1 { + fvRsBDToProfileObject, _ := types.ObjectValueFrom(ctx, FvRsBDToProfileFvBDType, FvRsBDToProfileFvBDList[0]) + data.FvRsBDToProfile = fvRsBDToProfileObject + } else { + fvRsBDToProfileObject, _ := types.ObjectValueFrom(ctx, FvRsBDToProfileFvBDType, getEmptyFvRsBDToProfileFvBDResourceModel()) + data.FvRsBDToProfile = fvRsBDToProfileObject + } + if len(FvRsBDToRelayPFvBDList) == 1 { + fvRsBDToRelayPObject, _ := types.ObjectValueFrom(ctx, FvRsBDToRelayPFvBDType, FvRsBDToRelayPFvBDList[0]) + data.FvRsBDToRelayP = fvRsBDToRelayPObject + } else { + fvRsBDToRelayPObject, _ := types.ObjectValueFrom(ctx, FvRsBDToRelayPFvBDType, getEmptyFvRsBDToRelayPFvBDResourceModel()) + data.FvRsBDToRelayP = fvRsBDToRelayPObject + } + if len(FvRsBdToEpRetFvBDList) == 1 { + fvRsBdToEpRetObject, _ := types.ObjectValueFrom(ctx, FvRsBdToEpRetFvBDType, FvRsBdToEpRetFvBDList[0]) + data.FvRsBdToEpRet = fvRsBdToEpRetObject + } else { + fvRsBdToEpRetObject, _ := types.ObjectValueFrom(ctx, FvRsBdToEpRetFvBDType, getEmptyFvRsBdToEpRetFvBDResourceModel()) + data.FvRsBdToEpRet = fvRsBdToEpRetObject + } + if len(FvRsCtxFvBDList) == 1 { + fvRsCtxObject, _ := types.ObjectValueFrom(ctx, FvRsCtxFvBDType, FvRsCtxFvBDList[0]) + data.FvRsCtx = fvRsCtxObject + } else { + fvRsCtxObject, _ := types.ObjectValueFrom(ctx, FvRsCtxFvBDType, getEmptyFvRsCtxFvBDResourceModel()) + data.FvRsCtx = fvRsCtxObject + } + if len(FvRsIgmpsnFvBDList) == 1 { + fvRsIgmpsnObject, _ := types.ObjectValueFrom(ctx, FvRsIgmpsnFvBDType, FvRsIgmpsnFvBDList[0]) + data.FvRsIgmpsn = fvRsIgmpsnObject + } else { + fvRsIgmpsnObject, _ := types.ObjectValueFrom(ctx, FvRsIgmpsnFvBDType, getEmptyFvRsIgmpsnFvBDResourceModel()) + data.FvRsIgmpsn = fvRsIgmpsnObject + } + if len(FvRsMldsnFvBDList) == 1 { + fvRsMldsnObject, _ := types.ObjectValueFrom(ctx, FvRsMldsnFvBDType, FvRsMldsnFvBDList[0]) + data.FvRsMldsn = fvRsMldsnObject + } else { + fvRsMldsnObject, _ := types.ObjectValueFrom(ctx, FvRsMldsnFvBDType, getEmptyFvRsMldsnFvBDResourceModel()) + data.FvRsMldsn = fvRsMldsnObject + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvBDList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvBDList) + data.TagTag = tagTagSet + setFvBDLegacyAttributes(ctx, diags, data, classReadInfo) + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvBD'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvBDRn(ctx context.Context, data *FvBDResourceModel) string { + rn := "BD-{name}" + for _, identifier := range []string{"name"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFvBDParentDn(ctx context.Context, dn string, data *FvBDResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvBDId(ctx context.Context, data *FvBDResourceModel) { + rn := getFvBDRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvBDFvAccPChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, fvAccPPlan, fvAccPState FvAccPFvBDResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvAccP.IsUnknown() { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !IsEmptySingleNestedAttribute(data.FvAccP.Attributes()) { + if !fvAccPPlan.Annotation.IsUnknown() && !fvAccPPlan.Annotation.IsNull() { + childMap["attributes"]["annotation"] = fvAccPPlan.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvAccPPlan.Descr.IsUnknown() && !fvAccPPlan.Descr.IsNull() { + childMap["attributes"]["descr"] = fvAccPPlan.Descr.ValueString() + } + if !fvAccPPlan.Encap.IsUnknown() && !fvAccPPlan.Encap.IsNull() { + childMap["attributes"]["encap"] = fvAccPPlan.Encap.ValueString() + } + if !fvAccPPlan.Name.IsUnknown() && !fvAccPPlan.Name.IsNull() { + childMap["attributes"]["name"] = fvAccPPlan.Name.ValueString() + } + if !fvAccPPlan.NameAlias.IsUnknown() && !fvAccPPlan.NameAlias.IsNull() { + childMap["attributes"]["nameAlias"] = fvAccPPlan.NameAlias.ValueString() + } + if !fvAccPPlan.OwnerKey.IsUnknown() && !fvAccPPlan.OwnerKey.IsNull() { + childMap["attributes"]["ownerKey"] = fvAccPPlan.OwnerKey.ValueString() + } + if !fvAccPPlan.OwnerTag.IsUnknown() && !fvAccPPlan.OwnerTag.IsNull() { + childMap["attributes"]["ownerTag"] = fvAccPPlan.OwnerTag.ValueString() + } + } else { + childMap["attributes"]["status"] = "deleted" + } + childPayloads = append(childPayloads, map[string]interface{}{"fvAccP": childMap}) + } else { + FvAccPObject, _ := types.ObjectValueFrom(ctx, FvAccPFvBDType, getEmptyFvAccPFvBDResourceModel()) + data.FvAccP = FvAccPObject + } + + return childPayloads +} +func getFvBDFvRogueExceptionMacChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, fvRogueExceptionMacPlan, fvRogueExceptionMacState []FvRogueExceptionMacFvBDResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRogueExceptionMac.IsUnknown() { + fvRogueExceptionMacIdentifiers := []FvRogueExceptionMacIdentifier{} + for _, fvRogueExceptionMac := range fvRogueExceptionMacPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRogueExceptionMac.Annotation.IsUnknown() && !fvRogueExceptionMac.Annotation.IsNull() { + childMap["attributes"]["annotation"] = fvRogueExceptionMac.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRogueExceptionMac.Descr.IsUnknown() && !fvRogueExceptionMac.Descr.IsNull() { + childMap["attributes"]["descr"] = fvRogueExceptionMac.Descr.ValueString() + } + if !fvRogueExceptionMac.Mac.IsUnknown() && !fvRogueExceptionMac.Mac.IsNull() { + childMap["attributes"]["mac"] = fvRogueExceptionMac.Mac.ValueString() + } + if !fvRogueExceptionMac.Name.IsUnknown() && !fvRogueExceptionMac.Name.IsNull() { + childMap["attributes"]["name"] = fvRogueExceptionMac.Name.ValueString() + } + if !fvRogueExceptionMac.NameAlias.IsUnknown() && !fvRogueExceptionMac.NameAlias.IsNull() { + childMap["attributes"]["nameAlias"] = fvRogueExceptionMac.NameAlias.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRogueExceptionMac": childMap}) + fvRogueExceptionMacIdentifier := FvRogueExceptionMacIdentifier{} + fvRogueExceptionMacIdentifier.Mac = fvRogueExceptionMac.Mac + fvRogueExceptionMacIdentifiers = append(fvRogueExceptionMacIdentifiers, fvRogueExceptionMacIdentifier) + } + for _, fvRogueExceptionMac := range fvRogueExceptionMacState { + delete := true + for _, fvRogueExceptionMacIdentifier := range fvRogueExceptionMacIdentifiers { + if fvRogueExceptionMacIdentifier.Mac == fvRogueExceptionMac.Mac { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["mac"] = fvRogueExceptionMac.Mac.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"fvRogueExceptionMac": childMap}) + } + } + } else { + data.FvRogueExceptionMac = types.SetNull(data.FvRogueExceptionMac.ElementType(ctx)) + } + + return childPayloads +} +func getFvBDFvRsABDPolMonPolChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, fvRsABDPolMonPolPlan, fvRsABDPolMonPolState FvRsABDPolMonPolFvBDResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsABDPolMonPol.IsUnknown() { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !IsEmptySingleNestedAttribute(data.FvRsABDPolMonPol.Attributes()) { + if !fvRsABDPolMonPolPlan.Annotation.IsUnknown() && !fvRsABDPolMonPolPlan.Annotation.IsNull() { + childMap["attributes"]["annotation"] = fvRsABDPolMonPolPlan.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsABDPolMonPolPlan.TnMonEPGPolName.IsUnknown() && !fvRsABDPolMonPolPlan.TnMonEPGPolName.IsNull() { + childMap["attributes"]["tnMonEPGPolName"] = fvRsABDPolMonPolPlan.TnMonEPGPolName.ValueString() + } + } else { + childMap["attributes"]["status"] = "deleted" + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsABDPolMonPol": childMap}) + } else { + FvRsABDPolMonPolObject, _ := types.ObjectValueFrom(ctx, FvRsABDPolMonPolFvBDType, getEmptyFvRsABDPolMonPolFvBDResourceModel()) + data.FvRsABDPolMonPol = FvRsABDPolMonPolObject + } + + return childPayloads +} +func getFvBDFvRsBDToFhsChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, fvRsBDToFhsPlan, fvRsBDToFhsState FvRsBDToFhsFvBDResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsBDToFhs.IsUnknown() { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !IsEmptySingleNestedAttribute(data.FvRsBDToFhs.Attributes()) { + if !fvRsBDToFhsPlan.Annotation.IsUnknown() && !fvRsBDToFhsPlan.Annotation.IsNull() { + childMap["attributes"]["annotation"] = fvRsBDToFhsPlan.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsBDToFhsPlan.TnFhsBDPolName.IsUnknown() && !fvRsBDToFhsPlan.TnFhsBDPolName.IsNull() { + childMap["attributes"]["tnFhsBDPolName"] = fvRsBDToFhsPlan.TnFhsBDPolName.ValueString() + } + } else { + childMap["attributes"]["status"] = "deleted" + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsBDToFhs": childMap}) + } else { + FvRsBDToFhsObject, _ := types.ObjectValueFrom(ctx, FvRsBDToFhsFvBDType, getEmptyFvRsBDToFhsFvBDResourceModel()) + data.FvRsBDToFhs = FvRsBDToFhsObject + } + + return childPayloads +} +func getFvBDFvRsBDToNdPChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, fvRsBDToNdPPlan, fvRsBDToNdPState FvRsBDToNdPFvBDResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsBDToNdP.IsUnknown() { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !IsEmptySingleNestedAttribute(data.FvRsBDToNdP.Attributes()) { + if !fvRsBDToNdPPlan.Annotation.IsUnknown() && !fvRsBDToNdPPlan.Annotation.IsNull() { + childMap["attributes"]["annotation"] = fvRsBDToNdPPlan.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsBDToNdPPlan.TnNdIfPolName.IsUnknown() && !fvRsBDToNdPPlan.TnNdIfPolName.IsNull() { + childMap["attributes"]["tnNdIfPolName"] = fvRsBDToNdPPlan.TnNdIfPolName.ValueString() + } + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsBDToNdP": childMap}) + } else { + FvRsBDToNdPObject, _ := types.ObjectValueFrom(ctx, FvRsBDToNdPFvBDType, getEmptyFvRsBDToNdPFvBDResourceModel()) + data.FvRsBDToNdP = FvRsBDToNdPObject + } + + return childPayloads +} +func getFvBDFvRsBDToNetflowMonitorPolChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, fvRsBDToNetflowMonitorPolPlan, fvRsBDToNetflowMonitorPolState []FvRsBDToNetflowMonitorPolFvBDResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsBDToNetflowMonitorPol.IsUnknown() { + fvRsBDToNetflowMonitorPolIdentifiers := []FvRsBDToNetflowMonitorPolIdentifier{} + for _, fvRsBDToNetflowMonitorPol := range fvRsBDToNetflowMonitorPolPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsBDToNetflowMonitorPol.Annotation.IsUnknown() && !fvRsBDToNetflowMonitorPol.Annotation.IsNull() { + childMap["attributes"]["annotation"] = fvRsBDToNetflowMonitorPol.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsBDToNetflowMonitorPol.FltType.IsUnknown() && !fvRsBDToNetflowMonitorPol.FltType.IsNull() { + childMap["attributes"]["fltType"] = fvRsBDToNetflowMonitorPol.FltType.ValueString() + } + if !fvRsBDToNetflowMonitorPol.TnNetflowMonitorPolName.IsUnknown() && !fvRsBDToNetflowMonitorPol.TnNetflowMonitorPolName.IsNull() { + childMap["attributes"]["tnNetflowMonitorPolName"] = fvRsBDToNetflowMonitorPol.TnNetflowMonitorPolName.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsBDToNetflowMonitorPol": childMap}) + fvRsBDToNetflowMonitorPolIdentifier := FvRsBDToNetflowMonitorPolIdentifier{} + fvRsBDToNetflowMonitorPolIdentifier.FltType = fvRsBDToNetflowMonitorPol.FltType + fvRsBDToNetflowMonitorPolIdentifier.TnNetflowMonitorPolName = fvRsBDToNetflowMonitorPol.TnNetflowMonitorPolName + fvRsBDToNetflowMonitorPolIdentifiers = append(fvRsBDToNetflowMonitorPolIdentifiers, fvRsBDToNetflowMonitorPolIdentifier) + } + for _, fvRsBDToNetflowMonitorPol := range fvRsBDToNetflowMonitorPolState { + delete := true + for _, fvRsBDToNetflowMonitorPolIdentifier := range fvRsBDToNetflowMonitorPolIdentifiers { + if fvRsBDToNetflowMonitorPolIdentifier.FltType == fvRsBDToNetflowMonitorPol.FltType && + fvRsBDToNetflowMonitorPolIdentifier.TnNetflowMonitorPolName == fvRsBDToNetflowMonitorPol.TnNetflowMonitorPolName { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["fltType"] = fvRsBDToNetflowMonitorPol.FltType.ValueString() + childMap["attributes"]["tnNetflowMonitorPolName"] = fvRsBDToNetflowMonitorPol.TnNetflowMonitorPolName.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"fvRsBDToNetflowMonitorPol": childMap}) + } + } + } else { + data.FvRsBDToNetflowMonitorPol = types.SetNull(data.FvRsBDToNetflowMonitorPol.ElementType(ctx)) + } + + return childPayloads +} +func getFvBDFvRsBDToOutChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, fvRsBDToOutPlan, fvRsBDToOutState []FvRsBDToOutFvBDResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsBDToOut.IsUnknown() { + fvRsBDToOutIdentifiers := []FvRsBDToOutIdentifier{} + for _, fvRsBDToOut := range fvRsBDToOutPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsBDToOut.Annotation.IsUnknown() && !fvRsBDToOut.Annotation.IsNull() { + childMap["attributes"]["annotation"] = fvRsBDToOut.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsBDToOut.TnL3extOutName.IsUnknown() && !fvRsBDToOut.TnL3extOutName.IsNull() { + childMap["attributes"]["tnL3extOutName"] = fvRsBDToOut.TnL3extOutName.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsBDToOut": childMap}) + fvRsBDToOutIdentifier := FvRsBDToOutIdentifier{} + fvRsBDToOutIdentifier.TnL3extOutName = fvRsBDToOut.TnL3extOutName + fvRsBDToOutIdentifiers = append(fvRsBDToOutIdentifiers, fvRsBDToOutIdentifier) + } + for _, fvRsBDToOut := range fvRsBDToOutState { + delete := true + for _, fvRsBDToOutIdentifier := range fvRsBDToOutIdentifiers { + if fvRsBDToOutIdentifier.TnL3extOutName == fvRsBDToOut.TnL3extOutName { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["tnL3extOutName"] = fvRsBDToOut.TnL3extOutName.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"fvRsBDToOut": childMap}) + } + } + } else { + data.FvRsBDToOut = types.SetNull(data.FvRsBDToOut.ElementType(ctx)) + } + + return childPayloads +} +func getFvBDFvRsBDToProfileChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, fvRsBDToProfilePlan, fvRsBDToProfileState FvRsBDToProfileFvBDResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsBDToProfile.IsUnknown() { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !IsEmptySingleNestedAttribute(data.FvRsBDToProfile.Attributes()) { + if !fvRsBDToProfilePlan.Annotation.IsUnknown() && !fvRsBDToProfilePlan.Annotation.IsNull() { + childMap["attributes"]["annotation"] = fvRsBDToProfilePlan.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsBDToProfilePlan.TnL3extOutName.IsUnknown() && !fvRsBDToProfilePlan.TnL3extOutName.IsNull() { + childMap["attributes"]["tnL3extOutName"] = fvRsBDToProfilePlan.TnL3extOutName.ValueString() + } + if !fvRsBDToProfilePlan.TnRtctrlProfileName.IsUnknown() && !fvRsBDToProfilePlan.TnRtctrlProfileName.IsNull() { + childMap["attributes"]["tnRtctrlProfileName"] = fvRsBDToProfilePlan.TnRtctrlProfileName.ValueString() + } + } else { + childMap["attributes"]["status"] = "deleted" + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsBDToProfile": childMap}) + } else { + FvRsBDToProfileObject, _ := types.ObjectValueFrom(ctx, FvRsBDToProfileFvBDType, getEmptyFvRsBDToProfileFvBDResourceModel()) + data.FvRsBDToProfile = FvRsBDToProfileObject + } + + return childPayloads +} +func getFvBDFvRsBDToRelayPChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, fvRsBDToRelayPPlan, fvRsBDToRelayPState FvRsBDToRelayPFvBDResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsBDToRelayP.IsUnknown() { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !IsEmptySingleNestedAttribute(data.FvRsBDToRelayP.Attributes()) { + if !fvRsBDToRelayPPlan.Annotation.IsUnknown() && !fvRsBDToRelayPPlan.Annotation.IsNull() { + childMap["attributes"]["annotation"] = fvRsBDToRelayPPlan.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsBDToRelayPPlan.TnDhcpRelayPName.IsUnknown() && !fvRsBDToRelayPPlan.TnDhcpRelayPName.IsNull() { + childMap["attributes"]["tnDhcpRelayPName"] = fvRsBDToRelayPPlan.TnDhcpRelayPName.ValueString() + } + } else { + childMap["attributes"]["status"] = "deleted" + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsBDToRelayP": childMap}) + } else { + FvRsBDToRelayPObject, _ := types.ObjectValueFrom(ctx, FvRsBDToRelayPFvBDType, getEmptyFvRsBDToRelayPFvBDResourceModel()) + data.FvRsBDToRelayP = FvRsBDToRelayPObject + } + + return childPayloads +} +func getFvBDFvRsBdToEpRetChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, fvRsBdToEpRetPlan, fvRsBdToEpRetState FvRsBdToEpRetFvBDResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsBdToEpRet.IsUnknown() { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !IsEmptySingleNestedAttribute(data.FvRsBdToEpRet.Attributes()) { + if !fvRsBdToEpRetPlan.Annotation.IsUnknown() && !fvRsBdToEpRetPlan.Annotation.IsNull() { + childMap["attributes"]["annotation"] = fvRsBdToEpRetPlan.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsBdToEpRetPlan.ResolveAct.IsUnknown() && !fvRsBdToEpRetPlan.ResolveAct.IsNull() { + childMap["attributes"]["resolveAct"] = fvRsBdToEpRetPlan.ResolveAct.ValueString() + } + if !fvRsBdToEpRetPlan.TnFvEpRetPolName.IsUnknown() && !fvRsBdToEpRetPlan.TnFvEpRetPolName.IsNull() { + childMap["attributes"]["tnFvEpRetPolName"] = fvRsBdToEpRetPlan.TnFvEpRetPolName.ValueString() + } + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsBdToEpRet": childMap}) + } else { + FvRsBdToEpRetObject, _ := types.ObjectValueFrom(ctx, FvRsBdToEpRetFvBDType, getEmptyFvRsBdToEpRetFvBDResourceModel()) + data.FvRsBdToEpRet = FvRsBdToEpRetObject + } + + return childPayloads +} +func getFvBDFvRsCtxChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, fvRsCtxPlan, fvRsCtxState FvRsCtxFvBDResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsCtx.IsUnknown() { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !IsEmptySingleNestedAttribute(data.FvRsCtx.Attributes()) { + if !fvRsCtxPlan.Annotation.IsUnknown() && !fvRsCtxPlan.Annotation.IsNull() { + childMap["attributes"]["annotation"] = fvRsCtxPlan.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsCtxPlan.TnFvCtxName.IsUnknown() && !fvRsCtxPlan.TnFvCtxName.IsNull() { + childMap["attributes"]["tnFvCtxName"] = fvRsCtxPlan.TnFvCtxName.ValueString() + } + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsCtx": childMap}) + } else { + FvRsCtxObject, _ := types.ObjectValueFrom(ctx, FvRsCtxFvBDType, getEmptyFvRsCtxFvBDResourceModel()) + data.FvRsCtx = FvRsCtxObject + } + + return childPayloads +} +func getFvBDFvRsIgmpsnChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, fvRsIgmpsnPlan, fvRsIgmpsnState FvRsIgmpsnFvBDResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsIgmpsn.IsUnknown() { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !IsEmptySingleNestedAttribute(data.FvRsIgmpsn.Attributes()) { + if !fvRsIgmpsnPlan.Annotation.IsUnknown() && !fvRsIgmpsnPlan.Annotation.IsNull() { + childMap["attributes"]["annotation"] = fvRsIgmpsnPlan.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsIgmpsnPlan.TnIgmpSnoopPolName.IsUnknown() && !fvRsIgmpsnPlan.TnIgmpSnoopPolName.IsNull() { + childMap["attributes"]["tnIgmpSnoopPolName"] = fvRsIgmpsnPlan.TnIgmpSnoopPolName.ValueString() + } + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsIgmpsn": childMap}) + } else { + FvRsIgmpsnObject, _ := types.ObjectValueFrom(ctx, FvRsIgmpsnFvBDType, getEmptyFvRsIgmpsnFvBDResourceModel()) + data.FvRsIgmpsn = FvRsIgmpsnObject + } + + return childPayloads +} +func getFvBDFvRsMldsnChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, fvRsMldsnPlan, fvRsMldsnState FvRsMldsnFvBDResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsMldsn.IsUnknown() { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !IsEmptySingleNestedAttribute(data.FvRsMldsn.Attributes()) { + if !fvRsMldsnPlan.Annotation.IsUnknown() && !fvRsMldsnPlan.Annotation.IsNull() { + childMap["attributes"]["annotation"] = fvRsMldsnPlan.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsMldsnPlan.TnMldSnoopPolName.IsUnknown() && !fvRsMldsnPlan.TnMldSnoopPolName.IsNull() { + childMap["attributes"]["tnMldSnoopPolName"] = fvRsMldsnPlan.TnMldSnoopPolName.ValueString() + } + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsMldsn": childMap}) + } else { + FvRsMldsnObject, _ := types.ObjectValueFrom(ctx, FvRsMldsnFvBDType, getEmptyFvRsMldsnFvBDResourceModel()) + data.FvRsMldsn = FvRsMldsnObject + } + + return childPayloads +} +func getFvBDTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvBDResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() && !tagAnnotation.Key.IsNull() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() && !tagAnnotation.Value.IsNull() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvBDTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvBDResourceModel, tagTagPlan, tagTagState []TagTagFvBDResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() && !tagTag.Key.IsNull() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() && !tagTag.Value.IsNull() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvBDCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, createType bool, data *FvBDResourceModel, fvAccPPlan, fvAccPState FvAccPFvBDResourceModel, fvRogueExceptionMacPlan, fvRogueExceptionMacState []FvRogueExceptionMacFvBDResourceModel, fvRsABDPolMonPolPlan, fvRsABDPolMonPolState FvRsABDPolMonPolFvBDResourceModel, fvRsBDToFhsPlan, fvRsBDToFhsState FvRsBDToFhsFvBDResourceModel, fvRsBDToNdPPlan, fvRsBDToNdPState FvRsBDToNdPFvBDResourceModel, fvRsBDToNetflowMonitorPolPlan, fvRsBDToNetflowMonitorPolState []FvRsBDToNetflowMonitorPolFvBDResourceModel, fvRsBDToOutPlan, fvRsBDToOutState []FvRsBDToOutFvBDResourceModel, fvRsBDToProfilePlan, fvRsBDToProfileState FvRsBDToProfileFvBDResourceModel, fvRsBDToRelayPPlan, fvRsBDToRelayPState FvRsBDToRelayPFvBDResourceModel, fvRsBdToEpRetPlan, fvRsBdToEpRetState FvRsBdToEpRetFvBDResourceModel, fvRsCtxPlan, fvRsCtxState FvRsCtxFvBDResourceModel, fvRsIgmpsnPlan, fvRsIgmpsnState FvRsIgmpsnFvBDResourceModel, fvRsMldsnPlan, fvRsMldsnState FvRsMldsnFvBDResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvBDResourceModel, tagTagPlan, tagTagState []TagTagFvBDResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + + if createType && !globalAllowExistingOnCreate { + payloadMap["attributes"].(map[string]string)["status"] = "created" + } + childPayloads := []map[string]interface{}{} + + FvAccPchildPayloads := getFvBDFvAccPChildPayloads(ctx, diags, data, fvAccPPlan, fvAccPState) + if FvAccPchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvAccPchildPayloads...) + + FvRogueExceptionMacchildPayloads := getFvBDFvRogueExceptionMacChildPayloads(ctx, diags, data, fvRogueExceptionMacPlan, fvRogueExceptionMacState) + if FvRogueExceptionMacchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRogueExceptionMacchildPayloads...) + + FvRsABDPolMonPolchildPayloads := getFvBDFvRsABDPolMonPolChildPayloads(ctx, diags, data, fvRsABDPolMonPolPlan, fvRsABDPolMonPolState) + if FvRsABDPolMonPolchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsABDPolMonPolchildPayloads...) + + FvRsBDToFhschildPayloads := getFvBDFvRsBDToFhsChildPayloads(ctx, diags, data, fvRsBDToFhsPlan, fvRsBDToFhsState) + if FvRsBDToFhschildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsBDToFhschildPayloads...) + + FvRsBDToNdPchildPayloads := getFvBDFvRsBDToNdPChildPayloads(ctx, diags, data, fvRsBDToNdPPlan, fvRsBDToNdPState) + if FvRsBDToNdPchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsBDToNdPchildPayloads...) + + FvRsBDToNetflowMonitorPolchildPayloads := getFvBDFvRsBDToNetflowMonitorPolChildPayloads(ctx, diags, data, fvRsBDToNetflowMonitorPolPlan, fvRsBDToNetflowMonitorPolState) + if FvRsBDToNetflowMonitorPolchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsBDToNetflowMonitorPolchildPayloads...) + + FvRsBDToOutchildPayloads := getFvBDFvRsBDToOutChildPayloads(ctx, diags, data, fvRsBDToOutPlan, fvRsBDToOutState) + if FvRsBDToOutchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsBDToOutchildPayloads...) + + FvRsBDToProfilechildPayloads := getFvBDFvRsBDToProfileChildPayloads(ctx, diags, data, fvRsBDToProfilePlan, fvRsBDToProfileState) + if FvRsBDToProfilechildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsBDToProfilechildPayloads...) + + FvRsBDToRelayPchildPayloads := getFvBDFvRsBDToRelayPChildPayloads(ctx, diags, data, fvRsBDToRelayPPlan, fvRsBDToRelayPState) + if FvRsBDToRelayPchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsBDToRelayPchildPayloads...) + + FvRsBdToEpRetchildPayloads := getFvBDFvRsBdToEpRetChildPayloads(ctx, diags, data, fvRsBdToEpRetPlan, fvRsBdToEpRetState) + if FvRsBdToEpRetchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsBdToEpRetchildPayloads...) + + FvRsCtxchildPayloads := getFvBDFvRsCtxChildPayloads(ctx, diags, data, fvRsCtxPlan, fvRsCtxState) + if FvRsCtxchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsCtxchildPayloads...) + + FvRsIgmpsnchildPayloads := getFvBDFvRsIgmpsnChildPayloads(ctx, diags, data, fvRsIgmpsnPlan, fvRsIgmpsnState) + if FvRsIgmpsnchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsIgmpsnchildPayloads...) + + FvRsMldsnchildPayloads := getFvBDFvRsMldsnChildPayloads(ctx, diags, data, fvRsMldsnPlan, fvRsMldsnState) + if FvRsMldsnchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsMldsnchildPayloads...) + + TagAnnotationchildPayloads := getFvBDTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvBDTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.OptimizeWanBandwidth.IsNull() && !data.OptimizeWanBandwidth.IsUnknown() { + payloadMap["attributes"].(map[string]string)["OptimizeWanBandwidth"] = data.OptimizeWanBandwidth.ValueString() + } + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.ArpFlood.IsNull() && !data.ArpFlood.IsUnknown() { + payloadMap["attributes"].(map[string]string)["arpFlood"] = data.ArpFlood.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.EnableRogueExceptMac.IsNull() && !data.EnableRogueExceptMac.IsUnknown() { + payloadMap["attributes"].(map[string]string)["enableRogueExceptMac"] = data.EnableRogueExceptMac.ValueString() + } + if !data.EpClear.IsNull() && !data.EpClear.IsUnknown() { + payloadMap["attributes"].(map[string]string)["epClear"] = data.EpClear.ValueString() + } + if !data.EpMoveDetectMode.IsNull() && !data.EpMoveDetectMode.IsUnknown() { + payloadMap["attributes"].(map[string]string)["epMoveDetectMode"] = data.EpMoveDetectMode.ValueString() + } + if !data.HostBasedRouting.IsNull() && !data.HostBasedRouting.IsUnknown() { + payloadMap["attributes"].(map[string]string)["hostBasedRouting"] = data.HostBasedRouting.ValueString() + } + if !data.IntersiteBumTrafficAllow.IsNull() && !data.IntersiteBumTrafficAllow.IsUnknown() { + payloadMap["attributes"].(map[string]string)["intersiteBumTrafficAllow"] = data.IntersiteBumTrafficAllow.ValueString() + } + if !data.IntersiteL2Stretch.IsNull() && !data.IntersiteL2Stretch.IsUnknown() { + payloadMap["attributes"].(map[string]string)["intersiteL2Stretch"] = data.IntersiteL2Stretch.ValueString() + } + if !data.IpLearning.IsNull() && !data.IpLearning.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ipLearning"] = data.IpLearning.ValueString() + } + if !data.Ipv6McastAllow.IsNull() && !data.Ipv6McastAllow.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ipv6McastAllow"] = data.Ipv6McastAllow.ValueString() + } + if !data.LimitIpLearnToSubnets.IsNull() && !data.LimitIpLearnToSubnets.IsUnknown() { + payloadMap["attributes"].(map[string]string)["limitIpLearnToSubnets"] = data.LimitIpLearnToSubnets.ValueString() + } + if !data.LlAddr.IsNull() && !data.LlAddr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["llAddr"] = data.LlAddr.ValueString() + } + if !data.Mac.IsNull() && !data.Mac.IsUnknown() { + payloadMap["attributes"].(map[string]string)["mac"] = data.Mac.ValueString() + } + if !data.McastARPDrop.IsNull() && !data.McastARPDrop.IsUnknown() { + payloadMap["attributes"].(map[string]string)["mcastARPDrop"] = data.McastARPDrop.ValueString() + } + if !data.McastAllow.IsNull() && !data.McastAllow.IsUnknown() { + payloadMap["attributes"].(map[string]string)["mcastAllow"] = data.McastAllow.ValueString() + } + if !data.MultiDstPktAct.IsNull() && !data.MultiDstPktAct.IsUnknown() { + payloadMap["attributes"].(map[string]string)["multiDstPktAct"] = data.MultiDstPktAct.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.OwnerKey.IsNull() && !data.OwnerKey.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerKey"] = data.OwnerKey.ValueString() + } + if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() + } + if !data.Type.IsNull() && !data.Type.IsUnknown() { + payloadMap["attributes"].(map[string]string)["type"] = data.Type.ValueString() + } + if !data.UnicastRoute.IsNull() && !data.UnicastRoute.IsUnknown() { + payloadMap["attributes"].(map[string]string)["unicastRoute"] = data.UnicastRoute.ValueString() + } + if !data.UnkMacUcastAct.IsNull() && !data.UnkMacUcastAct.IsUnknown() { + payloadMap["attributes"].(map[string]string)["unkMacUcastAct"] = data.UnkMacUcastAct.ValueString() + } + if !data.UnkMcastAct.IsNull() && !data.UnkMcastAct.IsUnknown() { + payloadMap["attributes"].(map[string]string)["unkMcastAct"] = data.UnkMcastAct.ValueString() + } + if !data.V6unkMcastAct.IsNull() && !data.V6unkMcastAct.IsUnknown() { + payloadMap["attributes"].(map[string]string)["v6unkMcastAct"] = data.V6unkMcastAct.ValueString() + } + if !data.Vmac.IsNull() && !data.Vmac.IsUnknown() { + payloadMap["attributes"].(map[string]string)["vmac"] = data.Vmac.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvBD": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_bridge_domain_test.go b/internal/provider/resource_aci_bridge_domain_test.go new file mode 100644 index 000000000..b423127f2 --- /dev/null +++ b/internal/provider/resource_aci_bridge_domain_test.go @@ -0,0 +1,900 @@ +// 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" + "github.com/hashicorp/terraform-plugin-testing/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/statecheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" +) + +func TestAccResourceFvBDWithFvTenant(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvBDMinDependencyWithFvTenantAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "name", "test_name"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "advertise_host_routes", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "advertise_host_routes", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "arp_flooding", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "arp_flooding", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "bridge_domain_type", "regular"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "bridge_domain_type", "regular"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "clear_remote_mac_entries", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "clear_remote_mac_entries", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "custom_mac_address", "00:22:BD:F8:19:FF"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "custom_mac_address", "00:22:BD:F8:19:FF"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "drop_arp_with_multicast_smac", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "drop_arp_with_multicast_smac", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "enable_rogue_exception_mac", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "enable_rogue_exception_mac", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "endpoint_move_detection_mode", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "endpoint_move_detection_mode", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "intersite_bum_traffic_allow", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "intersite_bum_traffic_allow", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "intersite_l2_stretch", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "intersite_l2_stretch", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "ip_learning", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "ip_learning", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "ipv6_l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "ipv6_l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "l2_unknown_unicast_flooding", "proxy"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "l2_unknown_unicast_flooding", "proxy"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "limit_ip_learn_to_subnets", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "limit_ip_learn_to_subnets", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "link_local_ipv6_address", "::"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "link_local_ipv6_address", "::"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "multi_destination_flooding", "bd-flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "multi_destination_flooding", "bd-flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "optimize_wan_bandwidth", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "optimize_wan_bandwidth", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "pim", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "pim", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "pim_ipv6", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "pim_ipv6", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "unicast_routing", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "unicast_routing", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "virtual_mac_address", "not-applicable"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "virtual_mac_address", "not-applicable"), + ), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "false") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvBDMinDependencyWithFvTenantAllowExisting, + ExpectError: regexp.MustCompile("Object Already Exists"), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "true") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvBDMinDependencyWithFvTenantAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "name", "test_name"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "advertise_host_routes", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "advertise_host_routes", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "arp_flooding", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "arp_flooding", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "bridge_domain_type", "regular"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "bridge_domain_type", "regular"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "clear_remote_mac_entries", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "clear_remote_mac_entries", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "custom_mac_address", "00:22:BD:F8:19:FF"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "custom_mac_address", "00:22:BD:F8:19:FF"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "drop_arp_with_multicast_smac", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "drop_arp_with_multicast_smac", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "enable_rogue_exception_mac", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "enable_rogue_exception_mac", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "endpoint_move_detection_mode", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "endpoint_move_detection_mode", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "intersite_bum_traffic_allow", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "intersite_bum_traffic_allow", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "intersite_l2_stretch", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "intersite_l2_stretch", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "ip_learning", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "ip_learning", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "ipv6_l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "ipv6_l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "l2_unknown_unicast_flooding", "proxy"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "l2_unknown_unicast_flooding", "proxy"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "limit_ip_learn_to_subnets", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "limit_ip_learn_to_subnets", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "link_local_ipv6_address", "::"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "link_local_ipv6_address", "::"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "multi_destination_flooding", "bd-flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "multi_destination_flooding", "bd-flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "optimize_wan_bandwidth", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "optimize_wan_bandwidth", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "pim", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "pim", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "pim_ipv6", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "pim_ipv6", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "unicast_routing", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "unicast_routing", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test", "virtual_mac_address", "not-applicable"), + resource.TestCheckResourceAttr("aci_bridge_domain.allow_test_2", "virtual_mac_address", "not-applicable"), + ), + }, + }, + }) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvBDMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_bridge_domain.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "advertise_host_routes", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "arp_flooding", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "bridge_domain_type", "regular"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "clear_remote_mac_entries", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "custom_mac_address", "00:22:BD:F8:19:FF"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "description", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "drop_arp_with_multicast_smac", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "enable_rogue_exception_mac", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "endpoint_move_detection_mode", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "intersite_bum_traffic_allow", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "intersite_l2_stretch", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "ip_learning", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "ipv6_l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "l2_unknown_unicast_flooding", "proxy"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "limit_ip_learn_to_subnets", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "link_local_ipv6_address", "::"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "multi_destination_flooding", "bd-flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "optimize_wan_bandwidth", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "pim", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "pim_ipv6", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "unicast_routing", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "virtual_mac_address", "not-applicable"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvBDAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_bridge_domain.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "advertise_host_routes", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "arp_flooding", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "bridge_domain_type", "fc"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "clear_remote_mac_entries", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "custom_mac_address", "00:22:BD:F8:19:FE"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "description", "description_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "drop_arp_with_multicast_smac", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "enable_rogue_exception_mac", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "endpoint_move_detection_mode", "garp"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "intersite_bum_traffic_allow", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "intersite_l2_stretch", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "ip_learning", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "ipv6_l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "l2_unknown_unicast_flooding", "proxy"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "limit_ip_learn_to_subnets", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "link_local_ipv6_address", "fe80::1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "multi_destination_flooding", "bd-flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "optimize_wan_bandwidth", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "owner_tag", "owner_tag_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "pim", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "pim_ipv6", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "unicast_routing", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "virtual_mac_address", "00:22:BD:F8:19:FB"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvBDMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_bridge_domain.test", "name", "test_name"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvBDResetDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_bridge_domain.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "advertise_host_routes", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "arp_flooding", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "bridge_domain_type", "regular"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "clear_remote_mac_entries", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "custom_mac_address", "00:22:BD:F8:19:FF"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "description", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "drop_arp_with_multicast_smac", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "enable_rogue_exception_mac", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "endpoint_move_detection_mode", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "intersite_bum_traffic_allow", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "intersite_l2_stretch", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "ip_learning", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "ipv6_l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "l2_unknown_unicast_flooding", "proxy"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "limit_ip_learn_to_subnets", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "link_local_ipv6_address", "::"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "multi_destination_flooding", "bd-flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "optimize_wan_bandwidth", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "pim", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "pim_ipv6", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "unicast_routing", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "virtual_mac_address", "not-applicable"), + ), + }, + // Import testing + { + ResourceName: "aci_bridge_domain.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children + { + Config: testConfigFvBDChildrenDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_bridge_domain.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "advertise_host_routes", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "arp_flooding", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "bridge_domain_type", "regular"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "clear_remote_mac_entries", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "custom_mac_address", "00:22:BD:F8:19:FF"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "description", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "drop_arp_with_multicast_smac", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "enable_rogue_exception_mac", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "endpoint_move_detection_mode", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "intersite_bum_traffic_allow", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "intersite_l2_stretch", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "ip_learning", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "ipv6_l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "l2_unknown_unicast_flooding", "proxy"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "l3_unknown_multicast_flooding", "flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "limit_ip_learn_to_subnets", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "link_local_ipv6_address", "::"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "multi_destination_flooding", "bd-flood"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "optimize_wan_bandwidth", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "pim", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "pim_ipv6", "no"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "unicast_routing", "yes"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "virtual_mac_address", "not-applicable"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "legacy_mode.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "legacy_mode.description", "description_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "legacy_mode.encapsulation", "vlan-100"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "legacy_mode.name", "name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "legacy_mode.name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "legacy_mode.owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "legacy_mode.owner_tag", "owner_tag_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_dhcp_relay_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_dhcp_relay_policy.dhcp_relay_policy_name", "dhcp_relay_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "end_point_retention_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.resolve_act", "inherit"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_first_hop_security_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_first_hop_security_policy.first_hop_security_policy_name", "first_hop_security_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.igmp_snooping_policy_name", "igmp_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.0.l3_outside_name", "l3_outside_name_0"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.1.l3_outside_name", "l3_outside_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.mld_snooping_policy_name", "mld_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_monitor_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_monitor_policy.monitoring_policy_name", "monitoring_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.neighbor_discovery_interface_policy_name", "neighbor_discovery_interface_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.0.filter_type", "ce"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.0.netflow_monitor_policy_name", "netflow_monitor_policy_name_0"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.1.filter_type", "ipv4"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.1.netflow_monitor_policy_name", "netflow_monitor_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_route_control_profile.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_route_control_profile.l3_outside_name", "l3_outside_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_route_control_profile.route_control_profile_name", "route_control_profile_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_vrf.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_vrf.vrf_name", "vrf_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.0.description", "description_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.0.mac", "00:00:00:00:00:00"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.0.name", "name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.0.name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.1.description", "description_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.1.mac", "00:00:00:00:00:01"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.1.name", "name_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.1.name_alias", "name_alias_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.1.value", "test_value"), + ), + }, + // Refresh State before import testing to ensure that the state is up to date + { + RefreshState: true, + ExpectNonEmptyPlan: false, + }, + // Import testing with children + { + ResourceName: "aci_bridge_domain.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children removed from config + { + Config: testConfigFvBDChildrenRemoveFromConfigDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "legacy_mode.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "legacy_mode.description", "description_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "legacy_mode.encapsulation", "vlan-100"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "legacy_mode.name", "name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "legacy_mode.name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "legacy_mode.owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "legacy_mode.owner_tag", "owner_tag_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_dhcp_relay_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_dhcp_relay_policy.dhcp_relay_policy_name", "dhcp_relay_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "end_point_retention_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.resolve_act", "inherit"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_first_hop_security_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_first_hop_security_policy.first_hop_security_policy_name", "first_hop_security_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.igmp_snooping_policy_name", "igmp_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.0.l3_outside_name", "l3_outside_name_0"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.1.l3_outside_name", "l3_outside_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.#", "2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.mld_snooping_policy_name", "mld_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_monitor_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_monitor_policy.monitoring_policy_name", "monitoring_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.neighbor_discovery_interface_policy_name", "neighbor_discovery_interface_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.0.filter_type", "ce"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.0.netflow_monitor_policy_name", "netflow_monitor_policy_name_0"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.1.filter_type", "ipv4"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.1.netflow_monitor_policy_name", "netflow_monitor_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.#", "2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_route_control_profile.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_route_control_profile.l3_outside_name", "l3_outside_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_route_control_profile.route_control_profile_name", "route_control_profile_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_vrf.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_vrf.vrf_name", "vrf_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.0.description", "description_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.0.mac", "00:00:00:00:00:00"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.0.name", "name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.0.name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.1.description", "description_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.1.mac", "00:00:00:00:00:01"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.1.name", "name_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.1.name_alias", "name_alias_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.#", "2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvBDChildrenRemoveOneDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotations.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "end_point_retention_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.resolve_act", "inherit"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.igmp_snooping_policy_name", "igmp_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.0.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.0.l3_outside_name", "l3_outside_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.#", "1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.mld_snooping_policy_name", "mld_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.neighbor_discovery_interface_policy_name", "neighbor_discovery_interface_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.0.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.0.filter_type", "ipv4"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.0.netflow_monitor_policy_name", "netflow_monitor_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.#", "1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_vrf.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_vrf.vrf_name", "vrf_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.0.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.0.description", "description_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.0.mac", "00:00:00:00:00:01"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.0.name", "name_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.0.name_alias", "name_alias_2"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.#", "1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.#", "1"), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue("aci_bridge_domain.test", + tfjsonpath.New("legacy_mode"), + knownvalue.MapExact( + map[string]knownvalue.Check{ + "annotation": knownvalue.Null(), + "description": knownvalue.Null(), + "encapsulation": knownvalue.Null(), + "name": knownvalue.Null(), + "name_alias": knownvalue.Null(), + "owner_key": knownvalue.Null(), + "owner_tag": knownvalue.Null(), + }, + ), + ), + statecheck.ExpectKnownValue("aci_bridge_domain.test", + tfjsonpath.New("relation_to_dhcp_relay_policy"), + knownvalue.MapExact( + map[string]knownvalue.Check{ + "annotation": knownvalue.Null(), + "dhcp_relay_policy_name": knownvalue.Null(), + }, + ), + ), + statecheck.ExpectKnownValue("aci_bridge_domain.test", + tfjsonpath.New("relation_to_first_hop_security_policy"), + knownvalue.MapExact( + map[string]knownvalue.Check{ + "annotation": knownvalue.Null(), + "first_hop_security_policy_name": knownvalue.Null(), + }, + ), + ), + statecheck.ExpectKnownValue("aci_bridge_domain.test", + tfjsonpath.New("relation_to_monitor_policy"), + knownvalue.MapExact( + map[string]knownvalue.Check{ + "annotation": knownvalue.Null(), + "monitoring_policy_name": knownvalue.Null(), + }, + ), + ), + statecheck.ExpectKnownValue("aci_bridge_domain.test", + tfjsonpath.New("relation_to_route_control_profile"), + knownvalue.MapExact( + map[string]knownvalue.Check{ + "annotation": knownvalue.Null(), + "l3_outside_name": knownvalue.Null(), + "route_control_profile_name": knownvalue.Null(), + }, + ), + ), + }, + }, + // Update with all children removed + { + Config: testConfigFvBDChildrenRemoveAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_bridge_domain.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "end_point_retention_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.resolve_act", "inherit"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.igmp_snooping_policy_name", "igmp_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.#", "0"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.mld_snooping_policy_name", "mld_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.neighbor_discovery_interface_policy_name", "neighbor_discovery_interface_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policy.#", "0"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_vrf.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_vrf.vrf_name", "vrf_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "rogue_coop_exceptions.#", "0"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.#", "0"), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue("aci_bridge_domain.test", + tfjsonpath.New("legacy_mode"), + knownvalue.MapExact( + map[string]knownvalue.Check{ + "annotation": knownvalue.Null(), + "description": knownvalue.Null(), + "encapsulation": knownvalue.Null(), + "name": knownvalue.Null(), + "name_alias": knownvalue.Null(), + "owner_key": knownvalue.Null(), + "owner_tag": knownvalue.Null(), + }, + ), + ), + statecheck.ExpectKnownValue("aci_bridge_domain.test", + tfjsonpath.New("relation_to_dhcp_relay_policy"), + knownvalue.MapExact( + map[string]knownvalue.Check{ + "annotation": knownvalue.Null(), + "dhcp_relay_policy_name": knownvalue.Null(), + }, + ), + ), + statecheck.ExpectKnownValue("aci_bridge_domain.test", + tfjsonpath.New("relation_to_first_hop_security_policy"), + knownvalue.MapExact( + map[string]knownvalue.Check{ + "annotation": knownvalue.Null(), + "first_hop_security_policy_name": knownvalue.Null(), + }, + ), + ), + statecheck.ExpectKnownValue("aci_bridge_domain.test", + tfjsonpath.New("relation_to_monitor_policy"), + knownvalue.MapExact( + map[string]knownvalue.Check{ + "annotation": knownvalue.Null(), + "monitoring_policy_name": knownvalue.Null(), + }, + ), + ), + statecheck.ExpectKnownValue("aci_bridge_domain.test", + tfjsonpath.New("relation_to_route_control_profile"), + knownvalue.MapExact( + map[string]knownvalue.Check{ + "annotation": knownvalue.Null(), + "l3_outside_name": knownvalue.Null(), + "route_control_profile_name": knownvalue.Null(), + }, + ), + ), + }, + }, + }, + }) +} + +const testConfigFvBDMinDependencyWithFvTenantAllowExisting = testConfigFvTenantMin + ` +resource "aci_bridge_domain" "allow_test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +resource "aci_bridge_domain" "allow_test_2" { + parent_dn = aci_tenant.test.id + name = "test_name" + depends_on = [aci_bridge_domain.allow_test] +} +` + +const testConfigFvBDMinDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_bridge_domain" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigFvBDAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_bridge_domain" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + advertise_host_routes = "no" + annotation = "annotation" + arp_flooding = "no" + bridge_domain_type = "fc" + clear_remote_mac_entries = "no" + custom_mac_address = "00:22:BD:F8:19:FE" + description = "description_1" + drop_arp_with_multicast_smac = "no" + enable_rogue_exception_mac = "no" + endpoint_move_detection_mode = "garp" + intersite_bum_traffic_allow = "no" + intersite_l2_stretch = "no" + ip_learning = "no" + ipv6_l3_unknown_multicast_flooding = "flood" + l2_unknown_unicast_flooding = "proxy" + l3_unknown_multicast_flooding = "flood" + limit_ip_learn_to_subnets = "no" + link_local_ipv6_address = "fe80::1" + multi_destination_flooding = "bd-flood" + name_alias = "name_alias_1" + optimize_wan_bandwidth = "no" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + pim = "no" + pim_ipv6 = "no" + unicast_routing = "no" + virtual_mac_address = "00:22:BD:F8:19:FB" +} +` + +const testConfigFvBDResetDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_bridge_domain" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + advertise_host_routes = "no" + annotation = "orchestrator:terraform" + arp_flooding = "no" + bridge_domain_type = "regular" + clear_remote_mac_entries = "no" + custom_mac_address = "00:22:BD:F8:19:FF" + description = "" + drop_arp_with_multicast_smac = "yes" + enable_rogue_exception_mac = "no" + endpoint_move_detection_mode = "" + intersite_bum_traffic_allow = "no" + intersite_l2_stretch = "no" + ip_learning = "yes" + ipv6_l3_unknown_multicast_flooding = "flood" + l2_unknown_unicast_flooding = "proxy" + l3_unknown_multicast_flooding = "flood" + limit_ip_learn_to_subnets = "yes" + link_local_ipv6_address = "::" + multi_destination_flooding = "bd-flood" + name_alias = "" + optimize_wan_bandwidth = "no" + owner_key = "" + owner_tag = "" + pim = "no" + pim_ipv6 = "no" + unicast_routing = "yes" + virtual_mac_address = "not-applicable" +} +` +const testConfigFvBDChildrenDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_bridge_domain" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] + legacy_mode = { + annotation = "annotation_1" + description = "description_1" + encapsulation = "vlan-100" + name = "name_1" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + } + relation_to_dhcp_relay_policy = { + annotation = "annotation_1" + dhcp_relay_policy_name = "dhcp_relay_policy_name_1" + } + relation_to_end_point_retention_policy = { + annotation = "annotation_1" + end_point_retention_policy_name = "end_point_retention_policy_name_1" + resolve_act = "inherit" + } + relation_to_first_hop_security_policy = { + annotation = "annotation_1" + first_hop_security_policy_name = "first_hop_security_policy_name_1" + } + relation_to_igmp_snooping_policy = { + annotation = "annotation_1" + igmp_snooping_policy_name = "igmp_snooping_policy_name_1" + } + relation_to_l3_outsides = [ + { + annotation = "annotation_1" + l3_outside_name = "l3_outside_name_0" + }, + { + annotation = "annotation_2" + l3_outside_name = "l3_outside_name_1" + }, + ] + relation_to_mld_snooping_policy = { + annotation = "annotation_1" + mld_snooping_policy_name = "mld_snooping_policy_name_1" + } + relation_to_monitor_policy = { + annotation = "annotation_1" + monitoring_policy_name = "monitoring_policy_name_1" + } + relation_to_neighbor_discovery_interface_policy = { + annotation = "annotation_1" + neighbor_discovery_interface_policy_name = "neighbor_discovery_interface_policy_name_1" + } + relation_to_netflow_monitor_policy = [ + { + annotation = "annotation_1" + filter_type = "ce" + netflow_monitor_policy_name = "netflow_monitor_policy_name_0" + }, + { + annotation = "annotation_2" + filter_type = "ipv4" + netflow_monitor_policy_name = "netflow_monitor_policy_name_1" + }, + ] + relation_to_route_control_profile = { + annotation = "annotation_1" + l3_outside_name = "l3_outside_name_1" + route_control_profile_name = "route_control_profile_name_1" + } + relation_to_vrf = { + annotation = "annotation_1" + vrf_name = "vrf_name_1" + } + rogue_coop_exceptions = [ + { + annotation = "annotation_1" + description = "description_1" + mac = "00:00:00:00:00:00" + name = "name_1" + name_alias = "name_alias_1" + }, + { + annotation = "annotation_2" + description = "description_2" + mac = "00:00:00:00:00:01" + name = "name_2" + name_alias = "name_alias_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigFvBDChildrenRemoveFromConfigDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_bridge_domain" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigFvBDChildrenRemoveOneDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_bridge_domain" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [ + { + key = "key_1" + value = "test_value" + }, + ] + legacy_mode = {} + relation_to_dhcp_relay_policy = {} + relation_to_first_hop_security_policy = {} + relation_to_l3_outsides = [ + { + annotation = "annotation_2" + l3_outside_name = "l3_outside_name_1" + }, + ] + relation_to_monitor_policy = {} + relation_to_netflow_monitor_policy = [ + { + annotation = "annotation_2" + filter_type = "ipv4" + netflow_monitor_policy_name = "netflow_monitor_policy_name_1" + }, + ] + relation_to_route_control_profile = {} + rogue_coop_exceptions = [ + { + annotation = "annotation_2" + description = "description_2" + mac = "00:00:00:00:00:01" + name = "name_2" + name_alias = "name_alias_2" + }, + ] + tags = [ + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigFvBDChildrenRemoveAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_bridge_domain" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [] + legacy_mode = {} + relation_to_dhcp_relay_policy = {} + relation_to_first_hop_security_policy = {} + relation_to_l3_outsides = [] + relation_to_monitor_policy = {} + relation_to_netflow_monitor_policy = [] + relation_to_route_control_profile = {} + rogue_coop_exceptions = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_endpoint_security_group.go b/internal/provider/resource_aci_endpoint_security_group.go index 42e94397c..547cfc930 100644 --- a/internal/provider/resource_aci_endpoint_security_group.go +++ b/internal/provider/resource_aci_endpoint_security_group.go @@ -685,7 +685,7 @@ func setFvESgLegacyAttributes(ctx context.Context, diags *diag.Diagnostics, data childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) if childClassName == "fvRsIntraEpg" { for childAttributeName, childAttributeValue := range childAttributes { - if childAttributeName == "tDn" && childAttributeValue != "" { + if childAttributeName == "tDn" && childAttributeValue != "" && !ContainsString(DeprecatedFvRsIntraEpgFvESgList, childAttributeValue.(string)) { DeprecatedFvRsIntraEpgFvESgList = append(DeprecatedFvRsIntraEpgFvESgList, childAttributeValue.(string)) } } @@ -699,7 +699,7 @@ func setFvESgLegacyAttributes(ctx context.Context, diags *diag.Diagnostics, data } if childClassName == "fvRsSecInherited" { for childAttributeName, childAttributeValue := range childAttributes { - if childAttributeName == "tDn" && childAttributeValue != "" { + if childAttributeName == "tDn" && childAttributeValue != "" && !ContainsString(DeprecatedFvRsSecInheritedFvESgList, childAttributeValue.(string)) { DeprecatedFvRsSecInheritedFvESgList = append(DeprecatedFvRsSecInheritedFvESgList, childAttributeValue.(string)) } } diff --git a/internal/provider/resource_aci_first_hop_security_policy.go b/internal/provider/resource_aci_first_hop_security_policy.go new file mode 100644 index 000000000..845de4381 --- /dev/null +++ b/internal/provider/resource_aci_first_hop_security_policy.go @@ -0,0 +1,1100 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FhsBDPolResource{} +var _ resource.ResourceWithImportState = &FhsBDPolResource{} + +func NewFhsBDPolResource() resource.Resource { + return &FhsBDPolResource{} +} + +// FhsBDPolResource defines the resource implementation. +type FhsBDPolResource struct { + client *client.Client +} + +// FhsBDPolResourceModel describes the resource data model. +type FhsBDPolResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + IpInspectAdminSt types.String `tfsdk:"ip_inspection"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` + RaGuardAdminSt types.String `tfsdk:"router_advertisement"` + SrcGuardAdminSt types.String `tfsdk:"source_guard"` + FhsRaGuardPol types.Object `tfsdk:"route_advertisement_guard_policy"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +func getEmptyFhsBDPolResourceModel() *FhsBDPolResourceModel { + return &FhsBDPolResourceModel{ + Id: basetypes.NewStringNull(), + ParentDn: basetypes.NewStringNull(), + Annotation: basetypes.NewStringNull(), + Descr: basetypes.NewStringNull(), + IpInspectAdminSt: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + OwnerKey: basetypes.NewStringNull(), + OwnerTag: basetypes.NewStringNull(), + RaGuardAdminSt: basetypes.NewStringNull(), + SrcGuardAdminSt: basetypes.NewStringNull(), + FhsRaGuardPol: types.ObjectNull(map[string]attr.Type{ + "annotation": types.StringType, + "description": types.StringType, + "managed_config_check": types.StringType, + "managed_config_flag": types.StringType, + "max_hop_limit": types.StringType, + "max_router_pref": types.StringType, + "min_hop_limit": types.StringType, + "name": types.StringType, + "name_alias": types.StringType, + "other_config_check": types.StringType, + "other_config_flag": types.StringType, + "owner_key": types.StringType, + "owner_tag": types.StringType, + }), + TagAnnotation: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + TagTag: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + } +} + +// FhsRaGuardPolFhsBDPolResourceModel describes the resource data model for the children without relation ships. +type FhsRaGuardPolFhsBDPolResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + ManagedConfigCheck types.String `tfsdk:"managed_config_check"` + ManagedConfigFlag types.String `tfsdk:"managed_config_flag"` + MaxHopLimit types.String `tfsdk:"max_hop_limit"` + MaxRouterPref types.String `tfsdk:"max_router_pref"` + MinHopLimit types.String `tfsdk:"min_hop_limit"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OtherConfigCheck types.String `tfsdk:"other_config_check"` + OtherConfigFlag types.String `tfsdk:"other_config_flag"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` +} + +func getEmptyFhsRaGuardPolFhsBDPolResourceModel() FhsRaGuardPolFhsBDPolResourceModel { + return FhsRaGuardPolFhsBDPolResourceModel{ + Annotation: basetypes.NewStringNull(), + Descr: basetypes.NewStringNull(), + ManagedConfigCheck: basetypes.NewStringNull(), + ManagedConfigFlag: basetypes.NewStringNull(), + MaxHopLimit: basetypes.NewStringNull(), + MaxRouterPref: basetypes.NewStringNull(), + MinHopLimit: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + OtherConfigCheck: basetypes.NewStringNull(), + OtherConfigFlag: basetypes.NewStringNull(), + OwnerKey: basetypes.NewStringNull(), + OwnerTag: basetypes.NewStringNull(), + } +} + +var FhsRaGuardPolFhsBDPolType = map[string]attr.Type{ + "annotation": types.StringType, + "description": types.StringType, + "managed_config_check": types.StringType, + "managed_config_flag": types.StringType, + "max_hop_limit": types.StringType, + "max_router_pref": types.StringType, + "min_hop_limit": types.StringType, + "name": types.StringType, + "name_alias": types.StringType, + "other_config_check": types.StringType, + "other_config_flag": types.StringType, + "owner_key": types.StringType, + "owner_tag": types.StringType, +} + +// TagAnnotationFhsBDPolResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFhsBDPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagAnnotationFhsBDPolResourceModel() TagAnnotationFhsBDPolResourceModel { + return TagAnnotationFhsBDPolResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +// TagTagFhsBDPolResourceModel describes the resource data model for the children without relation ships. +type TagTagFhsBDPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagTagFhsBDPolResourceModel() TagTagFhsBDPolResourceModel { + return TagTagFhsBDPolResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +type FhsBDPolIdentifier struct { + Name types.String +} + +func (r *FhsBDPolResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) { + if !req.Plan.Raw.IsNull() { + var planData, stateData, configData *FhsBDPolResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &planData)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + resp.Diagnostics.Append(req.Config.Get(ctx, &configData)...) + + if resp.Diagnostics.HasError() { + return + } + + if (planData.Id.IsUnknown() || planData.Id.IsNull()) && !planData.ParentDn.IsUnknown() && !planData.Name.IsUnknown() { + setFhsBDPolId(ctx, planData) + } + + if stateData == nil && !globalAllowExistingOnCreate && !planData.Id.IsUnknown() && !planData.Id.IsNull() { + CheckDn(ctx, &resp.Diagnostics, r.client, "fhsBDPol", planData.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + } + if !configData.FhsRaGuardPol.IsNull() && stateData != nil { + if IsEmptySingleNestedAttribute(configData.FhsRaGuardPol.Attributes()) { + FhsRaGuardPolObject, _ := types.ObjectValueFrom(ctx, FhsRaGuardPolFhsBDPolType, getEmptyFhsRaGuardPolFhsBDPolResourceModel()) + planData.FhsRaGuardPol = FhsRaGuardPolObject + } + } + + resp.Diagnostics.Append(resp.Plan.Set(ctx, &planData)...) + } +} + +func (r *FhsBDPolResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_first_hop_security_policy") + resp.TypeName = req.ProviderTypeName + "_first_hop_security_policy" + tflog.Debug(ctx, "End metadata of resource: aci_first_hop_security_policy") +} + +func (r *FhsBDPolResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_first_hop_security_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The first_hop_security_policy resource for the 'fhsBDPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the First Hop Security Policy object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the First Hop Security Policy object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The description of the First Hop Security Policy object.`, + }, + "ip_inspection": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled-both", "enabled-ipv4", "enabled-ipv6"), + }, + MarkdownDescription: `IP Inspection Admin Status.`, + }, + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the First Hop Security Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The name alias of the First Hop Security Policy object.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "router_advertisement": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `Router Advertisement Guard Admin Status.`, + }, + "source_guard": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled-both", "enabled-ipv4", "enabled-ipv6"), + }, + MarkdownDescription: `Source Guard Admin Status.`, + }, + "route_advertisement_guard_policy": schema.SingleNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Object{ + objectplanmodifier.UseStateForUnknown(), + }, + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Route Advertisement Guard Policy object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the Route Advertisement Guard Policy object.`, + }, + "managed_config_check": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Perform Managed config flag check.`, + }, + "managed_config_flag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Managed config flag settting.`, + }, + "max_hop_limit": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `Max allowed hop limit.`, + }, + "max_router_pref": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "high", "low", "medium"), + }, + MarkdownDescription: `Allowed max router preference.`, + }, + "min_hop_limit": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `Min allowed hop limit.`, + }, + "name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the Route Advertisement Guard Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the Route Advertisement Guard Policy object.`, + }, + "other_config_check": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Perform Other config flag check.`, + }, + "other_config_flag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Other config flag settting.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + }, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_first_hop_security_policy") +} + +func (r *FhsBDPolResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_first_hop_security_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_first_hop_security_policy") +} + +func (r *FhsBDPolResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_first_hop_security_policy") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FhsBDPolResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + if stateData.Id.IsUnknown() || stateData.Id.IsNull() { + setFhsBDPolId(ctx, stateData) + } + getAndSetFhsBDPolAttributes(ctx, &resp.Diagnostics, r.client, stateData) + if !globalAllowExistingOnCreate && !stateData.Id.IsNull() { + resp.Diagnostics.AddError( + "Object Already Exists", + fmt.Sprintf("The fhsBDPol object with DN '%s' already exists.", stateData.Id.ValueString()), + ) + return + } + + var data *FhsBDPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + if data.Id.IsUnknown() || data.Id.IsNull() { + setFhsBDPolId(ctx, data) + } + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_first_hop_security_policy with id '%s'", data.Id.ValueString())) + + var fhsRaGuardPolPlan, fhsRaGuardPolState FhsRaGuardPolFhsBDPolResourceModel + data.FhsRaGuardPol.As(ctx, &fhsRaGuardPolPlan, basetypes.ObjectAsOptions{}) + stateData.FhsRaGuardPol.As(ctx, &fhsRaGuardPolState, basetypes.ObjectAsOptions{}) + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFhsBDPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFhsBDPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFhsBDPolCreateJsonPayload(ctx, &resp.Diagnostics, true, data, fhsRaGuardPolPlan, fhsRaGuardPolState, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFhsBDPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_first_hop_security_policy with id '%s'", data.Id.ValueString())) +} + +func (r *FhsBDPolResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_first_hop_security_policy") + var data *FhsBDPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_first_hop_security_policy with id '%s'", data.Id.ValueString())) + + getAndSetFhsBDPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FhsBDPolResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_first_hop_security_policy with id '%s'", data.Id.ValueString())) +} + +func (r *FhsBDPolResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_first_hop_security_policy") + var data *FhsBDPolResourceModel + var stateData *FhsBDPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_first_hop_security_policy with id '%s'", data.Id.ValueString())) + + var fhsRaGuardPolPlan, fhsRaGuardPolState FhsRaGuardPolFhsBDPolResourceModel + data.FhsRaGuardPol.As(ctx, &fhsRaGuardPolPlan, basetypes.ObjectAsOptions{}) + stateData.FhsRaGuardPol.As(ctx, &fhsRaGuardPolState, basetypes.ObjectAsOptions{}) + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFhsBDPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFhsBDPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFhsBDPolCreateJsonPayload(ctx, &resp.Diagnostics, false, data, fhsRaGuardPolPlan, fhsRaGuardPolState, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFhsBDPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_first_hop_security_policy with id '%s'", data.Id.ValueString())) +} + +func (r *FhsBDPolResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_first_hop_security_policy") + var data *FhsBDPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_first_hop_security_policy with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fhsBDPol", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_first_hop_security_policy with id '%s'", data.Id.ValueString())) +} + +func (r *FhsBDPolResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_first_hop_security_policy") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FhsBDPolResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_first_hop_security_policy with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_first_hop_security_policy") +} + +func getAndSetFhsBDPolAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FhsBDPolResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fhsBDPol,fhsRaGuardPol,tagAnnotation,tagTag"), "GET", nil) + + *data = *getEmptyFhsBDPolResourceModel() + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fhsBDPol").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fhsBDPol").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFhsBDPolParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ipInspectAdminSt" { + data.IpInspectAdminSt = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerKey" { + data.OwnerKey = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerTag" { + data.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "raGuardAdminSt" { + data.RaGuardAdminSt = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "srcGuardAdminSt" { + data.SrcGuardAdminSt = basetypes.NewStringValue(attributeValue.(string)) + } + } + FhsRaGuardPolFhsBDPolList := make([]FhsRaGuardPolFhsBDPolResourceModel, 0) + TagAnnotationFhsBDPolList := make([]TagAnnotationFhsBDPolResourceModel, 0) + TagTagFhsBDPolList := make([]TagTagFhsBDPolResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "fhsRaGuardPol" { + FhsRaGuardPolFhsBDPol := getEmptyFhsRaGuardPolFhsBDPolResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FhsRaGuardPolFhsBDPol.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "descr" { + FhsRaGuardPolFhsBDPol.Descr = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "managedConfigCheck" { + FhsRaGuardPolFhsBDPol.ManagedConfigCheck = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "managedConfigFlag" { + FhsRaGuardPolFhsBDPol.ManagedConfigFlag = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "maxHopLimit" { + FhsRaGuardPolFhsBDPol.MaxHopLimit = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "maxRouterPref" { + FhsRaGuardPolFhsBDPol.MaxRouterPref = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "minHopLimit" { + FhsRaGuardPolFhsBDPol.MinHopLimit = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "name" { + FhsRaGuardPolFhsBDPol.Name = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "nameAlias" { + FhsRaGuardPolFhsBDPol.NameAlias = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "otherConfigCheck" { + FhsRaGuardPolFhsBDPol.OtherConfigCheck = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "otherConfigFlag" { + FhsRaGuardPolFhsBDPol.OtherConfigFlag = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "ownerKey" { + FhsRaGuardPolFhsBDPol.OwnerKey = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "ownerTag" { + FhsRaGuardPolFhsBDPol.OwnerTag = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FhsRaGuardPolFhsBDPolList = append(FhsRaGuardPolFhsBDPolList, FhsRaGuardPolFhsBDPol) + } + if childClassName == "tagAnnotation" { + TagAnnotationFhsBDPol := getEmptyTagAnnotationFhsBDPolResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFhsBDPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFhsBDPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFhsBDPolList = append(TagAnnotationFhsBDPolList, TagAnnotationFhsBDPol) + } + if childClassName == "tagTag" { + TagTagFhsBDPol := getEmptyTagTagFhsBDPolResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFhsBDPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFhsBDPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFhsBDPolList = append(TagTagFhsBDPolList, TagTagFhsBDPol) + } + } + } + } + if len(FhsRaGuardPolFhsBDPolList) == 1 { + fhsRaGuardPolObject, _ := types.ObjectValueFrom(ctx, FhsRaGuardPolFhsBDPolType, FhsRaGuardPolFhsBDPolList[0]) + data.FhsRaGuardPol = fhsRaGuardPolObject + } else { + fhsRaGuardPolObject, _ := types.ObjectValueFrom(ctx, FhsRaGuardPolFhsBDPolType, getEmptyFhsRaGuardPolFhsBDPolResourceModel()) + data.FhsRaGuardPol = fhsRaGuardPolObject + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFhsBDPolList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFhsBDPolList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fhsBDPol'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFhsBDPolRn(ctx context.Context, data *FhsBDPolResourceModel) string { + rn := "bdpol-{name}" + for _, identifier := range []string{"name"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFhsBDPolParentDn(ctx context.Context, dn string, data *FhsBDPolResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFhsBDPolId(ctx context.Context, data *FhsBDPolResourceModel) { + rn := getFhsBDPolRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFhsBDPolFhsRaGuardPolChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FhsBDPolResourceModel, fhsRaGuardPolPlan, fhsRaGuardPolState FhsRaGuardPolFhsBDPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FhsRaGuardPol.IsUnknown() { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !IsEmptySingleNestedAttribute(data.FhsRaGuardPol.Attributes()) { + if !fhsRaGuardPolPlan.Annotation.IsUnknown() && !fhsRaGuardPolPlan.Annotation.IsNull() { + childMap["attributes"]["annotation"] = fhsRaGuardPolPlan.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fhsRaGuardPolPlan.Descr.IsUnknown() && !fhsRaGuardPolPlan.Descr.IsNull() { + childMap["attributes"]["descr"] = fhsRaGuardPolPlan.Descr.ValueString() + } + if !fhsRaGuardPolPlan.ManagedConfigCheck.IsUnknown() && !fhsRaGuardPolPlan.ManagedConfigCheck.IsNull() { + childMap["attributes"]["managedConfigCheck"] = fhsRaGuardPolPlan.ManagedConfigCheck.ValueString() + } + if !fhsRaGuardPolPlan.ManagedConfigFlag.IsUnknown() && !fhsRaGuardPolPlan.ManagedConfigFlag.IsNull() { + childMap["attributes"]["managedConfigFlag"] = fhsRaGuardPolPlan.ManagedConfigFlag.ValueString() + } + if !fhsRaGuardPolPlan.MaxHopLimit.IsUnknown() && !fhsRaGuardPolPlan.MaxHopLimit.IsNull() { + childMap["attributes"]["maxHopLimit"] = fhsRaGuardPolPlan.MaxHopLimit.ValueString() + } + if !fhsRaGuardPolPlan.MaxRouterPref.IsUnknown() && !fhsRaGuardPolPlan.MaxRouterPref.IsNull() { + childMap["attributes"]["maxRouterPref"] = fhsRaGuardPolPlan.MaxRouterPref.ValueString() + } + if !fhsRaGuardPolPlan.MinHopLimit.IsUnknown() && !fhsRaGuardPolPlan.MinHopLimit.IsNull() { + childMap["attributes"]["minHopLimit"] = fhsRaGuardPolPlan.MinHopLimit.ValueString() + } + if !fhsRaGuardPolPlan.Name.IsUnknown() && !fhsRaGuardPolPlan.Name.IsNull() { + childMap["attributes"]["name"] = fhsRaGuardPolPlan.Name.ValueString() + } + if !fhsRaGuardPolPlan.NameAlias.IsUnknown() && !fhsRaGuardPolPlan.NameAlias.IsNull() { + childMap["attributes"]["nameAlias"] = fhsRaGuardPolPlan.NameAlias.ValueString() + } + if !fhsRaGuardPolPlan.OtherConfigCheck.IsUnknown() && !fhsRaGuardPolPlan.OtherConfigCheck.IsNull() { + childMap["attributes"]["otherConfigCheck"] = fhsRaGuardPolPlan.OtherConfigCheck.ValueString() + } + if !fhsRaGuardPolPlan.OtherConfigFlag.IsUnknown() && !fhsRaGuardPolPlan.OtherConfigFlag.IsNull() { + childMap["attributes"]["otherConfigFlag"] = fhsRaGuardPolPlan.OtherConfigFlag.ValueString() + } + if !fhsRaGuardPolPlan.OwnerKey.IsUnknown() && !fhsRaGuardPolPlan.OwnerKey.IsNull() { + childMap["attributes"]["ownerKey"] = fhsRaGuardPolPlan.OwnerKey.ValueString() + } + if !fhsRaGuardPolPlan.OwnerTag.IsUnknown() && !fhsRaGuardPolPlan.OwnerTag.IsNull() { + childMap["attributes"]["ownerTag"] = fhsRaGuardPolPlan.OwnerTag.ValueString() + } + } else { + childMap["attributes"]["status"] = "deleted" + } + childPayloads = append(childPayloads, map[string]interface{}{"fhsRaGuardPol": childMap}) + } else { + FhsRaGuardPolObject, _ := types.ObjectValueFrom(ctx, FhsRaGuardPolFhsBDPolType, getEmptyFhsRaGuardPolFhsBDPolResourceModel()) + data.FhsRaGuardPol = FhsRaGuardPolObject + } + + return childPayloads +} +func getFhsBDPolTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FhsBDPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFhsBDPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() && !tagAnnotation.Key.IsNull() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() && !tagAnnotation.Value.IsNull() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFhsBDPolTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FhsBDPolResourceModel, tagTagPlan, tagTagState []TagTagFhsBDPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() && !tagTag.Key.IsNull() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() && !tagTag.Value.IsNull() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFhsBDPolCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, createType bool, data *FhsBDPolResourceModel, fhsRaGuardPolPlan, fhsRaGuardPolState FhsRaGuardPolFhsBDPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFhsBDPolResourceModel, tagTagPlan, tagTagState []TagTagFhsBDPolResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + + if createType && !globalAllowExistingOnCreate { + payloadMap["attributes"].(map[string]string)["status"] = "created" + } + childPayloads := []map[string]interface{}{} + + FhsRaGuardPolchildPayloads := getFhsBDPolFhsRaGuardPolChildPayloads(ctx, diags, data, fhsRaGuardPolPlan, fhsRaGuardPolState) + if FhsRaGuardPolchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FhsRaGuardPolchildPayloads...) + + TagAnnotationchildPayloads := getFhsBDPolTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFhsBDPolTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.IpInspectAdminSt.IsNull() && !data.IpInspectAdminSt.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ipInspectAdminSt"] = data.IpInspectAdminSt.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.OwnerKey.IsNull() && !data.OwnerKey.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerKey"] = data.OwnerKey.ValueString() + } + if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() + } + if !data.RaGuardAdminSt.IsNull() && !data.RaGuardAdminSt.IsUnknown() { + payloadMap["attributes"].(map[string]string)["raGuardAdminSt"] = data.RaGuardAdminSt.ValueString() + } + if !data.SrcGuardAdminSt.IsNull() && !data.SrcGuardAdminSt.IsUnknown() { + payloadMap["attributes"].(map[string]string)["srcGuardAdminSt"] = data.SrcGuardAdminSt.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fhsBDPol": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_first_hop_security_policy_test.go b/internal/provider/resource_aci_first_hop_security_policy_test.go new file mode 100644 index 000000000..39de53a82 --- /dev/null +++ b/internal/provider/resource_aci_first_hop_security_policy_test.go @@ -0,0 +1,436 @@ +// 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" + "github.com/hashicorp/terraform-plugin-testing/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/statecheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" +) + +func TestAccResourceFhsBDPolWithFvTenant(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFhsBDPolMinDependencyWithFvTenantAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "name", "test_name"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "ip_inspection", "enabled-both"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "ip_inspection", "enabled-both"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "router_advertisement", "enabled"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "router_advertisement", "enabled"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "source_guard", "enabled-both"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "source_guard", "enabled-both"), + ), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "false") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFhsBDPolMinDependencyWithFvTenantAllowExisting, + ExpectError: regexp.MustCompile("Object Already Exists"), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "true") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFhsBDPolMinDependencyWithFvTenantAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "name", "test_name"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "ip_inspection", "enabled-both"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "ip_inspection", "enabled-both"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "router_advertisement", "enabled"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "router_advertisement", "enabled"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test", "source_guard", "enabled-both"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.allow_test_2", "source_guard", "enabled-both"), + ), + }, + }, + }) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFhsBDPolMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "ip_inspection", "enabled-both"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "router_advertisement", "enabled"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "source_guard", "enabled-both"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFhsBDPolAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "description", "description_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "ip_inspection", "disabled"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "owner_tag", "owner_tag_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "router_advertisement", "disabled"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "source_guard", "disabled"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFhsBDPolMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "name", "test_name"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFhsBDPolResetDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "ip_inspection", "enabled-both"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "router_advertisement", "enabled"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "source_guard", "enabled-both"), + ), + }, + // Import testing + { + ResourceName: "aci_first_hop_security_policy.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children + { + Config: testConfigFhsBDPolChildrenDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "ip_inspection", "enabled-both"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "router_advertisement", "enabled"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "source_guard", "enabled-both"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.description", "description_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.managed_config_check", "no"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.managed_config_flag", "no"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.max_hop_limit", "10"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.max_router_pref", "disabled"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.min_hop_limit", "1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.name", "name_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.other_config_check", "no"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.other_config_flag", "no"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.owner_tag", "owner_tag_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "tags.1.value", "test_value"), + ), + }, + // Refresh State before import testing to ensure that the state is up to date + { + RefreshState: true, + ExpectNonEmptyPlan: false, + }, + // Import testing with children + { + ResourceName: "aci_first_hop_security_policy.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children removed from config + { + Config: testConfigFhsBDPolChildrenRemoveFromConfigDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.description", "description_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.managed_config_check", "no"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.managed_config_flag", "no"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.max_hop_limit", "10"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.max_router_pref", "disabled"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.min_hop_limit", "1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.name", "name_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.other_config_check", "no"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.other_config_flag", "no"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "route_advertisement_guard_policy.owner_tag", "owner_tag_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "tags.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFhsBDPolChildrenRemoveOneDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotations.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "tags.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "tags.#", "1"), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue("aci_first_hop_security_policy.test", + tfjsonpath.New("route_advertisement_guard_policy"), + knownvalue.MapExact( + map[string]knownvalue.Check{ + "annotation": knownvalue.Null(), + "description": knownvalue.Null(), + "managed_config_check": knownvalue.Null(), + "managed_config_flag": knownvalue.Null(), + "max_hop_limit": knownvalue.Null(), + "max_router_pref": knownvalue.Null(), + "min_hop_limit": knownvalue.Null(), + "name": knownvalue.Null(), + "name_alias": knownvalue.Null(), + "other_config_check": knownvalue.Null(), + "other_config_flag": knownvalue.Null(), + "owner_key": knownvalue.Null(), + "owner_tag": knownvalue.Null(), + }, + ), + ), + }, + }, + // Update with all children removed + { + Config: testConfigFhsBDPolChildrenRemoveAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_first_hop_security_policy.test", "tags.#", "0"), + ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue("aci_first_hop_security_policy.test", + tfjsonpath.New("route_advertisement_guard_policy"), + knownvalue.MapExact( + map[string]knownvalue.Check{ + "annotation": knownvalue.Null(), + "description": knownvalue.Null(), + "managed_config_check": knownvalue.Null(), + "managed_config_flag": knownvalue.Null(), + "max_hop_limit": knownvalue.Null(), + "max_router_pref": knownvalue.Null(), + "min_hop_limit": knownvalue.Null(), + "name": knownvalue.Null(), + "name_alias": knownvalue.Null(), + "other_config_check": knownvalue.Null(), + "other_config_flag": knownvalue.Null(), + "owner_key": knownvalue.Null(), + "owner_tag": knownvalue.Null(), + }, + ), + ), + }, + }, + }, + }) +} + +const testConfigFhsBDPolMinDependencyWithFvTenantAllowExisting = testConfigFvTenantMin + ` +resource "aci_first_hop_security_policy" "allow_test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +resource "aci_first_hop_security_policy" "allow_test_2" { + parent_dn = aci_tenant.test.id + name = "test_name" + depends_on = [aci_first_hop_security_policy.allow_test] +} +` + +const testConfigFhsBDPolMinDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_first_hop_security_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigFhsBDPolAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_first_hop_security_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotation = "annotation" + description = "description_1" + ip_inspection = "disabled" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + router_advertisement = "disabled" + source_guard = "disabled" +} +` + +const testConfigFhsBDPolResetDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_first_hop_security_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotation = "orchestrator:terraform" + description = "" + ip_inspection = "enabled-both" + name_alias = "" + owner_key = "" + owner_tag = "" + router_advertisement = "enabled" + source_guard = "enabled-both" +} +` +const testConfigFhsBDPolChildrenDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_first_hop_security_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] + route_advertisement_guard_policy = { + annotation = "annotation_1" + description = "description_1" + managed_config_check = "no" + managed_config_flag = "no" + max_hop_limit = "10" + max_router_pref = "disabled" + min_hop_limit = "1" + name = "name_1" + name_alias = "name_alias_1" + other_config_check = "no" + other_config_flag = "no" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + } + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigFhsBDPolChildrenRemoveFromConfigDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_first_hop_security_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigFhsBDPolChildrenRemoveOneDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_first_hop_security_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [ + { + key = "key_1" + value = "test_value" + }, + ] + route_advertisement_guard_policy = {} + tags = [ + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigFhsBDPolChildrenRemoveAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_first_hop_security_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [] + route_advertisement_guard_policy = {} + tags = [] +} +` diff --git a/internal/provider/resource_aci_igmp_snooping_policy.go b/internal/provider/resource_aci_igmp_snooping_policy.go new file mode 100644 index 000000000..59b4b2905 --- /dev/null +++ b/internal/provider/resource_aci_igmp_snooping_policy.go @@ -0,0 +1,869 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/setvalidator" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &IgmpSnoopPolResource{} +var _ resource.ResourceWithImportState = &IgmpSnoopPolResource{} + +func NewIgmpSnoopPolResource() resource.Resource { + return &IgmpSnoopPolResource{} +} + +// IgmpSnoopPolResource defines the resource implementation. +type IgmpSnoopPolResource struct { + client *client.Client +} + +// IgmpSnoopPolResourceModel describes the resource data model. +type IgmpSnoopPolResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + AdminSt types.String `tfsdk:"admin_state"` + Annotation types.String `tfsdk:"annotation"` + Ctrl types.Set `tfsdk:"control"` + Descr types.String `tfsdk:"description"` + LastMbrIntvl types.String `tfsdk:"last_member_interval"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` + QueryIntvl types.String `tfsdk:"query_interval"` + RspIntvl types.String `tfsdk:"response_interval"` + StartQueryCnt types.String `tfsdk:"start_query_count"` + StartQueryIntvl types.String `tfsdk:"start_query_interval"` + Ver types.String `tfsdk:"querier_version"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +func getEmptyIgmpSnoopPolResourceModel() *IgmpSnoopPolResourceModel { + return &IgmpSnoopPolResourceModel{ + Id: basetypes.NewStringNull(), + ParentDn: basetypes.NewStringNull(), + AdminSt: basetypes.NewStringNull(), + Annotation: basetypes.NewStringNull(), + Ctrl: types.SetNull(types.StringType), + Descr: basetypes.NewStringNull(), + LastMbrIntvl: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + OwnerKey: basetypes.NewStringNull(), + OwnerTag: basetypes.NewStringNull(), + QueryIntvl: basetypes.NewStringNull(), + RspIntvl: basetypes.NewStringNull(), + StartQueryCnt: basetypes.NewStringNull(), + StartQueryIntvl: basetypes.NewStringNull(), + Ver: basetypes.NewStringNull(), + TagAnnotation: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + TagTag: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + } +} + +// TagAnnotationIgmpSnoopPolResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationIgmpSnoopPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagAnnotationIgmpSnoopPolResourceModel() TagAnnotationIgmpSnoopPolResourceModel { + return TagAnnotationIgmpSnoopPolResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +// TagTagIgmpSnoopPolResourceModel describes the resource data model for the children without relation ships. +type TagTagIgmpSnoopPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagTagIgmpSnoopPolResourceModel() TagTagIgmpSnoopPolResourceModel { + return TagTagIgmpSnoopPolResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +type IgmpSnoopPolIdentifier struct { + Name types.String +} + +func (r *IgmpSnoopPolResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) { + if !req.Plan.Raw.IsNull() { + var planData, stateData *IgmpSnoopPolResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &planData)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + if (planData.Id.IsUnknown() || planData.Id.IsNull()) && !planData.ParentDn.IsUnknown() && !planData.Name.IsUnknown() { + setIgmpSnoopPolId(ctx, planData) + } + + if stateData == nil && !globalAllowExistingOnCreate && !planData.Id.IsUnknown() && !planData.Id.IsNull() { + CheckDn(ctx, &resp.Diagnostics, r.client, "igmpSnoopPol", planData.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + } + + resp.Diagnostics.Append(resp.Plan.Set(ctx, &planData)...) + } +} + +func (r *IgmpSnoopPolResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_igmp_snooping_policy") + resp.TypeName = req.ProviderTypeName + "_igmp_snooping_policy" + tflog.Debug(ctx, "End metadata of resource: aci_igmp_snooping_policy") +} + +func (r *IgmpSnoopPolResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_igmp_snooping_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The igmp_snooping_policy resource for the 'igmpSnoopPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the IGMP Snooping Policy object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "admin_state": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `Administrative State.`, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the IGMP Snooping Policy object.`, + }, + "control": schema.SetAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.Set{ + setvalidator.SizeAtMost(4), + setvalidator.ValueStringsAre( + stringvalidator.OneOf("fast-leave", "opt-flood", "querier", "routing"), + ), + }, + ElementType: types.StringType, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The description of the IGMP Snooping Policy object.`, + }, + "last_member_interval": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `When the last member query interval parameter is configured, the software removes the group state if no host responds before the timeout.`, + }, + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the IGMP Snooping Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The name alias of the IGMP Snooping Policy object.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "query_interval": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: ``, + }, + "response_interval": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The IGMP snooping query response interval.`, + }, + "start_query_count": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The interval before the IGMP query begins.`, + }, + "start_query_interval": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The startup query interval. This configures the IGMP snooping query interval at startup.`, + }, + "querier_version": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("unspecified", "v1", "v2", "v3"), + }, + MarkdownDescription: `Version.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_igmp_snooping_policy") +} + +func (r *IgmpSnoopPolResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_igmp_snooping_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_igmp_snooping_policy") +} + +func (r *IgmpSnoopPolResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_igmp_snooping_policy") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *IgmpSnoopPolResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + if stateData.Id.IsUnknown() || stateData.Id.IsNull() { + setIgmpSnoopPolId(ctx, stateData) + } + getAndSetIgmpSnoopPolAttributes(ctx, &resp.Diagnostics, r.client, stateData) + if !globalAllowExistingOnCreate && !stateData.Id.IsNull() { + resp.Diagnostics.AddError( + "Object Already Exists", + fmt.Sprintf("The igmpSnoopPol object with DN '%s' already exists.", stateData.Id.ValueString()), + ) + return + } + + var data *IgmpSnoopPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + if data.Id.IsUnknown() || data.Id.IsNull() { + setIgmpSnoopPolId(ctx, data) + } + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_igmp_snooping_policy with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationIgmpSnoopPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagIgmpSnoopPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getIgmpSnoopPolCreateJsonPayload(ctx, &resp.Diagnostics, true, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetIgmpSnoopPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_igmp_snooping_policy with id '%s'", data.Id.ValueString())) +} + +func (r *IgmpSnoopPolResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_igmp_snooping_policy") + var data *IgmpSnoopPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_igmp_snooping_policy with id '%s'", data.Id.ValueString())) + + getAndSetIgmpSnoopPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *IgmpSnoopPolResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_igmp_snooping_policy with id '%s'", data.Id.ValueString())) +} + +func (r *IgmpSnoopPolResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_igmp_snooping_policy") + var data *IgmpSnoopPolResourceModel + var stateData *IgmpSnoopPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_igmp_snooping_policy with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationIgmpSnoopPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagIgmpSnoopPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getIgmpSnoopPolCreateJsonPayload(ctx, &resp.Diagnostics, false, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetIgmpSnoopPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_igmp_snooping_policy with id '%s'", data.Id.ValueString())) +} + +func (r *IgmpSnoopPolResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_igmp_snooping_policy") + var data *IgmpSnoopPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_igmp_snooping_policy with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "igmpSnoopPol", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_igmp_snooping_policy with id '%s'", data.Id.ValueString())) +} + +func (r *IgmpSnoopPolResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_igmp_snooping_policy") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *IgmpSnoopPolResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_igmp_snooping_policy with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_igmp_snooping_policy") +} + +func getAndSetIgmpSnoopPolAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *IgmpSnoopPolResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "igmpSnoopPol,tagAnnotation,tagTag"), "GET", nil) + + *data = *getEmptyIgmpSnoopPolResourceModel() + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("igmpSnoopPol").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("igmpSnoopPol").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setIgmpSnoopPolParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "adminSt" { + data.AdminSt = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ctrl" { + ctrlList := make([]string, 0) + if attributeValue.(string) != "" { + ctrlList = strings.Split(attributeValue.(string), ",") + } + ctrlSet, _ := types.SetValueFrom(ctx, data.Ctrl.ElementType(ctx), ctrlList) + data.Ctrl = ctrlSet + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "lastMbrIntvl" { + data.LastMbrIntvl = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerKey" { + data.OwnerKey = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerTag" { + data.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "queryIntvl" { + data.QueryIntvl = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "rspIntvl" { + data.RspIntvl = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "startQueryCnt" { + data.StartQueryCnt = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "startQueryIntvl" { + data.StartQueryIntvl = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ver" { + data.Ver = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationIgmpSnoopPolList := make([]TagAnnotationIgmpSnoopPolResourceModel, 0) + TagTagIgmpSnoopPolList := make([]TagTagIgmpSnoopPolResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationIgmpSnoopPol := getEmptyTagAnnotationIgmpSnoopPolResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationIgmpSnoopPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationIgmpSnoopPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationIgmpSnoopPolList = append(TagAnnotationIgmpSnoopPolList, TagAnnotationIgmpSnoopPol) + } + if childClassName == "tagTag" { + TagTagIgmpSnoopPol := getEmptyTagTagIgmpSnoopPolResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagIgmpSnoopPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagIgmpSnoopPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagIgmpSnoopPolList = append(TagTagIgmpSnoopPolList, TagTagIgmpSnoopPol) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationIgmpSnoopPolList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagIgmpSnoopPolList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'igmpSnoopPol'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getIgmpSnoopPolRn(ctx context.Context, data *IgmpSnoopPolResourceModel) string { + rn := "snPol-{name}" + for _, identifier := range []string{"name"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setIgmpSnoopPolParentDn(ctx context.Context, dn string, data *IgmpSnoopPolResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setIgmpSnoopPolId(ctx context.Context, data *IgmpSnoopPolResourceModel) { + rn := getIgmpSnoopPolRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getIgmpSnoopPolTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *IgmpSnoopPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationIgmpSnoopPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() && !tagAnnotation.Key.IsNull() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() && !tagAnnotation.Value.IsNull() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getIgmpSnoopPolTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *IgmpSnoopPolResourceModel, tagTagPlan, tagTagState []TagTagIgmpSnoopPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() && !tagTag.Key.IsNull() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() && !tagTag.Value.IsNull() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getIgmpSnoopPolCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, createType bool, data *IgmpSnoopPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationIgmpSnoopPolResourceModel, tagTagPlan, tagTagState []TagTagIgmpSnoopPolResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + + if createType && !globalAllowExistingOnCreate { + payloadMap["attributes"].(map[string]string)["status"] = "created" + } + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getIgmpSnoopPolTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getIgmpSnoopPolTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.AdminSt.IsNull() && !data.AdminSt.IsUnknown() { + payloadMap["attributes"].(map[string]string)["adminSt"] = data.AdminSt.ValueString() + } + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Ctrl.IsNull() && !data.Ctrl.IsUnknown() { + var tmpCtrl []string + data.Ctrl.ElementsAs(ctx, &tmpCtrl, false) + payloadMap["attributes"].(map[string]string)["ctrl"] = strings.Join(tmpCtrl, ",") + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.LastMbrIntvl.IsNull() && !data.LastMbrIntvl.IsUnknown() { + payloadMap["attributes"].(map[string]string)["lastMbrIntvl"] = data.LastMbrIntvl.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.OwnerKey.IsNull() && !data.OwnerKey.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerKey"] = data.OwnerKey.ValueString() + } + if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() + } + if !data.QueryIntvl.IsNull() && !data.QueryIntvl.IsUnknown() { + payloadMap["attributes"].(map[string]string)["queryIntvl"] = data.QueryIntvl.ValueString() + } + if !data.RspIntvl.IsNull() && !data.RspIntvl.IsUnknown() { + payloadMap["attributes"].(map[string]string)["rspIntvl"] = data.RspIntvl.ValueString() + } + if !data.StartQueryCnt.IsNull() && !data.StartQueryCnt.IsUnknown() { + payloadMap["attributes"].(map[string]string)["startQueryCnt"] = data.StartQueryCnt.ValueString() + } + if !data.StartQueryIntvl.IsNull() && !data.StartQueryIntvl.IsUnknown() { + payloadMap["attributes"].(map[string]string)["startQueryIntvl"] = data.StartQueryIntvl.ValueString() + } + if !data.Ver.IsNull() && !data.Ver.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ver"] = data.Ver.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"igmpSnoopPol": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_igmp_snooping_policy_test.go b/internal/provider/resource_aci_igmp_snooping_policy_test.go new file mode 100644 index 000000000..18db33cc1 --- /dev/null +++ b/internal/provider/resource_aci_igmp_snooping_policy_test.go @@ -0,0 +1,398 @@ +// 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 TestAccResourceIgmpSnoopPolWithFvTenant(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigIgmpSnoopPolMinDependencyWithFvTenantAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "name", "test_name"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "admin_state", "enabled"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "admin_state", "enabled"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "control.#", "0"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "control.#", "0"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "last_member_interval", "1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "last_member_interval", "1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "querier_version", "v3"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "querier_version", "v3"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "query_interval", "125"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "query_interval", "125"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "response_interval", "10"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "response_interval", "10"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "start_query_count", "2"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "start_query_count", "2"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "start_query_interval", "31"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "start_query_interval", "31"), + ), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "false") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigIgmpSnoopPolMinDependencyWithFvTenantAllowExisting, + ExpectError: regexp.MustCompile("Object Already Exists"), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "true") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigIgmpSnoopPolMinDependencyWithFvTenantAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "name", "test_name"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "admin_state", "enabled"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "admin_state", "enabled"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "control.#", "0"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "control.#", "0"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "last_member_interval", "1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "last_member_interval", "1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "querier_version", "v3"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "querier_version", "v3"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "query_interval", "125"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "query_interval", "125"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "response_interval", "10"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "response_interval", "10"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "start_query_count", "2"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "start_query_count", "2"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test", "start_query_interval", "31"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.allow_test_2", "start_query_interval", "31"), + ), + }, + }, + }) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigIgmpSnoopPolMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "admin_state", "enabled"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "control.#", "0"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "last_member_interval", "1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "querier_version", "v3"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "query_interval", "125"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "response_interval", "10"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "start_query_count", "2"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "start_query_interval", "31"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigIgmpSnoopPolAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "admin_state", "disabled"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "control.#", "2"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "control.0", "fast-leave"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "control.1", "querier"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "description", "description_1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "last_member_interval", "3"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "owner_tag", "owner_tag_1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "querier_version", "v2"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "query_interval", "140"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "response_interval", "11"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "start_query_count", "9"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "start_query_interval", "2"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigIgmpSnoopPolMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "name", "test_name"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigIgmpSnoopPolResetDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "admin_state", "enabled"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "control.#", "0"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "last_member_interval", "1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "querier_version", "v3"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "query_interval", "125"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "response_interval", "10"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "start_query_count", "2"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "start_query_interval", "31"), + ), + }, + // Import testing + { + ResourceName: "aci_igmp_snooping_policy.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children + { + Config: testConfigIgmpSnoopPolChildrenDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "admin_state", "enabled"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "control.#", "0"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "last_member_interval", "1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "querier_version", "v3"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "query_interval", "125"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "response_interval", "10"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "start_query_count", "2"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "start_query_interval", "31"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "tags.1.value", "test_value"), + ), + }, + // Refresh State before import testing to ensure that the state is up to date + { + RefreshState: true, + ExpectNonEmptyPlan: false, + }, + // Import testing with children + { + ResourceName: "aci_igmp_snooping_policy.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children removed from config + { + Config: testConfigIgmpSnoopPolChildrenRemoveFromConfigDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "tags.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigIgmpSnoopPolChildrenRemoveOneDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotations.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "tags.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigIgmpSnoopPolChildrenRemoveAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_igmp_snooping_policy.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigIgmpSnoopPolMinDependencyWithFvTenantAllowExisting = testConfigFvTenantMin + ` +resource "aci_igmp_snooping_policy" "allow_test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +resource "aci_igmp_snooping_policy" "allow_test_2" { + parent_dn = aci_tenant.test.id + name = "test_name" + depends_on = [aci_igmp_snooping_policy.allow_test] +} +` + +const testConfigIgmpSnoopPolMinDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_igmp_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigIgmpSnoopPolAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_igmp_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + admin_state = "disabled" + annotation = "annotation" + control = ["fast-leave", "querier"] + description = "description_1" + last_member_interval = "3" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + querier_version = "v2" + query_interval = "140" + response_interval = "11" + start_query_count = "9" + start_query_interval = "2" +} +` + +const testConfigIgmpSnoopPolResetDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_igmp_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + admin_state = "enabled" + annotation = "orchestrator:terraform" + control = [] + description = "" + last_member_interval = "1" + name_alias = "" + owner_key = "" + owner_tag = "" + querier_version = "v3" + query_interval = "125" + response_interval = "10" + start_query_count = "2" + start_query_interval = "31" +} +` +const testConfigIgmpSnoopPolChildrenDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_igmp_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigIgmpSnoopPolChildrenRemoveFromConfigDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_igmp_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigIgmpSnoopPolChildrenRemoveOneDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_igmp_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [ + { + key = "key_1" + value = "test_value" + }, + ] + tags = [ + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigIgmpSnoopPolChildrenRemoveAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_igmp_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_mld_snooping_policy.go b/internal/provider/resource_aci_mld_snooping_policy.go new file mode 100644 index 000000000..4e71e96b8 --- /dev/null +++ b/internal/provider/resource_aci_mld_snooping_policy.go @@ -0,0 +1,869 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/setvalidator" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &MldSnoopPolResource{} +var _ resource.ResourceWithImportState = &MldSnoopPolResource{} + +func NewMldSnoopPolResource() resource.Resource { + return &MldSnoopPolResource{} +} + +// MldSnoopPolResource defines the resource implementation. +type MldSnoopPolResource struct { + client *client.Client +} + +// MldSnoopPolResourceModel describes the resource data model. +type MldSnoopPolResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + AdminSt types.String `tfsdk:"admin_state"` + Annotation types.String `tfsdk:"annotation"` + Ctrl types.Set `tfsdk:"control"` + Descr types.String `tfsdk:"description"` + LastMbrIntvl types.String `tfsdk:"last_member_interval"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` + QueryIntvl types.String `tfsdk:"query_interval"` + RspIntvl types.String `tfsdk:"response_interval"` + StartQueryCnt types.String `tfsdk:"start_query_count"` + StartQueryIntvl types.String `tfsdk:"start_query_interval"` + Ver types.String `tfsdk:"ver"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +func getEmptyMldSnoopPolResourceModel() *MldSnoopPolResourceModel { + return &MldSnoopPolResourceModel{ + Id: basetypes.NewStringNull(), + ParentDn: basetypes.NewStringNull(), + AdminSt: basetypes.NewStringNull(), + Annotation: basetypes.NewStringNull(), + Ctrl: types.SetNull(types.StringType), + Descr: basetypes.NewStringNull(), + LastMbrIntvl: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + OwnerKey: basetypes.NewStringNull(), + OwnerTag: basetypes.NewStringNull(), + QueryIntvl: basetypes.NewStringNull(), + RspIntvl: basetypes.NewStringNull(), + StartQueryCnt: basetypes.NewStringNull(), + StartQueryIntvl: basetypes.NewStringNull(), + Ver: basetypes.NewStringNull(), + TagAnnotation: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + TagTag: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + } +} + +// TagAnnotationMldSnoopPolResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationMldSnoopPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagAnnotationMldSnoopPolResourceModel() TagAnnotationMldSnoopPolResourceModel { + return TagAnnotationMldSnoopPolResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +// TagTagMldSnoopPolResourceModel describes the resource data model for the children without relation ships. +type TagTagMldSnoopPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagTagMldSnoopPolResourceModel() TagTagMldSnoopPolResourceModel { + return TagTagMldSnoopPolResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +type MldSnoopPolIdentifier struct { + Name types.String +} + +func (r *MldSnoopPolResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) { + if !req.Plan.Raw.IsNull() { + var planData, stateData *MldSnoopPolResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &planData)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + if (planData.Id.IsUnknown() || planData.Id.IsNull()) && !planData.ParentDn.IsUnknown() && !planData.Name.IsUnknown() { + setMldSnoopPolId(ctx, planData) + } + + if stateData == nil && !globalAllowExistingOnCreate && !planData.Id.IsUnknown() && !planData.Id.IsNull() { + CheckDn(ctx, &resp.Diagnostics, r.client, "mldSnoopPol", planData.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + } + + resp.Diagnostics.Append(resp.Plan.Set(ctx, &planData)...) + } +} + +func (r *MldSnoopPolResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_mld_snooping_policy") + resp.TypeName = req.ProviderTypeName + "_mld_snooping_policy" + tflog.Debug(ctx, "End metadata of resource: aci_mld_snooping_policy") +} + +func (r *MldSnoopPolResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_mld_snooping_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The mld_snooping_policy resource for the 'mldSnoopPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the MLD Snooping Policy object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "admin_state": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: ``, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the MLD Snooping Policy object.`, + }, + "control": schema.SetAttribute{ + MarkdownDescription: `Controls for MLD Snoop Policy.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.Set{ + setvalidator.SizeAtMost(4), + setvalidator.ValueStringsAre( + stringvalidator.OneOf("fast-leave", "opt-flood", "querier", "routing"), + ), + }, + ElementType: types.StringType, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The description of the MLD Snooping Policy object.`, + }, + "last_member_interval": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `When the last member query interval parameter is configured, the software removes the group state if no host responds before the timeout.`, + }, + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the MLD Snooping Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The name alias of the MLD Snooping Policy object.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "query_interval": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `Query interval.`, + }, + "response_interval": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The snooping query response interval.`, + }, + "start_query_count": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The interval before the query begins.`, + }, + "start_query_interval": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The startup query interval. This configures the snooping query interval at startup.`, + }, + "ver": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("unspecified", "v1", "v2"), + }, + MarkdownDescription: `Version.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_mld_snooping_policy") +} + +func (r *MldSnoopPolResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_mld_snooping_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_mld_snooping_policy") +} + +func (r *MldSnoopPolResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_mld_snooping_policy") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *MldSnoopPolResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + if stateData.Id.IsUnknown() || stateData.Id.IsNull() { + setMldSnoopPolId(ctx, stateData) + } + getAndSetMldSnoopPolAttributes(ctx, &resp.Diagnostics, r.client, stateData) + if !globalAllowExistingOnCreate && !stateData.Id.IsNull() { + resp.Diagnostics.AddError( + "Object Already Exists", + fmt.Sprintf("The mldSnoopPol object with DN '%s' already exists.", stateData.Id.ValueString()), + ) + return + } + + var data *MldSnoopPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + if data.Id.IsUnknown() || data.Id.IsNull() { + setMldSnoopPolId(ctx, data) + } + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_mld_snooping_policy with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationMldSnoopPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagMldSnoopPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getMldSnoopPolCreateJsonPayload(ctx, &resp.Diagnostics, true, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetMldSnoopPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_mld_snooping_policy with id '%s'", data.Id.ValueString())) +} + +func (r *MldSnoopPolResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_mld_snooping_policy") + var data *MldSnoopPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_mld_snooping_policy with id '%s'", data.Id.ValueString())) + + getAndSetMldSnoopPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *MldSnoopPolResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_mld_snooping_policy with id '%s'", data.Id.ValueString())) +} + +func (r *MldSnoopPolResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_mld_snooping_policy") + var data *MldSnoopPolResourceModel + var stateData *MldSnoopPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_mld_snooping_policy with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationMldSnoopPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagMldSnoopPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getMldSnoopPolCreateJsonPayload(ctx, &resp.Diagnostics, false, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetMldSnoopPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_mld_snooping_policy with id '%s'", data.Id.ValueString())) +} + +func (r *MldSnoopPolResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_mld_snooping_policy") + var data *MldSnoopPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_mld_snooping_policy with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "mldSnoopPol", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_mld_snooping_policy with id '%s'", data.Id.ValueString())) +} + +func (r *MldSnoopPolResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_mld_snooping_policy") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *MldSnoopPolResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_mld_snooping_policy with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_mld_snooping_policy") +} + +func getAndSetMldSnoopPolAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *MldSnoopPolResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "mldSnoopPol,tagAnnotation,tagTag"), "GET", nil) + + *data = *getEmptyMldSnoopPolResourceModel() + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("mldSnoopPol").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("mldSnoopPol").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setMldSnoopPolParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "adminSt" { + data.AdminSt = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ctrl" { + ctrlList := make([]string, 0) + if attributeValue.(string) != "" { + ctrlList = strings.Split(attributeValue.(string), ",") + } + ctrlSet, _ := types.SetValueFrom(ctx, data.Ctrl.ElementType(ctx), ctrlList) + data.Ctrl = ctrlSet + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "lastMbrIntvl" { + data.LastMbrIntvl = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerKey" { + data.OwnerKey = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerTag" { + data.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "queryIntvl" { + data.QueryIntvl = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "rspIntvl" { + data.RspIntvl = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "startQueryCnt" { + data.StartQueryCnt = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "startQueryIntvl" { + data.StartQueryIntvl = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ver" { + data.Ver = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationMldSnoopPolList := make([]TagAnnotationMldSnoopPolResourceModel, 0) + TagTagMldSnoopPolList := make([]TagTagMldSnoopPolResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationMldSnoopPol := getEmptyTagAnnotationMldSnoopPolResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationMldSnoopPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationMldSnoopPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationMldSnoopPolList = append(TagAnnotationMldSnoopPolList, TagAnnotationMldSnoopPol) + } + if childClassName == "tagTag" { + TagTagMldSnoopPol := getEmptyTagTagMldSnoopPolResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagMldSnoopPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagMldSnoopPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagMldSnoopPolList = append(TagTagMldSnoopPolList, TagTagMldSnoopPol) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationMldSnoopPolList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagMldSnoopPolList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'mldSnoopPol'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getMldSnoopPolRn(ctx context.Context, data *MldSnoopPolResourceModel) string { + rn := "mldsnoopPol-{name}" + for _, identifier := range []string{"name"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setMldSnoopPolParentDn(ctx context.Context, dn string, data *MldSnoopPolResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setMldSnoopPolId(ctx context.Context, data *MldSnoopPolResourceModel) { + rn := getMldSnoopPolRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getMldSnoopPolTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *MldSnoopPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationMldSnoopPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() && !tagAnnotation.Key.IsNull() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() && !tagAnnotation.Value.IsNull() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getMldSnoopPolTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *MldSnoopPolResourceModel, tagTagPlan, tagTagState []TagTagMldSnoopPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() && !tagTag.Key.IsNull() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() && !tagTag.Value.IsNull() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getMldSnoopPolCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, createType bool, data *MldSnoopPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationMldSnoopPolResourceModel, tagTagPlan, tagTagState []TagTagMldSnoopPolResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + + if createType && !globalAllowExistingOnCreate { + payloadMap["attributes"].(map[string]string)["status"] = "created" + } + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getMldSnoopPolTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getMldSnoopPolTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.AdminSt.IsNull() && !data.AdminSt.IsUnknown() { + payloadMap["attributes"].(map[string]string)["adminSt"] = data.AdminSt.ValueString() + } + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Ctrl.IsNull() && !data.Ctrl.IsUnknown() { + var tmpCtrl []string + data.Ctrl.ElementsAs(ctx, &tmpCtrl, false) + payloadMap["attributes"].(map[string]string)["ctrl"] = strings.Join(tmpCtrl, ",") + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.LastMbrIntvl.IsNull() && !data.LastMbrIntvl.IsUnknown() { + payloadMap["attributes"].(map[string]string)["lastMbrIntvl"] = data.LastMbrIntvl.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.OwnerKey.IsNull() && !data.OwnerKey.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerKey"] = data.OwnerKey.ValueString() + } + if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() + } + if !data.QueryIntvl.IsNull() && !data.QueryIntvl.IsUnknown() { + payloadMap["attributes"].(map[string]string)["queryIntvl"] = data.QueryIntvl.ValueString() + } + if !data.RspIntvl.IsNull() && !data.RspIntvl.IsUnknown() { + payloadMap["attributes"].(map[string]string)["rspIntvl"] = data.RspIntvl.ValueString() + } + if !data.StartQueryCnt.IsNull() && !data.StartQueryCnt.IsUnknown() { + payloadMap["attributes"].(map[string]string)["startQueryCnt"] = data.StartQueryCnt.ValueString() + } + if !data.StartQueryIntvl.IsNull() && !data.StartQueryIntvl.IsUnknown() { + payloadMap["attributes"].(map[string]string)["startQueryIntvl"] = data.StartQueryIntvl.ValueString() + } + if !data.Ver.IsNull() && !data.Ver.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ver"] = data.Ver.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"mldSnoopPol": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_mld_snooping_policy_test.go b/internal/provider/resource_aci_mld_snooping_policy_test.go new file mode 100644 index 000000000..fde34b41c --- /dev/null +++ b/internal/provider/resource_aci_mld_snooping_policy_test.go @@ -0,0 +1,398 @@ +// 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 TestAccResourceMldSnoopPolWithFvTenant(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigMldSnoopPolMinDependencyWithFvTenantAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "name", "test_name"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "admin_state", "disabled"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "admin_state", "disabled"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "control.#", "0"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "control.#", "0"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "last_member_interval", "1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "last_member_interval", "1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "query_interval", "125"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "query_interval", "125"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "response_interval", "10"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "response_interval", "10"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "start_query_count", "2"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "start_query_count", "2"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "start_query_interval", "31"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "start_query_interval", "31"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "ver", "v2"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "ver", "v2"), + ), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "false") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigMldSnoopPolMinDependencyWithFvTenantAllowExisting, + ExpectError: regexp.MustCompile("Object Already Exists"), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "true") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigMldSnoopPolMinDependencyWithFvTenantAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "name", "test_name"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "admin_state", "disabled"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "admin_state", "disabled"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "control.#", "0"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "control.#", "0"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "last_member_interval", "1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "last_member_interval", "1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "query_interval", "125"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "query_interval", "125"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "response_interval", "10"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "response_interval", "10"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "start_query_count", "2"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "start_query_count", "2"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "start_query_interval", "31"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "start_query_interval", "31"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test", "ver", "v2"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.allow_test_2", "ver", "v2"), + ), + }, + }, + }) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigMldSnoopPolMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "admin_state", "disabled"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "control.#", "0"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "last_member_interval", "1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "query_interval", "125"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "response_interval", "10"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "start_query_count", "2"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "start_query_interval", "31"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "ver", "v2"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigMldSnoopPolAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "admin_state", "disabled"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "control.#", "2"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "control.0", "fast-leave"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "control.1", "querier"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "description", "description_1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "last_member_interval", "3"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "owner_tag", "owner_tag_1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "query_interval", "140"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "response_interval", "11"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "start_query_count", "9"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "start_query_interval", "2"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "ver", "unspecified"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigMldSnoopPolMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "name", "test_name"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigMldSnoopPolResetDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "admin_state", "disabled"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "control.#", "0"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "last_member_interval", "1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "query_interval", "125"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "response_interval", "10"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "start_query_count", "2"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "start_query_interval", "31"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "ver", "v2"), + ), + }, + // Import testing + { + ResourceName: "aci_mld_snooping_policy.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children + { + Config: testConfigMldSnoopPolChildrenDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "admin_state", "disabled"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "control.#", "0"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "last_member_interval", "1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "query_interval", "125"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "response_interval", "10"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "start_query_count", "2"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "start_query_interval", "31"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "ver", "v2"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "tags.1.value", "test_value"), + ), + }, + // Refresh State before import testing to ensure that the state is up to date + { + RefreshState: true, + ExpectNonEmptyPlan: false, + }, + // Import testing with children + { + ResourceName: "aci_mld_snooping_policy.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children removed from config + { + Config: testConfigMldSnoopPolChildrenRemoveFromConfigDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "tags.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigMldSnoopPolChildrenRemoveOneDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotations.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "tags.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigMldSnoopPolChildrenRemoveAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_mld_snooping_policy.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigMldSnoopPolMinDependencyWithFvTenantAllowExisting = testConfigFvTenantMin + ` +resource "aci_mld_snooping_policy" "allow_test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +resource "aci_mld_snooping_policy" "allow_test_2" { + parent_dn = aci_tenant.test.id + name = "test_name" + depends_on = [aci_mld_snooping_policy.allow_test] +} +` + +const testConfigMldSnoopPolMinDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_mld_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigMldSnoopPolAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_mld_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + admin_state = "disabled" + annotation = "annotation" + control = ["fast-leave", "querier"] + description = "description_1" + last_member_interval = "3" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + query_interval = "140" + response_interval = "11" + start_query_count = "9" + start_query_interval = "2" + ver = "unspecified" +} +` + +const testConfigMldSnoopPolResetDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_mld_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + admin_state = "disabled" + annotation = "orchestrator:terraform" + control = [] + description = "" + last_member_interval = "1" + name_alias = "" + owner_key = "" + owner_tag = "" + query_interval = "125" + response_interval = "10" + start_query_count = "2" + start_query_interval = "31" + ver = "v2" +} +` +const testConfigMldSnoopPolChildrenDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_mld_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigMldSnoopPolChildrenRemoveFromConfigDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_mld_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigMldSnoopPolChildrenRemoveOneDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_mld_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [ + { + key = "key_1" + value = "test_value" + }, + ] + tags = [ + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigMldSnoopPolChildrenRemoveAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_mld_snooping_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_neighbor_discovery_interface_policy.go b/internal/provider/resource_aci_neighbor_discovery_interface_policy.go new file mode 100644 index 000000000..5ae8f6404 --- /dev/null +++ b/internal/provider/resource_aci_neighbor_discovery_interface_policy.go @@ -0,0 +1,931 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/setvalidator" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &NdIfPolResource{} +var _ resource.ResourceWithImportState = &NdIfPolResource{} + +func NewNdIfPolResource() resource.Resource { + return &NdIfPolResource{} +} + +// NdIfPolResource defines the resource implementation. +type NdIfPolResource struct { + client *client.Client +} + +// NdIfPolResourceModel describes the resource data model. +type NdIfPolResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Ctrl types.Set `tfsdk:"controller_state"` + Descr types.String `tfsdk:"description"` + HopLimit types.String `tfsdk:"hop_limit"` + Mtu types.String `tfsdk:"mtu"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + NsIntvl types.String `tfsdk:"neighbor_solicitation_interval"` + NsRetries types.String `tfsdk:"neighbor_solicitation_retries"` + NudRetryBase types.String `tfsdk:"nud_retry_base"` + NudRetryInterval types.String `tfsdk:"nud_retry_interval"` + NudRetryMaxAttempts types.String `tfsdk:"nud_retry_max_attempts"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` + RaIntvl types.String `tfsdk:"router_advertisement_interval"` + RaLifetime types.String `tfsdk:"router_advertisement_lifetime"` + ReachableTime types.String `tfsdk:"reachable_time"` + RetransTimer types.String `tfsdk:"retransmit_timer"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +func getEmptyNdIfPolResourceModel() *NdIfPolResourceModel { + return &NdIfPolResourceModel{ + Id: basetypes.NewStringNull(), + ParentDn: basetypes.NewStringNull(), + Annotation: basetypes.NewStringNull(), + Ctrl: types.SetNull(types.StringType), + Descr: basetypes.NewStringNull(), + HopLimit: basetypes.NewStringNull(), + Mtu: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + NsIntvl: basetypes.NewStringNull(), + NsRetries: basetypes.NewStringNull(), + NudRetryBase: basetypes.NewStringNull(), + NudRetryInterval: basetypes.NewStringNull(), + NudRetryMaxAttempts: basetypes.NewStringNull(), + OwnerKey: basetypes.NewStringNull(), + OwnerTag: basetypes.NewStringNull(), + RaIntvl: basetypes.NewStringNull(), + RaLifetime: basetypes.NewStringNull(), + ReachableTime: basetypes.NewStringNull(), + RetransTimer: basetypes.NewStringNull(), + TagAnnotation: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + TagTag: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + } +} + +// TagAnnotationNdIfPolResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationNdIfPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagAnnotationNdIfPolResourceModel() TagAnnotationNdIfPolResourceModel { + return TagAnnotationNdIfPolResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +// TagTagNdIfPolResourceModel describes the resource data model for the children without relation ships. +type TagTagNdIfPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagTagNdIfPolResourceModel() TagTagNdIfPolResourceModel { + return TagTagNdIfPolResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +type NdIfPolIdentifier struct { + Name types.String +} + +func (r *NdIfPolResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) { + if !req.Plan.Raw.IsNull() { + var planData, stateData *NdIfPolResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &planData)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + if (planData.Id.IsUnknown() || planData.Id.IsNull()) && !planData.ParentDn.IsUnknown() && !planData.Name.IsUnknown() { + setNdIfPolId(ctx, planData) + } + + if stateData == nil && !globalAllowExistingOnCreate && !planData.Id.IsUnknown() && !planData.Id.IsNull() { + CheckDn(ctx, &resp.Diagnostics, r.client, "ndIfPol", planData.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + } + + resp.Diagnostics.Append(resp.Plan.Set(ctx, &planData)...) + } +} + +func (r *NdIfPolResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_neighbor_discovery_interface_policy") + resp.TypeName = req.ProviderTypeName + "_neighbor_discovery_interface_policy" + tflog.Debug(ctx, "End metadata of resource: aci_neighbor_discovery_interface_policy") +} + +func (r *NdIfPolResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_neighbor_discovery_interface_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The neighbor_discovery_interface_policy resource for the 'ndIfPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Neighbor Discovery Interface Policy object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the Neighbor Discovery Interface Policy object.`, + }, + "controller_state": schema.SetAttribute{ + MarkdownDescription: `The control state.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.Set{ + setvalidator.SizeAtMost(6), + setvalidator.ValueStringsAre( + stringvalidator.OneOf("managed-cfg", "other-cfg", "suppress-ra", "suppress-ra-mtu", "unsolicit-na-glean", "unspecified"), + ), + }, + ElementType: types.StringType, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The description of the Neighbor Discovery Interface Policy object.`, + }, + "hop_limit": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The hop limit is used by hosts in outgoing packets and link parameters such as the link MTU. This facilitates centralized administration of critical parameters that can be set on routers and automatically propagated to all attached hosts.`, + }, + "mtu": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `In the RA message, the maximum transmission unit (MTU) value that a host should use in packets that it originates.`, + }, + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the Neighbor Discovery Interface Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The name alias of the Neighbor Discovery Interface Policy object.`, + }, + "neighbor_solicitation_interval": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The neighbor solicitation interval is sent by a node to determine the link-layer address of a neighbor, or to verify that a neighbor is still reachable through a cached link-layer address. Neighbor solicitations are also used for duplicate address detection.`, + }, + "neighbor_solicitation_retries": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The retransmission retry count for for sending neighbor solicitation messages.`, + }, + "nud_retry_base": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `Retransmission base for NUD neighbor solication messages.`, + }, + "nud_retry_interval": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `Retransmission interval between NUD neighbor solication messages.`, + }, + "nud_retry_max_attempts": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `Retransmission maximum number of attempts for NUD neighbor solication messages.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "router_advertisement_interval": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The interval for sending router advertisement messages.`, + }, + "router_advertisement_lifetime": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The lifetime associated with the default router.`, + }, + "reachable_time": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The reachable time, which is the time in milliseconds that a node assumes a neighbor is reachable after receiving a reachability confirmation.`, + }, + "retransmit_timer": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The retransmit timer has the time in milliseconds between retransmitted neighbor solicitation messages.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_neighbor_discovery_interface_policy") +} + +func (r *NdIfPolResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_neighbor_discovery_interface_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_neighbor_discovery_interface_policy") +} + +func (r *NdIfPolResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_neighbor_discovery_interface_policy") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *NdIfPolResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + if stateData.Id.IsUnknown() || stateData.Id.IsNull() { + setNdIfPolId(ctx, stateData) + } + getAndSetNdIfPolAttributes(ctx, &resp.Diagnostics, r.client, stateData) + if !globalAllowExistingOnCreate && !stateData.Id.IsNull() { + resp.Diagnostics.AddError( + "Object Already Exists", + fmt.Sprintf("The ndIfPol object with DN '%s' already exists.", stateData.Id.ValueString()), + ) + return + } + + var data *NdIfPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + if data.Id.IsUnknown() || data.Id.IsNull() { + setNdIfPolId(ctx, data) + } + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_neighbor_discovery_interface_policy with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationNdIfPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagNdIfPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getNdIfPolCreateJsonPayload(ctx, &resp.Diagnostics, true, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetNdIfPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_neighbor_discovery_interface_policy with id '%s'", data.Id.ValueString())) +} + +func (r *NdIfPolResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_neighbor_discovery_interface_policy") + var data *NdIfPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_neighbor_discovery_interface_policy with id '%s'", data.Id.ValueString())) + + getAndSetNdIfPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *NdIfPolResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_neighbor_discovery_interface_policy with id '%s'", data.Id.ValueString())) +} + +func (r *NdIfPolResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_neighbor_discovery_interface_policy") + var data *NdIfPolResourceModel + var stateData *NdIfPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_neighbor_discovery_interface_policy with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationNdIfPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagNdIfPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getNdIfPolCreateJsonPayload(ctx, &resp.Diagnostics, false, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetNdIfPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_neighbor_discovery_interface_policy with id '%s'", data.Id.ValueString())) +} + +func (r *NdIfPolResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_neighbor_discovery_interface_policy") + var data *NdIfPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_neighbor_discovery_interface_policy with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "ndIfPol", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_neighbor_discovery_interface_policy with id '%s'", data.Id.ValueString())) +} + +func (r *NdIfPolResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_neighbor_discovery_interface_policy") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *NdIfPolResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_neighbor_discovery_interface_policy with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_neighbor_discovery_interface_policy") +} + +func getAndSetNdIfPolAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *NdIfPolResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "ndIfPol,tagAnnotation,tagTag"), "GET", nil) + + *data = *getEmptyNdIfPolResourceModel() + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("ndIfPol").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("ndIfPol").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setNdIfPolParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ctrl" { + ctrlList := make([]string, 0) + if attributeValue.(string) != "" { + ctrlList = strings.Split(attributeValue.(string), ",") + } + ctrlSet, _ := types.SetValueFrom(ctx, data.Ctrl.ElementType(ctx), ctrlList) + data.Ctrl = ctrlSet + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "hopLimit" { + data.HopLimit = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "mtu" { + data.Mtu = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nsIntvl" { + data.NsIntvl = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nsRetries" { + data.NsRetries = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nudRetryBase" { + data.NudRetryBase = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nudRetryInterval" { + data.NudRetryInterval = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nudRetryMaxAttempts" { + data.NudRetryMaxAttempts = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerKey" { + data.OwnerKey = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerTag" { + data.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "raIntvl" { + data.RaIntvl = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "raLifetime" { + data.RaLifetime = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "reachableTime" { + data.ReachableTime = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "retransTimer" { + data.RetransTimer = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationNdIfPolList := make([]TagAnnotationNdIfPolResourceModel, 0) + TagTagNdIfPolList := make([]TagTagNdIfPolResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationNdIfPol := getEmptyTagAnnotationNdIfPolResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationNdIfPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationNdIfPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationNdIfPolList = append(TagAnnotationNdIfPolList, TagAnnotationNdIfPol) + } + if childClassName == "tagTag" { + TagTagNdIfPol := getEmptyTagTagNdIfPolResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagNdIfPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagNdIfPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagNdIfPolList = append(TagTagNdIfPolList, TagTagNdIfPol) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationNdIfPolList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagNdIfPolList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'ndIfPol'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getNdIfPolRn(ctx context.Context, data *NdIfPolResourceModel) string { + rn := "ndifpol-{name}" + for _, identifier := range []string{"name"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setNdIfPolParentDn(ctx context.Context, dn string, data *NdIfPolResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setNdIfPolId(ctx context.Context, data *NdIfPolResourceModel) { + rn := getNdIfPolRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getNdIfPolTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *NdIfPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationNdIfPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() && !tagAnnotation.Key.IsNull() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() && !tagAnnotation.Value.IsNull() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getNdIfPolTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *NdIfPolResourceModel, tagTagPlan, tagTagState []TagTagNdIfPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() && !tagTag.Key.IsNull() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() && !tagTag.Value.IsNull() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getNdIfPolCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, createType bool, data *NdIfPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationNdIfPolResourceModel, tagTagPlan, tagTagState []TagTagNdIfPolResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + + if createType && !globalAllowExistingOnCreate { + payloadMap["attributes"].(map[string]string)["status"] = "created" + } + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getNdIfPolTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getNdIfPolTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Ctrl.IsNull() && !data.Ctrl.IsUnknown() { + var tmpCtrl []string + data.Ctrl.ElementsAs(ctx, &tmpCtrl, false) + payloadMap["attributes"].(map[string]string)["ctrl"] = strings.Join(tmpCtrl, ",") + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.HopLimit.IsNull() && !data.HopLimit.IsUnknown() { + payloadMap["attributes"].(map[string]string)["hopLimit"] = data.HopLimit.ValueString() + } + if !data.Mtu.IsNull() && !data.Mtu.IsUnknown() { + payloadMap["attributes"].(map[string]string)["mtu"] = data.Mtu.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.NsIntvl.IsNull() && !data.NsIntvl.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nsIntvl"] = data.NsIntvl.ValueString() + } + if !data.NsRetries.IsNull() && !data.NsRetries.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nsRetries"] = data.NsRetries.ValueString() + } + if !data.NudRetryBase.IsNull() && !data.NudRetryBase.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nudRetryBase"] = data.NudRetryBase.ValueString() + } + if !data.NudRetryInterval.IsNull() && !data.NudRetryInterval.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nudRetryInterval"] = data.NudRetryInterval.ValueString() + } + if !data.NudRetryMaxAttempts.IsNull() && !data.NudRetryMaxAttempts.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nudRetryMaxAttempts"] = data.NudRetryMaxAttempts.ValueString() + } + if !data.OwnerKey.IsNull() && !data.OwnerKey.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerKey"] = data.OwnerKey.ValueString() + } + if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() + } + if !data.RaIntvl.IsNull() && !data.RaIntvl.IsUnknown() { + payloadMap["attributes"].(map[string]string)["raIntvl"] = data.RaIntvl.ValueString() + } + if !data.RaLifetime.IsNull() && !data.RaLifetime.IsUnknown() { + payloadMap["attributes"].(map[string]string)["raLifetime"] = data.RaLifetime.ValueString() + } + if !data.ReachableTime.IsNull() && !data.ReachableTime.IsUnknown() { + payloadMap["attributes"].(map[string]string)["reachableTime"] = data.ReachableTime.ValueString() + } + if !data.RetransTimer.IsNull() && !data.RetransTimer.IsUnknown() { + payloadMap["attributes"].(map[string]string)["retransTimer"] = data.RetransTimer.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"ndIfPol": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_neighbor_discovery_interface_policy_test.go b/internal/provider/resource_aci_neighbor_discovery_interface_policy_test.go new file mode 100644 index 000000000..4f88346d5 --- /dev/null +++ b/internal/provider/resource_aci_neighbor_discovery_interface_policy_test.go @@ -0,0 +1,437 @@ +// 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 TestAccResourceNdIfPolWithFvTenant(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigNdIfPolMinDependencyWithFvTenantAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "name", "test_name"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "controller_state.#", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "controller_state.#", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "hop_limit", "64"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "hop_limit", "64"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "mtu", "9000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "mtu", "9000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "neighbor_solicitation_interval", "1000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "neighbor_solicitation_interval", "1000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "neighbor_solicitation_retries", "3"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "neighbor_solicitation_retries", "3"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "nud_retry_base", "1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "nud_retry_base", "1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "nud_retry_interval", "1000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "nud_retry_interval", "1000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "nud_retry_max_attempts", "3"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "nud_retry_max_attempts", "3"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "reachable_time", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "reachable_time", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "retransmit_timer", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "retransmit_timer", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "router_advertisement_interval", "600"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "router_advertisement_interval", "600"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "router_advertisement_lifetime", "1800"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "router_advertisement_lifetime", "1800"), + ), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "false") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigNdIfPolMinDependencyWithFvTenantAllowExisting, + ExpectError: regexp.MustCompile("Object Already Exists"), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "true") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigNdIfPolMinDependencyWithFvTenantAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "name", "test_name"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "controller_state.#", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "controller_state.#", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "hop_limit", "64"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "hop_limit", "64"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "mtu", "9000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "mtu", "9000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "neighbor_solicitation_interval", "1000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "neighbor_solicitation_interval", "1000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "neighbor_solicitation_retries", "3"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "neighbor_solicitation_retries", "3"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "nud_retry_base", "1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "nud_retry_base", "1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "nud_retry_interval", "1000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "nud_retry_interval", "1000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "nud_retry_max_attempts", "3"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "nud_retry_max_attempts", "3"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "reachable_time", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "reachable_time", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "retransmit_timer", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "retransmit_timer", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "router_advertisement_interval", "600"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "router_advertisement_interval", "600"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test", "router_advertisement_lifetime", "1800"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.allow_test_2", "router_advertisement_lifetime", "1800"), + ), + }, + }, + }) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigNdIfPolMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "controller_state.#", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "hop_limit", "64"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "mtu", "9000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "neighbor_solicitation_interval", "1000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "neighbor_solicitation_retries", "3"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "nud_retry_base", "1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "nud_retry_interval", "1000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "nud_retry_max_attempts", "3"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "reachable_time", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "retransmit_timer", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "router_advertisement_interval", "600"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "router_advertisement_lifetime", "1800"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigNdIfPolAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "controller_state.#", "1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "controller_state.0", "managed-cfg"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "description", "description_1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "hop_limit", "40"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "mtu", "8700"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "neighbor_solicitation_interval", "1500"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "neighbor_solicitation_retries", "6"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "nud_retry_base", "2"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "nud_retry_interval", "1300"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "nud_retry_max_attempts", "5"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "owner_tag", "owner_tag_1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "reachable_time", "2"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "retransmit_timer", "2"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "router_advertisement_interval", "500"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "router_advertisement_lifetime", "1500"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigNdIfPolMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "name", "test_name"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigNdIfPolResetDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "controller_state.#", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "hop_limit", "64"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "mtu", "9000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "neighbor_solicitation_interval", "1000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "neighbor_solicitation_retries", "3"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "nud_retry_base", "1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "nud_retry_interval", "1000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "nud_retry_max_attempts", "3"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "reachable_time", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "retransmit_timer", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "router_advertisement_interval", "600"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "router_advertisement_lifetime", "1800"), + ), + }, + // Import testing + { + ResourceName: "aci_neighbor_discovery_interface_policy.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children + { + Config: testConfigNdIfPolChildrenDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "controller_state.#", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "hop_limit", "64"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "mtu", "9000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "neighbor_solicitation_interval", "1000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "neighbor_solicitation_retries", "3"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "nud_retry_base", "1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "nud_retry_interval", "1000"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "nud_retry_max_attempts", "3"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "reachable_time", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "retransmit_timer", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "router_advertisement_interval", "600"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "router_advertisement_lifetime", "1800"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "tags.1.value", "test_value"), + ), + }, + // Refresh State before import testing to ensure that the state is up to date + { + RefreshState: true, + ExpectNonEmptyPlan: false, + }, + // Import testing with children + { + ResourceName: "aci_neighbor_discovery_interface_policy.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children removed from config + { + Config: testConfigNdIfPolChildrenRemoveFromConfigDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "tags.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigNdIfPolChildrenRemoveOneDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotations.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "tags.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigNdIfPolChildrenRemoveAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_neighbor_discovery_interface_policy.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigNdIfPolMinDependencyWithFvTenantAllowExisting = testConfigFvTenantMin + ` +resource "aci_neighbor_discovery_interface_policy" "allow_test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +resource "aci_neighbor_discovery_interface_policy" "allow_test_2" { + parent_dn = aci_tenant.test.id + name = "test_name" + depends_on = [aci_neighbor_discovery_interface_policy.allow_test] +} +` + +const testConfigNdIfPolMinDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_neighbor_discovery_interface_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigNdIfPolAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_neighbor_discovery_interface_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotation = "annotation" + controller_state = ["managed-cfg"] + description = "description_1" + hop_limit = "40" + mtu = "8700" + name_alias = "name_alias_1" + neighbor_solicitation_interval = "1500" + neighbor_solicitation_retries = "6" + nud_retry_base = "2" + nud_retry_interval = "1300" + nud_retry_max_attempts = "5" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" + reachable_time = "2" + retransmit_timer = "2" + router_advertisement_interval = "500" + router_advertisement_lifetime = "1500" +} +` + +const testConfigNdIfPolResetDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_neighbor_discovery_interface_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotation = "orchestrator:terraform" + controller_state = [] + description = "" + hop_limit = "64" + mtu = "9000" + name_alias = "" + neighbor_solicitation_interval = "1000" + neighbor_solicitation_retries = "3" + nud_retry_base = "1" + nud_retry_interval = "1000" + nud_retry_max_attempts = "3" + owner_key = "" + owner_tag = "" + reachable_time = "0" + retransmit_timer = "0" + router_advertisement_interval = "600" + router_advertisement_lifetime = "1800" +} +` +const testConfigNdIfPolChildrenDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_neighbor_discovery_interface_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigNdIfPolChildrenRemoveFromConfigDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_neighbor_discovery_interface_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigNdIfPolChildrenRemoveOneDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_neighbor_discovery_interface_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [ + { + key = "key_1" + value = "test_value" + }, + ] + tags = [ + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigNdIfPolChildrenRemoveAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_neighbor_discovery_interface_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_relation_from_bridge_domain_to_l3_outside.go b/internal/provider/resource_aci_relation_from_bridge_domain_to_l3_outside.go new file mode 100644 index 000000000..1ebc122a0 --- /dev/null +++ b/internal/provider/resource_aci_relation_from_bridge_domain_to_l3_outside.go @@ -0,0 +1,643 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvRsBDToOutResource{} +var _ resource.ResourceWithImportState = &FvRsBDToOutResource{} + +func NewFvRsBDToOutResource() resource.Resource { + return &FvRsBDToOutResource{} +} + +// FvRsBDToOutResource defines the resource implementation. +type FvRsBDToOutResource struct { + client *client.Client +} + +// FvRsBDToOutResourceModel describes the resource data model. +type FvRsBDToOutResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + TnL3extOutName types.String `tfsdk:"l3_outside_name"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +func getEmptyFvRsBDToOutResourceModel() *FvRsBDToOutResourceModel { + return &FvRsBDToOutResourceModel{ + Id: basetypes.NewStringNull(), + ParentDn: basetypes.NewStringNull(), + Annotation: basetypes.NewStringNull(), + TnL3extOutName: basetypes.NewStringNull(), + TagAnnotation: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + TagTag: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + } +} + +// TagAnnotationFvRsBDToOutResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvRsBDToOutResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagAnnotationFvRsBDToOutResourceModel() TagAnnotationFvRsBDToOutResourceModel { + return TagAnnotationFvRsBDToOutResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +// TagTagFvRsBDToOutResourceModel describes the resource data model for the children without relation ships. +type TagTagFvRsBDToOutResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagTagFvRsBDToOutResourceModel() TagTagFvRsBDToOutResourceModel { + return TagTagFvRsBDToOutResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +type FvRsBDToOutIdentifier struct { + TnL3extOutName types.String +} + +func (r *FvRsBDToOutResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) { + if !req.Plan.Raw.IsNull() { + var planData, stateData *FvRsBDToOutResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &planData)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + if (planData.Id.IsUnknown() || planData.Id.IsNull()) && !planData.ParentDn.IsUnknown() && !planData.TnL3extOutName.IsUnknown() { + setFvRsBDToOutId(ctx, planData) + } + + if stateData == nil && !globalAllowExistingOnCreate && !planData.Id.IsUnknown() && !planData.Id.IsNull() { + CheckDn(ctx, &resp.Diagnostics, r.client, "fvRsBDToOut", planData.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + } + + resp.Diagnostics.Append(resp.Plan.Set(ctx, &planData)...) + } +} + +func (r *FvRsBDToOutResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_relation_from_bridge_domain_to_l3_outside") + resp.TypeName = req.ProviderTypeName + "_relation_from_bridge_domain_to_l3_outside" + tflog.Debug(ctx, "End metadata of resource: aci_relation_from_bridge_domain_to_l3_outside") +} + +func (r *FvRsBDToOutResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_relation_from_bridge_domain_to_l3_outside") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The relation_from_bridge_domain_to_l3_outside resource for the 'fvRsBDToOut' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Relation From Bridge Domain To L3 Outside object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the Relation From Bridge Domain To L3 Outside object.`, + }, + "l3_outside_name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the L3 Outside object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_relation_from_bridge_domain_to_l3_outside") +} + +func (r *FvRsBDToOutResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_relation_from_bridge_domain_to_l3_outside") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_relation_from_bridge_domain_to_l3_outside") +} + +func (r *FvRsBDToOutResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_relation_from_bridge_domain_to_l3_outside") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvRsBDToOutResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + if stateData.Id.IsUnknown() || stateData.Id.IsNull() { + setFvRsBDToOutId(ctx, stateData) + } + getAndSetFvRsBDToOutAttributes(ctx, &resp.Diagnostics, r.client, stateData) + if !globalAllowExistingOnCreate && !stateData.Id.IsNull() { + resp.Diagnostics.AddError( + "Object Already Exists", + fmt.Sprintf("The fvRsBDToOut object with DN '%s' already exists.", stateData.Id.ValueString()), + ) + return + } + + var data *FvRsBDToOutResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + if data.Id.IsUnknown() || data.Id.IsNull() { + setFvRsBDToOutId(ctx, data) + } + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_relation_from_bridge_domain_to_l3_outside with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsBDToOutResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvRsBDToOutResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvRsBDToOutCreateJsonPayload(ctx, &resp.Diagnostics, true, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvRsBDToOutAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_relation_from_bridge_domain_to_l3_outside with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsBDToOutResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_relation_from_bridge_domain_to_l3_outside") + var data *FvRsBDToOutResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_relation_from_bridge_domain_to_l3_outside with id '%s'", data.Id.ValueString())) + + getAndSetFvRsBDToOutAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvRsBDToOutResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_relation_from_bridge_domain_to_l3_outside with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsBDToOutResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_relation_from_bridge_domain_to_l3_outside") + var data *FvRsBDToOutResourceModel + var stateData *FvRsBDToOutResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_relation_from_bridge_domain_to_l3_outside with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsBDToOutResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvRsBDToOutResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvRsBDToOutCreateJsonPayload(ctx, &resp.Diagnostics, false, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvRsBDToOutAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_relation_from_bridge_domain_to_l3_outside with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsBDToOutResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_relation_from_bridge_domain_to_l3_outside") + var data *FvRsBDToOutResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_relation_from_bridge_domain_to_l3_outside with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvRsBDToOut", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_relation_from_bridge_domain_to_l3_outside with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsBDToOutResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_relation_from_bridge_domain_to_l3_outside") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvRsBDToOutResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_relation_from_bridge_domain_to_l3_outside with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_relation_from_bridge_domain_to_l3_outside") +} + +func getAndSetFvRsBDToOutAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvRsBDToOutResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvRsBDToOut,tagAnnotation,tagTag"), "GET", nil) + + *data = *getEmptyFvRsBDToOutResourceModel() + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvRsBDToOut").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvRsBDToOut").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvRsBDToOutParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "tnL3extOutName" { + data.TnL3extOutName = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationFvRsBDToOutList := make([]TagAnnotationFvRsBDToOutResourceModel, 0) + TagTagFvRsBDToOutList := make([]TagTagFvRsBDToOutResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationFvRsBDToOut := getEmptyTagAnnotationFvRsBDToOutResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvRsBDToOut.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvRsBDToOut.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvRsBDToOutList = append(TagAnnotationFvRsBDToOutList, TagAnnotationFvRsBDToOut) + } + if childClassName == "tagTag" { + TagTagFvRsBDToOut := getEmptyTagTagFvRsBDToOutResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvRsBDToOut.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvRsBDToOut.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvRsBDToOutList = append(TagTagFvRsBDToOutList, TagTagFvRsBDToOut) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvRsBDToOutList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvRsBDToOutList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvRsBDToOut'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvRsBDToOutRn(ctx context.Context, data *FvRsBDToOutResourceModel) string { + rn := "rsBDToOut-{tnL3extOutName}" + for _, identifier := range []string{"tnL3extOutName"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFvRsBDToOutParentDn(ctx context.Context, dn string, data *FvRsBDToOutResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvRsBDToOutId(ctx context.Context, data *FvRsBDToOutResourceModel) { + rn := getFvRsBDToOutRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvRsBDToOutTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvRsBDToOutResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsBDToOutResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() && !tagAnnotation.Key.IsNull() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() && !tagAnnotation.Value.IsNull() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvRsBDToOutTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvRsBDToOutResourceModel, tagTagPlan, tagTagState []TagTagFvRsBDToOutResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() && !tagTag.Key.IsNull() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() && !tagTag.Value.IsNull() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvRsBDToOutCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, createType bool, data *FvRsBDToOutResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsBDToOutResourceModel, tagTagPlan, tagTagState []TagTagFvRsBDToOutResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + + if createType && !globalAllowExistingOnCreate { + payloadMap["attributes"].(map[string]string)["status"] = "created" + } + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getFvRsBDToOutTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvRsBDToOutTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.TnL3extOutName.IsNull() && !data.TnL3extOutName.IsUnknown() { + payloadMap["attributes"].(map[string]string)["tnL3extOutName"] = data.TnL3extOutName.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvRsBDToOut": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_relation_from_bridge_domain_to_l3_outside_test.go b/internal/provider/resource_aci_relation_from_bridge_domain_to_l3_outside_test.go new file mode 100644 index 000000000..330d0203c --- /dev/null +++ b/internal/provider/resource_aci_relation_from_bridge_domain_to_l3_outside_test.go @@ -0,0 +1,276 @@ +// 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 TestAccResourceFvRsBDToOutWithFvBD(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvRsBDToOutMinDependencyWithFvBDAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.allow_test", "l3_outside_name", "test_tn_l3ext_out_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.allow_test_2", "l3_outside_name", "test_tn_l3ext_out_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.allow_test_2", "annotation", "orchestrator:terraform"), + ), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "false") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvRsBDToOutMinDependencyWithFvBDAllowExisting, + ExpectError: regexp.MustCompile("Object Already Exists"), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "true") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvRsBDToOutMinDependencyWithFvBDAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.allow_test", "l3_outside_name", "test_tn_l3ext_out_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.allow_test_2", "l3_outside_name", "test_tn_l3ext_out_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.allow_test_2", "annotation", "orchestrator:terraform"), + ), + }, + }, + }) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvRsBDToOutMinDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "l3_outside_name", "test_tn_l3ext_out_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotation", "orchestrator:terraform"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvRsBDToOutAllDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "l3_outside_name", "test_tn_l3ext_out_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotation", "annotation"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvRsBDToOutMinDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "l3_outside_name", "test_tn_l3ext_out_name"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvRsBDToOutResetDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "l3_outside_name", "test_tn_l3ext_out_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotation", "orchestrator:terraform"), + ), + }, + // Import testing + { + ResourceName: "aci_relation_from_bridge_domain_to_l3_outside.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children + { + Config: testConfigFvRsBDToOutChildrenDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "l3_outside_name", "test_tn_l3ext_out_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "tags.1.value", "test_value"), + ), + }, + // Refresh State before import testing to ensure that the state is up to date + { + RefreshState: true, + ExpectNonEmptyPlan: false, + }, + // Import testing with children + { + ResourceName: "aci_relation_from_bridge_domain_to_l3_outside.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children removed from config + { + Config: testConfigFvRsBDToOutChildrenRemoveFromConfigDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "tags.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvRsBDToOutChildrenRemoveOneDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotations.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "tags.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvRsBDToOutChildrenRemoveAllDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_l3_outside.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvRsBDToOutMinDependencyWithFvBDAllowExisting = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_l3_outside" "allow_test" { + parent_dn = aci_bridge_domain.test.id + l3_outside_name = "test_tn_l3ext_out_name" +} +resource "aci_relation_from_bridge_domain_to_l3_outside" "allow_test_2" { + parent_dn = aci_bridge_domain.test.id + l3_outside_name = "test_tn_l3ext_out_name" + depends_on = [aci_relation_from_bridge_domain_to_l3_outside.allow_test] +} +` + +const testConfigFvRsBDToOutMinDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_l3_outside" "test" { + parent_dn = aci_bridge_domain.test.id + l3_outside_name = "test_tn_l3ext_out_name" +} +` + +const testConfigFvRsBDToOutAllDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_l3_outside" "test" { + parent_dn = aci_bridge_domain.test.id + l3_outside_name = "test_tn_l3ext_out_name" + annotation = "annotation" +} +` + +const testConfigFvRsBDToOutResetDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_l3_outside" "test" { + parent_dn = aci_bridge_domain.test.id + l3_outside_name = "test_tn_l3ext_out_name" + annotation = "orchestrator:terraform" +} +` +const testConfigFvRsBDToOutChildrenDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_l3_outside" "test" { + parent_dn = aci_bridge_domain.test.id + l3_outside_name = "test_tn_l3ext_out_name" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigFvRsBDToOutChildrenRemoveFromConfigDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_l3_outside" "test" { + parent_dn = aci_bridge_domain.test.id + l3_outside_name = "test_tn_l3ext_out_name" +} +` + +const testConfigFvRsBDToOutChildrenRemoveOneDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_l3_outside" "test" { + parent_dn = aci_bridge_domain.test.id + l3_outside_name = "test_tn_l3ext_out_name" + annotations = [ + { + key = "key_1" + value = "test_value" + }, + ] + tags = [ + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigFvRsBDToOutChildrenRemoveAllDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_l3_outside" "test" { + parent_dn = aci_bridge_domain.test.id + l3_outside_name = "test_tn_l3ext_out_name" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_relation_from_bridge_domain_to_netflow_monitor_policy.go b/internal/provider/resource_aci_relation_from_bridge_domain_to_netflow_monitor_policy.go new file mode 100644 index 000000000..c4f3dec26 --- /dev/null +++ b/internal/provider/resource_aci_relation_from_bridge_domain_to_netflow_monitor_policy.go @@ -0,0 +1,666 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvRsBDToNetflowMonitorPolResource{} +var _ resource.ResourceWithImportState = &FvRsBDToNetflowMonitorPolResource{} + +func NewFvRsBDToNetflowMonitorPolResource() resource.Resource { + return &FvRsBDToNetflowMonitorPolResource{} +} + +// FvRsBDToNetflowMonitorPolResource defines the resource implementation. +type FvRsBDToNetflowMonitorPolResource struct { + client *client.Client +} + +// FvRsBDToNetflowMonitorPolResourceModel describes the resource data model. +type FvRsBDToNetflowMonitorPolResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + FltType types.String `tfsdk:"filter_type"` + TnNetflowMonitorPolName types.String `tfsdk:"netflow_monitor_policy_name"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +func getEmptyFvRsBDToNetflowMonitorPolResourceModel() *FvRsBDToNetflowMonitorPolResourceModel { + return &FvRsBDToNetflowMonitorPolResourceModel{ + Id: basetypes.NewStringNull(), + ParentDn: basetypes.NewStringNull(), + Annotation: basetypes.NewStringNull(), + FltType: basetypes.NewStringNull(), + TnNetflowMonitorPolName: basetypes.NewStringNull(), + TagAnnotation: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + TagTag: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + } +} + +// TagAnnotationFvRsBDToNetflowMonitorPolResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvRsBDToNetflowMonitorPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagAnnotationFvRsBDToNetflowMonitorPolResourceModel() TagAnnotationFvRsBDToNetflowMonitorPolResourceModel { + return TagAnnotationFvRsBDToNetflowMonitorPolResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +// TagTagFvRsBDToNetflowMonitorPolResourceModel describes the resource data model for the children without relation ships. +type TagTagFvRsBDToNetflowMonitorPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagTagFvRsBDToNetflowMonitorPolResourceModel() TagTagFvRsBDToNetflowMonitorPolResourceModel { + return TagTagFvRsBDToNetflowMonitorPolResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +type FvRsBDToNetflowMonitorPolIdentifier struct { + FltType types.String + TnNetflowMonitorPolName types.String +} + +func (r *FvRsBDToNetflowMonitorPolResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) { + if !req.Plan.Raw.IsNull() { + var planData, stateData *FvRsBDToNetflowMonitorPolResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &planData)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + if (planData.Id.IsUnknown() || planData.Id.IsNull()) && !planData.ParentDn.IsUnknown() && !planData.FltType.IsUnknown() && !planData.TnNetflowMonitorPolName.IsUnknown() { + setFvRsBDToNetflowMonitorPolId(ctx, planData) + } + + if stateData == nil && !globalAllowExistingOnCreate && !planData.Id.IsUnknown() && !planData.Id.IsNull() { + CheckDn(ctx, &resp.Diagnostics, r.client, "fvRsBDToNetflowMonitorPol", planData.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + } + + resp.Diagnostics.Append(resp.Plan.Set(ctx, &planData)...) + } +} + +func (r *FvRsBDToNetflowMonitorPolResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") + resp.TypeName = req.ProviderTypeName + "_relation_from_bridge_domain_to_netflow_monitor_policy" + tflog.Debug(ctx, "End metadata of resource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") +} + +func (r *FvRsBDToNetflowMonitorPolResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The relation_from_bridge_domain_to_netflow_monitor_policy resource for the 'fvRsBDToNetflowMonitorPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Relation From Bridge Domain To NetFlow Monitor Policy object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the Relation From Bridge Domain To NetFlow Monitor Policy object.`, + }, + "filter_type": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + stringplanmodifier.RequiresReplace(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("ce", "ipv4", "ipv6", "unspecified"), + }, + MarkdownDescription: `The filter type of the NetFlow Monitor Policy object.`, + }, + "netflow_monitor_policy_name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the NetFlow Monitor Policy object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") +} + +func (r *FvRsBDToNetflowMonitorPolResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") +} + +func (r *FvRsBDToNetflowMonitorPolResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvRsBDToNetflowMonitorPolResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + if stateData.Id.IsUnknown() || stateData.Id.IsNull() { + setFvRsBDToNetflowMonitorPolId(ctx, stateData) + } + getAndSetFvRsBDToNetflowMonitorPolAttributes(ctx, &resp.Diagnostics, r.client, stateData) + if !globalAllowExistingOnCreate && !stateData.Id.IsNull() { + resp.Diagnostics.AddError( + "Object Already Exists", + fmt.Sprintf("The fvRsBDToNetflowMonitorPol object with DN '%s' already exists.", stateData.Id.ValueString()), + ) + return + } + + var data *FvRsBDToNetflowMonitorPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + if data.Id.IsUnknown() || data.Id.IsNull() { + setFvRsBDToNetflowMonitorPolId(ctx, data) + } + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_relation_from_bridge_domain_to_netflow_monitor_policy with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsBDToNetflowMonitorPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvRsBDToNetflowMonitorPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvRsBDToNetflowMonitorPolCreateJsonPayload(ctx, &resp.Diagnostics, true, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvRsBDToNetflowMonitorPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_relation_from_bridge_domain_to_netflow_monitor_policy with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsBDToNetflowMonitorPolResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") + var data *FvRsBDToNetflowMonitorPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_relation_from_bridge_domain_to_netflow_monitor_policy with id '%s'", data.Id.ValueString())) + + getAndSetFvRsBDToNetflowMonitorPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvRsBDToNetflowMonitorPolResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_relation_from_bridge_domain_to_netflow_monitor_policy with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsBDToNetflowMonitorPolResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") + var data *FvRsBDToNetflowMonitorPolResourceModel + var stateData *FvRsBDToNetflowMonitorPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_relation_from_bridge_domain_to_netflow_monitor_policy with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsBDToNetflowMonitorPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvRsBDToNetflowMonitorPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvRsBDToNetflowMonitorPolCreateJsonPayload(ctx, &resp.Diagnostics, false, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvRsBDToNetflowMonitorPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_relation_from_bridge_domain_to_netflow_monitor_policy with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsBDToNetflowMonitorPolResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") + var data *FvRsBDToNetflowMonitorPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_relation_from_bridge_domain_to_netflow_monitor_policy with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvRsBDToNetflowMonitorPol", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_relation_from_bridge_domain_to_netflow_monitor_policy with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsBDToNetflowMonitorPolResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvRsBDToNetflowMonitorPolResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_relation_from_bridge_domain_to_netflow_monitor_policy with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_relation_from_bridge_domain_to_netflow_monitor_policy") +} + +func getAndSetFvRsBDToNetflowMonitorPolAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvRsBDToNetflowMonitorPolResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvRsBDToNetflowMonitorPol,tagAnnotation,tagTag"), "GET", nil) + + *data = *getEmptyFvRsBDToNetflowMonitorPolResourceModel() + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvRsBDToNetflowMonitorPol").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvRsBDToNetflowMonitorPol").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvRsBDToNetflowMonitorPolParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "fltType" { + data.FltType = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "tnNetflowMonitorPolName" { + data.TnNetflowMonitorPolName = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationFvRsBDToNetflowMonitorPolList := make([]TagAnnotationFvRsBDToNetflowMonitorPolResourceModel, 0) + TagTagFvRsBDToNetflowMonitorPolList := make([]TagTagFvRsBDToNetflowMonitorPolResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationFvRsBDToNetflowMonitorPol := getEmptyTagAnnotationFvRsBDToNetflowMonitorPolResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvRsBDToNetflowMonitorPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvRsBDToNetflowMonitorPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvRsBDToNetflowMonitorPolList = append(TagAnnotationFvRsBDToNetflowMonitorPolList, TagAnnotationFvRsBDToNetflowMonitorPol) + } + if childClassName == "tagTag" { + TagTagFvRsBDToNetflowMonitorPol := getEmptyTagTagFvRsBDToNetflowMonitorPolResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvRsBDToNetflowMonitorPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvRsBDToNetflowMonitorPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvRsBDToNetflowMonitorPolList = append(TagTagFvRsBDToNetflowMonitorPolList, TagTagFvRsBDToNetflowMonitorPol) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvRsBDToNetflowMonitorPolList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvRsBDToNetflowMonitorPolList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvRsBDToNetflowMonitorPol'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvRsBDToNetflowMonitorPolRn(ctx context.Context, data *FvRsBDToNetflowMonitorPolResourceModel) string { + rn := "rsBDToNetflowMonitorPol-[{tnNetflowMonitorPolName}]-{fltType}" + for _, identifier := range []string{"tnNetflowMonitorPolName", "fltType"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFvRsBDToNetflowMonitorPolParentDn(ctx context.Context, dn string, data *FvRsBDToNetflowMonitorPolResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvRsBDToNetflowMonitorPolId(ctx context.Context, data *FvRsBDToNetflowMonitorPolResourceModel) { + rn := getFvRsBDToNetflowMonitorPolRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvRsBDToNetflowMonitorPolTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvRsBDToNetflowMonitorPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsBDToNetflowMonitorPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() && !tagAnnotation.Key.IsNull() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() && !tagAnnotation.Value.IsNull() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvRsBDToNetflowMonitorPolTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvRsBDToNetflowMonitorPolResourceModel, tagTagPlan, tagTagState []TagTagFvRsBDToNetflowMonitorPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() && !tagTag.Key.IsNull() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() && !tagTag.Value.IsNull() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvRsBDToNetflowMonitorPolCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, createType bool, data *FvRsBDToNetflowMonitorPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsBDToNetflowMonitorPolResourceModel, tagTagPlan, tagTagState []TagTagFvRsBDToNetflowMonitorPolResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + + if createType && !globalAllowExistingOnCreate { + payloadMap["attributes"].(map[string]string)["status"] = "created" + } + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getFvRsBDToNetflowMonitorPolTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvRsBDToNetflowMonitorPolTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.FltType.IsNull() && !data.FltType.IsUnknown() { + payloadMap["attributes"].(map[string]string)["fltType"] = data.FltType.ValueString() + } + if !data.TnNetflowMonitorPolName.IsNull() && !data.TnNetflowMonitorPolName.IsUnknown() { + payloadMap["attributes"].(map[string]string)["tnNetflowMonitorPolName"] = data.TnNetflowMonitorPolName.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvRsBDToNetflowMonitorPol": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_relation_from_bridge_domain_to_netflow_monitor_policy_test.go b/internal/provider/resource_aci_relation_from_bridge_domain_to_netflow_monitor_policy_test.go new file mode 100644 index 000000000..e2faebd09 --- /dev/null +++ b/internal/provider/resource_aci_relation_from_bridge_domain_to_netflow_monitor_policy_test.go @@ -0,0 +1,294 @@ +// 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 TestAccResourceFvRsBDToNetflowMonitorPolWithFvBD(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvRsBDToNetflowMonitorPolMinDependencyWithFvBDAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.allow_test", "netflow_monitor_policy_name", "test_tn_netflow_monitor_pol_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.allow_test_2", "netflow_monitor_policy_name", "test_tn_netflow_monitor_pol_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.allow_test", "filter_type", "ipv4"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.allow_test_2", "filter_type", "ipv4"), + ), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "false") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvRsBDToNetflowMonitorPolMinDependencyWithFvBDAllowExisting, + ExpectError: regexp.MustCompile("Object Already Exists"), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "true") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvRsBDToNetflowMonitorPolMinDependencyWithFvBDAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.allow_test", "netflow_monitor_policy_name", "test_tn_netflow_monitor_pol_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.allow_test_2", "netflow_monitor_policy_name", "test_tn_netflow_monitor_pol_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.allow_test", "filter_type", "ipv4"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.allow_test_2", "filter_type", "ipv4"), + ), + }, + }, + }) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvRsBDToNetflowMonitorPolMinDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "netflow_monitor_policy_name", "test_tn_netflow_monitor_pol_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "filter_type", "ipv4"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvRsBDToNetflowMonitorPolAllDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "netflow_monitor_policy_name", "test_tn_netflow_monitor_pol_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "filter_type", "ce"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvRsBDToNetflowMonitorPolMinDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "filter_type", "ipv4"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "netflow_monitor_policy_name", "test_tn_netflow_monitor_pol_name"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvRsBDToNetflowMonitorPolResetDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "filter_type", "ipv4"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "netflow_monitor_policy_name", "test_tn_netflow_monitor_pol_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotation", "orchestrator:terraform"), + ), + }, + // Import testing + { + ResourceName: "aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children + { + Config: testConfigFvRsBDToNetflowMonitorPolChildrenDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "filter_type", "ipv4"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "netflow_monitor_policy_name", "test_tn_netflow_monitor_pol_name"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "tags.1.value", "test_value"), + ), + }, + // Refresh State before import testing to ensure that the state is up to date + { + RefreshState: true, + ExpectNonEmptyPlan: false, + }, + // Import testing with children + { + ResourceName: "aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children removed from config + { + Config: testConfigFvRsBDToNetflowMonitorPolChildrenRemoveFromConfigDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "tags.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvRsBDToNetflowMonitorPolChildrenRemoveOneDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotations.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "tags.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvRsBDToNetflowMonitorPolChildrenRemoveAllDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_relation_from_bridge_domain_to_netflow_monitor_policy.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvRsBDToNetflowMonitorPolMinDependencyWithFvBDAllowExisting = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "allow_test" { + parent_dn = aci_bridge_domain.test.id + filter_type = "ipv4" + netflow_monitor_policy_name = "test_tn_netflow_monitor_pol_name" +} +resource "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "allow_test_2" { + parent_dn = aci_bridge_domain.test.id + filter_type = "ipv4" + netflow_monitor_policy_name = "test_tn_netflow_monitor_pol_name" + depends_on = [aci_relation_from_bridge_domain_to_netflow_monitor_policy.allow_test] +} +` + +const testConfigFvRsBDToNetflowMonitorPolMinDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "test" { + parent_dn = aci_bridge_domain.test.id + filter_type = "ipv4" + netflow_monitor_policy_name = "test_tn_netflow_monitor_pol_name" +} +` + +const testConfigFvRsBDToNetflowMonitorPolAllDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "test" { + parent_dn = aci_bridge_domain.test.id + netflow_monitor_policy_name = "test_tn_netflow_monitor_pol_name" + annotation = "annotation" + filter_type = "ce" +} +` + +const testConfigFvRsBDToNetflowMonitorPolResetDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "test" { + parent_dn = aci_bridge_domain.test.id + netflow_monitor_policy_name = "test_tn_netflow_monitor_pol_name" + annotation = "orchestrator:terraform" + filter_type = "ipv4" +} +` +const testConfigFvRsBDToNetflowMonitorPolChildrenDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "test" { + parent_dn = aci_bridge_domain.test.id + filter_type = "ipv4" + netflow_monitor_policy_name = "test_tn_netflow_monitor_pol_name" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigFvRsBDToNetflowMonitorPolChildrenRemoveFromConfigDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "test" { + parent_dn = aci_bridge_domain.test.id + filter_type = "ipv4" + netflow_monitor_policy_name = "test_tn_netflow_monitor_pol_name" +} +` + +const testConfigFvRsBDToNetflowMonitorPolChildrenRemoveOneDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "test" { + parent_dn = aci_bridge_domain.test.id + filter_type = "ipv4" + netflow_monitor_policy_name = "test_tn_netflow_monitor_pol_name" + annotations = [ + { + key = "key_1" + value = "test_value" + }, + ] + tags = [ + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigFvRsBDToNetflowMonitorPolChildrenRemoveAllDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_relation_from_bridge_domain_to_netflow_monitor_policy" "test" { + parent_dn = aci_bridge_domain.test.id + filter_type = "ipv4" + netflow_monitor_policy_name = "test_tn_netflow_monitor_pol_name" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_rogue_coop_exception.go b/internal/provider/resource_aci_rogue_coop_exception.go new file mode 100644 index 000000000..1b0e8f7af --- /dev/null +++ b/internal/provider/resource_aci_rogue_coop_exception.go @@ -0,0 +1,694 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvRogueExceptionMacResource{} +var _ resource.ResourceWithImportState = &FvRogueExceptionMacResource{} + +func NewFvRogueExceptionMacResource() resource.Resource { + return &FvRogueExceptionMacResource{} +} + +// FvRogueExceptionMacResource defines the resource implementation. +type FvRogueExceptionMacResource struct { + client *client.Client +} + +// FvRogueExceptionMacResourceModel describes the resource data model. +type FvRogueExceptionMacResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + Mac types.String `tfsdk:"mac"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +func getEmptyFvRogueExceptionMacResourceModel() *FvRogueExceptionMacResourceModel { + return &FvRogueExceptionMacResourceModel{ + Id: basetypes.NewStringNull(), + ParentDn: basetypes.NewStringNull(), + Annotation: basetypes.NewStringNull(), + Descr: basetypes.NewStringNull(), + Mac: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + TagAnnotation: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + TagTag: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + } +} + +// TagAnnotationFvRogueExceptionMacResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvRogueExceptionMacResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagAnnotationFvRogueExceptionMacResourceModel() TagAnnotationFvRogueExceptionMacResourceModel { + return TagAnnotationFvRogueExceptionMacResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +// TagTagFvRogueExceptionMacResourceModel describes the resource data model for the children without relation ships. +type TagTagFvRogueExceptionMacResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func getEmptyTagTagFvRogueExceptionMacResourceModel() TagTagFvRogueExceptionMacResourceModel { + return TagTagFvRogueExceptionMacResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + +type FvRogueExceptionMacIdentifier struct { + Mac types.String +} + +func (r *FvRogueExceptionMacResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) { + if !req.Plan.Raw.IsNull() { + var planData, stateData *FvRogueExceptionMacResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &planData)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + if (planData.Id.IsUnknown() || planData.Id.IsNull()) && !planData.ParentDn.IsUnknown() && !planData.Mac.IsUnknown() { + setFvRogueExceptionMacId(ctx, planData) + } + + if stateData == nil && !globalAllowExistingOnCreate && !planData.Id.IsUnknown() && !planData.Id.IsNull() { + CheckDn(ctx, &resp.Diagnostics, r.client, "fvRogueExceptionMac", planData.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + } + + resp.Diagnostics.Append(resp.Plan.Set(ctx, &planData)...) + } +} + +func (r *FvRogueExceptionMacResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_rogue_coop_exception") + resp.TypeName = req.ProviderTypeName + "_rogue_coop_exception" + tflog.Debug(ctx, "End metadata of resource: aci_rogue_coop_exception") +} + +func (r *FvRogueExceptionMacResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_rogue_coop_exception") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The rogue_coop_exception resource for the 'fvRogueExceptionMac' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Rogue Coop Exception object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the Rogue Coop Exception object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The description of the Rogue Coop Exception object.`, + }, + "mac": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The MAC address of the Rogue Coop Exception object.`, + }, + "name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The name of the Rogue Coop Exception object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), + }, + MarkdownDescription: `The name alias of the Rogue Coop Exception object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_rogue_coop_exception") +} + +func (r *FvRogueExceptionMacResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_rogue_coop_exception") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_rogue_coop_exception") +} + +func (r *FvRogueExceptionMacResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_rogue_coop_exception") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvRogueExceptionMacResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + if stateData.Id.IsUnknown() || stateData.Id.IsNull() { + setFvRogueExceptionMacId(ctx, stateData) + } + getAndSetFvRogueExceptionMacAttributes(ctx, &resp.Diagnostics, r.client, stateData) + if !globalAllowExistingOnCreate && !stateData.Id.IsNull() { + resp.Diagnostics.AddError( + "Object Already Exists", + fmt.Sprintf("The fvRogueExceptionMac object with DN '%s' already exists.", stateData.Id.ValueString()), + ) + return + } + + var data *FvRogueExceptionMacResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + if data.Id.IsUnknown() || data.Id.IsNull() { + setFvRogueExceptionMacId(ctx, data) + } + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_rogue_coop_exception with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRogueExceptionMacResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvRogueExceptionMacResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvRogueExceptionMacCreateJsonPayload(ctx, &resp.Diagnostics, true, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvRogueExceptionMacAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_rogue_coop_exception with id '%s'", data.Id.ValueString())) +} + +func (r *FvRogueExceptionMacResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_rogue_coop_exception") + var data *FvRogueExceptionMacResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_rogue_coop_exception with id '%s'", data.Id.ValueString())) + + getAndSetFvRogueExceptionMacAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvRogueExceptionMacResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_rogue_coop_exception with id '%s'", data.Id.ValueString())) +} + +func (r *FvRogueExceptionMacResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_rogue_coop_exception") + var data *FvRogueExceptionMacResourceModel + var stateData *FvRogueExceptionMacResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_rogue_coop_exception with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRogueExceptionMacResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvRogueExceptionMacResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvRogueExceptionMacCreateJsonPayload(ctx, &resp.Diagnostics, false, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvRogueExceptionMacAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_rogue_coop_exception with id '%s'", data.Id.ValueString())) +} + +func (r *FvRogueExceptionMacResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_rogue_coop_exception") + var data *FvRogueExceptionMacResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_rogue_coop_exception with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvRogueExceptionMac", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_rogue_coop_exception with id '%s'", data.Id.ValueString())) +} + +func (r *FvRogueExceptionMacResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_rogue_coop_exception") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvRogueExceptionMacResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_rogue_coop_exception with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_rogue_coop_exception") +} + +func getAndSetFvRogueExceptionMacAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvRogueExceptionMacResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvRogueExceptionMac,tagAnnotation,tagTag"), "GET", nil) + + *data = *getEmptyFvRogueExceptionMacResourceModel() + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvRogueExceptionMac").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvRogueExceptionMac").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvRogueExceptionMacParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "mac" { + data.Mac = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationFvRogueExceptionMacList := make([]TagAnnotationFvRogueExceptionMacResourceModel, 0) + TagTagFvRogueExceptionMacList := make([]TagTagFvRogueExceptionMacResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationFvRogueExceptionMac := getEmptyTagAnnotationFvRogueExceptionMacResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvRogueExceptionMac.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvRogueExceptionMac.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvRogueExceptionMacList = append(TagAnnotationFvRogueExceptionMacList, TagAnnotationFvRogueExceptionMac) + } + if childClassName == "tagTag" { + TagTagFvRogueExceptionMac := getEmptyTagTagFvRogueExceptionMacResourceModel() + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvRogueExceptionMac.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvRogueExceptionMac.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvRogueExceptionMacList = append(TagTagFvRogueExceptionMacList, TagTagFvRogueExceptionMac) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvRogueExceptionMacList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvRogueExceptionMacList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvRogueExceptionMac'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvRogueExceptionMacRn(ctx context.Context, data *FvRogueExceptionMacResourceModel) string { + rn := "rgexpmac-{mac}" + for _, identifier := range []string{"mac"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFvRogueExceptionMacParentDn(ctx context.Context, dn string, data *FvRogueExceptionMacResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvRogueExceptionMacId(ctx context.Context, data *FvRogueExceptionMacResourceModel) { + rn := getFvRogueExceptionMacRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvRogueExceptionMacTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvRogueExceptionMacResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRogueExceptionMacResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() && !tagAnnotation.Key.IsNull() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() && !tagAnnotation.Value.IsNull() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvRogueExceptionMacTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvRogueExceptionMacResourceModel, tagTagPlan, tagTagState []TagTagFvRogueExceptionMacResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() && !tagTag.Key.IsNull() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() && !tagTag.Value.IsNull() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvRogueExceptionMacCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, createType bool, data *FvRogueExceptionMacResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRogueExceptionMacResourceModel, tagTagPlan, tagTagState []TagTagFvRogueExceptionMacResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + + if createType && !globalAllowExistingOnCreate { + payloadMap["attributes"].(map[string]string)["status"] = "created" + } + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getFvRogueExceptionMacTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvRogueExceptionMacTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.Mac.IsNull() && !data.Mac.IsUnknown() { + payloadMap["attributes"].(map[string]string)["mac"] = data.Mac.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvRogueExceptionMac": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_rogue_coop_exception_test.go b/internal/provider/resource_aci_rogue_coop_exception_test.go new file mode 100644 index 000000000..58a676ba2 --- /dev/null +++ b/internal/provider/resource_aci_rogue_coop_exception_test.go @@ -0,0 +1,306 @@ +// 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 TestAccResourceFvRogueExceptionMacWithFvBD(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvRogueExceptionMacMinDependencyWithFvBDAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test", "mac", "00:00:00:00:00:01"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test_2", "mac", "00:00:00:00:00:01"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test", "name", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test_2", "name", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test_2", "name_alias", ""), + ), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "false") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvRogueExceptionMacMinDependencyWithFvBDAllowExisting, + ExpectError: regexp.MustCompile("Object Already Exists"), + }, + }, + }) + + setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "true") + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvRogueExceptionMacMinDependencyWithFvBDAllowExisting, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test", "mac", "00:00:00:00:00:01"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test_2", "mac", "00:00:00:00:00:01"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test", "name", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test_2", "name", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.allow_test_2", "name_alias", ""), + ), + }, + }, + }) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvRogueExceptionMacMinDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "mac", "00:00:00:00:00:01"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "description", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "name", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "name_alias", ""), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvRogueExceptionMacAllDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "mac", "00:00:00:00:00:01"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "description", "description_1"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "name", "name_1"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "name_alias", "name_alias_1"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvRogueExceptionMacMinDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "mac", "00:00:00:00:00:01"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvRogueExceptionMacResetDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "mac", "00:00:00:00:00:01"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "description", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "name", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "name_alias", ""), + ), + }, + // Import testing + { + ResourceName: "aci_rogue_coop_exception.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children + { + Config: testConfigFvRogueExceptionMacChildrenDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "mac", "00:00:00:00:00:01"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "description", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "name", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "tags.1.value", "test_value"), + ), + }, + // Refresh State before import testing to ensure that the state is up to date + { + RefreshState: true, + ExpectNonEmptyPlan: false, + }, + // Import testing with children + { + ResourceName: "aci_rogue_coop_exception.test", + ImportState: true, + ImportStateVerify: true, + }, + // Update with children removed from config + { + Config: testConfigFvRogueExceptionMacChildrenRemoveFromConfigDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotations.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "tags.1.value", "test_value"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvRogueExceptionMacChildrenRemoveOneDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotations.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "tags.0.value", "test_value"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvRogueExceptionMacChildrenRemoveAllDependencyWithFvBD, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_rogue_coop_exception.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvRogueExceptionMacMinDependencyWithFvBDAllowExisting = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_rogue_coop_exception" "allow_test" { + parent_dn = aci_bridge_domain.test.id + mac = "00:00:00:00:00:01" +} +resource "aci_rogue_coop_exception" "allow_test_2" { + parent_dn = aci_bridge_domain.test.id + mac = "00:00:00:00:00:01" + depends_on = [aci_rogue_coop_exception.allow_test] +} +` + +const testConfigFvRogueExceptionMacMinDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_rogue_coop_exception" "test" { + parent_dn = aci_bridge_domain.test.id + mac = "00:00:00:00:00:01" +} +` + +const testConfigFvRogueExceptionMacAllDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_rogue_coop_exception" "test" { + parent_dn = aci_bridge_domain.test.id + mac = "00:00:00:00:00:01" + annotation = "annotation" + description = "description_1" + name = "name_1" + name_alias = "name_alias_1" +} +` + +const testConfigFvRogueExceptionMacResetDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_rogue_coop_exception" "test" { + parent_dn = aci_bridge_domain.test.id + mac = "00:00:00:00:00:01" + annotation = "orchestrator:terraform" + description = "" + name = "" + name_alias = "" +} +` +const testConfigFvRogueExceptionMacChildrenDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_rogue_coop_exception" "test" { + parent_dn = aci_bridge_domain.test.id + mac = "00:00:00:00:00:01" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigFvRogueExceptionMacChildrenRemoveFromConfigDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_rogue_coop_exception" "test" { + parent_dn = aci_bridge_domain.test.id + mac = "00:00:00:00:00:01" +} +` + +const testConfigFvRogueExceptionMacChildrenRemoveOneDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_rogue_coop_exception" "test" { + parent_dn = aci_bridge_domain.test.id + mac = "00:00:00:00:00:01" + annotations = [ + { + key = "key_1" + value = "test_value" + }, + ] + tags = [ + { + key = "key_1" + value = "test_value" + }, + ] +} +` + +const testConfigFvRogueExceptionMacChildrenRemoveAllDependencyWithFvBD = testConfigFvBDMinDependencyWithFvTenant + ` +resource "aci_rogue_coop_exception" "test" { + parent_dn = aci_bridge_domain.test.id + mac = "00:00:00:00:00:01" + annotations = [] + tags = [] +} +`