Skip to content
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

Handle IPv6 paths correctly with multitenancy #1093

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions nsxt/gateway_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,19 @@ func getIpv6ProfilePathsFromSchema(d *schema.ResourceData) []string {
func setIpv6ProfilePathsInSchema(d *schema.ResourceData, paths []string) error {
for _, path := range paths {
tokens := strings.Split(path, "/")
// First token is empty, second is infra or global-infra, third is profile type
// First token is empty, second is infra, global-infra or orgs, third is profile type
if len(tokens) < 4 {
return fmt.Errorf("Unexpected ipv6 profile path: %s", path)
}
if tokens[2] == "ipv6-ndra-profiles" {
tokenOffset := 2
if tokens[1] == "orgs" && tokens[3] == "projects" {
// It's a multitenancy environment
tokenOffset = 6
}
if tokens[tokenOffset] == "ipv6-ndra-profiles" {
d.Set("ipv6_ndra_profile_path", path)
}
if tokens[2] == "ipv6-dad-profiles" {
if tokens[tokenOffset] == "ipv6-dad-profiles" {
d.Set("ipv6_dad_profile_path", path)
}
}
Expand Down
Loading