Skip to content

CLOUDSTACK-9106 - As a Developer I want the Redundant VPC private gateway feature fixed#1184

Merged
asfgit merged 6 commits into
apache:4.6from
artificially-ai:fix/4.6-rvpc-pvtgw-CLOUDSTACK-9106
Dec 7, 2015
Merged

CLOUDSTACK-9106 - As a Developer I want the Redundant VPC private gateway feature fixed#1184
asfgit merged 6 commits into
apache:4.6from
artificially-ai:fix/4.6-rvpc-pvtgw-CLOUDSTACK-9106

Conversation

@wilderrodrigues
Copy link
Copy Markdown
Contributor

This PR contains the same fixes from PR #1179, which was created against the master branch.

In addition, the points mentioned by @DaanHoogland were handled in this new PR:

  • Made the code more consistent
    • result = result && methodCall(), instead of throwing exceptions in some places or not checking 2 consecutive returns - in case of rVPC.
  • Added an unit test to cover changes in the VpcRouterElementImpl.applyVpnUsers() method. The method returns an array of String, so I had to make sure it would contain the users from 2 consecutive calls. There are 2 tests to cover negative scenarios.

…s of a VPC

   - It was causing problems because Nics were expected to be plugged before they actually exist. Only in rVPC cases.
   - Applies ACL items to routers only after the Pvt GW is setup.
…thod

    - Use the router to retrieve the instance ID
    - Check if the VPC is redundant in order to reuse the private gateway address.
    - Brings the private gateways interfaces up.
   - Checks the result of a call against the previous result. Either both are true or the method returns false.
   - Do not thrown exceptions because some calls are not handling/rethrowing them. It would cause runtime problems.
   - When doing a list.addAll(Arrays.asList(String[]{}) will cause problems when trying to cast the list.toArray() into an aray of String
     It would only work if instead of calling addAll() I would pass it straight into the constructor:
     e.g. List<String> l = new ArrayList(Arrays.asList(new String[]{});
          Stirng [] s = (String[]) l.toArray();
     But I did not like that implementation because it would require 2 arrays of string and combine them at the end.
…rs() method

   - Changed the NetworkTopologyContext class just to make the private member accessible from the test
   - Added a test class to cover the positive scenario of the VpcVirtualRouterElementTest.applyVpnUsers() method.
   - Covering when there is either no VPC or no routers.
@wilderrodrigues
Copy link
Copy Markdown
Contributor Author

Ping @DaanHoogland @remibergsma @borisroman

I will continue the tests, but PR is ready to be reviewed.

  • Environment
    • Hardware required: TRUE
    • Management Server + MySQL on CentOS 7.1
    • One KVM Host on CentOS 7.1
    • Agent + Common RPMs built from 4.6.1 source
  • Tests executed
nosetests --with-marvin --marvin-config=/data/shared/marvin/mct-zone1-kvm1-ISOLATED.cfg -s -a tags=advanced,required_hardware=true smoke/test_privategw_acl.py
  • Results
test_01_vpc_privategw_acl (integration.smoke.test_privategw_acl.TestPrivateGwACL) ... === TestName: test_01_vpc_privategw_acl | Status : SUCCESS ===
ok
test_02_vpc_privategw_static_routes (integration.smoke.test_privategw_acl.TestPrivateGwACL) ... === TestName: test_02_vpc_privategw_static_routes | Status : SUCCESS ===
ok
test_03_rvpc_privategw_static_routes (integration.smoke.test_privategw_acl.TestPrivateGwACL) ... === TestName: test_03_rvpc_privategw_static_routes | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 3 tests in 2359.021s

OK
/tmp//MarvinLogs/test_privategw_acl_11STHV/results.txt (END)

@wilderrodrigues
Copy link
Copy Markdown
Contributor Author

Jenkins known issue:

image

@wilderrodrigues
Copy link
Copy Markdown
Contributor Author

Ping @remibergsma @miguelaferreira @DaanHoogland @borisroman

Problem with my PR! I haven’t seen that one failing before. Will investigate.

=== TestName: test_02_RVR_Network_FW_PF_SSH_default_routes_egress_false | Status : FAILED ===

@wilderrodrigues
Copy link
Copy Markdown
Contributor Author

Ping @remibergsma @DaanHoogland @miguelaferreira @borisroman

Deployed another DC and followed the same step as the test, but did it manually:

Result:

  • Without egress configured to open ports
sbpltk1zffh04:sbp_dev wrodrigues$ ssh root@192.168.23.54
root@192.168.23.54's password: 
# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 0 packets received, 100% packet loss
  • After configuring egress
sbpltk1zffh04:sbp_dev wrodrigues$ ssh root@192.168.23.54
root@192.168.23.54's password: 
# wget google.com
--2015-12-07 17:15:16--  http://google.com/
Resolving google.com... 2a00:1450:4013:c00::8b, 173.194.65.102, 173.194.65.138, ...
Connecting to google.com|2a00:1450:4013:c00::8b|:80... failed: Network is unreachable.
Connecting to google.com|173.194.65.102|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.google.nl/?gfe_rd=cr&ei=pL5lVsbhOpGwOvj-nUg [following]
--2015-12-07 17:15:16--  http://www.google.nl/?gfe_rd=cr&ei=pL5lVsbhOpGwOvj-nUg
Resolving www.google.nl... 2a00:1450:4013:c00::5e, 173.194.65.94
Connecting to www.google.nl|2a00:1450:4013:c00::5e|:80... failed: Network is unreachable.
Connecting to www.google.nl|173.194.65.94|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: 'index.html.1'

index.html.1                                       [ <=>                                                                                                 ]  18.59K  --.-KB/s   in 0.03s  

2015-12-07 17:15:17 (590 KB/s) - 'index.html.1' saved [19036]

# wget google.com
--2015-12-07 17:17:41--  http://google.com/
Resolving google.com... 2a00:1450:4013:c00::8b, 173.194.65.113, 173.194.65.102, ...
Connecting to google.com|2a00:1450:4013:c00::8b|:80... failed: Network is unreachable.
Connecting to google.com|173.194.65.113|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.google.nl/?gfe_rd=cr&ei=Nr9lVqvUBIyOOpHGhnA [following]
--2015-12-07 17:17:41--  http://www.google.nl/?gfe_rd=cr&ei=Nr9lVqvUBIyOOpHGhnA
Resolving www.google.nl... 2a00:1450:4013:c00::5e, 173.194.65.94
Connecting to www.google.nl|2a00:1450:4013:c00::5e|:80... failed: Network is unreachable.
Connecting to www.google.nl|173.194.65.94|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: 'index.html.2'

index.html.2                                       [ <=>                                                                                                 ]  18.68K  --.-KB/s   in 0.01s  

2015-12-07 17:17:42 (1.54 MB/s) - 'index.html.2' saved [19132]

# wget -t 1 -T 1 www.google.com
--2015-12-07 17:18:04--  http://www.google.com/
Resolving www.google.com... 2a00:1450:4013:c00::93, 173.194.65.103, 173.194.65.99, ...
Connecting to www.google.com|2a00:1450:4013:c00::93|:80... failed: Network is unreachable.
Connecting to www.google.com|173.194.65.103|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.google.nl/?gfe_rd=cr&ei=Tb9lVtaAA8mvOrmhisgG [following]
--2015-12-07 17:18:04--  http://www.google.nl/?gfe_rd=cr&ei=Tb9lVtaAA8mvOrmhisgG
Resolving www.google.nl... 2a00:1450:4013:c00::5e, 173.194.65.94
Connecting to www.google.nl|2a00:1450:4013:c00::5e|:80... failed: Network is unreachable.
Connecting to www.google.nl|173.194.65.94|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: 'index.html.3'

index.html.3                                       [ <=>                                                                                                 ]  18.68K  --.-KB/s   in 0.01s  

2015-12-07 17:18:05 (1.25 MB/s) - 'index.html.3' saved [19133]

#

Waiting for your feedback on your tests.

Cheers,
Wilder

@wilderrodrigues
Copy link
Copy Markdown
Contributor Author

Although it worked manually, I'm running the test again... in an brand new DC.

nosetests --with-marvin --marvin-config=/data/shared/marvin/mct-zone2-kvm2-ISOLATED.cfg -s -a tags=advanced,required_hardware=true component/test_routers_network_ops.py

@DaanHoogland
Copy link
Copy Markdown
Contributor

Went through the code. Looks Good To Me.

@remibergsma
Copy link
Copy Markdown
Contributor

LGTM based on these tests:

test_01_vpc_privategw_acl (integration.smoke.test_privategw_acl.TestPrivateGwACL) ... === TestName: test_01_vpc_privategw_acl | Status : SUCCESS ===
ok
test_02_vpc_privategw_static_routes (integration.smoke.test_privategw_acl.TestPrivateGwACL) ... === TestName: test_02_vpc_privategw_static_routes | Status : SUCCESS ===
ok
test_03_rvpc_privategw_static_routes (integration.smoke.test_privategw_acl.TestPrivateGwACL) ... === TestName: test_03_rvpc_privategw_static_routes | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 3 tests in 2358.726s

OK

@wilderrodrigues
Copy link
Copy Markdown
Contributor Author

Ping @remibergsma @miguelaferreira @DaanHoogland

Test passed as expected!

Test redundant router internals ... === TestName: test_01_isolate_network_FW_PF_default_routes_egress_true | Status : SUCCESS ===
ok
Test redundant router internals ... === TestName: test_02_isolate_network_FW_PF_default_routes_egress_false | Status : SUCCESS ===
ok
Test redundant router internals ... === TestName: test_01_RVR_Network_FW_PF_SSH_default_routes_egress_true | Status : SUCCESS ===
ok
Test redundant router internals ... === TestName: test_02_RVR_Network_FW_PF_SSH_default_routes_egress_false | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 4 tests in 2839.425s

OK
/tmp//MarvinLogs/test_routers_network_ops_PVLLQ6/results.txt (END)

I will post more results soon!

@wilderrodrigues
Copy link
Copy Markdown
Contributor Author

  • Environment
    • Hardware required: TRUE
    • Management Server + MySQL on CentOS 7.1
    • One KVM Host on CentOS 7.1
    • Agent + Common RPMs built from 4.6.1 source
  • Tests executed
nosetests --with-marvin --marvin-config=/data/shared/marvin/mct-zone1-kvm1-ISOLATED.cfg -s -a tags=advanced,required_hardware=true component/test_vpc_redundant.py component/test_routers_iptables_default_policy.py component/test_routers_network_ops.py component/test_vpc_router_nics.py component/test_password_server.py component/test_router_dhcphosts.py smoke/test_loadbalance.py smoke/test_internal_lb.py smoke/test_ssvm.py smoke/test_vpc_vpn.py smoke/test_network.py
  • Successful tests
Create a redundant VPC with two networks with two VMs in each network ... === TestName: test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL | Status : SUCCESS ===
ok
Create a redundant VPC with two networks with two VMs in each network and check default routes ... === TestName: test_02_redundant_VPC_default_routes | Status : SUCCESS ===
ok
Create a redundant VPC with two networks with two VMs in each network ... === TestName: test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routers | Status : SUCCESS ===
ok
Test iptables default INPUT/FORWARD policy on RouterVM ... === TestName: test_02_routervm_iptables_policies | Status : SUCCESS ===
ok
Test iptables default INPUT/FORWARD policies on VPC router ... === TestName: test_01_single_VPC_iptables_policies | Status : SUCCESS ===
ok
Test redundant router internals ... === TestName: test_01_isolate_network_FW_PF_default_routes_egress_true | Status : SUCCESS ===
ok
Test redundant router internals ... === TestName: test_02_isolate_network_FW_PF_default_routes_egress_false | Status : SUCCESS ===
ok
Test redundant router internals ... === TestName: test_01_RVR_Network_FW_PF_SSH_default_routes_egress_true | Status : SUCCESS ===
ok
Create a VPC with two networks with one VM in each network and test nics after destroy ... === TestName: test_01_VPC_nics_after_destroy | Status : SUCCESS ===
ok
Create a VPC with two networks with one VM in each network and test default routes ... === TestName: test_02_VPC_default_routes | Status : SUCCESS ===
ok
Check the password file in the Router VM ... === TestName: test_isolate_network_password_server | Status : SUCCESS ===
ok
Check that the /etc/dhcphosts.txt doesn't contain duplicate IPs ... === TestName: test_router_dhcphosts | Status : SUCCESS ===
ok
Test to create Load balancing rule with source NAT ... === TestName: test_01_create_lb_rule_src_nat | Status : SUCCESS ===
ok
Test to create Load balancing rule with non source NAT ... === TestName: test_02_create_lb_rule_non_nat | Status : SUCCESS ===
ok
Test for assign & removing load balancing rule ... === TestName: test_assign_and_removal_lb | Status : SUCCESS ===
ok
Test to verify access to loadbalancer haproxy admin stats page ... === TestName: test02_internallb_haproxy_stats_on_all_interfaces | Status : SUCCESS ===
ok
Test create, assign, remove of an Internal LB with roundrobin http traffic to 3 vm's ... === TestName: test_01_internallb_roundrobin_1VPC_3VM_HTTP_port80 | Status : SUCCESS ===
ok
Test SSVM Internals ... === TestName: test_03_ssvm_internals | Status : SUCCESS ===
ok
Test CPVM Internals ... === TestName: test_04_cpvm_internals | Status : SUCCESS ===
ok
Test stop SSVM ... === TestName: test_05_stop_ssvm | Status : SUCCESS ===
ok
Test stop CPVM ... === TestName: test_06_stop_cpvm | Status : SUCCESS ===
ok
Test reboot SSVM ... === TestName: test_07_reboot_ssvm | Status : SUCCESS ===
ok
Test reboot CPVM ... === TestName: test_08_reboot_cpvm | Status : SUCCESS ===
ok
Test destroy SSVM ... === TestName: test_09_destroy_ssvm | Status : SUCCESS ===
ok
Test destroy CPVM ... === TestName: test_10_destroy_cpvm | Status : SUCCESS ===
ok
Test Remote Access VPN in VPC ... === TestName: test_vpc_remote_access_vpn | Status : SUCCESS ===
ok
Test VPN in VPC ... === TestName: test_vpc_site2site_vpn | Status : SUCCESS ===
ok
Test for port forwarding on source NAT ... === TestName: test_01_port_fwd_on_src_nat | Status : SUCCESS ===
ok
Test for port forwarding on non source NAT ... === TestName: test_02_port_fwd_on_non_src_nat | Status : SUCCESS ===
ok
Test for reboot router ... === TestName: test_reboot_router | Status : SUCCESS ===
ok
Test for Router rules for network rules on acquired public IP ... === TestName: test_network_rules_acquired_public_ip_1_static_nat_rule | Status : SUCCESS ===
ok
Test for Router rules for network rules on acquired public IP ... === TestName: test_network_rules_acquired_public_ip_2_nat_rule | Status : SUCCESS ===
ok
Test for Router rules for network rules on acquired public IP ... === TestName: test_network_rules_acquired_public_ip_3_Load_Balancer_Rule | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 34 tests in 19843.563s

FAILED (failures=1)
(END)
  • Failed tests
Test redundant router internals ... === TestName: test_02_RVR_Network_FW_PF_SSH_default_routes_egress_false | Status : FAILED ===
FAIL

Ping @remibergsma @DaanHoogland @miguelaferreira

I executed all the steps of the tests that failed manually, in a new DC, and everything worked fine. I also executed the test itself, with nose - see comment above - , and all worked as expected.

Cheers,
Wilder

@remibergsma
Copy link
Copy Markdown
Contributor

@wilderrodrigues I think we're fine. That test also passes here:

Test redundant router internals ... === TestName: test_02_RVR_Network_FW_PF_SSH_default_routes_egress_false | Status : SUCCESS ===

@asfgit asfgit merged commit 14db2d3 into apache:4.6 Dec 7, 2015
asfgit pushed a commit that referenced this pull request Dec 7, 2015
…9106

CLOUDSTACK-9106 - As a Developer I want the Redundant VPC private gateway feature fixedThis PR contains the same fixes from PR #1179, which was created against the master branch.

In addition, the points mentioned by @DaanHoogland were handled in this new PR:

* Made the code more consistent
  - result = result && methodCall(), instead of throwing exceptions in some places or not checking 2 consecutive returns - in case of rVPC.
* Added an unit test to cover changes in the VpcRouterElementImpl.applyVpnUsers() method. The method returns an array of String, so I had to make sure it would contain the users from 2 consecutive calls. There are 2 tests to cover negative scenarios.

* pr/1184:
  CLOUDSTACK-9106 - Makes Enum name compliant with Java code conventions.
  CLOUDSTACK-9106 - Adds a test to cover the changes in the applyVpnUsers() method
  CLOUDSTACK-9106 - Makes the router commands call more consistent.
  CLOUDSTACK-9106 - Enables private gateway tests on Redundant VPCs
  CLOUDSTACK-9106 - Refactor the createPrivateNicProfileForGateway() method
  CLOUDSTACK-9106 - Reduces the amount of iterations through the routers of a VPC

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.

4 participants