Skip to content

Commit

Permalink
[minor_changes] Added connector_type and att_notify parameters to 'ac…
Browse files Browse the repository at this point in the history
…i_function_mode' and fixed documentation for aci_function_node and and aci_connection to have a particular format for names and added examples to show these changes.
  • Loading branch information
anvitha-jain committed Mar 2, 2024
1 parent 6210f70 commit 8fd3f5f
Show file tree
Hide file tree
Showing 7 changed files with 483 additions and 202 deletions.
16 changes: 16 additions & 0 deletions aci/data_source_aci_vnsabsnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,22 @@ func dataSourceAciFunctionNode() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"l4_l7_device_interface_consumer_connector_type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"l4_l7_device_interface_provider_connector_type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"l4_l7_device_interface_consumer_att_notify": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"l4_l7_device_interface_provider_att_notify": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
}),
}
}
Expand Down
66 changes: 56 additions & 10 deletions aci/resource_aci_vnsabsnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,29 +148,63 @@ func resourceAciFunctionNode() *schema.Resource {
},

"relation_vns_rs_node_to_abs_func_prof": &schema.Schema{
Type: schema.TypeString,

Type: schema.TypeString,
Optional: true,
},
"relation_vns_rs_node_to_l_dev": &schema.Schema{
Type: schema.TypeString,

Type: schema.TypeString,
Optional: true,
},
"relation_vns_rs_node_to_m_func": &schema.Schema{
Type: schema.TypeString,

Type: schema.TypeString,
Optional: true,
},
"relation_vns_rs_default_scope_to_term": &schema.Schema{
Type: schema.TypeString,

Type: schema.TypeString,
Optional: true,
},
"relation_vns_rs_node_to_cloud_l_dev": &schema.Schema{
Type: schema.TypeString,

Type: schema.TypeString,
Optional: true,
},
"l4_l7_device_interface_consumer_connector_type": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{
"none",
"redir",
}, false),
},
"l4_l7_device_interface_provider_connector_type": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{
"none",
"redir",
"dnat",
"snat",
"snat_dnat",
}, false),
},
"l4_l7_device_interface_consumer_att_notify": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{
"no",
"yes",
}, false),
},
"l4_l7_device_interface_provider_att_notify": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{
"no",
"yes",
}, false),
},
}),
}
Expand Down Expand Up @@ -231,6 +265,8 @@ func getAndSetFunctionNodeRelationalAttributes(client *client.Client, dn string,
}
d.Set("conn_consumer_dn", vnsAbsFuncConn.DistinguishedName)
d.Set("l4_l7_device_interface_consumer_name", vnsAbsFuncConn.DeviceLIfName)
d.Set("l4_l7_device_interface_consumer_connector_type", vnsAbsFuncConn.ConnType)
d.Set("l4_l7_device_interface_consumer_att_notify", vnsAbsFuncConn.AttNotify)

// Provider Part
provDn := fmt.Sprintf("%s/AbsFConn-provider", dn)
Expand All @@ -244,6 +280,8 @@ func getAndSetFunctionNodeRelationalAttributes(client *client.Client, dn string,
}
d.Set("conn_provider_dn", vnsAbsFuncConn.DistinguishedName)
d.Set("l4_l7_device_interface_provider_name", vnsAbsFuncConn.DeviceLIfName)
d.Set("l4_l7_device_interface_provider_connector_type", vnsAbsFuncConn.ConnType)
d.Set("l4_l7_device_interface_provider_att_notify", vnsAbsFuncConn.AttNotify)

vnsRsNodeToAbsFuncProfData, err := client.ReadRelationvnsRsNodeToAbsFuncProfFromFunctionNode(dn)
if err != nil {
Expand Down Expand Up @@ -361,6 +399,8 @@ func resourceAciFunctionNodeCreate(ctx context.Context, d *schema.ResourceData,
vnsAbsFuncConnAttr := models.FunctionConnectorAttributes{}
vnsAbsFuncConnAttr.Annotation = "{}"
vnsAbsFuncConnAttr.DeviceLIfName = d.Get("l4_l7_device_interface_consumer_name").(string)
vnsAbsFuncConnAttr.AttNotify = d.Get("l4_l7_device_interface_consumer_att_notify").(string)
vnsAbsFuncConnAttr.ConnType = d.Get("l4_l7_device_interface_consumer_connector_type").(string)
vnsAbsFuncConn := models.NewFunctionConnector(fmt.Sprintf("AbsFConn-%s", "consumer"), vnsAbsNode.DistinguishedName, "", vnsAbsFuncConnAttr)
err = aciClient.Save(vnsAbsFuncConn)
if err != nil {
Expand All @@ -369,6 +409,8 @@ func resourceAciFunctionNodeCreate(ctx context.Context, d *schema.ResourceData,
d.Set("conn_consumer_dn", vnsAbsFuncConn.DistinguishedName)

vnsAbsFuncConnAttr.DeviceLIfName = d.Get("l4_l7_device_interface_provider_name").(string)
vnsAbsFuncConnAttr.AttNotify = d.Get("l4_l7_device_interface_provider_att_notify").(string)
vnsAbsFuncConnAttr.ConnType = d.Get("l4_l7_device_interface_provider_connector_type").(string)
vnsAbsFuncConn = models.NewFunctionConnector(fmt.Sprintf("AbsFConn-%s", "provider"), vnsAbsNode.DistinguishedName, "", vnsAbsFuncConnAttr)
err = aciClient.Save(vnsAbsFuncConn)
if err != nil {
Expand Down Expand Up @@ -509,6 +551,8 @@ func resourceAciFunctionNodeUpdate(ctx context.Context, d *schema.ResourceData,
vnsAbsFuncConnAttr := models.FunctionConnectorAttributes{}
vnsAbsFuncConnAttr.Annotation = "{}"
vnsAbsFuncConnAttr.DeviceLIfName = d.Get("l4_l7_device_interface_consumer_name").(string)
vnsAbsFuncConnAttr.AttNotify = d.Get("l4_l7_device_interface_consumer_att_notify").(string)
vnsAbsFuncConnAttr.ConnType = d.Get("l4_l7_device_interface_consumer_connector_type").(string)
vnsAbsFuncConn := models.NewFunctionConnector(fmt.Sprintf("AbsFConn-%s", "consumer"), vnsAbsNode.DistinguishedName, "", vnsAbsFuncConnAttr)
err = aciClient.Save(vnsAbsFuncConn)
if err != nil {
Expand All @@ -521,6 +565,8 @@ func resourceAciFunctionNodeUpdate(ctx context.Context, d *schema.ResourceData,
vnsAbsFuncConnAttr := models.FunctionConnectorAttributes{}
vnsAbsFuncConnAttr.Annotation = "{}"
vnsAbsFuncConnAttr.DeviceLIfName = d.Get("l4_l7_device_interface_provider_name").(string)
vnsAbsFuncConnAttr.AttNotify = d.Get("l4_l7_device_interface_provider_att_notify").(string)
vnsAbsFuncConnAttr.ConnType = d.Get("l4_l7_device_interface_provider_connector_type").(string)
vnsAbsFuncConn := models.NewFunctionConnector(fmt.Sprintf("AbsFConn-%s", "provider"), vnsAbsNode.DistinguishedName, "", vnsAbsFuncConnAttr)
err = aciClient.Save(vnsAbsFuncConn)
if err != nil {
Expand Down
6 changes: 5 additions & 1 deletion docs/data-sources/function_node.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ data "aci_function_node" "example" {
- `relation_vns_rs_node_to_l_dev` - (Read-Only) Represents the relation to Logical Device Abstraction (class vnsALDevIf). Type: String.
- `relation_vns_rs_node_to_m_func` - (Read-Only) Represents the relation to Meta Function (class vnsMFunc). Type: String.
- `relation_vns_rs_default_scope_to_term` - (Read-Only) Represents the relation to Terminal Abstract Class (class vnsATerm). Type: String.
- `relation_vns_rs_node_to_cloud_l_dev` - (Read-Only) Represents the relation to Cloud L4-L7 Abstract Devices (class cloudALDev). Type: String.
- `relation_vns_rs_node_to_cloud_l_dev` - (Read-Only) Represents the relation to Cloud L4-L7 Abstract Devices (class cloudALDev). Type: String.
- `l4_l7_device_interface_consumer_connector_type` - (Read-Only) The connection type of the consumer interface. Type: String.
- `l4_l7_device_interface_provider_connector_type` - (Read-Only) The connection type of the provider interface. Type: String.
- `l4_l7_device_interface_consumer_att_notify` - (Read-Only) The consumer interface attribute notification. Type: String.
- `l4_l7_device_interface_provider_att_notify` - (Read-Only) The provider interface attribute notification. Type: String.
2 changes: 1 addition & 1 deletion docs/resources/connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ resource "aci_connection" "conn2" {
## Argument Reference

- `l4_l7_service_graph_template_dn` - (Required) Distinguished name of parent L4-L7 Service Graph Template object.
- `name` - (Required) Name of object connection.
- `name` - (Required) Name of object connection. The valid connection name format is `CONX`, where X is a number starting with 0. Type: String.
- `adj_type` - (Optional) Connector adjacency type. Allowed values are "L2", "L3". Default value is "L2".
- `annotation` - (Optional) Annotation for object connection.
- `description` - (Optional) Description for object connection.
Expand Down
10 changes: 9 additions & 1 deletion docs/resources/function_node.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,17 @@ resource "aci_function_node" "example" {
share_encap = "yes"
l4_l7_device_interface_consumer_name = "interface1"
l4_l7_device_interface_provider_name = "interface2"
l4_l7_device_interface_consumer_connector_type = "none"
l4_l7_device_interface_provider_connector_type = "redir"
l4_l7_device_interface_consumer_att_notify = "no"
l4_l7_device_interface_provider_att_notify = "yes"
}
```

## Argument Reference

- `l4_l7_service_graph_template_dn` - (Required) Distinguished name of parent L4-L7 Service Graph Template object. Type: String.
- `name` - (Required) Name of the Function Node object. Type: String.
- `name` - (Required) Name of the Function Node object. The valid function node format is `NX`, where X is a number starting with 0. Type: String.
- `annotation` - (Optional) Annotation of the Function Node object. Type: String.
- `description` - (Optional) Description of the Function Node object. Type: String.
- `func_template_type` - (Optional) Function Template type of the Function Node object. Allowed values: "OTHER", "FW_TRANS", "FW_ROUTED", "CLOUD_VENDOR_LB", "CLOUD_VENDOR_FW", "CLOUD_NATIVE_LB", "CLOUD_NATIVE_FW", "ADC_TWO_ARM", "ADC_ONE_ARM". Default value: "OTHER". Type: String.
Expand All @@ -62,6 +66,10 @@ resource "aci_function_node" "example" {
- `relation_vns_rs_node_to_m_func` - (Optional) Represents the relation to Meta Function (class vnsMFunc). Type: String.
- `relation_vns_rs_default_scope_to_term` - (Optional) Represents the relation to Terminal Abstract Class (class vnsATerm). Type: String.
- `relation_vns_rs_node_to_cloud_l_dev` - (Optional) Represents the relation to Cloud L4-L7 Abstract Devices (class cloudALDev). Type: String.
- `l4_l7_device_interface_consumer_connector_type` - (Optional) The connection type of the consumer interface. Allowed values: "none", "redir". Default value: "none". This argument can be set only when the function node is a "network load balancer" or "third party firewall". Type: String.
- `l4_l7_device_interface_provider_connector_type` - (Optional) The connection type of the provider interface. Allowed values: "none", "redir", "dnat", "snat", "snat_dnat". This argument can be set only when the function node is a "network load balancer" or "third party firewall". Default value: "none". Type: String.
- `l4_l7_device_interface_consumer_att_notify` - (Optional) The consumer interface attribute notification. Allowed values: "no", "yes". Default value: "no". Type: String.
- `l4_l7_device_interface_provider_att_notify` - (Optional) The provider interface attribute notification. Allowed values: "no", "yes". Default value: "no". Type: String.

## Importing

Expand Down
Loading

0 comments on commit 8fd3f5f

Please sign in to comment.