Skip to content

Commit

Permalink
[ignore] Fix small comments on NetFlow Exporter and rename customtype…
Browse files Browse the repository at this point in the history
… to custom_type
  • Loading branch information
lhercot committed Sep 10, 2024
1 parent f66657b commit f95173e
Show file tree
Hide file tree
Showing 27 changed files with 63 additions and 55 deletions.
8 changes: 4 additions & 4 deletions docs/data-sources/netflow_exporter_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ data "aci_netflow_exporter_policy" "example_tenant" {
* `source_ip_address` (srcAddr) - (string) The source IP address.
* `version` (ver) - (string) The NetFlow Exporter Version of the NetFlow Exporter Policy object.

* `relation_to_vrf` - (list) A list of Relation To VRF (ACI object [netflowRsExporterToCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowRsExporterToCtx/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.
* `relation_to_vrf` - (list) A list of Relation From NetFlow Exporter To VRF (ACI object [netflowRsExporterToCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowRsExporterToCtx/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 From NetFlow Exporter To VRF object.
* `target_dn` (tDn) - (string) The distinguished name of the target.

* `relation_to_epg` - (list) A list of Relation To EPG (ACI object [netflowRsExporterToEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowRsExporterToEPg/overview)). This relation can point to multiple ACI objects:
* `relation_to_epg` - (list) A list of Relation From NetFlow Exporter To EPG (ACI object [netflowRsExporterToEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowRsExporterToEPg/overview)). This relation can point to multiple ACI objects:
- [fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview).
- [l3extInstP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extInstP/overview).
- [l2extInstP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l2extInstP/overview).
* `annotation` (annotation) - (string) The annotation of the Relation To EPG object.
* `annotation` (annotation) - (string) The annotation of the Relation From NetFlow Exporter To EPG object.
* `target_dn` (tDn) - (string) The distinguished name of the target.

* `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.
Expand Down
8 changes: 4 additions & 4 deletions docs/resources/netflow_exporter_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,26 +138,26 @@ All examples for the NetFlow Exporter Policy resource can be found in the [examp
- Default: `v9`
- Valid Values: `cisco-v1`, `v5`, `v9`.

* `relation_to_vrf` - (list) A list of Relation To VRF (ACI object [netflowRsExporterToCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowRsExporterToCtx/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.
* `relation_to_vrf` - (list) A list of Relation From NetFlow Exporter To VRF (ACI object [netflowRsExporterToCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowRsExporterToCtx/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.
- Max Items: 1


#### Optional ####

* `annotation` (annotation) - (string) The annotation of the Relation To VRF object.
* `annotation` (annotation) - (string) The annotation of the Relation From NetFlow Exporter To VRF object.
- Default: `orchestrator:terraform`
* `target_dn` (tDn) - (string) The distinguished name of the target.

* `relation_to_epg` - (list) A list of Relation To EPG (ACI object [netflowRsExporterToEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowRsExporterToEPg/overview)). This relation can point to multiple ACI objects:
* `relation_to_epg` - (list) A list of Relation From NetFlow Exporter To EPG (ACI object [netflowRsExporterToEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowRsExporterToEPg/overview)). This relation can point to multiple ACI objects:
- [fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview) which can be configured using the [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) resource.
- [l3extInstP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extInstP/overview) which can be configured using the [aci_external_network_instance_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/external_network_instance_profile) resource.
- [l2extInstP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l2extInstP/overview) which can be configured using the [aci_l2out_extepg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l2out_extepg) resource.


#### Optional ####

* `annotation` (annotation) - (string) The annotation of the Relation To EPG object.
* `annotation` (annotation) - (string) The annotation of the Relation From NetFlow Exporter To EPG object.
- Default: `orchestrator:terraform`
* `target_dn` (tDn) - (string) The distinguished name of the target.

Expand Down
4 changes: 2 additions & 2 deletions gen/definitions/classes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ netflowExporterPol:
sub_category: "Tenant Policies"

netflowRsExporterToEPg:
resource_name: "relation_to_epg"
resource_name: "relation_from_netflow_exporter_to_epg"
ui_locations:
- "Tenants -> Policies -> NetFlow -> NetFlow Exporters"
- "Fabric -> Access Policies -> Policies -> Interface -> NetFlow -> NetFlow Exporters"
Expand All @@ -365,7 +365,7 @@ netflowRsExporterToEPg:
- "l2extInstP"

netflowRsExporterToCtx:
resource_name: "relation_to_vrf"
resource_name: "relation_from_netflow_exporter_to_vrf"
ui_locations:
- "Tenants -> Policies -> NetFlow -> NetFlow Exporters"
- "Fabric -> Access Policies -> Policies -> Interface -> NetFlow -> NetFlow Exporters"
Expand Down
22 changes: 15 additions & 7 deletions gen/definitions/properties.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ resource_name_overwrite:
relation_from_l3out_consumer_label_to_external_epg: "external_network_instance_profile"
relation_to_external_epgs: "external_network_instance_profile"
relation_from_l3out_consumer_label_to_route_control_profile: "route_control_profile"
relation_to_vrf: "vrf"
relation_from_netflow_exporter_to_vrf: "vrf"
relation_to_epg: "application_epg"
relation_from_netflow_exporter_to_epg: "application_epg"

l3extRsRedistributePol:
overwrites:
Expand Down Expand Up @@ -93,11 +97,11 @@ mgmtSubnet:
ip: "2.2.2.0/24"

mgmtInstP:
ignore_customtype_docs:
ignore_custom_type_docs:
- "Prio"

mgmtRsOoBCons:
ignore_customtype_docs:
ignore_custom_type_docs:
- "Prio"

l3extConsLbl:
Expand Down Expand Up @@ -416,7 +420,7 @@ fvRsScope:
fvRsCons:
ignores:
- "intent"
ignore_customtype_docs:
ignore_custom_type_docs:
- "Prio"
parents:
- class_name: "fvESg"
Expand All @@ -427,7 +431,7 @@ fvRsCons:
fvRsProv:
ignores:
- "intent"
ignore_customtype_docs:
ignore_custom_type_docs:
- "Prio"
parents:
- class_name: "fvESg"
Expand All @@ -436,7 +440,7 @@ fvRsProv:
parent_dependency: "fvAp"

fvRsConsIf:
ignore_customtype_docs:
ignore_custom_type_docs:
- "Prio"
parents:
- class_name: "fvESg"
Expand Down Expand Up @@ -673,7 +677,7 @@ fvAEPg:
remove_valid_values:
pcTag:
- "any"
ignore_customtype_docs:
ignore_custom_type_docs:
- "Prio"
default_values:
shutdown: "no"
Expand Down Expand Up @@ -981,6 +985,8 @@ netflowExporterPol:
parent_dn: "aci_tenant.test.id"

netflowRsExporterToEPg:
overwrites:
relation_from_netflow_exporter_to_epg: "relation_to_epg"
parents:
- class_name: "netflowExporterPol"
target_classes:
Expand All @@ -989,10 +995,12 @@ netflowRsExporterToEPg:
- class_name: "fvAEPg"
target_dn: "uni/tn-test_tenant/ap-test_ap/epg-test_epg"
target_dn_overwrite_docs: "aci_application_epg.example.id"
relation_resource_name: "epg"
relation_resource_name: "application_epg"
static: true

netflowRsExporterToCtx:
overwrites:
relation_from_netflow_exporter_to_vrf: "relation_to_vrf"
parents:
- class_name: "netflowExporterPol"
target_classes:
Expand Down
2 changes: 1 addition & 1 deletion gen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2448,7 +2448,7 @@ func IsRequiredInTestValue(classPkgName, propertyName string, definitions Defini
func HasCustomTypeDocs(classPkgName, propertyName string, definitions Definitions) bool {
if classDetails, ok := definitions.Properties[classPkgName]; ok {
for key, value := range classDetails.(map[interface{}]interface{}) {
if key.(string) == "ignore_customtype_docs" {
if key.(string) == "ignore_custom_type_docs" {
for _, property := range value.([]interface{}) {
if property.(string) == propertyName {
return false
Expand Down
20 changes: 10 additions & 10 deletions gen/templates/resource_test.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,13 @@ func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *tes
),
},
{{- end}}
{{- if $.customtype}}
// Update with minimum config and customtype semantic equivalent values
{{- if $.custom_type}}
// Update with minimum config and custom type semantic equivalent values
{
Config: testConfig{{$.resourceClassName}}CustomTypeDependencyWith{{capitalize .class_name}},
ExpectNonEmptyPlan: {{.class_in_parent}},
Check: resource.ComposeAggregateTestCheckFunc(
{{- range $key, $value := $.customtype}}
{{- range $key, $value := $.custom_type}}
{{- if eq $key "target_dn" }}
resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}_1{{- end }}", "{{$key}}", "{{getTestTargetDn $.targets $.resourceName $value false $target_classes 0 false}}"),
{{- else }}
Expand Down Expand Up @@ -821,12 +821,12 @@ func TestAccResource{{.resourceClassName}}(t *testing.T) {
),
},
{{- end}}
{{- if $.customtype}}
// Update with minimum config and customtype semantic equivalent values
{{- if $.custom_type}}
// Update with minimum config and custom type semantic equivalent values
{
Config: testConfig{{$.resourceClassName}}CustomType,
Check: resource.ComposeAggregateTestCheckFunc(
{{- range $key, $value := $.customtype}}
{{- range $key, $value := $.custom_type}}
{{- if eq $key "target_dn" }}
resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{getTestTargetDn $.targets $.resourceName $value false nil 0 false}}"),
{{- else }}
Expand Down Expand Up @@ -1070,11 +1070,11 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas
`
{{- end}}

{{if $.customtype}}
{{if $.custom_type}}
const testConfig{{$.resourceClassName}}CustomTypeDependencyWith{{capitalize .class_name}} = {{- if $dependencies }} testDependencyConfig{{$.resourceClassName}} + {{- end }} testConfig{{capitalize .class_name}}Min{{- if ne .parent_dependency ""}}DependencyWith{{capitalize .parent_dependency}}{{if and (ne .parent_dependency_name nil) (ne .parent_dependency_name "")}}{{capitalize .parent_dependency_name }}{{- end }}{{- end}} + `
resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClassName }}_1{{- end }}" {
parent_dn = {{.parent_dn}}
{{- range $key, $value := $.customtype}}
{{- range $key, $value := $.custom_type}}
{{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true $target_classes 0 false}}
{{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}}
{{- else }}
Expand Down Expand Up @@ -1246,10 +1246,10 @@ resource "aci_{{$.resourceName}}" "test" {
`
{{- end}}

{{if $.customtype}}
{{if $.custom_type}}
const testConfig{{.resourceClassName}}CustomType = `
resource "aci_{{$.resourceName}}" "test" {
{{- range $key, $value := $.customtype}}
{{- range $key, $value := $.custom_type}}
{{$key}} = "{{$value}}"
{{- end}}
}
Expand Down
2 changes: 1 addition & 1 deletion gen/templates/testvars.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ resource_required:
{{- end}}
{{- if .HasCustomTypeProperties}}

customtype:
custom_type:
{{- range .Properties}}{{$testValue := createTestValue .SnakeCaseName}}{{$overwritePropertyName := overwriteProperty .PkgName .SnakeCaseName $.Definitions}}
{{- if .HasCustomType}}
{{overwriteProperty .PkgName .SnakeCaseName $.Definitions}}: {{$validValuesMap := .ValidValuesMap}}{{range $key, $value := $validValuesMap}}{{if or (ne $value "unspecified") (eq (len $validValuesMap) 1)}}"{{$key}}"{{break}}{{end}}{{end}}
Expand Down
2 changes: 1 addition & 1 deletion gen/testvars/fvAEPg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ datasource_required:
resource_required:
name: "test_name"

customtype:
custom_type:
name: "test_name"
priority: "1"

Expand Down
2 changes: 1 addition & 1 deletion gen/testvars/fvRsCons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ datasource_required:
resource_required:
contract_name: "test_tn_vz_br_cp_name"

customtype:
custom_type:
priority: "1"
contract_name: "test_tn_vz_br_cp_name"

Expand Down
2 changes: 1 addition & 1 deletion gen/testvars/fvRsConsIf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ datasource_required:
resource_required:
imported_contract_name: "test_tn_vz_cp_if_name"

customtype:
custom_type:
priority: "1"
imported_contract_name: "test_tn_vz_cp_if_name"

Expand Down
2 changes: 1 addition & 1 deletion gen/testvars/fvRsProv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ datasource_required:
resource_required:
contract_name: "test_tn_vz_br_cp_name"

customtype:
custom_type:
priority: "1"
contract_name: "test_tn_vz_br_cp_name"

Expand Down
2 changes: 1 addition & 1 deletion gen/testvars/mgmtInstP.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ datasource_required:
resource_required:
name: "test_name"

customtype:
custom_type:
name: "test_name"
priority: "1"

Expand Down
2 changes: 1 addition & 1 deletion gen/testvars/mgmtRsOoBCons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ datasource_required:
resource_required:
out_of_band_contract_name: "test_tn_vz_oob_br_cp_name"

customtype:
custom_type:
priority: "1"
out_of_band_contract_name: "test_tn_vz_oob_br_cp_name"

Expand Down
4 changes: 2 additions & 2 deletions gen/testvars/netflowExporterPol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ resource_required:
name: "netfow_exporter"
source_ip_address: "1.1.1.1/10"

customtype:
custom_type:
qos_dscp_value: "0"
destination_ip_address: "2.2.2.1"
destination_port: "110"
Expand Down Expand Up @@ -84,5 +84,5 @@ child_targets:
- class_name: "fvAEPg"
target_dn: "uni/tn-test_tenant/ap-test_ap/epg-test_epg"
target_dn_overwrite_docs: "aci_application_epg.example.id"
relation_resource_name: "epg"
relation_resource_name: "application_epg"
static: true
2 changes: 1 addition & 1 deletion gen/testvars/qosDppPol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ datasource_required:
resource_required:
name: "test_name"

customtype:
custom_type:
excessive_burst: "0xffffffffffffffff"
burst: "0xffffffffffffffff"
conform_mark_cos: "0xffff"
Expand Down
2 changes: 1 addition & 1 deletion gen/testvars/vzOOBBrCP.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ datasource_required:
resource_required:
name: "test_name"

customtype:
custom_type:
name: "test_name"
priority: "1"
target_dscp: "0"
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/data_source_aci_netflow_exporter_policy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/provider/resource_aci_application_epg_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/provider/resource_aci_netflow_exporter_policy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f95173e

Please sign in to comment.