mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK: Test script to verify fix for CS-5332
Signed-off-by: sanjeev <sanjeev@apache.org> Signed-off-by: Santhosh Edukulla <santhosh.edukulla@gmail.com>
This commit is contained in:
parent
737f76df8c
commit
bc92bfd827
@ -21,7 +21,8 @@
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
#from marvin.cloudstackAPI import *
|
||||
from marvin.lib.utils import (cleanup_resources)
|
||||
from marvin.lib.utils import (cleanup_resources,
|
||||
validateList)
|
||||
from marvin.lib.base import (VirtualMachine,
|
||||
Account,
|
||||
Network,
|
||||
@ -35,6 +36,7 @@ from marvin.lib.base import (VirtualMachine,
|
||||
from marvin.lib.common import (get_domain,
|
||||
get_zone,
|
||||
get_template)
|
||||
from marvin.codes import *
|
||||
|
||||
|
||||
class Services:
|
||||
@ -735,7 +737,119 @@ class TestNOVirtualRouter(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
@attr(tags=["advanced", "selfservice"])
|
||||
def test_03_network_off_CS5332(self):
|
||||
"""
|
||||
@Desc: Test Network offering with Custom system offering for VR
|
||||
@Steps:
|
||||
Step1: Create new system offering for domain router
|
||||
Step2: Verify the custom system offering creation for domain router
|
||||
Step3: Create new network offering with domain router system offering created in step1
|
||||
Step4: Verify the network offering creation with custom system offering for VR
|
||||
Step5: Enable the network offering created in step3
|
||||
Step5: Create isolated guest network using network offering created in step3
|
||||
Step6: Deploy guest vm in network created above
|
||||
"""
|
||||
#create custom system offering for VR
|
||||
self.services["service_offering"]["name"] = "test_service_offering_for_router"
|
||||
self.services["service_offering"]["displaytext"] = "test_service_offering_for_router"
|
||||
self.services["service_offering"]["cpuspeed"] = 500
|
||||
self.services["service_offering"]["memory"] = 512
|
||||
self.services["service_offering"]["systemvmtype"] = "domainrouter"
|
||||
self.services["service_offering"]["storagetype"] = "shared"
|
||||
self.services["service_offering"]["issystem"] = "true"
|
||||
vr_sys_off = ServiceOffering.create(
|
||||
self.apiclient,
|
||||
self.services["service_offering"],
|
||||
)
|
||||
self.assertIsNotNone(
|
||||
vr_sys_off,
|
||||
"Failed to create custom system offering for VR"
|
||||
)
|
||||
vr_sys_off_res = ServiceOffering.list(
|
||||
self.apiclient,
|
||||
id = vr_sys_off.id,
|
||||
issystem = "true"
|
||||
)
|
||||
status = validateList(vr_sys_off_res)
|
||||
self.assertEquals(
|
||||
PASS,
|
||||
status[0],
|
||||
"Listing of VR system offering failed"
|
||||
)
|
||||
self.assertEqual(
|
||||
len(vr_sys_off_res),
|
||||
1,
|
||||
"Listing more than VR system offerings created"
|
||||
)
|
||||
self.debug("Created system offering with id %s" % vr_sys_off.id)
|
||||
# Create a network offering with all virtual router services enabled using custom system offering for VR
|
||||
self.debug(
|
||||
"Creating n/w offering with all services in VR & using custom system offering for VR"
|
||||
)
|
||||
self.network_offering = NetworkOffering.create(
|
||||
self.apiclient,
|
||||
self.services["network_offering"],
|
||||
conservemode=False,
|
||||
serviceofferingid=vr_sys_off.id
|
||||
)
|
||||
self.assertIsNotNone(
|
||||
self.network_offering,
|
||||
"Failed to create network offering with custom system offering for VR"
|
||||
)
|
||||
network_off_res = NetworkOffering.list(
|
||||
self.apiclient,
|
||||
id=self.network_offering.id
|
||||
)
|
||||
status = validateList(network_off_res)
|
||||
self.assertEquals(
|
||||
PASS,
|
||||
status[0],
|
||||
"Listing of network offerings failed"
|
||||
)
|
||||
self.assertEquals(
|
||||
len(network_off_res),
|
||||
1,
|
||||
"More than one network offerings are created"
|
||||
)
|
||||
self.assertEquals(
|
||||
network_off_res[0].serviceofferingid,
|
||||
vr_sys_off.id,
|
||||
"FAIL: Network offering has been created with default system offering"
|
||||
)
|
||||
self.cleanup.append(self.network_offering)
|
||||
self.cleanup.append(vr_sys_off)
|
||||
self.debug("Created n/w offering with ID: %s" % self.network_offering.id)
|
||||
# Enable Network offering
|
||||
self.network_offering.update(self.apiclient, state='Enabled')
|
||||
# Creating network using the network offering created
|
||||
self.debug("Creating network with network offering: %s" % self.network_offering.id)
|
||||
self.network = Network.create(
|
||||
self.apiclient,
|
||||
self.services["network"],
|
||||
accountid=self.account.name,
|
||||
domainid=self.account.domainid,
|
||||
networkofferingid=self.network_offering.id,
|
||||
zoneid=self.zone.id
|
||||
)
|
||||
self.assertIsNotNone(self.network,"Failed to create network")
|
||||
self.debug("Created network with ID: %s" % self.network.id)
|
||||
self.debug("Deploying VM in account: %s" % self.account.name)
|
||||
# Spawn an instance in that network
|
||||
virtual_machine = VirtualMachine.create(
|
||||
self.apiclient,
|
||||
self.services["virtual_machine"],
|
||||
accountid=self.account.name,
|
||||
domainid=self.account.domainid,
|
||||
serviceofferingid=self.service_offering.id,
|
||||
networkids=[str(self.network.id)]
|
||||
)
|
||||
self.assertIsNotNone(
|
||||
virtual_machine,
|
||||
"VM creation failed with network %s" % self.network.id
|
||||
)
|
||||
self.debug("Deployed VM in network: %s" % self.network.id)
|
||||
return
|
||||
|
||||
class TestNetworkUpgrade(cloudstackTestCase):
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user