-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New functionality for handling vApp network NAT #316
Conversation
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
# Conflicts: # govcd/vapp_network_test.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some changes required
govcd/vapp_network.go
Outdated
|
||
util.Logger.Printf("[TRACE] Looking for networks: %s --- %d", id, len(vapp.VApp.NetworkConfigSection.NetworkConfig)) | ||
for _, vappNetwork := range vapp.VApp.NetworkConfigSection.NetworkConfig { | ||
// break early for disconnected network interfaces. They don't have all information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be "empty" instead of "disconnected"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from UI perspective they are disconected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am OK with using UI names in Terraform, but in the SDK we should follow the API.
# Conflicts: # CHANGELOG.md # govcd/vapp_network.go # govcd/vapp_network_test.go # types/v56/types.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small changes needed
govcd/vapp_network.go
Outdated
|
||
util.Logger.Printf("[TRACE] Looking for networks: %s --- %d", id, len(vapp.VApp.NetworkConfigSection.NetworkConfig)) | ||
for _, vappNetwork := range vapp.VApp.NetworkConfigSection.NetworkConfig { | ||
// break early for disconnected network interfaces. They don't have all information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am OK with using UI names in Terraform, but in the SDK we should follow the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main concern and topic for discussion is that we are overwriting FW and NAT service enabled/disabled state to enabled after updating the network, regardless of what it was before. Is this really what we want and why?
# Conflicts: # govcd/common_test.go # govcd/lb_test.go # govcd/vm_test.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - just a few concerns from me about RemoveAll*
functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more comments and change requests
govcd/vapp_network.go
Outdated
return nil | ||
} | ||
|
||
// RemoveAllNetworkFirewallRules removes all network all firewall rules from a vApp network. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// RemoveAllNetworkFirewallRules removes all network all firewall rules from a vApp network. | |
// RemoveAllNetworkFirewallRules removes all network firewall rules from a vApp network. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ty, fixed
check.Assert(result.Configuration.Features.NatService.NatRule[1].OneToOneVMRule.MappingMode, Equals, "manual") | ||
check.Assert(result.Configuration.Features.NatService.NatRule[1].OneToOneVMRule.VAppScopedVMID, Equals, vm2.VM.VAppScopedLocalID) | ||
check.Assert(result.Configuration.Features.NatService.NatRule[1].OneToOneVMRule.VMNicID, Equals, 0) | ||
check.Assert(*result.Configuration.Features.NatService.NatRule[1].OneToOneVMRule.ExternalIPAddress, Equals, "192.168.100.1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check that the pointer is not nil before comparing its value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. Just one mroe comment about some commented out code chunk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add function needed for implementing vApp network NAT rules resource:
This PR is derived from #308 so shows that PR code too.