cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

cleanup validations for VPN connection creation

Open DaanHoogland opened this issue 1 year ago • 35 comments

Description

This PR adds a validation when creating a VPN connection in a VPC to make sure the VPN gateway exists.

Fixes: #7250

Types of changes

  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] Enhancement (improves an existing feature and functionality)
  • [x] Cleanup (Code refactoring and cleanup, that may add test cases)
  • [ ] build/CI

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • [ ] Major
  • [x] Minor

Bug Severity

  • [ ] BLOCKER
  • [ ] Critical
  • [ ] Major
  • [ ] Minor
  • [x] Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

DaanHoogland avatar Jun 10 '24 08:06 DaanHoogland

Codecov Report

Attention: Patch coverage is 0% with 48 lines in your changes missing coverage. Please review.

Project coverage is 15.08%. Comparing base (67ce326) to head (c9a722b). Report is 1 commits behind head on 4.19.

Files with missing lines Patch % Lines
...com/cloud/network/vpn/Site2SiteVpnManagerImpl.java 0.00% 48 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##               4.19    #9195      +/-   ##
============================================
- Coverage     15.08%   15.08%   -0.01%     
- Complexity    11182    11183       +1     
============================================
  Files          5402     5402              
  Lines        473137   473148      +11     
  Branches      61094    61020      -74     
============================================
  Hits          71364    71364              
- Misses       393835   393846      +11     
  Partials       7938     7938              
Flag Coverage Δ
uitests 4.30% <ø> (-0.01%) :arrow_down:
unittests 15.80% <0.00%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jun 10 '24 08:06 codecov[bot]

CLGTM.

Just one remark, maybe we can use a unique error message in the getAndValidate methods.

The calls have different messages passed (though only slightly). Can you specify what you would like to see there @hsato03 ?

DaanHoogland avatar Jun 19 '24 06:06 DaanHoogland

CLGTM. Just one remark, maybe we can use a unique error message in the getAndValidate methods.

The calls have different messages passed (though only slightly). Can you specify what you would like to see there @hsato03 ?

What about throw new InvalidParameterValueException(String.format("Unable to find the specified Site-to-Site VPN customer gateway: %s.", customerGatewayId)); in the getAndValidateSite2SiteCustomerGateway

and throw new InvalidParameterValueException(String.format("Unable to find the specified Site-to-Site VPN gateway %s.", vpnGatewayId)); in the getAndValidateSite2SiteVpnGateway?

This should cover all cases and the errMsg parameter can be removed.

hsato03 avatar Jun 19 '24 16:06 hsato03

@hsato03 applied your suggestion and did some extra cleanup.

DaanHoogland avatar Jun 20 '24 08:06 DaanHoogland

@blueorangutan package

sureshanaparti avatar Jun 24 '24 07:06 sureshanaparti

@blueorangutan package

sureshanaparti avatar Jun 25 '24 14:06 sureshanaparti

@blueorangutan test

sureshanaparti avatar Jun 25 '24 19:06 sureshanaparti

@blueorangutan test

sureshanaparti avatar Jun 25 '24 19:06 sureshanaparti

@blueorangutan package

sureshanaparti avatar Jun 27 '24 11:06 sureshanaparti

@blueorangutan test

sureshanaparti avatar Jun 27 '24 12:06 sureshanaparti

@blueorangutan package

sureshanaparti avatar Jun 28 '24 10:06 sureshanaparti

@blueorangutan test

sureshanaparti avatar Jun 28 '24 11:06 sureshanaparti

The issue is not resolved. When I try creating a site to site VPN connection without enabling the VPN gateway of the VPC it doesn't throw any error.

thanks for testing @rajujith

sureshanaparti avatar Jun 28 '24 12:06 sureshanaparti

The issue is not resolved. When I try creating a site to site VPN connection without enabling the VPN gateway of the VPC it doesn't throw any error.

hm, it has been a while and had some updates. I'll retest and see...

DaanHoogland avatar Jul 01 '24 09:07 DaanHoogland

The issue is not resolved. When I try creating a site to site VPN connection without enabling the VPN gateway of the VPC it doesn't throw any error.

hm, it has been a while and had some updates. I'll retest and see...

@rajujith , this was probably due to some merge issues, It should work now. I.E. you should not be able to create a VPN connection without having a VPN gateway available. Can you try?

DaanHoogland avatar Jul 18 '24 13:07 DaanHoogland

The issue is not resolved. When I try creating a site to site VPN connection without enabling the VPN gateway of the VPC it doesn't throw any error.

hm, it has been a while and had some updates. I'll retest and see...

@rajujith , this was probably due to some merge issues, It should work now. I.E. you should not be able to create a VPN connection without having a VPN gateway available. Can you try?

@DaanHoogland

I tried again with the packages from 17th Jul and the issue is not resolved.

When I try creating a site to site VPN connection without enabling the VPN gateway of the VPC it doesn't throw any error.

kiranchavala avatar Sep 23 '24 10:09 kiranchavala

The issue is not resolved. When I try creating a site to site VPN connection without enabling the VPN gateway of the VPC it doesn't throw any error.

hm, it has been a while and had some updates. I'll retest and see...

@rajujith , this was probably due to some merge issues, It should work now. I.E. you should not be able to create a VPN connection without having a VPN gateway available. Can you try?

@DaanHoogland

I tried again with the packages from 17th Jul and the issue is not resolved.

When I try creating a site to site VPN connection without enabling the VPN gateway of the VPC it doesn't throw any error.

@kiranchavala it was only caught/solved in the API. It is now also the UI.

DaanHoogland avatar Sep 25 '24 17:09 DaanHoogland

@blueorangutan package

DaanHoogland avatar Sep 25 '24 17:09 DaanHoogland

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

blueorangutan avatar Sep 25 '24 17:09 blueorangutan

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 11208

blueorangutan avatar Sep 25 '24 18:09 blueorangutan

[SF] Trillian test result (tid-11568) Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8 Total time taken: 51996 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9195-t11568-kvm-ol8.zip Smoke tests completed. 132 look OK, 1 have errors, 0 did not run Only failed and skipped tests results shown below:

Test Result Time (s) Test File
ContextSuite context=TestISOUsage>:setup Error 0.00 test_usage.py

blueorangutan avatar Sep 28 '24 04:09 blueorangutan

@blueorangutan package

DaanHoogland avatar Sep 30 '24 13:09 DaanHoogland

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

blueorangutan avatar Sep 30 '24 13:09 blueorangutan

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 11242

blueorangutan avatar Sep 30 '24 14:09 blueorangutan