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

Add inter VRF routing resource #1167

Merged
merged 1 commit into from
Apr 10, 2024
Merged

Conversation

ksamoray
Copy link
Collaborator

@ksamoray ksamoray commented Mar 31, 2024

Fixes: #1051

@ksamoray ksamoray force-pushed the inter_vrf_routing branch from 0e242f9 to 6853a8e Compare March 31, 2024 14:52
@ksamoray
Copy link
Collaborator Author

/test-all

@ksamoray ksamoray force-pushed the inter_vrf_routing branch from 6853a8e to 3669681 Compare April 1, 2024 07:58
@ksamoray
Copy link
Collaborator Author

ksamoray commented Apr 1, 2024

/test-all

Type: schema.TypeList,
Description: "route map path for IN direction",
Optional: true,
MaxItems: 1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason those lists with size 1 are still lists? If we're following the API that expects to grow in future, maybe we shouldn't code the MaxItems in the provider to prevent the requirement for future change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDK why it's defined as it is - they're lists in the spec. Do you think that we can remove MaxItems and let NSX enforce the limit?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise I could flatten these attributes

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in favor of letting NSX enforce the limit

d.Set("nsx_id", d.Id())
gwPath, err := getParameterFromPolicyPath("", "/inter-vrf-routing/", importID)
if err != nil {
return nil, err
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this error message should be something like incorrect policy path for inter vrf routing resource: %v

connector := getPolicyConnector(m)
client := tier_0s.NewInterVrfRoutingClient(connector)

gwPolicyPath := d.Get("gateway_path").(string)
Copy link
Collaborator

@annakhm annakhm Apr 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its more reliable to rely on path here and in update

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a utility func to parse the gwID from path?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not this one specifically..

* `description` - (Optional) Description of the resource.
* `tag` - (Optional) A list of scope + tag pairs to associate with this resource.
* `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the policy resource.
* `gateway_path` - (Required) The NSX Policy path to the Tier0 or Tier1 Gateway for this NAT Rule.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description doesn't seem right

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, it's only T0

@ksamoray ksamoray force-pushed the inter_vrf_routing branch 2 times, most recently from 3b6d517 to ceee384 Compare April 3, 2024 08:00
* `description` - (Optional) Description of the resource.
* `tag` - (Optional) A list of scope + tag pairs to associate with this resource.
* `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the policy resource.
* `gateway_path` - (Required) The NSX Policy path to the Tier0 Gateway for this NAT Rule.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for this NAT Rule => for this resource

if id == "" {
id = newUUID()
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually check that object with this nsx_id does not exist yet, here this check is missing, is this intentional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I guess that I've copy-pasted from the wrong place :)
Seems that there are quite a lot of cases where we do not check this. Maybe it's worthwhile to add this to some TODO list?

@annakhm
Copy link
Collaborator

annakhm commented Apr 4, 2024

I think this resource is also relevant for GM?

Fixes: vmware#1051

Signed-off-by: Kobi Samoray <[email protected]>
@ksamoray ksamoray force-pushed the inter_vrf_routing branch from ceee384 to 5c42c7b Compare April 9, 2024 10:45
@ksamoray
Copy link
Collaborator Author

ksamoray commented Apr 9, 2024

I think this resource is also relevant for GM?

This is weird - GM model contains PolicyInterVrfRoutingConfig type, and even has this but there's no NewInterVrfRoutingClient func for GM.

@annakhm
Copy link
Collaborator

annakhm commented Apr 9, 2024

I think this resource is also relevant for GM?

This is weird - GM model contains PolicyInterVrfRoutingConfig type, and even has this but there's no NewInterVrfRoutingClient func for GM.

Indeed looks like support for GM is different - /global-infra/tier-0s/{tier-0-id}/inter-vrf-routing/{inter-vrf-routing-id}/advertised-networks is supported. I think we better support this in a separate PR?

@ksamoray
Copy link
Collaborator Author

I think this resource is also relevant for GM?

This is weird - GM model contains PolicyInterVrfRoutingConfig type, and even has this but there's no NewInterVrfRoutingClient func for GM.

Indeed looks like support for GM is different - /global-infra/tier-0s/{tier-0-id}/inter-vrf-routing/{inter-vrf-routing-id}/advertised-networks is supported. I think we better support this in a separate PR?

Makes sense

@ksamoray
Copy link
Collaborator Author

/test-all

@ksamoray ksamoray merged commit 11170d4 into vmware:master Apr 10, 2024
7 checks passed
@ksamoray ksamoray deleted the inter_vrf_routing branch April 10, 2024 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inter VRF Routing
2 participants