mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge branch '4.8' into 4.9
This commit is contained in:
commit
9b9b49e10b
@ -214,6 +214,10 @@ class updateDataBag:
|
|||||||
elif (self.qFile.data['cmd_line']['type'] == "dhcpsrvr"):
|
elif (self.qFile.data['cmd_line']['type'] == "dhcpsrvr"):
|
||||||
self.processCLItem('0', "guest")
|
self.processCLItem('0', "guest")
|
||||||
self.processCLItem('1', "control")
|
self.processCLItem('1', "control")
|
||||||
|
elif (self.qFile.data['cmd_line']['type'] == "ilbvm"):
|
||||||
|
self.processCLItem('0', "guest")
|
||||||
|
self.processCLItem('1', "control")
|
||||||
|
|
||||||
return cs_cmdline.merge(dbag, self.qFile.data)
|
return cs_cmdline.merge(dbag, self.qFile.data)
|
||||||
|
|
||||||
def processCLItem(self, num, nw_type):
|
def processCLItem(self, num, nw_type):
|
||||||
@ -225,10 +229,13 @@ class updateDataBag:
|
|||||||
dp['source_nat'] = False
|
dp['source_nat'] = False
|
||||||
dp['add'] = True
|
dp['add'] = True
|
||||||
dp['one_to_one_nat'] = False
|
dp['one_to_one_nat'] = False
|
||||||
if('localgw' in self.qFile.data['cmd_line']):
|
if nw_type == "public":
|
||||||
dp['gateway'] = self.qFile.data['cmd_line']['localgw']
|
dp['gateway'] = self.qFile.data['cmd_line']['gateway']
|
||||||
else:
|
else:
|
||||||
dp['gateway'] = 'None'
|
if('localgw' in self.qFile.data['cmd_line']):
|
||||||
|
dp['gateway'] = self.qFile.data['cmd_line']['localgw']
|
||||||
|
else:
|
||||||
|
dp['gateway'] = 'None'
|
||||||
dp['nic_dev_id'] = num
|
dp['nic_dev_id'] = num
|
||||||
dp['nw_type'] = nw_type
|
dp['nw_type'] = nw_type
|
||||||
qf = QueueFile()
|
qf = QueueFile()
|
||||||
|
|||||||
@ -49,6 +49,7 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
|
|||||||
testClient = super(TestDeployvGPUenabledVM, self).getClsTestClient()
|
testClient = super(TestDeployvGPUenabledVM, self).getClsTestClient()
|
||||||
self.apiclient = testClient.getApiClient()
|
self.apiclient = testClient.getApiClient()
|
||||||
self.testdata = self.testClient.getParsedTestDataConfig()
|
self.testdata = self.testClient.getParsedTestDataConfig()
|
||||||
|
self.hostConfig = self.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
|
||||||
self._cleanup = []
|
self._cleanup = []
|
||||||
self.unsupportedHypervisor = False
|
self.unsupportedHypervisor = False
|
||||||
self.noSuitableHost = False
|
self.noSuitableHost = False
|
||||||
@ -69,8 +70,8 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
|
|||||||
sshClient = SshClient(
|
sshClient = SshClient(
|
||||||
host=ghost.ipaddress,
|
host=ghost.ipaddress,
|
||||||
port=self.testdata['configurableData']['host']["publicport"],
|
port=self.testdata['configurableData']['host']["publicport"],
|
||||||
user=self.testdata['configurableData']['host']["username"],
|
user=self.hostConfig['username'],
|
||||||
passwd=self.testdata['configurableData']['host']["password"])
|
passwd=self.hostConfig['password'])
|
||||||
if ghost.hypervisorversion == "6.2.0":
|
if ghost.hypervisorversion == "6.2.0":
|
||||||
res = sshClient.execute(
|
res = sshClient.execute(
|
||||||
"xe patch-list uuid=0850b186-4d47-11e3-a720-001b2151a503")
|
"xe patch-list uuid=0850b186-4d47-11e3-a720-001b2151a503")
|
||||||
|
|||||||
@ -226,7 +226,7 @@ class Services:
|
|||||||
"displaytext": "macchinina kvm",
|
"displaytext": "macchinina kvm",
|
||||||
"format": "qcow2",
|
"format": "qcow2",
|
||||||
"hypervisor": "kvm",
|
"hypervisor": "kvm",
|
||||||
"ostype": "Other PV (64-bit)",
|
"ostype": "Other Linux (64-bit)",
|
||||||
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
|
||||||
"requireshvm": "True"
|
"requireshvm": "True"
|
||||||
},
|
},
|
||||||
@ -235,7 +235,7 @@ class Services:
|
|||||||
"displaytext": "macchinina xen",
|
"displaytext": "macchinina xen",
|
||||||
"format": "vhd",
|
"format": "vhd",
|
||||||
"hypervisor": "xenserver",
|
"hypervisor": "xenserver",
|
||||||
"ostype": "Other PV (64-bit)",
|
"ostype": "Other Linux (64-bit)",
|
||||||
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
|
||||||
"requireshvm": "True",
|
"requireshvm": "True",
|
||||||
},
|
},
|
||||||
@ -244,7 +244,7 @@ class Services:
|
|||||||
"displaytext": "macchinina xen",
|
"displaytext": "macchinina xen",
|
||||||
"format": "vhd",
|
"format": "vhd",
|
||||||
"hypervisor": "hyperv",
|
"hypervisor": "hyperv",
|
||||||
"ostype": "Other PV (64-bit)",
|
"ostype": "Other Linux (64-bit)",
|
||||||
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
|
||||||
"requireshvm": "True",
|
"requireshvm": "True",
|
||||||
},
|
},
|
||||||
@ -253,8 +253,8 @@ class Services:
|
|||||||
"displaytext": "macchinina vmware",
|
"displaytext": "macchinina vmware",
|
||||||
"format": "ova",
|
"format": "ova",
|
||||||
"hypervisor": "vmware",
|
"hypervisor": "vmware",
|
||||||
"ostype": "Other PV (64-bit)",
|
"ostype": "Other Linux (64-bit)",
|
||||||
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.vmdk.bz2",
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
|
||||||
"requireshvm": "True",
|
"requireshvm": "True",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -302,7 +302,7 @@ class TestInternalLb(cloudstackTestCase):
|
|||||||
%s" % (cls.account.name,
|
%s" % (cls.account.name,
|
||||||
cls.account.id))
|
cls.account.id))
|
||||||
|
|
||||||
cls._cleanup = [cls.template, cls.account, cls.compute_offering]
|
cls._cleanup = [cls.account, cls.compute_offering]
|
||||||
return
|
return
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -842,6 +842,9 @@ class TestInternalLb(cloudstackTestCase):
|
|||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
cls.logger.debug("Cleaning up class resources")
|
cls.logger.debug("Cleaning up class resources")
|
||||||
|
try:
|
||||||
|
cls.template.delete(cls.apiclient)
|
||||||
|
except Exception: pass
|
||||||
cleanup_resources(cls.apiclient, cls._cleanup)
|
cleanup_resources(cls.apiclient, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Cleanup failed with %s" % e)
|
raise Exception("Cleanup failed with %s" % e)
|
||||||
|
|||||||
@ -1039,6 +1039,7 @@ class TestRouterRules(cloudstackTestCase):
|
|||||||
cls.domain = get_domain(cls.apiclient)
|
cls.domain = get_domain(cls.apiclient)
|
||||||
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
|
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
|
||||||
cls.hypervisor = testClient.getHypervisorInfo()
|
cls.hypervisor = testClient.getHypervisorInfo()
|
||||||
|
cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
|
||||||
template = get_template(
|
template = get_template(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
@ -1117,8 +1118,8 @@ class TestRouterRules(cloudstackTestCase):
|
|||||||
"Check for list hosts response return valid data"
|
"Check for list hosts response return valid data"
|
||||||
)
|
)
|
||||||
host = hosts[0]
|
host = hosts[0]
|
||||||
host.user = self.services["configurableData"]["host"]["username"]
|
host.user = self.hostConfig['username']
|
||||||
host.passwd = self.services["configurableData"]["host"]["password"]
|
host.passwd = self.hostConfig['password']
|
||||||
|
|
||||||
result = get_process_status(
|
result = get_process_status(
|
||||||
host.ipaddress,
|
host.ipaddress,
|
||||||
|
|||||||
@ -64,7 +64,7 @@ class TestNetworkACL(cloudstackTestCase):
|
|||||||
self.assert_(networkOffering is not None and len(networkOffering) > 0, "No VPC based network offering")
|
self.assert_(networkOffering is not None and len(networkOffering) > 0, "No VPC based network offering")
|
||||||
|
|
||||||
# 1) Create VPC
|
# 1) Create VPC
|
||||||
vpcOffering = VpcOffering.list(self.apiclient,isdefault=True)
|
vpcOffering = VpcOffering.list(self.apiclient, name="Default VPC offering")
|
||||||
self.assert_(vpcOffering is not None and len(vpcOffering)>0, "No VPC offerings found")
|
self.assert_(vpcOffering is not None and len(vpcOffering)>0, "No VPC offerings found")
|
||||||
self.services["vpc"] = {}
|
self.services["vpc"] = {}
|
||||||
self.services["vpc"]["name"] = "vpc-networkacl"
|
self.services["vpc"]["name"] = "vpc-networkacl"
|
||||||
|
|||||||
@ -47,9 +47,17 @@ class TestUpdatePhysicalNetwork(cloudstackTestCase):
|
|||||||
self.assertNotEqual(len(phy_networks), 0,
|
self.assertNotEqual(len(phy_networks), 0,
|
||||||
msg="There are no physical networks in the zone")
|
msg="There are no physical networks in the zone")
|
||||||
|
|
||||||
self.network = phy_networks[0]
|
phy_network = None
|
||||||
self.networkid = phy_networks[0].id
|
for network in phy_networks:
|
||||||
self.existing_vlan = phy_networks[0].vlan
|
if hasattr(network, 'vlan'):
|
||||||
|
phy_network = network
|
||||||
|
break
|
||||||
|
|
||||||
|
self.assert_(phy_network is not None, msg="No network with vlan found")
|
||||||
|
|
||||||
|
self.network = phy_network
|
||||||
|
self.networkid = phy_network.id
|
||||||
|
self.existing_vlan = phy_network.vlan
|
||||||
vlan1 = self.existing_vlan+","+self.vlan["partial_range"][0]
|
vlan1 = self.existing_vlan+","+self.vlan["partial_range"][0]
|
||||||
updatePhysicalNetworkResponse = self.network.update(self.apiClient, id = self.networkid, vlan = vlan1)
|
updatePhysicalNetworkResponse = self.network.update(self.apiClient, id = self.networkid, vlan = vlan1)
|
||||||
self.assert_(updatePhysicalNetworkResponse is not None,
|
self.assert_(updatePhysicalNetworkResponse is not None,
|
||||||
@ -65,7 +73,6 @@ class TestUpdatePhysicalNetwork(cloudstackTestCase):
|
|||||||
vlanranges= updatePhysicalNetworkResponse2.vlan
|
vlanranges= updatePhysicalNetworkResponse2.vlan
|
||||||
self.assert_(vlanranges is not None,
|
self.assert_(vlanranges is not None,
|
||||||
"No VLAN ranges found on the deployment")
|
"No VLAN ranges found on the deployment")
|
||||||
self.assert_(str(vlanranges) == vlan2, "vlan ranges are not extended")
|
|
||||||
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
|||||||
@ -64,6 +64,7 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase):
|
|||||||
cls.testClient = super(TestIsolatedNetworksPasswdServer, cls).getClsTestClient()
|
cls.testClient = super(TestIsolatedNetworksPasswdServer, cls).getClsTestClient()
|
||||||
cls.api_client = cls.testClient.getApiClient()
|
cls.api_client = cls.testClient.getApiClient()
|
||||||
|
|
||||||
|
cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
|
||||||
cls.services = cls.testClient.getParsedTestDataConfig()
|
cls.services = cls.testClient.getParsedTestDataConfig()
|
||||||
# Get Zone, Domain and templates
|
# Get Zone, Domain and templates
|
||||||
cls.domain = get_domain(cls.api_client)
|
cls.domain = get_domain(cls.api_client)
|
||||||
@ -141,8 +142,6 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase):
|
|||||||
|
|
||||||
cls.services["configurableData"] = {
|
cls.services["configurableData"] = {
|
||||||
"host": {
|
"host": {
|
||||||
"password": "password",
|
|
||||||
"username": "root",
|
|
||||||
"port": 22
|
"port": 22
|
||||||
},
|
},
|
||||||
"input": "INPUT",
|
"input": "INPUT",
|
||||||
@ -170,6 +169,7 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.apiclient = self.testClient.getApiClient()
|
self.apiclient = self.testClient.getApiClient()
|
||||||
|
self.hypervisor = self.testClient.getHypervisorInfo()
|
||||||
return
|
return
|
||||||
|
|
||||||
def test_ssh_command(self, vm, nat_rule, rule_label):
|
def test_ssh_command(self, vm, nat_rule, rule_label):
|
||||||
@ -181,12 +181,12 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase):
|
|||||||
ssh = vm.get_ssh_client(ipaddress=nat_rule.ipaddress, port=self.services[rule_label]["publicport"], retries=5)
|
ssh = vm.get_ssh_client(ipaddress=nat_rule.ipaddress, port=self.services[rule_label]["publicport"], retries=5)
|
||||||
result = str(ssh.execute(ssh_command))
|
result = str(ssh.execute(ssh_command))
|
||||||
|
|
||||||
self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received")))
|
self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count(" 0% packet loss")))
|
||||||
except:
|
except:
|
||||||
self.fail("Failed to SSH into VM - %s" % (nat_rule.ipaddress))
|
self.fail("Failed to SSH into VM - %s" % (nat_rule.ipaddress))
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
result.count("3 packets received"),
|
result.count(" 0% packet loss"),
|
||||||
1,
|
1,
|
||||||
"Ping to outside world from VM should be successful"
|
"Ping to outside world from VM should be successful"
|
||||||
)
|
)
|
||||||
@ -202,23 +202,34 @@ class TestIsolatedNetworksPasswdServer(cloudstackTestCase):
|
|||||||
"Check for list hosts response return valid data")
|
"Check for list hosts response return valid data")
|
||||||
|
|
||||||
host = hosts[0]
|
host = hosts[0]
|
||||||
host.user = self.services["configurableData"]["host"]["username"]
|
host.user = self.hostConfig['username']
|
||||||
host.passwd = self.services["configurableData"]["host"]["password"]
|
host.passwd = self.hostConfig['password']
|
||||||
host.port = self.services["configurableData"]["host"]["port"]
|
host.port = self.services["configurableData"]["host"]["port"]
|
||||||
|
|
||||||
try:
|
if self.hypervisor.lower() in ('vmware', 'hyperv'):
|
||||||
result = get_process_status(
|
result = get_process_status(
|
||||||
host.ipaddress,
|
self.apiclient.connection.mgtSvr,
|
||||||
host.port,
|
22,
|
||||||
host.user,
|
self.apiclient.connection.user,
|
||||||
host.passwd,
|
self.apiclient.connection.passwd,
|
||||||
router.linklocalip,
|
router.linklocalip,
|
||||||
"cat /var/cache/cloud/passwords-%s | grep %s | sed 's/=/ /g' | awk '{print $1}'" % (vm.nic[0].gateway, vm.nic[0].ipaddress))
|
"cat /var/cache/cloud/passwords-%s | grep %s | sed 's/=/ /g' | awk '{print $1}'" % (vm.nic[0].gateway, vm.nic[0].ipaddress),
|
||||||
except KeyError:
|
hypervisor=self.hypervisor
|
||||||
self.skipTest(
|
)
|
||||||
"Provide a marvin config file with host\
|
else:
|
||||||
credentials to run %s" %
|
try:
|
||||||
self._testMethodName)
|
result = get_process_status(
|
||||||
|
host.ipaddress,
|
||||||
|
host.port,
|
||||||
|
host.user,
|
||||||
|
host.passwd,
|
||||||
|
router.linklocalip,
|
||||||
|
"cat /var/cache/cloud/passwords-%s | grep %s | sed 's/=/ /g' | awk '{print $1}'" % (vm.nic[0].gateway, vm.nic[0].ipaddress))
|
||||||
|
except KeyError:
|
||||||
|
self.skipTest(
|
||||||
|
"Provide a marvin config file with host\
|
||||||
|
credentials to run %s" %
|
||||||
|
self._testMethodName)
|
||||||
|
|
||||||
self.logger.debug("cat /var/cache/cloud/passwords-%s | grep %s | sed 's/=/ /g' | awk '{print $1}' RESULT IS ==> %s" % (vm.nic[0].gateway, vm.nic[0].ipaddress, result))
|
self.logger.debug("cat /var/cache/cloud/passwords-%s | grep %s | sed 's/=/ /g' | awk '{print $1}' RESULT IS ==> %s" % (vm.nic[0].gateway, vm.nic[0].ipaddress, result))
|
||||||
res = str(result)
|
res = str(result)
|
||||||
|
|||||||
@ -157,6 +157,9 @@ class TestPrimaryStorageServices(cloudstackTestCase):
|
|||||||
if self.hypervisor.lower() in ["kvm","hyperv", "vmware", "lxc"]:
|
if self.hypervisor.lower() in ["kvm","hyperv", "vmware", "lxc"]:
|
||||||
raise self.skipTest("iscsi primary storage not supported on kvm, VMWare, Hyper-V, or LXC")
|
raise self.skipTest("iscsi primary storage not supported on kvm, VMWare, Hyper-V, or LXC")
|
||||||
|
|
||||||
|
if not self.services["configurableData"]["iscsi"]["url"]:
|
||||||
|
raise self.skipTest("iscsi test storage url not setup, skipping")
|
||||||
|
|
||||||
# Validate the following:
|
# Validate the following:
|
||||||
# 1. List Clusters
|
# 1. List Clusters
|
||||||
# 2. verify that the cluster is in 'Enabled' allocation state
|
# 2. verify that the cluster is in 'Enabled' allocation state
|
||||||
|
|||||||
@ -37,8 +37,6 @@ class Services:
|
|||||||
self.services = {
|
self.services = {
|
||||||
"configurableData": {
|
"configurableData": {
|
||||||
"host": {
|
"host": {
|
||||||
"password": "password",
|
|
||||||
"username": "root",
|
|
||||||
"port": 22
|
"port": 22
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -173,6 +171,7 @@ class TestPrivateGwACL(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"])
|
cls.services["ostype"])
|
||||||
|
|
||||||
|
cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
|
||||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||||
cls.services["virtual_machine"]["template"] = cls.template.id
|
cls.services["virtual_machine"]["template"] = cls.template.id
|
||||||
|
|
||||||
@ -197,6 +196,8 @@ class TestPrivateGwACL(cloudstackTestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.apiclient = self.testClient.getApiClient()
|
self.apiclient = self.testClient.getApiClient()
|
||||||
self.dbclient = self.testClient.getDbConnection()
|
self.dbclient = self.testClient.getDbConnection()
|
||||||
|
self.hypervisor = self.testClient.getHypervisorInfo()
|
||||||
|
|
||||||
self.logger.debug("Creating Admin Account for Domain ID ==> %s" % self.domain.id)
|
self.logger.debug("Creating Admin Account for Domain ID ==> %s" % self.domain.id)
|
||||||
self.account = Account.create(
|
self.account = Account.create(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
@ -236,13 +237,13 @@ class TestPrivateGwACL(cloudstackTestCase):
|
|||||||
|
|
||||||
self.cleanup = [vpc, vpc_off, self.account]
|
self.cleanup = [vpc, vpc_off, self.account]
|
||||||
|
|
||||||
physical_networks = get_physical_networks(self.apiclient, self.zone.id)
|
physical_network = self.get_guest_traffic_physical_network(self.apiclient, self.zone.id)
|
||||||
if not physical_networks:
|
if not physical_network:
|
||||||
self.fail("No Physical Networks found!")
|
self.fail("No Physical Networks found!")
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select vnet from op_dc_vnet_alloc where physical_network_id=\
|
"select vnet from op_dc_vnet_alloc where physical_network_id=\
|
||||||
(select id from physical_network where uuid='%s' ) and taken is NULL;" % physical_networks[0].id
|
(select id from physical_network where uuid='%s' ) and taken is NULL and reservation_id is NULL and account_id is NULL ORDER BY id DESC;" % physical_network.id
|
||||||
)
|
)
|
||||||
self.assertEqual(validateList(qresultset)[0],
|
self.assertEqual(validateList(qresultset)[0],
|
||||||
PASS,
|
PASS,
|
||||||
@ -312,13 +313,13 @@ class TestPrivateGwACL(cloudstackTestCase):
|
|||||||
|
|
||||||
self.cleanup = [vpc_1, vpc_2, vpc_off, self.account]
|
self.cleanup = [vpc_1, vpc_2, vpc_off, self.account]
|
||||||
|
|
||||||
physical_networks = get_physical_networks(self.apiclient, self.zone.id)
|
physical_network = self.get_guest_traffic_physical_network(self.apiclient, self.zone.id)
|
||||||
if not physical_networks:
|
if not physical_network:
|
||||||
self.fail("No Physical Networks found!")
|
self.fail("No Physical Networks found!")
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select vnet from op_dc_vnet_alloc where physical_network_id=\
|
"select vnet from op_dc_vnet_alloc where physical_network_id=\
|
||||||
(select id from physical_network where uuid='%s' ) and taken is NULL;" % physical_networks[0].id
|
(select id from physical_network where uuid='%s' ) and taken is NULL and reservation_id is NULL and account_id is NULL ORDER BY id DESC;" % physical_network.id
|
||||||
)
|
)
|
||||||
self.assertEqual(validateList(qresultset)[0],
|
self.assertEqual(validateList(qresultset)[0],
|
||||||
PASS,
|
PASS,
|
||||||
@ -372,12 +373,15 @@ class TestPrivateGwACL(cloudstackTestCase):
|
|||||||
|
|
||||||
self.cleanup = [vpc_1, vpc_off, self.account]
|
self.cleanup = [vpc_1, vpc_off, self.account]
|
||||||
|
|
||||||
physical_networks = get_physical_networks(self.apiclient, self.zone.id)
|
physical_network = self.get_guest_traffic_physical_network(self.apiclient, self.zone.id)
|
||||||
if not physical_networks:
|
if not physical_network:
|
||||||
self.fail("No Physical Networks found!")
|
self.fail("No Physical Networks found!")
|
||||||
|
qresultset = self.dbclient.execute(
|
||||||
vlans = physical_networks[0].vlan.split('-')
|
"select vnet from op_dc_vnet_alloc where physical_network_id=\
|
||||||
vlan_1 = int(vlans[0])
|
(select id from physical_network where uuid='%s' ) and taken is NULL and reservation_id is NULL and account_id is NULL ORDER BY id DESC;" % physical_network.id
|
||||||
|
)
|
||||||
|
vlans = qresultset
|
||||||
|
vlan_1 = int(vlans[0][0])
|
||||||
|
|
||||||
net_offering_no_lb = "network_offering_no_lb"
|
net_offering_no_lb = "network_offering_no_lb"
|
||||||
|
|
||||||
@ -408,7 +412,7 @@ class TestPrivateGwACL(cloudstackTestCase):
|
|||||||
|
|
||||||
public_ip_1 = self.acquire_publicip(vpc_1, network_1)
|
public_ip_1 = self.acquire_publicip(vpc_1, network_1)
|
||||||
nat_rule_1 = self.create_natrule(vpc_1, vm1, public_ip_1, network_1)
|
nat_rule_1 = self.create_natrule(vpc_1, vm1, public_ip_1, network_1)
|
||||||
|
|
||||||
self.check_private_gateway_interfaces()
|
self.check_private_gateway_interfaces()
|
||||||
|
|
||||||
self.check_pvt_gw_connectivity(vm1, public_ip_1, [vm2.nic[0].ipaddress, vm3.nic[0].ipaddress, vm4.nic[0].ipaddress])
|
self.check_pvt_gw_connectivity(vm1, public_ip_1, [vm2.nic[0].ipaddress, vm3.nic[0].ipaddress, vm4.nic[0].ipaddress])
|
||||||
@ -589,14 +593,14 @@ class TestPrivateGwACL(cloudstackTestCase):
|
|||||||
return obj_network
|
return obj_network
|
||||||
|
|
||||||
def createPvtGw(self, vpc, ip_address, gateway, aclId, vlan):
|
def createPvtGw(self, vpc, ip_address, gateway, aclId, vlan):
|
||||||
physical_networks = get_physical_networks(self.apiclient, self.zone.id)
|
physical_network = self.get_guest_traffic_physical_network(self.apiclient, self.zone.id)
|
||||||
if not physical_networks:
|
if not physical_network:
|
||||||
self.fail("No Physical Networks found!")
|
self.fail("No Physical Networks found!")
|
||||||
|
|
||||||
self.logger.debug('::: Physical Networks ::: ==> %s' % physical_networks)
|
self.logger.debug('::: Physical Networks ::: ==> %s' % physical_network)
|
||||||
|
|
||||||
createPrivateGatewayCmd = createPrivateGateway.createPrivateGatewayCmd()
|
createPrivateGatewayCmd = createPrivateGateway.createPrivateGatewayCmd()
|
||||||
createPrivateGatewayCmd.physicalnetworkid = physical_networks[0].id
|
createPrivateGatewayCmd.physicalnetworkid = physical_network.id
|
||||||
createPrivateGatewayCmd.gateway = gateway
|
createPrivateGatewayCmd.gateway = gateway
|
||||||
createPrivateGatewayCmd.netmask = "255.255.255.0"
|
createPrivateGatewayCmd.netmask = "255.255.255.0"
|
||||||
createPrivateGatewayCmd.ipaddress = ip_address
|
createPrivateGatewayCmd.ipaddress = ip_address
|
||||||
@ -707,13 +711,13 @@ class TestPrivateGwACL(cloudstackTestCase):
|
|||||||
self.logger.debug("Ping to VM inside another Network Tier")
|
self.logger.debug("Ping to VM inside another Network Tier")
|
||||||
result = str(ssh.execute(ssh_command))
|
result = str(ssh.execute(ssh_command))
|
||||||
|
|
||||||
self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received")))
|
self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 received")))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("SSH Access failed for %s: %s" % \
|
self.fail("SSH Access failed for %s: %s" % \
|
||||||
(virtual_machine, e)
|
(virtual_machine, e)
|
||||||
)
|
)
|
||||||
|
|
||||||
succeeded_pings += result.count("3 packets received")
|
succeeded_pings += result.count("3 received")
|
||||||
|
|
||||||
|
|
||||||
self.assertTrue(succeeded_pings >= minimum_vms_to_pass,
|
self.assertTrue(succeeded_pings >= minimum_vms_to_pass,
|
||||||
@ -751,28 +755,47 @@ class TestPrivateGwACL(cloudstackTestCase):
|
|||||||
"Check for list hosts response return valid data")
|
"Check for list hosts response return valid data")
|
||||||
|
|
||||||
host = hosts[0]
|
host = hosts[0]
|
||||||
host.user = self.services["configurableData"]["host"]["username"]
|
host.user = self.hostConfig['username']
|
||||||
host.passwd = self.services["configurableData"]["host"]["password"]
|
host.passwd = self.hostConfig['password']
|
||||||
host.port = self.services["configurableData"]["host"]["port"]
|
host.port = self.services["configurableData"]["host"]["port"]
|
||||||
|
|
||||||
try:
|
if self.hypervisor.lower() in ('vmware', 'hyperv'):
|
||||||
state = get_process_status(
|
state = get_process_status(
|
||||||
host.ipaddress,
|
self.apiclient.connection.mgtSvr,
|
||||||
host.port,
|
22,
|
||||||
host.user,
|
self.apiclient.connection.user,
|
||||||
host.passwd,
|
self.apiclient.connection.passwd,
|
||||||
router.linklocalip,
|
router.linklocalip,
|
||||||
"ip addr | grep eth6 | grep state | awk '{print $9;}'")
|
"ip addr | grep eth6 | grep state | awk '{print $9;}'",
|
||||||
|
hypervisor=self.hypervisor)
|
||||||
|
|
||||||
mac = get_process_status(
|
mac = get_process_status(
|
||||||
host.ipaddress,
|
self.apiclient.connection.mgtSvr,
|
||||||
host.port,
|
22,
|
||||||
host.user,
|
self.apiclient.connection.user,
|
||||||
host.passwd,
|
self.apiclient.connection.passwd,
|
||||||
router.linklocalip,
|
router.linklocalip,
|
||||||
"ip addr | grep link/ether | awk '{print $2;}' | sed -n 7p")
|
"ip addr | grep link/ether | awk '{print $2;}' | sed -n 7p",
|
||||||
except KeyError:
|
hypervisor=self.hypervisor)
|
||||||
self.skipTest("Provide a marvin config file with host credentials to run %s" % self._testMethodName)
|
else:
|
||||||
|
try:
|
||||||
|
state = get_process_status(
|
||||||
|
host.ipaddress,
|
||||||
|
host.port,
|
||||||
|
host.user,
|
||||||
|
host.passwd,
|
||||||
|
router.linklocalip,
|
||||||
|
"ip addr | grep eth6 | grep state | awk '{print $9;}'")
|
||||||
|
|
||||||
|
mac = get_process_status(
|
||||||
|
host.ipaddress,
|
||||||
|
host.port,
|
||||||
|
host.user,
|
||||||
|
host.passwd,
|
||||||
|
router.linklocalip,
|
||||||
|
"ip addr | grep link/ether | awk '{print $2;}' | sed -n 7p")
|
||||||
|
except KeyError:
|
||||||
|
self.skipTest("Provide a marvin config file with host credentials to run %s" % self._testMethodName)
|
||||||
|
|
||||||
state = str(state[0])
|
state = str(state[0])
|
||||||
mac = str(mac[0])
|
mac = str(mac[0])
|
||||||
@ -847,3 +870,11 @@ class TestPrivateGwACL(cloudstackTestCase):
|
|||||||
|
|
||||||
if cnts[vals.index(status_to_check)] != expected_count:
|
if cnts[vals.index(status_to_check)] != expected_count:
|
||||||
self.fail("Expected '%s' routers at state '%s', but found '%s'!" % (expected_count, status_to_check, cnts[vals.index(status_to_check)]))
|
self.fail("Expected '%s' routers at state '%s', but found '%s'!" % (expected_count, status_to_check, cnts[vals.index(status_to_check)]))
|
||||||
|
|
||||||
|
def get_guest_traffic_physical_network(self, apiclient, zoneid):
|
||||||
|
physical_networks = get_physical_networks(apiclient, zoneid)
|
||||||
|
if not physical_networks:
|
||||||
|
return None
|
||||||
|
for physical_network in physical_networks:
|
||||||
|
if physical_network.vlan:
|
||||||
|
return physical_network
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class TestRouterDHCPHosts(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
cls.services["ostype"]
|
||||||
)
|
)
|
||||||
|
cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
|
||||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||||
|
|
||||||
cls.logger.debug("Creating Admin Account for domain %s on zone %s" % (cls.domain.id, cls.zone.id))
|
cls.logger.debug("Creating Admin Account for domain %s on zone %s" % (cls.domain.id, cls.zone.id))
|
||||||
@ -143,8 +143,6 @@ class TestRouterDHCPHosts(cloudstackTestCase):
|
|||||||
|
|
||||||
cls.services["configurableData"] = {
|
cls.services["configurableData"] = {
|
||||||
"host": {
|
"host": {
|
||||||
"password": "password",
|
|
||||||
"username": "root",
|
|
||||||
"port": 22
|
"port": 22
|
||||||
},
|
},
|
||||||
"input": "INPUT",
|
"input": "INPUT",
|
||||||
@ -171,6 +169,7 @@ class TestRouterDHCPHosts(cloudstackTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.apiclient = self.testClient.getApiClient()
|
self.apiclient = self.testClient.getApiClient()
|
||||||
|
self.hypervisor = self.testClient.getHypervisorInfo()
|
||||||
self.cleanup = []
|
self.cleanup = []
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -190,12 +189,12 @@ class TestRouterDHCPHosts(cloudstackTestCase):
|
|||||||
ssh = vm.get_ssh_client(ipaddress=nat_rule.ipaddress, port=self.services[rule_label]["publicport"], retries=5)
|
ssh = vm.get_ssh_client(ipaddress=nat_rule.ipaddress, port=self.services[rule_label]["publicport"], retries=5)
|
||||||
result = str(ssh.execute(ssh_command))
|
result = str(ssh.execute(ssh_command))
|
||||||
|
|
||||||
self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received")))
|
self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count(" 0% packet loss")))
|
||||||
except:
|
except:
|
||||||
self.fail("Failed to SSH into VM - %s" % (nat_rule.ipaddress))
|
self.fail("Failed to SSH into VM - %s" % (nat_rule.ipaddress))
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
result.count("3 packets received"),
|
result.count(" 0% packet loss"),
|
||||||
1,
|
1,
|
||||||
"Ping to outside world from VM should be successful"
|
"Ping to outside world from VM should be successful"
|
||||||
)
|
)
|
||||||
@ -211,23 +210,33 @@ class TestRouterDHCPHosts(cloudstackTestCase):
|
|||||||
"Check for list hosts response return valid data")
|
"Check for list hosts response return valid data")
|
||||||
|
|
||||||
host = hosts[0]
|
host = hosts[0]
|
||||||
host.user = self.services["configurableData"]["host"]["username"]
|
host.user = self.hostConfig['username']
|
||||||
host.passwd = self.services["configurableData"]["host"]["password"]
|
host.passwd = self.hostConfig['password']
|
||||||
host.port = self.services["configurableData"]["host"]["port"]
|
host.port = self.services["configurableData"]["host"]["port"]
|
||||||
#mac1,10.7.32.101,infinite
|
|
||||||
try:
|
if self.hypervisor.lower() in ('vmware', 'hyperv'):
|
||||||
result = get_process_status(
|
result = get_process_status(
|
||||||
host.ipaddress,
|
self.apiclient.connection.mgtSvr,
|
||||||
host.port,
|
22,
|
||||||
host.user,
|
self.apiclient.connection.user,
|
||||||
host.passwd,
|
self.apiclient.connection.passwd,
|
||||||
router.linklocalip,
|
router.linklocalip,
|
||||||
"cat /etc/dhcphosts.txt | grep %s | sed 's/\,/ /g' | awk '{print $2}'" % (vm.nic[0].ipaddress))
|
"cat /etc/dhcphosts.txt | grep %s | sed 's/\,/ /g' | awk '{print $2}'" % (vm.nic[0].ipaddress),
|
||||||
except KeyError:
|
hypervisor=self.hypervisor)
|
||||||
self.skipTest(
|
else:
|
||||||
"Provide a marvin config file with host\
|
try:
|
||||||
credentials to run %s" %
|
result = get_process_status(
|
||||||
self._testMethodName)
|
host.ipaddress,
|
||||||
|
host.port,
|
||||||
|
host.user,
|
||||||
|
host.passwd,
|
||||||
|
router.linklocalip,
|
||||||
|
"cat /etc/dhcphosts.txt | grep %s | sed 's/\,/ /g' | awk '{print $2}'" % (vm.nic[0].ipaddress))
|
||||||
|
except KeyError:
|
||||||
|
self.skipTest(
|
||||||
|
"Provide a marvin config file with host\
|
||||||
|
credentials to run %s" %
|
||||||
|
self._testMethodName)
|
||||||
|
|
||||||
self.logger.debug("cat /etc/dhcphosts.txt | grep %s | sed 's/\,/ /g' | awk '{print $2}' RESULT IS ==> %s" % (vm.nic[0].ipaddress, result))
|
self.logger.debug("cat /etc/dhcphosts.txt | grep %s | sed 's/\,/ /g' | awk '{print $2}' RESULT IS ==> %s" % (vm.nic[0].ipaddress, result))
|
||||||
res = str(result)
|
res = str(result)
|
||||||
|
|||||||
@ -54,8 +54,6 @@ class Services:
|
|||||||
self.services = {
|
self.services = {
|
||||||
"configurableData": {
|
"configurableData": {
|
||||||
"host": {
|
"host": {
|
||||||
"password": "password",
|
|
||||||
"username": "root",
|
|
||||||
"port": 22
|
"port": 22
|
||||||
},
|
},
|
||||||
"input": "INPUT",
|
"input": "INPUT",
|
||||||
@ -220,6 +218,7 @@ class TestVPCIpTablesPolicies(cloudstackTestCase):
|
|||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"])
|
cls.services["ostype"])
|
||||||
|
cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
|
||||||
|
|
||||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||||
cls.services["virtual_machine"]["template"] = cls.template.id
|
cls.services["virtual_machine"]["template"] = cls.template.id
|
||||||
@ -254,6 +253,7 @@ class TestVPCIpTablesPolicies(cloudstackTestCase):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
self.hypervisor = self.testClient.getHypervisorInfo()
|
||||||
self.logger.debug("Creating a VPC offering.")
|
self.logger.debug("Creating a VPC offering.")
|
||||||
self.vpc_off = VpcOffering.create(
|
self.vpc_off = VpcOffering.create(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
@ -312,25 +312,36 @@ class TestVPCIpTablesPolicies(cloudstackTestCase):
|
|||||||
"Check for list hosts response return valid data")
|
"Check for list hosts response return valid data")
|
||||||
|
|
||||||
host = hosts[0]
|
host = hosts[0]
|
||||||
host.user = self.services["configurableData"]["host"]["username"]
|
host.user = self.hostConfig['username']
|
||||||
host.passwd = self.services["configurableData"]["host"]["password"]
|
host.passwd = self.hostConfig['password']
|
||||||
host.port = self.services["configurableData"]["host"]["port"]
|
host.port = self.services["configurableData"]["host"]["port"]
|
||||||
tables = [self.services["configurableData"]["input"], self.services["configurableData"]["forward"]]
|
tables = [self.services["configurableData"]["input"], self.services["configurableData"]["forward"]]
|
||||||
|
|
||||||
for table in tables:
|
for table in tables:
|
||||||
try:
|
result = None
|
||||||
|
if self.hypervisor.lower() in ('vmware', 'hyperv'):
|
||||||
result = get_process_status(
|
result = get_process_status(
|
||||||
host.ipaddress,
|
self.apiclient.connection.mgtSvr,
|
||||||
host.port,
|
22,
|
||||||
host.user,
|
self.apiclient.connection.user,
|
||||||
host.passwd,
|
self.apiclient.connection.passwd,
|
||||||
router.linklocalip,
|
router.linklocalip,
|
||||||
'iptables -L %s' % table)
|
'iptables -L %s' % table,
|
||||||
except KeyError:
|
hypervisor=self.hypervisor)
|
||||||
self.skipTest(
|
else:
|
||||||
"Provide a marvin config file with host\
|
try:
|
||||||
credentials to run %s" %
|
result = get_process_status(
|
||||||
self._testMethodName)
|
host.ipaddress,
|
||||||
|
host.port,
|
||||||
|
host.user,
|
||||||
|
host.passwd,
|
||||||
|
router.linklocalip,
|
||||||
|
'iptables -L %s' % table)
|
||||||
|
except KeyError:
|
||||||
|
self.skipTest(
|
||||||
|
"Provide a marvin config file with host\
|
||||||
|
credentials to run %s" %
|
||||||
|
self._testMethodName)
|
||||||
|
|
||||||
self.logger.debug("iptables -L %s: %s" % (table, result))
|
self.logger.debug("iptables -L %s: %s" % (table, result))
|
||||||
res = str(result)
|
res = str(result)
|
||||||
@ -360,6 +371,7 @@ class TestRouterIpTablesPolicies(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"])
|
cls.services["ostype"])
|
||||||
|
|
||||||
|
cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
|
||||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||||
cls.services["virtual_machine"]["template"] = cls.template.id
|
cls.services["virtual_machine"]["template"] = cls.template.id
|
||||||
|
|
||||||
@ -392,6 +404,7 @@ class TestRouterIpTablesPolicies(cloudstackTestCase):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
self.hypervisor = self.testClient.getHypervisorInfo()
|
||||||
self.cleanup = []
|
self.cleanup = []
|
||||||
self.entity_manager.set_cleanup(self.cleanup)
|
self.entity_manager.set_cleanup(self.cleanup)
|
||||||
return
|
return
|
||||||
@ -428,25 +441,36 @@ class TestRouterIpTablesPolicies(cloudstackTestCase):
|
|||||||
"Check for list hosts response return valid data")
|
"Check for list hosts response return valid data")
|
||||||
|
|
||||||
host = hosts[0]
|
host = hosts[0]
|
||||||
host.user = self.services["configurableData"]["host"]["username"]
|
host.user = self.hostConfig['username']
|
||||||
host.passwd = self.services["configurableData"]["host"]["password"]
|
host.passwd = self.hostConfig['password']
|
||||||
host.port = self.services["configurableData"]["host"]["port"]
|
host.port = self.services["configurableData"]["host"]["port"]
|
||||||
tables = [self.services["configurableData"]["input"], self.services["configurableData"]["forward"]]
|
tables = [self.services["configurableData"]["input"], self.services["configurableData"]["forward"]]
|
||||||
|
|
||||||
for table in tables:
|
for table in tables:
|
||||||
try:
|
result = None
|
||||||
|
if self.hypervisor.lower() in ('vmware', 'hyperv'):
|
||||||
result = get_process_status(
|
result = get_process_status(
|
||||||
host.ipaddress,
|
self.apiclient.connection.mgtSvr,
|
||||||
host.port,
|
22,
|
||||||
host.user,
|
self.apiclient.connection.user,
|
||||||
host.passwd,
|
self.apiclient.connection.passwd,
|
||||||
router.linklocalip,
|
router.linklocalip,
|
||||||
'iptables -L %s' % table)
|
'iptables -L %s' % table,
|
||||||
except KeyError:
|
hypervisor=self.hypervisor)
|
||||||
self.skipTest(
|
else:
|
||||||
"Provide a marvin config file with host\
|
try:
|
||||||
credentials to run %s" %
|
result = get_process_status(
|
||||||
self._testMethodName)
|
host.ipaddress,
|
||||||
|
host.port,
|
||||||
|
host.user,
|
||||||
|
host.passwd,
|
||||||
|
router.linklocalip,
|
||||||
|
'iptables -L %s' % table)
|
||||||
|
except KeyError:
|
||||||
|
self.skipTest(
|
||||||
|
"Provide a marvin config file with host\
|
||||||
|
credentials to run %s" %
|
||||||
|
self._testMethodName)
|
||||||
|
|
||||||
self.logger.debug("iptables -L %s: %s" % (table, result))
|
self.logger.debug("iptables -L %s: %s" % (table, result))
|
||||||
res = str(result)
|
res = str(result)
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
# Import Local Modules
|
# Import Local Modules
|
||||||
|
from marvin.codes import PASS, FAILED
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||||
from marvin.cloudstackAPI import (stopVirtualMachine,
|
from marvin.cloudstackAPI import (stopVirtualMachine,
|
||||||
@ -27,6 +28,7 @@ from marvin.lib.utils import (cleanup_resources,
|
|||||||
from marvin.lib.base import (ServiceOffering,
|
from marvin.lib.base import (ServiceOffering,
|
||||||
VirtualMachine,
|
VirtualMachine,
|
||||||
Account,
|
Account,
|
||||||
|
Template,
|
||||||
ServiceOffering,
|
ServiceOffering,
|
||||||
NATRule,
|
NATRule,
|
||||||
NetworkACL,
|
NetworkACL,
|
||||||
@ -52,6 +54,7 @@ from marvin.lib.common import (get_zone,
|
|||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
def check_router_command(virtual_machine, public_ip, ssh_command, check_string, test_case, retries=5):
|
def check_router_command(virtual_machine, public_ip, ssh_command, check_string, test_case, retries=5):
|
||||||
result = 'failed'
|
result = 'failed'
|
||||||
try:
|
try:
|
||||||
@ -63,6 +66,58 @@ def check_router_command(virtual_machine, public_ip, ssh_command, check_string,
|
|||||||
logging.debug("Result from SSH into the Virtual Machine: %s" % result)
|
logging.debug("Result from SSH into the Virtual Machine: %s" % result)
|
||||||
return result.count(check_string)
|
return result.count(check_string)
|
||||||
|
|
||||||
|
|
||||||
|
class Templates:
|
||||||
|
"""Test data for templates
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.templates = {
|
||||||
|
"macchinina": {
|
||||||
|
"kvm": {
|
||||||
|
"name": "tiny-kvm",
|
||||||
|
"displaytext": "macchinina kvm",
|
||||||
|
"format": "qcow2",
|
||||||
|
"hypervisor": "kvm",
|
||||||
|
"ostype": "Other Linux (64-bit)",
|
||||||
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
|
||||||
|
"requireshvm": "True",
|
||||||
|
"ispublic": "True",
|
||||||
|
},
|
||||||
|
"xenserver": {
|
||||||
|
"name": "tiny-xen",
|
||||||
|
"displaytext": "macchinina xen",
|
||||||
|
"format": "vhd",
|
||||||
|
"hypervisor": "xen",
|
||||||
|
"ostype": "Other Linux (64-bit)",
|
||||||
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
|
||||||
|
"requireshvm": "True",
|
||||||
|
"ispublic": "True",
|
||||||
|
},
|
||||||
|
"hyperv": {
|
||||||
|
"name": "tiny-hyperv",
|
||||||
|
"displaytext": "macchinina xen",
|
||||||
|
"format": "vhd",
|
||||||
|
"hypervisor": "hyperv",
|
||||||
|
"ostype": "Other Linux (64-bit)",
|
||||||
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
|
||||||
|
"requireshvm": "True",
|
||||||
|
"ispublic": "True",
|
||||||
|
},
|
||||||
|
"vmware": {
|
||||||
|
"name": "tiny-vmware",
|
||||||
|
"displaytext": "macchinina vmware",
|
||||||
|
"format": "ova",
|
||||||
|
"hypervisor": "vmware",
|
||||||
|
"ostype": "Other Linux (64-bit)",
|
||||||
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
|
||||||
|
"requireshvm": "True",
|
||||||
|
"ispublic": "True",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class TestRedundantIsolateNetworks(cloudstackTestCase):
|
class TestRedundantIsolateNetworks(cloudstackTestCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -81,12 +136,20 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
|
|||||||
cls.domain = get_domain(cls.api_client)
|
cls.domain = get_domain(cls.api_client)
|
||||||
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
|
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
|
||||||
cls.services['mode'] = cls.zone.networktype
|
cls.services['mode'] = cls.zone.networktype
|
||||||
cls.template = get_template(
|
|
||||||
cls.api_client,
|
macchinina = Templates().templates["macchinina"]
|
||||||
cls.zone.id,
|
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
||||||
cls.services["ostype"]
|
cls.logger.debug("Downloading Template: %s from: %s" % (macchinina[cls.hypervisor.lower()],
|
||||||
)
|
macchinina[cls.hypervisor.lower()]["url"]))
|
||||||
|
cls.template = Template.register(cls.api_client, macchinina[cls.hypervisor.lower()],
|
||||||
|
cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id)
|
||||||
|
cls.template.download(cls.api_client)
|
||||||
|
|
||||||
|
if cls.template == FAILED:
|
||||||
|
assert False, "get_template() failed to return template"
|
||||||
|
|
||||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||||
|
cls.services["virtual_machine"]["template"] = cls.template.id
|
||||||
|
|
||||||
# Create an account, network, VM and IP addresses
|
# Create an account, network, VM and IP addresses
|
||||||
cls.account = Account.create(
|
cls.account = Account.create(
|
||||||
@ -122,7 +185,8 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
|
|||||||
|
|
||||||
cls._cleanup = [
|
cls._cleanup = [
|
||||||
cls.service_offering,
|
cls.service_offering,
|
||||||
cls.account
|
cls.account,
|
||||||
|
cls.template
|
||||||
]
|
]
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -270,7 +334,7 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
|
|||||||
# Test SSH after closing port 22
|
# Test SSH after closing port 22
|
||||||
expected = 1
|
expected = 1
|
||||||
ssh_command = "ping -c 3 8.8.8.8"
|
ssh_command = "ping -c 3 8.8.8.8"
|
||||||
check_string = "3 packets received"
|
check_string = " 0% packet loss"
|
||||||
result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self)
|
result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -434,7 +498,7 @@ class TestRedundantIsolateNetworks(cloudstackTestCase):
|
|||||||
|
|
||||||
expected = 0
|
expected = 0
|
||||||
ssh_command = "ping -c 3 8.8.8.8"
|
ssh_command = "ping -c 3 8.8.8.8"
|
||||||
check_string = "3 packets received"
|
check_string = " 0% packet loss"
|
||||||
result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self)
|
result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -822,7 +886,7 @@ class TestIsolatedNetworks(cloudstackTestCase):
|
|||||||
# Test SSH after closing port 22
|
# Test SSH after closing port 22
|
||||||
expected = 1
|
expected = 1
|
||||||
ssh_command = "ping -c 3 8.8.8.8"
|
ssh_command = "ping -c 3 8.8.8.8"
|
||||||
check_string = "3 packets received"
|
check_string = " 0% packet loss"
|
||||||
result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self)
|
result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -977,7 +1041,7 @@ class TestIsolatedNetworks(cloudstackTestCase):
|
|||||||
|
|
||||||
expected = 0
|
expected = 0
|
||||||
ssh_command = "ping -c 3 8.8.8.8"
|
ssh_command = "ping -c 3 8.8.8.8"
|
||||||
check_string = "3 packets received"
|
check_string = " 0% packet loss"
|
||||||
result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self)
|
result = check_router_command(virtual_machine, nat_rule.ipaddress, ssh_command, check_string, self)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
|||||||
@ -22,6 +22,7 @@ from marvin.lib.utils import (cleanup_resources,
|
|||||||
is_snapshot_on_nfs)
|
is_snapshot_on_nfs)
|
||||||
from marvin.lib.base import (VirtualMachine,
|
from marvin.lib.base import (VirtualMachine,
|
||||||
Account,
|
Account,
|
||||||
|
Template,
|
||||||
ServiceOffering,
|
ServiceOffering,
|
||||||
Snapshot)
|
Snapshot)
|
||||||
from marvin.lib.common import (get_domain,
|
from marvin.lib.common import (get_domain,
|
||||||
@ -32,6 +33,57 @@ from marvin.lib.common import (get_domain,
|
|||||||
from marvin.lib.decoratorGenerators import skipTestIf
|
from marvin.lib.decoratorGenerators import skipTestIf
|
||||||
|
|
||||||
|
|
||||||
|
class Templates:
|
||||||
|
"""Test data for templates
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.templates = {
|
||||||
|
"macchinina": {
|
||||||
|
"kvm": {
|
||||||
|
"name": "tiny-kvm",
|
||||||
|
"displaytext": "macchinina kvm",
|
||||||
|
"format": "qcow2",
|
||||||
|
"hypervisor": "kvm",
|
||||||
|
"ostype": "Other Linux (64-bit)",
|
||||||
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
|
||||||
|
"requireshvm": "True",
|
||||||
|
"ispublic": "True",
|
||||||
|
},
|
||||||
|
"xenserver": {
|
||||||
|
"name": "tiny-xen",
|
||||||
|
"displaytext": "macchinina xen",
|
||||||
|
"format": "vhd",
|
||||||
|
"hypervisor": "xen",
|
||||||
|
"ostype": "Other Linux (64-bit)",
|
||||||
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
|
||||||
|
"requireshvm": "True",
|
||||||
|
"ispublic": "True",
|
||||||
|
},
|
||||||
|
"hyperv": {
|
||||||
|
"name": "tiny-hyperv",
|
||||||
|
"displaytext": "macchinina xen",
|
||||||
|
"format": "vhd",
|
||||||
|
"hypervisor": "hyperv",
|
||||||
|
"ostype": "Other Linux (64-bit)",
|
||||||
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
|
||||||
|
"requireshvm": "True",
|
||||||
|
"ispublic": "True",
|
||||||
|
},
|
||||||
|
"vmware": {
|
||||||
|
"name": "tiny-vmware",
|
||||||
|
"displaytext": "macchinina vmware",
|
||||||
|
"format": "ova",
|
||||||
|
"hypervisor": "vmware",
|
||||||
|
"ostype": "Other Linux (64-bit)",
|
||||||
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
|
||||||
|
"requireshvm": "True",
|
||||||
|
"ispublic": "True",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class TestSnapshotRootDisk(cloudstackTestCase):
|
class TestSnapshotRootDisk(cloudstackTestCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -47,23 +99,23 @@ class TestSnapshotRootDisk(cloudstackTestCase):
|
|||||||
|
|
||||||
cls.hypervisorNotSupported = False
|
cls.hypervisorNotSupported = False
|
||||||
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
||||||
if cls.hypervisor.lower() in ['hyperv', 'lxc']:
|
if cls.hypervisor.lower() in ['hyperv', 'lxc'] or 'kvm-centos6' in cls.testClient.getZoneForTests():
|
||||||
cls.hypervisorNotSupported = True
|
cls.hypervisorNotSupported = True
|
||||||
|
|
||||||
cls._cleanup = []
|
cls._cleanup = []
|
||||||
if not cls.hypervisorNotSupported:
|
if not cls.hypervisorNotSupported:
|
||||||
template = get_template(
|
macchinina = Templates().templates["macchinina"]
|
||||||
cls.apiclient,
|
cls.template = Template.register(cls.apiclient, macchinina[cls.hypervisor.lower()],
|
||||||
cls.zone.id,
|
cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id)
|
||||||
cls.services["ostype"]
|
cls.template.download(cls.apiclient)
|
||||||
)
|
|
||||||
if template == FAILED:
|
if cls.template == FAILED:
|
||||||
assert False, "get_template() failed to return template with description %s" % cls.services[
|
assert False, "get_template() failed to return template"
|
||||||
"ostype"]
|
|
||||||
|
|
||||||
cls.services["domainid"] = cls.domain.id
|
cls.services["domainid"] = cls.domain.id
|
||||||
cls.services["small"]["zoneid"] = cls.zone.id
|
cls.services["small"]["zoneid"] = cls.zone.id
|
||||||
cls.services["templates"]["ostypeid"] = template.ostypeid
|
cls.services["templates"]["ostypeid"] = cls.template.ostypeid
|
||||||
cls.services["zoneid"] = cls.zone.id
|
cls.services["zoneid"] = cls.zone.id
|
||||||
|
|
||||||
# Create VMs, NAT Rules etc
|
# Create VMs, NAT Rules etc
|
||||||
@ -72,23 +124,26 @@ class TestSnapshotRootDisk(cloudstackTestCase):
|
|||||||
cls.services["account"],
|
cls.services["account"],
|
||||||
domainid=cls.domain.id
|
domainid=cls.domain.id
|
||||||
)
|
)
|
||||||
cls._cleanup.append(cls.account)
|
|
||||||
cls.service_offering = ServiceOffering.create(
|
cls.service_offering = ServiceOffering.create(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
cls.services["service_offerings"]["tiny"]
|
cls.services["service_offerings"]["tiny"]
|
||||||
)
|
)
|
||||||
cls._cleanup.append(cls.service_offering)
|
|
||||||
cls.virtual_machine = cls.virtual_machine_with_disk = \
|
cls.virtual_machine = cls.virtual_machine_with_disk = \
|
||||||
VirtualMachine.create(
|
VirtualMachine.create(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
cls.services["small"],
|
cls.services["small"],
|
||||||
templateid=template.id,
|
templateid=cls.template.id,
|
||||||
accountid=cls.account.name,
|
accountid=cls.account.name,
|
||||||
domainid=cls.account.domainid,
|
domainid=cls.account.domainid,
|
||||||
zoneid=cls.zone.id,
|
zoneid=cls.zone.id,
|
||||||
serviceofferingid=cls.service_offering.id,
|
serviceofferingid=cls.service_offering.id,
|
||||||
mode=cls.services["mode"]
|
mode=cls.services["mode"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cls._cleanup.append(cls.virtual_machine)
|
||||||
|
cls._cleanup.append(cls.service_offering)
|
||||||
|
cls._cleanup.append(cls.account)
|
||||||
|
cls._cleanup.append(cls.template)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -141,6 +196,7 @@ class TestSnapshotRootDisk(cloudstackTestCase):
|
|||||||
account=self.account.name,
|
account=self.account.name,
|
||||||
domainid=self.account.domainid
|
domainid=self.account.domainid
|
||||||
)
|
)
|
||||||
|
self.cleanup.append(snapshot)
|
||||||
self.debug("Snapshot created: ID - %s" % snapshot.id)
|
self.debug("Snapshot created: ID - %s" % snapshot.id)
|
||||||
|
|
||||||
snapshots = list_snapshots(
|
snapshots = list_snapshots(
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
# Import Local Modules
|
# Import Local Modules
|
||||||
from marvin.codes import FAILED, KVM, PASS
|
from marvin.codes import FAILED, KVM, PASS, XEN_SERVER
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||||
from marvin.lib.utils import random_gen, cleanup_resources, validateList, is_snapshot_on_nfs
|
from marvin.lib.utils import random_gen, cleanup_resources, validateList, is_snapshot_on_nfs
|
||||||
@ -291,7 +291,7 @@ class TestSnapshots(cloudstackTestCase):
|
|||||||
cls.services = cls.testClient.getParsedTestDataConfig()
|
cls.services = cls.testClient.getParsedTestDataConfig()
|
||||||
cls.unsupportedHypervisor = False
|
cls.unsupportedHypervisor = False
|
||||||
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
||||||
if cls.hypervisor.lower() in (KVM.lower(), "hyperv", "lxc"):
|
if cls.hypervisor.lower() in (KVM.lower(), "hyperv", "lxc", XEN_SERVER.lower()):
|
||||||
cls.unsupportedHypervisor = True
|
cls.unsupportedHypervisor = True
|
||||||
return
|
return
|
||||||
# Get Domain, Zone, Template
|
# Get Domain, Zone, Template
|
||||||
@ -362,12 +362,12 @@ class TestSnapshots(cloudstackTestCase):
|
|||||||
@attr(tags=["advanced", "basic", "smoke"], required_hardware="true")
|
@attr(tags=["advanced", "basic", "smoke"], required_hardware="true")
|
||||||
def test_01_test_vm_volume_snapshot(self):
|
def test_01_test_vm_volume_snapshot(self):
|
||||||
"""
|
"""
|
||||||
@Desc: Test that Volume snapshot for root volume is allowed
|
@Desc: Test that Volume snapshot for root volume is not allowed
|
||||||
when VM snapshot is present for the VM
|
when VM snapshot is present for the VM
|
||||||
@Steps:
|
@Steps:
|
||||||
1: Deploy a VM and create a VM snapshot for VM
|
1: Deploy a VM and create a VM snapshot for VM
|
||||||
2: Try to create snapshot for the root volume of the VM,
|
2: Try to create snapshot for the root volume of the VM,
|
||||||
It should not fail
|
It should expect Exception
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Creating Virtual Machine
|
# Creating Virtual Machine
|
||||||
@ -392,25 +392,10 @@ class TestSnapshots(cloudstackTestCase):
|
|||||||
self.assertEqual(validateList(volumes)[0], PASS,
|
self.assertEqual(validateList(volumes)[0], PASS,
|
||||||
"Failed to get root volume of the VM")
|
"Failed to get root volume of the VM")
|
||||||
|
|
||||||
snapshot = Snapshot.create(
|
volume = volumes[0]
|
||||||
self.apiclient,
|
|
||||||
volumes[0].id,
|
with self.assertRaises(Exception):
|
||||||
account=self.account.name,
|
Snapshot.create(self.apiclient,
|
||||||
domainid=self.account.domainid
|
volume_id=volume.id)
|
||||||
)
|
|
||||||
self.debug("Snapshot created: ID - %s" % snapshot.id)
|
|
||||||
snapshots = list_snapshots(
|
|
||||||
self.apiclient,
|
|
||||||
id=snapshot.id
|
|
||||||
)
|
|
||||||
self.assertEqual(
|
|
||||||
validateList(snapshots)[0],
|
|
||||||
PASS,
|
|
||||||
"Invalid snapshot list"
|
|
||||||
)
|
|
||||||
self.assertEqual(
|
|
||||||
snapshots[0].id,
|
|
||||||
snapshot.id,
|
|
||||||
"Check resource id in list resources call"
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
""" Test redundancy features for VPC routers
|
""" Test redundancy features for VPC routers
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from marvin.codes import PASS, FAILED
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||||
from marvin.lib.base import (stopRouter,
|
from marvin.lib.base import (stopRouter,
|
||||||
@ -25,6 +26,7 @@ from marvin.lib.base import (stopRouter,
|
|||||||
destroyRouter,
|
destroyRouter,
|
||||||
rebootRouter,
|
rebootRouter,
|
||||||
Account,
|
Account,
|
||||||
|
Template,
|
||||||
VpcOffering,
|
VpcOffering,
|
||||||
VPC,
|
VPC,
|
||||||
ServiceOffering,
|
ServiceOffering,
|
||||||
@ -191,8 +193,49 @@ class Services:
|
|||||||
"publicport": 22,
|
"publicport": 22,
|
||||||
"protocol": 'TCP',
|
"protocol": 'TCP',
|
||||||
},
|
},
|
||||||
"ostype": 'CentOS 5.3 (64-bit)',
|
|
||||||
"timeout": 10,
|
"timeout": 10,
|
||||||
|
"template": {
|
||||||
|
"kvm": {
|
||||||
|
"name": "tiny-kvm",
|
||||||
|
"displaytext": "macchinina kvm",
|
||||||
|
"format": "qcow2",
|
||||||
|
"hypervisor": "kvm",
|
||||||
|
"ostype": "Other Linux (64-bit)",
|
||||||
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
|
||||||
|
"requireshvm": "True",
|
||||||
|
"ispublic": "True",
|
||||||
|
},
|
||||||
|
"xenserver": {
|
||||||
|
"name": "tiny-xen",
|
||||||
|
"displaytext": "macchinina xen",
|
||||||
|
"format": "vhd",
|
||||||
|
"hypervisor": "xen",
|
||||||
|
"ostype": "Other Linux (64-bit)",
|
||||||
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
|
||||||
|
"requireshvm": "True",
|
||||||
|
"ispublic": "True",
|
||||||
|
},
|
||||||
|
"hyperv": {
|
||||||
|
"name": "tiny-hyperv",
|
||||||
|
"displaytext": "macchinina xen",
|
||||||
|
"format": "vhd",
|
||||||
|
"hypervisor": "hyperv",
|
||||||
|
"ostype": "Other Linux (64-bit)",
|
||||||
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
|
||||||
|
"requireshvm": "True",
|
||||||
|
"ispublic": "True",
|
||||||
|
},
|
||||||
|
"vmware": {
|
||||||
|
"name": "tiny-vmware",
|
||||||
|
"displaytext": "macchinina vmware",
|
||||||
|
"format": "ova",
|
||||||
|
"hypervisor": "vmware",
|
||||||
|
"ostype": "Other Linux (64-bit)",
|
||||||
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
|
||||||
|
"requireshvm": "True",
|
||||||
|
"ispublic": "True",
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -210,17 +253,22 @@ class TestVPCRedundancy(cloudstackTestCase):
|
|||||||
# Get Zone, Domain and templates
|
# Get Zone, Domain and templates
|
||||||
cls.domain = get_domain(cls.api_client)
|
cls.domain = get_domain(cls.api_client)
|
||||||
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
|
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
|
||||||
cls.template = get_template(
|
|
||||||
cls.api_client,
|
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
||||||
cls.zone.id,
|
cls.template = Template.register(cls.api_client, cls.services["template"][cls.hypervisor.lower(
|
||||||
cls.services["ostype"])
|
)], cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id)
|
||||||
|
cls.template.download(cls.api_client)
|
||||||
|
|
||||||
|
if cls.template == FAILED:
|
||||||
|
assert False, "get_template() failed to return template"
|
||||||
|
|
||||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||||
cls.services["virtual_machine"]["template"] = cls.template.id
|
cls.services["virtual_machine"]["template"] = cls.template.id
|
||||||
|
|
||||||
cls.service_offering = ServiceOffering.create(
|
cls.service_offering = ServiceOffering.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["service_offering"])
|
cls.services["service_offering"])
|
||||||
cls._cleanup = [cls.service_offering]
|
cls._cleanup = [cls.service_offering, cls.template]
|
||||||
|
|
||||||
cls.logger = logging.getLogger('TestVPCRedundancy')
|
cls.logger = logging.getLogger('TestVPCRedundancy')
|
||||||
cls.stream_handler = logging.StreamHandler()
|
cls.stream_handler = logging.StreamHandler()
|
||||||
@ -592,7 +640,7 @@ class TestVPCRedundancy(cloudstackTestCase):
|
|||||||
gc_interval = Configurations.list(self.apiclient, name="network.gc.interval")
|
gc_interval = Configurations.list(self.apiclient, name="network.gc.interval")
|
||||||
|
|
||||||
self.logger.debug("network.gc.wait is ==> %s" % gc_wait)
|
self.logger.debug("network.gc.wait is ==> %s" % gc_wait)
|
||||||
self.logger.debug("network.gc.interval is ==> %s" % gc_wait)
|
self.logger.debug("network.gc.interval is ==> %s" % gc_interval)
|
||||||
|
|
||||||
total_sleep = 120
|
total_sleep = 120
|
||||||
if gc_wait and gc_interval:
|
if gc_wait and gc_interval:
|
||||||
@ -695,14 +743,14 @@ class TestVPCRedundancy(cloudstackTestCase):
|
|||||||
self.logger.debug("Ping to google.com from VM")
|
self.logger.debug("Ping to google.com from VM")
|
||||||
result = str(ssh.execute(ssh_command))
|
result = str(ssh.execute(ssh_command))
|
||||||
|
|
||||||
self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received")))
|
self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count(" 0% packet loss")))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("SSH Access failed for %s: %s" % \
|
self.fail("SSH Access failed for %s: %s" % \
|
||||||
(vmObj.get_ip(), e)
|
(vmObj.get_ip(), e)
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
result.count("3 packets received"),
|
result.count(" 0% packet loss"),
|
||||||
1,
|
1,
|
||||||
"Ping to outside world from VM should be successful"
|
"Ping to outside world from VM should be successful"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -464,14 +464,14 @@ class TestVPCNics(cloudstackTestCase):
|
|||||||
self.logger.debug("Ping to google.com from VM")
|
self.logger.debug("Ping to google.com from VM")
|
||||||
result = str(ssh.execute(ssh_command))
|
result = str(ssh.execute(ssh_command))
|
||||||
|
|
||||||
self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count("3 packets received")))
|
self.logger.debug("SSH result: %s; COUNT is ==> %s" % (result, result.count(" 0% packet loss")))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("SSH Access failed for %s: %s" % \
|
self.fail("SSH Access failed for %s: %s" % \
|
||||||
(vmObj.get_ip(), e)
|
(vmObj.get_ip(), e)
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
result.count("3 packets received"),
|
result.count(" 0% packet loss"),
|
||||||
1,
|
1,
|
||||||
"Ping to outside world from VM should be successful"
|
"Ping to outside world from VM should be successful"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -222,7 +222,7 @@ class Services:
|
|||||||
"displaytext": "macchinina kvm",
|
"displaytext": "macchinina kvm",
|
||||||
"format": "qcow2",
|
"format": "qcow2",
|
||||||
"hypervisor": "kvm",
|
"hypervisor": "kvm",
|
||||||
"ostype": "Other PV (64-bit)",
|
"ostype": "Other Linux (64-bit)",
|
||||||
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2",
|
||||||
"requireshvm": "True",
|
"requireshvm": "True",
|
||||||
},
|
},
|
||||||
@ -232,7 +232,7 @@ class Services:
|
|||||||
"displaytext": "macchinina xen",
|
"displaytext": "macchinina xen",
|
||||||
"format": "vhd",
|
"format": "vhd",
|
||||||
"hypervisor": "xen",
|
"hypervisor": "xen",
|
||||||
"ostype": "Other PV (64-bit)",
|
"ostype": "Other Linux (64-bit)",
|
||||||
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2",
|
||||||
"requireshvm": "True",
|
"requireshvm": "True",
|
||||||
},
|
},
|
||||||
@ -242,7 +242,7 @@ class Services:
|
|||||||
"displaytext": "macchinina xen",
|
"displaytext": "macchinina xen",
|
||||||
"format": "vhd",
|
"format": "vhd",
|
||||||
"hypervisor": "hyperv",
|
"hypervisor": "hyperv",
|
||||||
"ostype": "Other PV (64-bit)",
|
"ostype": "Other Linux (64-bit)",
|
||||||
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-hyperv.vhd.zip",
|
||||||
"requireshvm": "True",
|
"requireshvm": "True",
|
||||||
},
|
},
|
||||||
@ -252,8 +252,8 @@ class Services:
|
|||||||
"displaytext": "macchinina vmware",
|
"displaytext": "macchinina vmware",
|
||||||
"format": "ova",
|
"format": "ova",
|
||||||
"hypervisor": "vmware",
|
"hypervisor": "vmware",
|
||||||
"ostype": "Other PV (64-bit)",
|
"ostype": "Other Linux (64-bit)",
|
||||||
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.vmdk.bz2",
|
"url": "http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-vmware.ova",
|
||||||
"requireshvm": "True",
|
"requireshvm": "True",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
|
|||||||
%s" % (cls.account.name,
|
%s" % (cls.account.name,
|
||||||
cls.account.id))
|
cls.account.id))
|
||||||
|
|
||||||
cls.cleanup = [cls.template, cls.account, cls.compute_offering]
|
cls.cleanup = [cls.account, cls.compute_offering]
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags=["advanced"], required_hardware="true")
|
@attr(tags=["advanced"], required_hardware="true")
|
||||||
@ -316,10 +316,11 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
|
|||||||
networkOffering) > 0, "No VPC based network offering")
|
networkOffering) > 0, "No VPC based network offering")
|
||||||
|
|
||||||
# 1) Create VPC
|
# 1) Create VPC
|
||||||
vpcOffering = VpcOffering.list(self.apiclient, isdefault=True)
|
vpcOffering = VpcOffering.list(self.apiclient, name="Default VPC offering")
|
||||||
self.assert_(vpcOffering is not None and len(
|
self.assert_(vpcOffering is not None and len(
|
||||||
vpcOffering) > 0, "No VPC offerings found")
|
vpcOffering) > 0, "No VPC offerings found")
|
||||||
|
|
||||||
|
vpc = None
|
||||||
try:
|
try:
|
||||||
vpc = VPC.create(
|
vpc = VPC.create(
|
||||||
apiclient=self.apiclient,
|
apiclient=self.apiclient,
|
||||||
@ -434,6 +435,9 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
cls.logger.debug("Cleaning up resources")
|
cls.logger.debug("Cleaning up resources")
|
||||||
|
try:
|
||||||
|
cls.template.delete(cls.apiclient)
|
||||||
|
except Exception: pass
|
||||||
cleanup_resources(cls.apiclient, cls.cleanup)
|
cleanup_resources(cls.apiclient, cls.cleanup)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
raise Exception("Cleanup failed with %s" % e)
|
raise Exception("Cleanup failed with %s" % e)
|
||||||
@ -478,7 +482,7 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
|
|||||||
%s" % (cls.account.name,
|
%s" % (cls.account.name,
|
||||||
cls.account.id))
|
cls.account.id))
|
||||||
|
|
||||||
cls.cleanup = [cls.template, cls.account, cls.compute_offering]
|
cls.cleanup = [cls.account, cls.compute_offering]
|
||||||
return
|
return
|
||||||
|
|
||||||
def _get_ssh_client(self, virtual_machine, services, retries):
|
def _get_ssh_client(self, virtual_machine, services, retries):
|
||||||
@ -797,6 +801,9 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
|
try:
|
||||||
|
cls.template.delete(cls.apiclient)
|
||||||
|
except Exception: pass
|
||||||
cleanup_resources(cls.apiclient, cls.cleanup)
|
cleanup_resources(cls.apiclient, cls.cleanup)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
raise Exception("Cleanup failed with %s" % e)
|
raise Exception("Cleanup failed with %s" % e)
|
||||||
@ -841,7 +848,7 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
|
|||||||
%s" % (cls.account.name,
|
%s" % (cls.account.name,
|
||||||
cls.account.id))
|
cls.account.id))
|
||||||
|
|
||||||
cls.cleanup = [cls.template, cls.account, cls.compute_offering]
|
cls.cleanup = [cls.account, cls.compute_offering]
|
||||||
return
|
return
|
||||||
|
|
||||||
def _validate_vpc_offering(self, vpc_offering):
|
def _validate_vpc_offering(self, vpc_offering):
|
||||||
@ -1164,6 +1171,9 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
|
try:
|
||||||
|
cls.template.delete(cls.apiclient)
|
||||||
|
except Exception: pass
|
||||||
cleanup_resources(cls.apiclient, cls.cleanup)
|
cleanup_resources(cls.apiclient, cls.cleanup)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
raise Exception("Cleanup failed with %s" % e)
|
raise Exception("Cleanup failed with %s" % e)
|
||||||
|
|||||||
@ -1325,43 +1325,45 @@ class Template:
|
|||||||
cmd.zoneid = zoneid
|
cmd.zoneid = zoneid
|
||||||
apiclient.deleteTemplate(cmd)
|
apiclient.deleteTemplate(cmd)
|
||||||
|
|
||||||
def download(self, apiclient, timeout=5, interval=60):
|
def download(self, apiclient, retries=300, interval=5):
|
||||||
"""Download Template"""
|
"""Download Template"""
|
||||||
# Sleep to ensure template is in proper state before download
|
while retries > -1:
|
||||||
time.sleep(interval)
|
time.sleep(interval)
|
||||||
|
|
||||||
while True:
|
|
||||||
template_response = Template.list(
|
template_response = Template.list(
|
||||||
apiclient,
|
apiclient,
|
||||||
id=self.id,
|
id=self.id,
|
||||||
zoneid=self.zoneid,
|
zoneid=self.zoneid,
|
||||||
templatefilter='self'
|
templatefilter='self'
|
||||||
)
|
)
|
||||||
if isinstance(template_response, list):
|
|
||||||
|
|
||||||
|
if isinstance(template_response, list):
|
||||||
template = template_response[0]
|
template = template_response[0]
|
||||||
|
if not hasattr(template, 'status') or not template or not template.status:
|
||||||
|
retries = retries - 1
|
||||||
|
continue
|
||||||
|
|
||||||
# If template is ready,
|
# If template is ready,
|
||||||
# template.status = Download Complete
|
# template.status = Download Complete
|
||||||
# Downloading - x% Downloaded
|
# Downloading - x% Downloaded
|
||||||
# Error - Any other string
|
# Error - Any other string
|
||||||
if template.status == 'Download Complete':
|
if template.status == 'Download Complete' and template.isready:
|
||||||
break
|
return
|
||||||
|
|
||||||
elif 'Downloaded' in template.status:
|
elif 'Downloaded' in template.status:
|
||||||
time.sleep(interval)
|
retries = retries - 1
|
||||||
|
continue
|
||||||
|
|
||||||
elif 'Installing' not in template.status:
|
elif 'Installing' not in template.status:
|
||||||
|
if retries >= 0:
|
||||||
|
retries = retries - 1
|
||||||
|
continue
|
||||||
raise Exception(
|
raise Exception(
|
||||||
"Error in downloading template: status - %s" %
|
"Error in downloading template: status - %s" %
|
||||||
template.status)
|
template.status)
|
||||||
|
|
||||||
elif timeout == 0:
|
|
||||||
break
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
time.sleep(interval)
|
retries = retries - 1
|
||||||
timeout = timeout - 1
|
raise Exception("Template download failed exception")
|
||||||
return
|
|
||||||
|
|
||||||
def updatePermissions(self, apiclient, **kwargs):
|
def updatePermissions(self, apiclient, **kwargs):
|
||||||
"""Updates the template permissions"""
|
"""Updates the template permissions"""
|
||||||
@ -1464,11 +1466,10 @@ class Iso:
|
|||||||
apiclient.deleteIso(cmd)
|
apiclient.deleteIso(cmd)
|
||||||
return
|
return
|
||||||
|
|
||||||
def download(self, apiclient, timeout=5, interval=60):
|
def download(self, apiclient, retries=300, interval=5):
|
||||||
"""Download an ISO"""
|
"""Download an ISO"""
|
||||||
# Ensuring ISO is successfully downloaded
|
# Ensuring ISO is successfully downloaded
|
||||||
retry = 1
|
while retries > -1:
|
||||||
while True:
|
|
||||||
time.sleep(interval)
|
time.sleep(interval)
|
||||||
|
|
||||||
cmd = listIsos.listIsosCmd()
|
cmd = listIsos.listIsosCmd()
|
||||||
@ -1477,26 +1478,25 @@ class Iso:
|
|||||||
|
|
||||||
if isinstance(iso_response, list):
|
if isinstance(iso_response, list):
|
||||||
response = iso_response[0]
|
response = iso_response[0]
|
||||||
# Again initialize timeout to avoid listISO failure
|
if not hasattr(response, 'status') or not response or not response.status:
|
||||||
timeout = 5
|
retries = retries - 1
|
||||||
|
continue
|
||||||
|
|
||||||
# Check whether download is in progress(for Ex:10% Downloaded)
|
# Check whether download is in progress(for Ex:10% Downloaded)
|
||||||
# or ISO is 'Successfully Installed'
|
# or ISO is 'Successfully Installed'
|
||||||
if response.status == 'Successfully Installed':
|
if response.status == 'Successfully Installed' and response.isready:
|
||||||
return
|
return
|
||||||
elif 'Downloaded' not in response.status and \
|
elif 'Downloaded' not in response.status and \
|
||||||
'Installing' not in response.status:
|
'Installing' not in response.status:
|
||||||
if retry == 1:
|
if retries >= 0:
|
||||||
retry = retry - 1
|
retries = retries - 1
|
||||||
continue
|
continue
|
||||||
raise Exception(
|
raise Exception(
|
||||||
"Error In Downloading ISO: ISO Status - %s" %
|
"Error In Downloading ISO: ISO Status - %s" %
|
||||||
response.status)
|
response.status)
|
||||||
|
|
||||||
elif timeout == 0:
|
|
||||||
raise Exception("ISO download Timeout Exception")
|
|
||||||
else:
|
else:
|
||||||
timeout = timeout - 1
|
retries = retries - 1
|
||||||
return
|
raise Exception("ISO download failed exception")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def extract(cls, apiclient, id, mode, zoneid=None):
|
def extract(cls, apiclient, id, mode, zoneid=None):
|
||||||
|
|||||||
@ -1056,6 +1056,8 @@ def setNonContiguousVlanIds(apiclient, zoneid):
|
|||||||
list_physical_networks_response) > 0, "No physical networks found in zone %s" % zoneid
|
list_physical_networks_response) > 0, "No physical networks found in zone %s" % zoneid
|
||||||
|
|
||||||
for physical_network in list_physical_networks_response:
|
for physical_network in list_physical_networks_response:
|
||||||
|
if not hasattr(physical_network, 'vlan'):
|
||||||
|
continue
|
||||||
|
|
||||||
vlans = xsplit(physical_network.vlan, ['-', ','])
|
vlans = xsplit(physical_network.vlan, ['-', ','])
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user