Skip to content

Commit 0c743b3

Browse files
committed
Support transport node API of various versions
Various NSX versions expose different transport node attribute sets. Signed-off-by: Kobi Samoray <[email protected]>
1 parent d7b914e commit 0c743b3

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

nsxt/resource_nsxt_transport_node.go

+7-12
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,6 @@ func getEdgeNodeDeploymentConfigSchema() *schema.Schema {
282282
Optional: true,
283283
Description: "Host identifier in the specified vcenter server",
284284
},
285-
"ipv4_assignment_enabled": {
286-
Type: schema.TypeBool,
287-
Description: "This flag represents whether IPv4 configuration is enabled or not",
288-
Optional: true,
289-
Default: true,
290-
},
291285
"management_network_id": {
292286
Type: schema.TypeString,
293287
Required: true,
@@ -994,7 +988,6 @@ func getEdgeNodeDeploymentConfigFromSchema(cfg interface{}) (*model.EdgeNodeDepl
994988
dataNetworkIds := interface2StringList(vdc["data_network_ids"].([]interface{}))
995989
defaultGatewayAddresses := interface2StringList(vdc["default_gateway_address"].([]interface{}))
996990
hostID := vdc["host_id"].(string)
997-
ipv4AssignmentEnabled := vdc["ipv4_assignment_enabled"].(bool)
998991
managementNetworkID := vdc["management_network_id"].(string)
999992
var managemenPortSubnets []model.IPSubnet
1000993
for _, ipsi := range vdc["management_port_subnet"].([]interface{}) {
@@ -1030,7 +1023,6 @@ func getEdgeNodeDeploymentConfigFromSchema(cfg interface{}) (*model.EdgeNodeDepl
10301023
ComputeId: &computeID,
10311024
DataNetworkIds: dataNetworkIds,
10321025
HostId: &hostID,
1033-
Ipv4AssignmentEnabled: &ipv4AssignmentEnabled,
10341026
ManagementNetworkId: &managementNetworkID,
10351027
ManagementPortSubnets: managemenPortSubnets,
10361028
ReservationInfo: reservationInfo,
@@ -1204,18 +1196,22 @@ func getEdgeNodeSettingsFromSchema(s interface{}) (*model.EdgeNodeSettings, erro
12041196
Server: &server,
12051197
})
12061198
}
1207-
return &model.EdgeNodeSettings{
1199+
obj := &model.EdgeNodeSettings{
12081200
AdvancedConfiguration: advCfg,
12091201
AllowSshRootLogin: &allowSSHRootLogin,
12101202
DnsServers: dnsServers,
12111203
EnableSsh: &enableSSH,
1212-
EnableUptMode: &enableUptMode,
12131204
Hostname: &hostName,
12141205
NtpServers: ntpServers,
12151206
SearchDomains: searchDomains,
12161207
SyslogServers: syslogServers,
1217-
}, nil
1208+
}
1209+
if nsxVersionHigherOrEqual("4.0.0") {
1210+
obj.EnableUptMode = &enableUptMode
1211+
}
1212+
return obj, nil
12181213
}
1214+
12191215
return nil, nil
12201216
}
12211217

@@ -1762,7 +1758,6 @@ func setVMDeploymentConfigInSchema(config *data.StructValue) (interface{}, error
17621758
elem["data_network_ids"] = vSphereCfg.DataNetworkIds
17631759
elem["default_gateway_address"] = vSphereCfg.DefaultGatewayAddresses
17641760
elem["host_id"] = vSphereCfg.HostId
1765-
elem["ipv4_assignment_enabled"] = vSphereCfg.Ipv4AssignmentEnabled
17661761
elem["management_network_id"] = vSphereCfg.ManagementNetworkId
17671762

17681763
var mpSubnets []map[string]interface{}

website/docs/r/transport_node.html.markdown

-2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ The following arguments are supported:
164164
* `data_network_ids` - (Required) List of portgroups, logical switch identifiers or segment paths for datapath connectivity.
165165
* `default_gateway_address` - (Optional) Default gateway for the node.
166166
* `host_id` - (Optional) Host identifier in the specified vcenter server.
167-
* `ipv4_assignment_enabled` - (Optional) This flag represents whether IPv4 configuration is enabled or not. Defaults to true.
168167
* `management_network_id` - (Required) Portgroup, logical switch identifier or segment path for management network connectivity.
169168
* `management_port_subnet` - (Optional) Port subnets for management port. IPv4, IPv6 and Dual Stack Address is supported.
170169
* `ip_addresses` - (Required) List of IP addresses.
@@ -206,7 +205,6 @@ The following arguments are supported:
206205
* `data_network_ids` - (Required) List of portgroups, logical switch identifiers or segment paths for datapath connectivity.
207206
* `default_gateway_address` - (Optional) Default gateway for the node.
208207
* `host_id` - (Optional) Host identifier in the specified vcenter server.
209-
* `ipv4_assignment_enabled` - (Optional) This flag represents whether IPv4 configuration is enabled or not. Defaults to true.
210208
* `management_network_id` - (Required) Portgroup, logical switch identifier or segment path for management network connectivity.
211209
* `management_port_subnet` - (Optional) Port subnets for management port. IPv4, IPv6 and Dual Stack Address is supported.
212210
* `ip_addresses` - (Required) List of IP addresses.

0 commit comments

Comments
 (0)