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 NSX-T Firewall Group Support (Security Groups and IP Sets) #368

Merged
merged 16 commits into from
May 11, 2021

Conversation

Didainius
Copy link
Collaborator

@Didainius Didainius commented Apr 15, 2021

This PR adds NSX-T Firewall Group support (this endpoint supports setting both - Security Groups and IP Sets).
It does so by introducing the following new types:

  • NsxtFirewallGroup
  • NsxtFirewallGroupMemberVms

And such methods for managing them:

  • Vdc.CreateNsxtFirewallGroup,
  • NsxtEdgeGateway.CreateNsxtFirewallGroup
  • Org.GetAllNsxtFirewallGroups
  • Vdc.GetAllNsxtFirewallGroups
  • Org.GetNsxtFirewallGroupByName,
  • Vdc.GetNsxtFirewallGroupByName
  • NsxtEdgeGateway.GetNsxtFirewallGroupByName,
  • Org.GetNsxtFirewallGroupById
  • Vdc.GetNsxtFirewallGroupById,
  • NsxtEdgeGateway.GetNsxtFirewallGroupById
  • NsxtFirewallGroup.Update,
  • NsxtFirewallGroup.Delete
  • NsxtFirewallGroup.GetAssociatedVms,
  • NsxtFirewallGroup.IsSecurityGroup
  • NsxtFirewallGroup.IsIpSet

Additionally it adds the following new methods to improve test cleanup framework (add support for VM cleanup when they are spread in multiple VDCs)
Org.QueryVmList and Org.QueryVmById to find VM by ID in an Org

IMPROVEMENTS:

  • Improved test entity cleanup to find standalone VMs in any VDC (not only default NSX-V one)
  • Improved test entity cleanup to allow specifying parent VDC for vApp removals

Signed-off-by: Dainius Serplis <dserplis@vmware.com>
@Didainius Didainius force-pushed the security-groups-pr branch from 92f3a2b to 858d5a0 Compare April 15, 2021 19:53
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
@Didainius Didainius marked this pull request as ready for review April 19, 2021 09:20
}

if firewallGroup.NsxtFirewallGroup.ID == "" {
return nil, fmt.Errorf("cannot retrieve associated VMs for NSX-T Firewall Group without ID")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return nil, fmt.Errorf("cannot retrieve associated VMs for NSX-T Firewall Group without ID")
return nil, fmt.Errorf("cannot retrieve associated VMs for NSX-T Firewall Group without ID")

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

CHANGELOG.md Outdated
@@ -2,7 +2,27 @@

* Added method `vdc.QueryEdgeGateway` [#364](https://github.com/vmware/go-vcloud-director/pull/364)
* Deprecated `vdc.GetEdgeGatewayRecordsType` [#364](https://github.com/vmware/go-vcloud-director/pull/364)
* Added NSX-T Firewall Group (Security Groups and IP Set) support by using structures
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggesting below just because I got puzzled by the meaning of it all the way until I reached the very last file in the PR 😄

Suggested change
* Added NSX-T Firewall Group (Security Groups and IP Set) support by using structures
* Added NSX-T Firewall Group type (which represents a Security Group or an IP Set) support by using structures

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed

Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Copy link
Collaborator

@lvirbalas lvirbalas left a comment

Choose a reason for hiding this comment

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

One typo and LGTM!

CHANGELOG.md Outdated
@@ -2,7 +2,27 @@

* Added method `vdc.QueryEdgeGateway` [#364](https://github.com/vmware/go-vcloud-director/pull/364)
* Deprecated `vdc.GetEdgeGatewayRecordsType` [#364](https://github.com/vmware/go-vcloud-director/pull/364)
* Added NSX-T Firewall Group type (which represents a Security Group or an IP Set) support by using
structures `NsxtFirewallGroup` and `NsxtFirewallGroupMemberVms`. The following methods are
introduced for managing Security Groups and IpP Sets: `Vdc.CreateNsxtFirewallGroup`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
introduced for managing Security Groups and IpP Sets: `Vdc.CreateNsxtFirewallGroup`,
introduced for managing Security Groups and IP Sets: `Vdc.CreateNsxtFirewallGroup`,

Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Copy link
Contributor

@dataclouder dataclouder left a comment

Choose a reason for hiding this comment

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

LGTM

@Didainius Didainius merged commit 6b86aa4 into vmware:master May 11, 2021
@Didainius Didainius deleted the security-groups-pr branch May 11, 2021 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants