Adding more test case for shared network

This closes #120
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
Gaurav Aradhye 2015-03-20 14:36:54 +05:30 committed by SrikanteswaraRao Talluri
parent 02c7bc0201
commit 8031b62b7f
2 changed files with 604 additions and 329 deletions

File diff suppressed because it is too large Load Diff

View File

@ -57,10 +57,6 @@ from marvin.cloudstackAPI import (listConfigurations,
listNetworkOfferings,
listResourceLimits,
listVPCOfferings)
from marvin.sshClient import SshClient
from marvin.codes import (PASS, FAILED, ISOLATED_NETWORK, VPC_NETWORK,
BASIC_ZONE, FAIL, NAT_RULE, STATIC_NAT_RULE,
@ -83,7 +79,8 @@ from marvin.lib.base import (PhysicalNetwork,
Network,
Host,
Resources,
Configurations)
Configurations,
Router)
import random
@ -1395,3 +1392,28 @@ def isNetworkDeleted(apiclient, networkid, timeout=600):
time.sleep(60)
#end while
return networkDeleted
def verifyRouterState(apiclient, routerid, state, listall=True):
"""List router and check if the router state matches the given state"""
retriesCount = 10
isRouterInDesiredState = False
exceptionOccured = False
exceptionMessage = ""
try:
while retriesCount >= 0:
routers = Router.list(apiclient, id=routerid, listall=listall)
assert validateList(
routers)[0] == PASS, "Routers list validation failed"
if str(routers[0].state).lower() == state:
isRouterInDesiredState = True
break
retriesCount -= 1
time.sleep(60)
if not isRouterInDesiredState:
exceptionMessage = "Router state should be %s, it is %s" %\
(state, routers[0].state)
except Exception as e:
exceptionOccured = True
exceptionMessage = e
return [exceptionOccured, isRouterInDesiredState, exceptionMessage]
return [exceptionOccured, isRouterInDesiredState, exceptionMessage]