mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-6282: Added Automated tests to test_escalations.py for Security Groups, VPN Customer Gateways, Templates, ISO's CS API calls
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
parent
baadf930fb
commit
e9e8c65b4d
File diff suppressed because it is too large
Load Diff
@ -434,7 +434,14 @@ test_data = {
|
|||||||
"publicport": 2222,
|
"publicport": 2222,
|
||||||
"protocol": 'TCP'
|
"protocol": 'TCP'
|
||||||
},
|
},
|
||||||
|
"iso": {
|
||||||
|
"displaytext": "Test ISO",
|
||||||
|
"name": "ISO",
|
||||||
|
"url": "http://people.apache.org/~tsp/dummy.iso",
|
||||||
|
"bootable": False,
|
||||||
|
"ispublic": False,
|
||||||
|
"ostype": "CentOS 5.6 (64-bit)",
|
||||||
|
},
|
||||||
"iso1": {
|
"iso1": {
|
||||||
"displaytext": "Test ISO 1",
|
"displaytext": "Test ISO 1",
|
||||||
"name": "ISO 1",
|
"name": "ISO 1",
|
||||||
@ -489,6 +496,14 @@ test_data = {
|
|||||||
"endport": "22",
|
"endport": "22",
|
||||||
"cidrlist": "0.0.0.0/0"
|
"cidrlist": "0.0.0.0/0"
|
||||||
},
|
},
|
||||||
|
"vpncustomergateway": {
|
||||||
|
"ipsecpsk": "secreatKey",
|
||||||
|
"ikepolicy": "aes128-sha1",
|
||||||
|
"ikelifetime": "86400",
|
||||||
|
"esppolicy": "aes128-sha1",
|
||||||
|
"epslifetime": "3600",
|
||||||
|
"dpd": "false"
|
||||||
|
},
|
||||||
"ostype": "CentOS 5.6 (64-bit)",
|
"ostype": "CentOS 5.6 (64-bit)",
|
||||||
"sleep": 90,
|
"sleep": 90,
|
||||||
"timeout": 10,
|
"timeout": 10,
|
||||||
|
|||||||
@ -1086,6 +1086,25 @@ class Template:
|
|||||||
[setattr(cmd, k, v) for k, v in kwargs.items()]
|
[setattr(cmd, k, v) for k, v in kwargs.items()]
|
||||||
return(apiclient.updateTemplatePermissions(cmd))
|
return(apiclient.updateTemplatePermissions(cmd))
|
||||||
|
|
||||||
|
def update(self, apiclient, **kwargs):
|
||||||
|
"""Updates the template details"""
|
||||||
|
|
||||||
|
cmd = updateTemplate.updateTemplateCmd()
|
||||||
|
cmd.id = self.id
|
||||||
|
[setattr(cmd, k, v) for k, v in kwargs.items()]
|
||||||
|
return(apiclient.updateTemplate(cmd))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def copy(cls, apiclient, id, sourcezoneid, destzoneid):
|
||||||
|
"Copy Template from source Zone to Destination Zone"
|
||||||
|
|
||||||
|
cmd = copyTemplate.copyTemplateCmd()
|
||||||
|
cmd.id = id
|
||||||
|
cmd.sourcezoneid = sourcezoneid
|
||||||
|
cmd.destzoneid = destzoneid
|
||||||
|
|
||||||
|
return apiclient.copyTemplate(cmd)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def list(cls, apiclient, **kwargs):
|
def list(cls, apiclient, **kwargs):
|
||||||
"""List all templates matching criteria"""
|
"""List all templates matching criteria"""
|
||||||
@ -1185,6 +1204,36 @@ class Iso:
|
|||||||
timeout = timeout - 1
|
timeout = timeout - 1
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def extract(cls, apiclient, id, mode, zoneid=None):
|
||||||
|
"Extract ISO "
|
||||||
|
|
||||||
|
cmd = extractIso.extractIsoCmd()
|
||||||
|
cmd.id = id
|
||||||
|
cmd.mode = mode
|
||||||
|
cmd.zoneid = zoneid
|
||||||
|
|
||||||
|
return apiclient.extractIso(cmd)
|
||||||
|
|
||||||
|
def update(self, apiclient, **kwargs):
|
||||||
|
"""Updates the ISO details"""
|
||||||
|
|
||||||
|
cmd = updateIso.updateIsoCmd()
|
||||||
|
cmd.id = self.id
|
||||||
|
[setattr(cmd, k, v) for k, v in kwargs.items()]
|
||||||
|
return(apiclient.updateIso(cmd))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def copy(cls, apiclient, id, sourcezoneid, destzoneid):
|
||||||
|
"Copy ISO from source Zone to Destination Zone"
|
||||||
|
|
||||||
|
cmd = copyIso.copyIsoCmd()
|
||||||
|
cmd.id = id
|
||||||
|
cmd.sourcezoneid = sourcezoneid
|
||||||
|
cmd.destzoneid = destzoneid
|
||||||
|
|
||||||
|
return apiclient.copyIso(cmd)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def list(cls, apiclient, **kwargs):
|
def list(cls, apiclient, **kwargs):
|
||||||
"""Lists all available ISO files."""
|
"""Lists all available ISO files."""
|
||||||
@ -1680,6 +1729,20 @@ class SnapshotPolicy:
|
|||||||
[setattr(cmd, k, v) for k, v in kwargs.items()]
|
[setattr(cmd, k, v) for k, v in kwargs.items()]
|
||||||
return(apiclient.listSnapshotPolicies(cmd))
|
return(apiclient.listSnapshotPolicies(cmd))
|
||||||
|
|
||||||
|
class Hypervisor:
|
||||||
|
"""Manage Hypervisor"""
|
||||||
|
|
||||||
|
def __init__(self, items):
|
||||||
|
self.__dict__.update(items)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def list(cls, apiclient, **kwargs):
|
||||||
|
"""Lists hypervisors"""
|
||||||
|
|
||||||
|
cmd = listHypervisors.listHypervisorsCmd()
|
||||||
|
[setattr(cmd, k, v) for k, v in kwargs.items()]
|
||||||
|
return(apiclient.listHypervisors(cmd))
|
||||||
|
|
||||||
|
|
||||||
class LoadBalancerRule:
|
class LoadBalancerRule:
|
||||||
"""Manage Load Balancer rule"""
|
"""Manage Load Balancer rule"""
|
||||||
@ -2678,7 +2741,7 @@ class SecurityGroup:
|
|||||||
"""Create security group"""
|
"""Create security group"""
|
||||||
cmd = createSecurityGroup.createSecurityGroupCmd()
|
cmd = createSecurityGroup.createSecurityGroupCmd()
|
||||||
|
|
||||||
cmd.name = services["name"]
|
cmd.name = "-".join([services["name"], random_gen()])
|
||||||
if account:
|
if account:
|
||||||
cmd.account = account
|
cmd.account = account
|
||||||
if domainid:
|
if domainid:
|
||||||
@ -2780,6 +2843,76 @@ class SecurityGroup:
|
|||||||
return(apiclient.listSecurityGroups(cmd))
|
return(apiclient.listSecurityGroups(cmd))
|
||||||
|
|
||||||
|
|
||||||
|
class VpnCustomerGateway:
|
||||||
|
"""Manage VPN Customer Gateway"""
|
||||||
|
|
||||||
|
def __init__(self, items):
|
||||||
|
self.__dict__.update(items)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def create(cls, apiclient, services, name, gateway, cidrlist,
|
||||||
|
account=None, domainid=None):
|
||||||
|
"""Create VPN Customer Gateway"""
|
||||||
|
cmd = createVpnCustomerGateway.createVpnCustomerGatewayCmd()
|
||||||
|
cmd.name = name
|
||||||
|
cmd.gateway = gateway
|
||||||
|
cmd.cidrlist = cidrlist
|
||||||
|
if "ipsecpsk" in services:
|
||||||
|
cmd.ipsecpsk = services["ipsecpsk"]
|
||||||
|
if "ikepolicy" in services:
|
||||||
|
cmd.ikepolicy = services["ikepolicy"]
|
||||||
|
if "ikelifetime" in services:
|
||||||
|
cmd.ikelifetime = services["ikelifetime"]
|
||||||
|
if "esppolicy" in services:
|
||||||
|
cmd.esppolicy = services["esppolicy"]
|
||||||
|
if "esplifetime" in services:
|
||||||
|
cmd.esplifetime = services["esplifetime"]
|
||||||
|
if "dpd" in services:
|
||||||
|
cmd.dpd = services["dpd"]
|
||||||
|
if account:
|
||||||
|
cmd.account = account
|
||||||
|
if domainid:
|
||||||
|
cmd.domainid = domainid
|
||||||
|
return VpnCustomerGateway(apiclient.createVpnCustomerGateway(cmd).__dict__)
|
||||||
|
|
||||||
|
def update(self, apiclient, services, name, gateway, cidrlist):
|
||||||
|
"""Updates VPN Customer Gateway"""
|
||||||
|
|
||||||
|
cmd = updateVpnCustomerGateway.updateVpnCustomerGatewayCmd()
|
||||||
|
cmd.id = self.id
|
||||||
|
cmd.name = name
|
||||||
|
cmd.gateway = gateway
|
||||||
|
cmd.cidrlist = cidrlist
|
||||||
|
if "ipsecpsk" in services:
|
||||||
|
cmd.ipsecpsk = services["ipsecpsk"]
|
||||||
|
if "ikepolicy" in services:
|
||||||
|
cmd.ikepolicy = services["ikepolicy"]
|
||||||
|
if "ikelifetime" in services:
|
||||||
|
cmd.ikelifetime = services["ikelifetime"]
|
||||||
|
if "esppolicy" in services:
|
||||||
|
cmd.esppolicy = services["esppolicy"]
|
||||||
|
if "esplifetime" in services:
|
||||||
|
cmd.esplifetime = services["esplifetime"]
|
||||||
|
if "dpd" in services:
|
||||||
|
cmd.dpd = services["dpd"]
|
||||||
|
return(apiclient.updateVpnCustomerGateway(cmd))
|
||||||
|
|
||||||
|
def delete(self, apiclient):
|
||||||
|
"""Delete VPN Customer Gateway"""
|
||||||
|
|
||||||
|
cmd = deleteVpnCustomerGateway.deleteVpnCustomerGatewayCmd()
|
||||||
|
cmd.id = self.id
|
||||||
|
apiclient.deleteVpnCustomerGateway(cmd)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def list(cls, apiclient, **kwargs):
|
||||||
|
"""List all VPN customer Gateway"""
|
||||||
|
|
||||||
|
cmd = listVpnCustomerGateways.listVpnCustomerGatewaysCmd()
|
||||||
|
[setattr(cmd, k, v) for k, v in kwargs.items()]
|
||||||
|
return(apiclient.listVpnCustomerGateways(cmd))
|
||||||
|
|
||||||
|
|
||||||
class Project:
|
class Project:
|
||||||
"""Manage Project life cycle"""
|
"""Manage Project life cycle"""
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user