mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-3643: Automation: Fix VPC test cases
Also add a timeout for network connection testings. Ideally this timeout should be around 30s or even less, but keep it at 60s for now for safe.
This commit is contained in:
parent
cc99a83d71
commit
9f15779f10
|
|
@ -42,6 +42,7 @@ from marvin.integration.lib.common import (get_domain,
|
|||
get_template,
|
||||
cleanup_resources,
|
||||
list_routers)
|
||||
import socket
|
||||
|
||||
class Services:
|
||||
"""Test VPC network services Load Balancing Rules Test data
|
||||
|
|
@ -179,6 +180,9 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
|
|||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
# We want to fail quicker if it's failure
|
||||
socket.setdefaulttimeout(60)
|
||||
|
||||
cls.api_client = super(
|
||||
TestVPCNetworkLBRules,
|
||||
cls
|
||||
|
|
@ -294,6 +298,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
|
|||
|
||||
def start_VPC_VRouter(self, router):
|
||||
# Start the VPC Router
|
||||
self.debug("Starting router ID: %s" % router.id)
|
||||
cmd = startRouter.startRouterCmd()
|
||||
cmd.id = router.id
|
||||
self.apiclient.startRouter(cmd)
|
||||
|
|
@ -665,7 +670,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
|
|||
self.debug('lb_rule_http=%s' % lb_rule_http.__dict__)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
|
||||
lb_rule_nat.delete()
|
||||
lb_rule_nat.delete(self.apiclient)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
|
||||
return
|
||||
|
||||
|
|
@ -696,7 +701,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
|
|||
self.debug('lb_rule_http=%s' % lb_rule_http.__dict__)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
|
||||
lb_rule_nat.delete()
|
||||
lb_rule_nat.delete(self.apiclient)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
|
||||
return
|
||||
|
||||
|
|
@ -727,8 +732,8 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
|
|||
self.debug('lb_rule_http=%s' % lb_rule_http.__dict__)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
|
||||
lb_rule_nat.delete()
|
||||
lb_rule_http.delete()
|
||||
lb_rule_nat.delete(self.apiclient)
|
||||
lb_rule_http.delete(self.apiclient)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
|
||||
return
|
||||
|
|
@ -760,8 +765,8 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
|
|||
self.debug('lb_rule_http=%s' % lb_rule_http.__dict__)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
|
||||
lb_rule_nat.delete()
|
||||
lb_rule_http.delete()
|
||||
lb_rule_nat.delete(self.apiclient)
|
||||
lb_rule_http.delete(self.apiclient)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ from marvin.integration.lib.common import (get_domain,
|
|||
get_template,
|
||||
cleanup_resources,
|
||||
list_routers)
|
||||
import socket
|
||||
|
||||
|
||||
class Services:
|
||||
|
|
@ -179,6 +180,9 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
|
|||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
# We want to fail quicker if it's failure
|
||||
socket.setdefaulttimeout(60)
|
||||
|
||||
cls.api_client = super(
|
||||
TestVPCNetworkPFRules,
|
||||
cls
|
||||
|
|
@ -294,6 +298,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
|
|||
|
||||
def start_vpcrouter(self, router):
|
||||
# Start the VPC Router
|
||||
self.debug("Starting router ID: %s" % router.id)
|
||||
cmd = startRouter.startRouterCmd()
|
||||
cmd.id = router.id
|
||||
self.apiclient.startRouter(cmd)
|
||||
|
|
@ -634,7 +639,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
|
|||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
|
||||
router = self.stop_vpcrouter()
|
||||
http_rule.delete()
|
||||
http_rule.delete(self.apiclient)
|
||||
self.start_vpcrouter(router)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
|
||||
return
|
||||
|
|
@ -663,7 +668,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
|
|||
#http_rule = self.create_egress_Internet_Rule(network_1)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
|
||||
http_rule.delete()
|
||||
http_rule.delete(self.apiclient)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
|
||||
return
|
||||
|
||||
|
|
@ -695,8 +700,8 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
|
|||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
|
||||
router = self.stop_vpcrouter()
|
||||
http_rule.delete()
|
||||
nat_rule.delete()
|
||||
http_rule.delete(self.apiclient)
|
||||
nat_rule.delete(self.apiclient)
|
||||
self.start_vpcrouter(router)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
|
||||
|
|
@ -727,8 +732,8 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
|
|||
#http_rule = self.create_egress_Internet_Rule(network_1)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
|
||||
http_rule.delete()
|
||||
nat_rule.delete()
|
||||
http_rule.delete(self.apiclient)
|
||||
nat_rule.delete(self.apiclient)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
|
||||
return
|
||||
|
|
@ -764,34 +769,40 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
|
|||
public_ip_2 = self.acquire_publicip(network_1)
|
||||
nat_rule1 = self.create_natrule(vm_1, public_ip_1, network_1)
|
||||
nat_rule2 = self.create_natrule(vm_2, public_ip_2, network_1)
|
||||
http_rule1 = self.open_egress_to_world(network_1)
|
||||
nat_rule3 = self.create_natrule(vm_3, public_ip_1, network_2)
|
||||
nat_rule4 = self.create_natrule(vm_4, public_ip_2, network_2)
|
||||
http_rule2 = self.open_egress_to_world(network_2)
|
||||
http_rule1 = self.create_natrule(vm_1, public_ip_1, network_1, self.services["http_rule"])
|
||||
http_rule2 = self.create_natrule(vm_2, public_ip_2, network_1, self.services["http_rule"])
|
||||
public_ip_3 = self.acquire_publicip(network_2)
|
||||
public_ip_4 = self.acquire_publicip(network_2)
|
||||
nat_rule3 = self.create_natrule(vm_3, public_ip_3, network_2)
|
||||
nat_rule4 = self.create_natrule(vm_4, public_ip_4, network_2)
|
||||
http_rule3 = self.create_natrule(vm_3, public_ip_3, network_2, self.services["http_rule"])
|
||||
http_rule4 = self.create_natrule(vm_4, public_ip_4, network_2, self.services["http_rule"])
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
|
||||
self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=False)
|
||||
self.check_ssh_into_vm(vm_3, public_ip_1, testnegative=False)
|
||||
self.check_ssh_into_vm(vm_4, public_ip_2, testnegative=False)
|
||||
self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=False)
|
||||
self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=False)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
|
||||
self.check_wget_from_vm(vm_2, public_ip_2, testnegative=False)
|
||||
self.check_wget_from_vm(vm_3, public_ip_1, testnegative=False)
|
||||
self.check_wget_from_vm(vm_4, public_ip_2, testnegative=False)
|
||||
self.check_wget_from_vm(vm_3, public_ip_3, testnegative=False)
|
||||
self.check_wget_from_vm(vm_4, public_ip_4, testnegative=False)
|
||||
router = self.stop_vpcrouter()
|
||||
nat_rule1.delete()
|
||||
nat_rule2.delete()
|
||||
nat_rule3.delete()
|
||||
nat_rule4.delete()
|
||||
http_rule1.delete()
|
||||
http_rule2.delete()
|
||||
nat_rule1.delete(self.apiclient)
|
||||
nat_rule2.delete(self.apiclient)
|
||||
nat_rule3.delete(self.apiclient)
|
||||
nat_rule4.delete(self.apiclient)
|
||||
http_rule1.delete(self.apiclient)
|
||||
http_rule2.delete(self.apiclient)
|
||||
http_rule3.delete(self.apiclient)
|
||||
http_rule4.delete(self.apiclient)
|
||||
self.start_vpcrouter(router)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
|
||||
self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=True)
|
||||
self.check_ssh_into_vm(vm_3, public_ip_1, testnegative=True)
|
||||
self.check_ssh_into_vm(vm_4, public_ip_2, testnegative=True)
|
||||
self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=True)
|
||||
self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=True)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
|
||||
self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True)
|
||||
self.check_wget_from_vm(vm_3, public_ip_1, testnegative=True)
|
||||
self.check_wget_from_vm(vm_4, public_ip_2, testnegative=True)
|
||||
self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True)
|
||||
self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "intervlan"])
|
||||
|
|
@ -822,30 +833,36 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
|
|||
public_ip_2 = self.acquire_publicip(network_1)
|
||||
nat_rule1 = self.create_natrule(vm_1, public_ip_1, network_1)
|
||||
nat_rule2 = self.create_natrule(vm_2, public_ip_2, network_1)
|
||||
http_rule1 = self.open_egress_to_world(network_1)
|
||||
nat_rule3 = self.create_natrule(vm_3, public_ip_1, network_2)
|
||||
nat_rule4 = self.create_natrule(vm_4, public_ip_2, network_2)
|
||||
http_rule2 = self.open_egress_to_world(network_2)
|
||||
http_rule1 = self.create_natrule(vm_1, public_ip_1, network_1, self.services["http_rule"])
|
||||
http_rule2 = self.create_natrule(vm_2, public_ip_2, network_1, self.services["http_rule"])
|
||||
public_ip_3 = self.acquire_publicip(network_2)
|
||||
public_ip_4 = self.acquire_publicip(network_2)
|
||||
nat_rule3 = self.create_natrule(vm_3, public_ip_3, network_2)
|
||||
nat_rule4 = self.create_natrule(vm_4, public_ip_4, network_2)
|
||||
http_rule3 = self.create_natrule(vm_3, public_ip_3, network_2, self.services["http_rule"])
|
||||
http_rule4 = self.create_natrule(vm_4, public_ip_4, network_2, self.services["http_rule"])
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
|
||||
self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=False)
|
||||
self.check_ssh_into_vm(vm_3, public_ip_1, testnegative=False)
|
||||
self.check_ssh_into_vm(vm_4, public_ip_2, testnegative=False)
|
||||
self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=False)
|
||||
self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=False)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
|
||||
self.check_wget_from_vm(vm_2, public_ip_2, testnegative=False)
|
||||
self.check_wget_from_vm(vm_3, public_ip_1, testnegative=False)
|
||||
self.check_wget_from_vm(vm_4, public_ip_2, testnegative=False)
|
||||
nat_rule1.delete()
|
||||
nat_rule2.delete()
|
||||
nat_rule3.delete()
|
||||
nat_rule4.delete()
|
||||
http_rule1.delete()
|
||||
http_rule2.delete()
|
||||
self.check_wget_from_vm(vm_3, public_ip_3, testnegative=False)
|
||||
self.check_wget_from_vm(vm_4, public_ip_4, testnegative=False)
|
||||
nat_rule1.delete(self.apiclient)
|
||||
nat_rule2.delete(self.apiclient)
|
||||
nat_rule3.delete(self.apiclient)
|
||||
nat_rule4.delete(self.apiclient)
|
||||
http_rule1.delete(self.apiclient)
|
||||
http_rule2.delete(self.apiclient)
|
||||
http_rule3.delete(self.apiclient)
|
||||
http_rule4.delete(self.apiclient)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
|
||||
self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=True)
|
||||
self.check_ssh_into_vm(vm_3, public_ip_1, testnegative=True)
|
||||
self.check_ssh_into_vm(vm_4, public_ip_2, testnegative=True)
|
||||
self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=True)
|
||||
self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=True)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
|
||||
self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True)
|
||||
self.check_wget_from_vm(vm_3, public_ip_1, testnegative=True)
|
||||
self.check_wget_from_vm(vm_4, public_ip_2, testnegative=True)
|
||||
self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True)
|
||||
self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ from marvin.integration.lib.common import (get_domain,
|
|||
get_template,
|
||||
cleanup_resources,
|
||||
list_routers)
|
||||
import socket
|
||||
|
||||
|
||||
class Services:
|
||||
|
|
@ -178,6 +179,9 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
|
|||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
# We want to fail quicker if it's failure
|
||||
socket.setdefaulttimeout(60)
|
||||
|
||||
cls.api_client = super(
|
||||
TestVPCNetworkPFRules,
|
||||
cls
|
||||
|
|
@ -634,8 +638,8 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
|
|||
http_rule = self.create_NatRule_For_VM(vm_1, public_ip_1, network_1, self.services["http_rule"])
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
|
||||
http_rule.delete()
|
||||
nat_rule.delete()
|
||||
http_rule.delete(self.apiclient)
|
||||
nat_rule.delete(self.apiclient)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
|
||||
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
|
||||
return
|
||||
|
|
@ -682,12 +686,12 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
|
|||
self.check_wget_from_vm(vm_2, public_ip_2, testnegative=False)
|
||||
self.check_wget_from_vm(vm_3, public_ip_1, testnegative=False)
|
||||
self.check_wget_from_vm(vm_4, public_ip_2, testnegative=False)
|
||||
nat_rule1.delete()
|
||||
nat_rule2.delete()
|
||||
nat_rule3.delete()
|
||||
nat_rule4.delete()
|
||||
http_rule1.delete()
|
||||
http_rule2.delete()
|
||||
nat_rule1.delete(self.apiclient)
|
||||
nat_rule2.delete(self.apiclient)
|
||||
nat_rule3.delete(self.apiclient)
|
||||
nat_rule4.delete(self.apiclient)
|
||||
http_rule1.delete(self.apiclient)
|
||||
http_rule2.delete(self.apiclient)
|
||||
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
|
||||
self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=True)
|
||||
self.check_ssh_into_vm(vm_3, public_ip_1, testnegative=True)
|
||||
|
|
|
|||
Loading…
Reference in New Issue