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

[4.7] FIX Site2SiteVPN on redundant VPC #1276

Merged
merged 6 commits into from
Jan 16, 2016

Conversation

michaelandersen
Copy link

This PR:

  • fixes the inability to setup more than one Site2Site VPN connection from a VPC
  • fixes starting of Site2Site VPN on redundant VPC
  • fixes Site2Site VPN state checking on redundant VPC
  • improves the vpc_vpn test to allow multple hypervisors
  • adds an integration test for Site2Site VPN on redundant VPC

Tested it on 4.7 single Xen server zone:

command:

nosetests --with-marvin --marvin-config=/data/shared/marvin/mct-zone1-xen1.cfg -a tags=advanced,required_hardware=true /tmp/test_vpc_vpn.py

results:

Test Site 2 Site VPN Across redundant VPCs ... === TestName: test_01_redundant_vpc_site2site_vpn | Status : SUCCESS ===
ok
Test Remote Access VPN in VPC ... === TestName: test_01_vpc_remote_access_vpn | Status : SUCCESS ===
ok
Test Site 2 Site VPN Across VPCs ... === TestName: test_01_vpc_site2site_vpn | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 3 tests in 1490.076s

OK

also performed numerous manual inspections of state of VPN connections and connectivity between VPC's

@michaelandersen michaelandersen changed the title FIX Site2SiteVPN on redundant VPC [4.7] FIX Site2SiteVPN on redundant VPC Dec 22, 2015
@wilderrodrigues
Copy link
Contributor

Jenkins error is not related:

image

@wilderrodrigues
Copy link
Contributor

Did a code review on this PR and also talked to @michaelandersen on Slack about switching the MASTER router off. With the changes he applied on the Java file it will work fine.

Also checked the changes concerning the tests now covering KVM, Xen, VMware and HyperV.

Code LGTM and awesome to see it covered by an integration test. Thanks a lot!

👍

Will do some tests, but please check with @remibergsma @DaanHoogland @miguelaferreira to give a second LGTM based on tests because I'm on holidays. :)

Cheers,
Wilder

@pdube
Copy link
Contributor

pdube commented Dec 22, 2015

Good to see additional tests created. I would suggest adding a test that turns one of the routers off, and then seeing if the VPN connection works correctly. I quickly looked through the component testing and didn't find any similar tests.

Is there a timing issue possible where both routers would be in the same state? If so, it might be good to throw an exception before doing any operations (i.e. if the loop exits, and no routers were found to be MASTER).

Also, should the check to see if the router is the MASTER occur before persisting the vpn connection state on each router?

@@ -916,6 +916,9 @@ protected void updateSite2SiteVpnConnectionState(final List<DomainRouterVO> rout
}
continue;
}
if (router.getIsRedundantRouter() && router.getRedundantState() != RedundantState.MASTER){
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this check be done before the previous 'if'?

Copy link
Author

Choose a reason for hiding this comment

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

Not per se, as the previous if statement skips the iteration if the router to be checked is not in a running state. And running state is required to do any further state checking.

Copy link
Author

Choose a reason for hiding this comment

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

after some more thought: You could be right. if the BACKUP is not running and goes through the previous inspection AND has an attached vpn connection will be marked as disconnected.
need to investigate a bit to see what _s2sVpnMgr.getConnectionsForRouter(router) would return for a backup router. It the backup router does not have an attached vpn connection we are good as it will just skip any further vpn connection checking for that iteration.

Copy link
Author

Choose a reason for hiding this comment

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

ok @pdube so getConnectionsForRouter() returns vpn connections based on the vpcid of the router. As both the backup and master router have the same vpcid assigned and therefore will both return vpn connections, which will then be marked as disconnected if the backup router is not running, it makes sense to first exclude backup routers and then to exclude non-running routers.

I force pushed the change. @pdube could you test?

@michaelandersen
Copy link
Author

As for:

Is there a timing issue possible where both routers would be in the same state? If so, it might be good to > throw an exception before doing any operations (i.e. if the loop exits, and no routers were found to be MASTER).

A dual MASTER state should not be possible, but even if it occurred it would, in this context worst case, trigger a vpn state check on both routers.

I would suggest adding a test that turns one of the routers off, and then seeing if the VPN connection works correctly.

This makes sense and i will manually verify and if possible automate this tomorrow.

@@ -468,7 +500,7 @@ def get_ssh_client(self, virtual_machine, services, retries):

return ssh_client

def create_natrule(self, vpc, vm, public_port, private_port, public_ip, network, services=None):
def _create_natrule(self, vpc, vm, public_port, private_port, public_ip, network, services=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

why _create_natrule() and not create_natrule()?

Copy link
Author

Choose a reason for hiding this comment

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

a matter of style i guess, i consistently changed private methods/non-tests to be prefixed with an underscore.

@michaelandersen michaelandersen force-pushed the fix/site2sitevpn branch 2 times, most recently from 7e988ff to 7513fdb Compare January 11, 2016 12:30
@michaelandersen
Copy link
Author

just ran the test again after adding the validateList method:

command:

nosetests --with-marvin --marvin-config=/data/shared/marvin/mct-zone1-xen1.cfg -a tags=advanced,required_hardware=true test/integration/smoke/test_vpc_vpn.py

results:

Test Site 2 Site VPN Across redundant VPCs ... === TestName: test_01_redundant_vpc_site2site_vpn | Status : SUCCESS ===
ok
Test Remote Access VPN in VPC ... === TestName: test_01_vpc_remote_access_vpn | Status : SUCCESS ===
ok
Test Site 2 Site VPN Across VPCs ... === TestName: test_01_vpc_site2site_vpn | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 3 tests in 1567.984s

OK

@michaelandersen
Copy link
Author

ping @DaanHoogland

@michaelandersen
Copy link
Author

ping @sanju1010 @wido @terbolous

@DaanHoogland
Copy link
Contributor

tested on a two kvm, as in the bubble, setup:

# less /tmp/MarvinLogs/test_vpc_vpn_Q1BTHP/results.txt
Test Site 2 Site VPN Across redundant VPCs ... === TestName: test_01_redundant_vpc_site2site_vpn | Status : SUCCESS ===
ok
Test Remote Access VPN in VPC ... === TestName: test_01_vpc_remote_access_vpn | Status : SUCCESS ===
ok
Test Site 2 Site VPN Across VPCs ... === TestName: test_01_vpc_site2site_vpn | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 3 tests in 2166.200s

OK

LGTM

@wilderrodrigues
Copy link
Contributor

Ping @remibergsma

LGTM, please proceed with merge.

Cheers,
Wilder

@asfgit asfgit merged commit 435a98c into apache:4.7 Jan 16, 2016
asfgit pushed a commit that referenced this pull request Jan 16, 2016
[4.7] FIX Site2SiteVPN on redundant VPCThis PR:
- fixes the inability to setup more than one Site2Site VPN connection from a VPC
- fixes starting of Site2Site VPN on redundant VPC
- fixes Site2Site VPN state checking on redundant VPC
- improves the vpc_vpn test to allow multple hypervisors
- adds an integration test for Site2Site VPN on redundant VPC

Tested it on 4.7 single Xen server zone:

command:
```
nosetests --with-marvin --marvin-config=/data/shared/marvin/mct-zone1-xen1.cfg -a tags=advanced,required_hardware=true /tmp/test_vpc_vpn.py
```

results:
```
Test Site 2 Site VPN Across redundant VPCs ... === TestName: test_01_redundant_vpc_site2site_vpn | Status : SUCCESS ===
ok
Test Remote Access VPN in VPC ... === TestName: test_01_vpc_remote_access_vpn | Status : SUCCESS ===
ok
Test Site 2 Site VPN Across VPCs ... === TestName: test_01_vpc_site2site_vpn | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 3 tests in 1490.076s

OK
```

also performed numerous manual inspections of state of VPN connections and connectivity between VPC's

* pr/1276:
  Fix unable to setup more than one Site2Site VPN Connection
  FIX S2S VPN rVPC: Check only redundant routers in state MASTER
  PEP8 of integration/smoke/test_vpc_vpn
  Add S2S VPN test for Redundant VPC
  Make integration/smoke/test_vpc_vpn Hypervisor independant
  FIX VPN: non-working ipsec commands

Signed-off-by: Remi Bergsma <github@remi.nl>
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.

None yet

6 participants