Adding missing changes to test suits and configs before merging to 4.4-forward

(cherry picked from commit 87205f9555)
This commit is contained in:
Girish Shilamkar 2014-05-05 19:40:47 -04:00 committed by Daan Hoogland
parent 6259772144
commit f7ff16cad4
5 changed files with 139 additions and 43 deletions

View File

@ -24,13 +24,21 @@
Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Dynamic+Compute+Offering+FS
"""
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from marvin.lib.utils import cleanup_resources, validateList, random_gen
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
Resources,
AffinityGroup,
Host)
from marvin.lib.common import (get_domain,
get_zone,
get_template,
verifyComputeOfferingCreation)
from nose.plugins.attrib import attr
from marvin.codes import PASS, ADMIN_ACCOUNT, USER_ACCOUNT
from marvin.codes import PASS, ADMIN_ACCOUNT, USER_ACCOUNT, FAILED
from ddt import ddt, data
import time
@ddt
class TestDynamicServiceOffering(cloudstackTestCase):

View File

@ -23,10 +23,21 @@
Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/FS+-+IP+Range+Reservation+within+a+Network
"""
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.cloudstackException import CloudstackAPIException
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from marvin.lib.utils import validateList, cleanup_resources, verifyRouterState
from marvin.lib.base import (Account,
Network,
VirtualMachine,
Router,
ServiceOffering,
NetworkOffering)
from marvin.lib.common import (get_zone,
get_template,
get_domain,
wait_for_cleanup,
createEnabledNetworkOffering,
createNetworkRulesForVM)
from marvin.codes import (PASS, FAIL, FAILED, UNKNOWN, FAULT, MASTER,
NAT_RULE, STATIC_NAT_RULE)
import netaddr
import random
@ -952,12 +963,16 @@ class TestRouterOperations(cloudstackTestCase):
self.assertEqual(validateList(routers)[0], PASS, "Routers list validation failed")
# Destroy Router
result = Router.destroy(self.apiclient, id=routers[0].id)
if result[0] == FAIL:
self.fail("Failed to destroy router: %s" % result[2])
try:
Router.destroy(self.apiclient, id=routers[0].id)
except Exception as e:
self.fail("Failed to destroy router: %s" % e)
#Restart Network
isolated_network.restart(self.apiclient)
try:
isolated_network.restart(self.apiclient)
except Exception as e:
self.fail("Failed to restart network: %s" % e)
try:
virtual_machine_2 = createVirtualMachine(self, network_id=isolated_network.id)
@ -1072,11 +1087,9 @@ class TestFailureScnarios(cloudstackTestCase):
#
# validation
# should throw exception as network is not in implemented state as no vm is created
try:
update_response = Network.update(self.isolated_network, self.apiclient, id=isolated_network.id, guestvmcidr="10.1.1.0/26")
self.fail("Network Update of guest VM CIDR is successful withot any VM deployed in network")
except Exception as e:
self.debug("Network Update of guest VM CIDR should fail as there is no VM deployed in network")
with self.assertRaises(Exception):
self.isolated_network.update(self.apiclient, guestvmcidr="10.1.1.0/26")
return
@attr(tags=["advanced", "selfservice"])
def test_vm_create_after_reservation(self):
@ -1111,7 +1124,7 @@ class TestFailureScnarios(cloudstackTestCase):
if netaddr.IPAddress(virtual_machine_2.ipaddress) not in netaddr.IPNetwork(guest_vm_cidr):
self.fail("Newly created VM doesn't get IP from reserverd CIDR")
except Exception as e:
self.skipTest("VM creation fails, cannot validate the condition")
self.skipTest("VM creation fails, cannot validate the condition: %s" % e)
@attr(tags=["advanced", "selfservice"])
def test_reservation_after_router_restart(self):
@ -1130,19 +1143,13 @@ class TestFailureScnarios(cloudstackTestCase):
routers = Router.list(self.apiclient,
networkid=self.isolated_persistent_network.id,
listall=True)
self.assertEqual(
isinstance(routers, list),
True,
"list router should return valid response"
)
if not routers:
self.skipTest("Router list should not be empty, skipping test")
self.assertEqual(validateList(routers)[0], PASS,
"routers list validation failed")
Router.reboot(self.apiclient, routers[0].id)
networks = Network.list(self.apiclient, id=self.isolated_persistent_network.id)
self.assertEqual(
isinstance(networks, list),
True,
validateList(networks)[0], PASS,
"list Networks should return valid response"
)
self.assertEqual(networks[0].cidr, guest_vm_cidr, "guestvmcidr should match after router reboot")
@ -1163,4 +1170,4 @@ class TestFailureScnarios(cloudstackTestCase):
self.create_virtual_machine(network_id=self.isolated_persistent_network.id, ip_address=u"10.1.1.9")
self.fail("vm should not be created ")
except Exception as e:
self.debug("exception as IP is outside of guestvmcidr")
self.debug("exception as IP is outside of guestvmcidr: %s" % e)

View File

@ -23,12 +23,33 @@
Design Document: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Multiple+IP+address+per+NIC
"""
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from marvin.lib.utils import (cleanup_resources,
validateList,
random_gen)
from marvin.lib.base import (Account,
VirtualMachine,
ServiceOffering,
PublicIPAddress,
NIC,
FireWallRule,
NATRule,
StaticNATRule,
VpcOffering,
Domain,
Network,
Router,
VPC
)
from marvin.lib.common import (get_domain,
get_zone,
get_template,
get_free_vlan,
setSharedNetworkParams,
createEnabledNetworkOffering,
shouldTestBeSkipped,
wait_for_cleanup)
from nose.plugins.attrib import attr
from marvin.codes import PASS, ISOLATED_NETWORK, VPC_NETWORK, SHARED_NETWORK, FAIL
from marvin.codes import PASS, ISOLATED_NETWORK, VPC_NETWORK, SHARED_NETWORK, FAIL, FAILED
from ddt import ddt, data
import time

View File

@ -15,11 +15,32 @@
# specific language governing permissions and limitations
# under the License.
""" Tests for Persistent Networks without running VMs feature"""
from marvin.cloudstackException import CloudstackAPIException
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
import netaddr
from marvin.lib.utils import (validateList,
cleanup_resources,
get_hypervisor_type)
from marvin.lib.base import (NATRule,
StaticNATRule,
VirtualMachine,
LoadBalancerRule,
VPC,
Account,
Network,
Router,
ServiceOffering,
NetworkACL,
VpcOffering,
Domain,
PublicIPAddress,
FireWallRule,
Host,
NetworkOffering,
Project)
from marvin.lib.common import (get_zone,
get_template,
get_domain,
add_netscaler,
verifyNetworkState,
wait_for_cleanup)
from nose.plugins.attrib import attr
from marvin.codes import PASS, FAIL, FAILED
from marvin.sshClient import SshClient
@ -991,7 +1012,7 @@ class TestAssignVirtualMachine(cloudstackTestCase):
cls.services["ostype"]
)
if cls.template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
assert False, "get_template() failed to return template"
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
@ -1153,7 +1174,7 @@ class TestProjectAccountOperations(cloudstackTestCase):
cls.services["ostype"]
)
if cls.template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
assert False, "get_template() failed to return template"
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
@ -1328,7 +1349,7 @@ class TestRestartPersistentNetwork(cloudstackTestCase):
cls.services["ostype"]
)
if cls.template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
assert False, "get_template() failed to return template"
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
@ -1610,7 +1631,7 @@ class TestVPCNetworkOperations(cloudstackTestCase):
cls.services["ostype"]
)
if cls.template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
assert False, "get_template() failed to return template"
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id

View File

@ -209,6 +209,18 @@ test_data = {
"name": "Isolated Network",
"displaytext": "Isolated Network"
},
"netscaler_VPX": {
"ipaddress": "10.223.240.174",
"username": "nsroot",
"password": "nsroot",
"networkdevicetype": "NetscalerVPXLoadBalancer",
"publicinterface": "1/1",
"privateinterface": "1/2",
"numretries": 2,
"lbdevicededicated": "True",
"lbdevicecapacity": 2,
"port": 22
},
"virtual_machine": {
"displayname": "Test VM",
"username": "root",
@ -501,6 +513,26 @@ test_data = {
"NetworkACL": "VpcVirtualRouter"
}
},
"nw_offering_shared_persistent": {
"name": "Network offering for Shared Persistent Network",
"displaytext": "Network offering-DA services",
"guestiptype": "Shared",
"supportedservices": "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat",
"traffictype": "GUEST",
"availability": "Optional",
"ispersistent": "True",
"serviceProviderList": {
"Dhcp": "VirtualRouter",
"Dns": "VirtualRouter",
"SourceNat": "VirtualRouter",
"PortForwarding": "VirtualRouter",
"Vpn": "VirtualRouter",
"Firewall": "VirtualRouter",
"Lb": "VirtualRouter",
"UserData": "VirtualRouter",
"StaticNat": "VirtualRouter"
}
},
"fwrule": {
"startport": 22,
"endport": 22,
@ -586,6 +618,12 @@ test_data = {
"publicport": 2222,
"protocol": 'TCP'
},
"icmprule": {
"icmptype": -1,
"icmpcode": -1,
"cidrlist": "0.0.0.0/0",
"protocol": "ICMP"
},
"iso": {
"displaytext": "Test ISO",
"name": "ISO",
@ -662,6 +700,7 @@ test_data = {
"page": 1,
"pagesize": 2,
"listall": 'true',
"host_password": "password",
"advanced_sg": {
"zone": {
"name": "",