CLOUDSTACK-7928 : Fixed the script 'test_vpc_vm_life_cycle.py' - Removed the Invalid test cases for Stopped VPC VR Scenario

This commit is contained in:
Chandan Purushothama 2014-11-18 09:43:33 -08:00 committed by Sangeetha Hariharan
parent 5327038c16
commit 20a8852db1

View File

@ -2658,173 +2658,6 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
return
@attr(tags=["advanced", "intervlan"], required_hardware="true")
def test_07_migrate_instance_in_network(self):
""" Test migrate an instance in VPC networks
"""
# Validate the following
# 1. Migrate the virtual machines to other hosts
# 2. Vm should be in stopped state. State both the instances
# 3. Make sure that all the PF,LB and Static NAT rules on this VM
# works as expected.
# 3. Make sure that we are able to access google.com from this user Vm
self.debug("Validating if the network rules work properly or not?")
self.validate_network_rules()
host = findSuitableHostForMigration(self.apiclient, self.vm_1.id)
if host is None:
self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
self.debug("Migrating VM-ID: %s on Host: %s to Host: %s" % (
self.vm_1.id,
self.vm_1.hostid,
host.id
))
try:
self.vm_1.migrate(self.apiclient, hostid=host.id)
except Exception as e:
self.fail("Failed to migrate instance, %s" % e)
self.debug("Validating if the network rules work properly or not?")
self.validate_network_rules()
return
@attr(tags=["advanced", "intervlan"], required_hardware="true")
def test_08_user_data(self):
""" Test user data in virtual machines
"""
# Validate the following
# 1. Create a VPC with cidr - 10.1.1.1/16
# 2. Add network1(10.1.1.1/24) and network2(10.1.2.1/24) to this VPC.
# 3. Deploy a vm in network1 and a vm in network2 using userdata
# Steps
# 1.Query for the user data for both the user vms from both networks
# User should be able to query the user data for the vms belonging to
# both the networks from the VR
try:
ssh = self.vm_1.get_ssh_client(
ipaddress=self.public_ip_1.ipaddress.ipaddress,
reconnect=True)
self.debug("SSH into VM is successfully")
except Exception as e:
self.fail("Failed to SSH into instance")
self.debug("check the userdata with that of present in router")
try:
cmds = [
"wget http://%s/latest/user-data" % self.network_1.gateway,
"cat user-data",
]
for c in cmds:
result = ssh.execute(c)
self.debug("%s: %s" % (c, result))
except Exception as e:
self.fail("Failed to SSH in Virtual machine: %s" % e)
res = str(result)
self.assertEqual(
res.count(
self.services["virtual_machine"]["userdata"]),
1,
"Verify user data from router"
)
return
@attr(tags=["advanced", "intervlan"], required_hardware="true")
def test_09_meta_data(self):
""" Test meta data in virtual machines
"""
# Validate the following
# 1. Create a VPC with cidr - 10.1.1.1/16
# 2. Add network1(10.1.1.1/24) and network2(10.1.2.1/24) to this VPC.
# 3. Deploy a vm in network1 and a vm in network2 using userdata
# Steps
# 1.Query for the meta data for both the user vms from both networks
# User should be able to query the user data for the vms belonging to
# both the networks from the VR
try:
ssh = self.vm_1.get_ssh_client(
ipaddress=self.public_ip_1.ipaddress.ipaddress,
reconnect=True)
self.debug("SSH into VM is successfully")
except Exception as e:
self.fail("Failed to SSH into instance")
self.debug("check the metadata with that of present in router")
try:
cmds = [
"wget http://%s/latest/vm-id" % self.network_1.gateway,
"cat vm-id",
]
for c in cmds:
result = ssh.execute(c)
self.debug("%s: %s" % (c, result))
except Exception as e:
self.fail("Failed to SSH in Virtual machine: %s" % e)
res = str(result)
self.assertNotEqual(
res,
None,
"Meta data should be returned from router"
)
return
@attr(tags=["advanced", "intervlan"], required_hardware="true")
def test_10_expunge_instance_in_network(self):
""" Test expunge an instance in VPC networks
"""
# Validate the following
# 1. Recover the virtual machines.
# 2. Vm should be in stopped state. State both the instances
# 3. Make sure that all the PF,LB and Static NAT rules on this VM
# works as expected.
# 3. Make sure that we are able to access google.com from this user Vm
self.debug("Validating if the network rules work properly or not?")
self.validate_network_rules()
self.debug("Delete virtual machines in account: %s" %
self.account.name)
try:
self.vm_1.delete(self.apiclient)
self.vm_2.delete(self.apiclient)
except Exception as e:
self.fail("Failed to destroy the virtual instances, %s" % e)
self.debug(
"Waiting for expunge interval to cleanup the network and VMs")
wait_for_cleanup(
self.apiclient,
["expunge.interval", "expunge.delay"]
)
# Check if the network rules still exists after Vm expunged
self.debug("Checking if NAT rules existed ")
with self.assertRaises(Exception):
NATRule.list(
self.apiclient,
id=self.nat_rule.id,
listall=True
)
LoadBalancerRule.list(
self.apiclient,
id=self.lb_rule.id,
listall=True
)
return
class TestVMLifeCycleDiffHosts(cloudstackTestCase):
@classmethod