From fa00dc9f9b7cf354dfb41d4e90923037d1762df1 Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Mon, 28 Jan 2013 19:15:18 +0530 Subject: [PATCH] marvin_refactor: add body to all the entities in base - don't do package import of cloudstackentity - create() and list() method will return obj(s) of type(Entity) Signed-off-by: Prasanna Santhanam --- .../marvin/integration/lib/base/Account.py | 51 +++++++++--- .../lib/base/AccountFromProject.py | 11 ++- .../integration/lib/base/AccountToProject.py | 10 ++- .../marvin/integration/lib/base/Alerts.py | 12 ++- .../marvin/integration/lib/base/ApiLimit.py | 18 ++++- .../marvin/integration/lib/base/Apis.py | 12 ++- .../integration/lib/base/AsyncJobResult.py | 10 ++- .../marvin/integration/lib/base/AsyncJobs.py | 12 ++- .../integration/lib/base/AutoScalePolicies.py | 12 ++- .../integration/lib/base/AutoScalePolicy.py | 25 +++++- .../integration/lib/base/AutoScaleVmGroup.py | 48 ++++++++++-- .../lib/base/AutoScaleVmProfile.py | 34 ++++++-- .../integration/lib/base/Capabilities.py | 12 ++- .../marvin/integration/lib/base/Capacity.py | 12 ++- .../integration/lib/base/CloudIdentifier.py | 10 ++- .../marvin/integration/lib/base/Cluster.py | 37 +++++++-- .../marvin/integration/lib/base/Condition.py | 27 +++++-- .../marvin/integration/lib/base/Config.py | 12 ++- .../integration/lib/base/Configuration.py | 19 ++++- .../marvin/integration/lib/base/Counter.py | 27 +++++-- .../integration/lib/base/CustomCertificate.py | 11 ++- .../lib/base/DefaultZoneForAccount.py | 12 ++- .../integration/lib/base/DiskOffering.py | 34 ++++++-- .../marvin/integration/lib/base/Domain.py | 34 ++++++-- .../integration/lib/base/DomainChildren.py | 12 ++- .../marvin/integration/lib/base/EventTypes.py | 12 ++- .../marvin/integration/lib/base/Events.py | 12 ++- .../integration/lib/base/FirewallRule.py | 27 +++++-- .../lib/base/FromLoadBalancerRule.py | 11 ++- .../marvin/integration/lib/base/Host.py | 45 +++++++++-- .../lib/base/HostForMaintenance.py | 10 ++- .../integration/lib/base/HostMaintenance.py | 10 ++- .../integration/lib/base/HostPassword.py | 11 ++- .../lib/base/HypervisorCapabilities.py | 18 ++++- .../integration/lib/base/Hypervisors.py | 12 ++- .../integration/lib/base/InstanceGroup.py | 34 ++++++-- .../marvin/integration/lib/base/IpAddress.py | 16 +++- .../integration/lib/base/IpForwardingRule.py | 27 +++++-- .../marvin/marvin/integration/lib/base/Iso.py | 68 +++++++++++++--- .../integration/lib/base/IsoPermissions.py | 20 ++++- .../lib/base/LBStickinessPolicies.py | 13 +++- .../lib/base/LBStickinessPolicy.py | 18 ++++- .../integration/lib/base/LoadBalancerRule.py | 34 ++++++-- .../lib/base/LoadBalancerRuleInstances.py | 13 +++- .../marvin/integration/lib/base/Network.py | 41 ++++++++-- .../marvin/integration/lib/base/NetworkACL.py | 27 +++++-- .../integration/lib/base/NetworkDevice.py | 25 ++++-- .../integration/lib/base/NetworkOffering.py | 33 ++++++-- .../lib/base/NetworkServiceProvider.py | 34 ++++++-- .../integration/lib/base/NiciraNvpDevice.py | 30 +++++-- .../lib/base/NiciraNvpDeviceNetworks.py | 13 +++- .../integration/lib/base/OsCategories.py | 12 ++- .../marvin/integration/lib/base/OsTypes.py | 12 ++- .../lib/base/PasswordForVirtualMachine.py | 10 ++- .../integration/lib/base/PhysicalNetwork.py | 34 ++++++-- .../marvin/marvin/integration/lib/base/Pod.py | 34 ++++++-- .../lib/base/PortForwardingRule.py | 37 +++++++-- .../integration/lib/base/PrivateGateway.py | 27 +++++-- .../marvin/integration/lib/base/Project.py | 48 ++++++++++-- .../integration/lib/base/ProjectAccounts.py | 13 +++- .../integration/lib/base/ProjectInvitation.py | 26 +++++-- .../integration/lib/base/PublicIpAddresses.py | 12 ++- .../integration/lib/base/RemoteAccessVpn.py | 28 +++++-- .../marvin/integration/lib/base/Remove.py | 11 ++- .../integration/lib/base/ResourceCount.py | 10 ++- .../integration/lib/base/ResourceLimit.py | 19 ++++- .../marvin/integration/lib/base/Router.py | 40 ++++++++-- .../marvin/marvin/integration/lib/base/S3.py | 21 ++++- .../marvin/integration/lib/base/SSHKeyPair.py | 35 +++++++-- .../integration/lib/base/SecondaryStorage.py | 10 ++- .../integration/lib/base/SecurityGroup.py | 26 +++++-- .../lib/base/SecurityGroupEgress.py | 16 +++- .../lib/base/SecurityGroupIngress.py | 16 +++- .../integration/lib/base/ServiceForRouter.py | 11 ++- .../lib/base/ServiceForSystemVm.py | 11 ++- .../lib/base/ServiceForVirtualMachine.py | 11 ++- .../integration/lib/base/ServiceOffering.py | 34 ++++++-- .../marvin/integration/lib/base/Snapshot.py | 27 +++++-- .../integration/lib/base/SnapshotPolicies.py | 19 ++++- .../integration/lib/base/SnapshotPolicy.py | 11 ++- .../marvin/integration/lib/base/StaticNat.py | 18 ++++- .../integration/lib/base/StaticRoute.py | 27 +++++-- .../lib/base/StorageMaintenance.py | 17 +++- .../lib/base/StorageNetworkIpRange.py | 34 ++++++-- .../integration/lib/base/StoragePool.py | 34 ++++++-- .../lib/base/SupportedNetworkServices.py | 12 ++- .../marvin/integration/lib/base/Swift.py | 19 ++++- .../marvin/integration/lib/base/SystemVm.py | 48 ++++++++++-- .../marvin/integration/lib/base/Tags.py | 28 +++++-- .../marvin/integration/lib/base/Template.py | 73 ++++++++++++++--- .../lib/base/TemplatePermissions.py | 20 ++++- .../lib/base/ToLoadBalancerRule.py | 11 ++- .../integration/lib/base/TrafficMonitor.py | 28 +++++-- .../integration/lib/base/TrafficType.py | 35 +++++++-- .../lib/base/TrafficTypeImplementors.py | 12 ++- .../integration/lib/base/UsageRecords.py | 22 +++++- .../marvin/integration/lib/base/UsageTypes.py | 12 ++- .../marvin/integration/lib/base/User.py | 62 ++++++++++++--- .../marvin/integration/lib/base/UserKeys.py | 10 ++- .../marvin/integration/lib/base/VMPassword.py | 10 ++- .../marvin/marvin/integration/lib/base/VPC.py | 39 ++++++++-- .../integration/lib/base/VPCOffering.py | 33 ++++++-- .../integration/lib/base/VirtualMachine.py | 78 ++++++++++++++++--- .../lib/base/VirtualRouterElement.py | 28 +++++-- .../integration/lib/base/VlanIpRange.py | 27 +++++-- .../marvin/integration/lib/base/Volume.py | 68 +++++++++++++--- .../integration/lib/base/VpnConnection.py | 34 ++++++-- .../lib/base/VpnCustomerGateway.py | 39 ++++++++-- .../marvin/integration/lib/base/VpnGateway.py | 27 +++++-- .../marvin/integration/lib/base/VpnUser.py | 27 +++++-- .../marvin/integration/lib/base/Zone.py | 34 ++++++-- .../integration/lib/factory/AccountFactory.py | 11 ++- .../marvin/integration/lib/generateBase.py | 73 ++++++++++------- 113 files changed, 2271 insertions(+), 528 deletions(-) diff --git a/tools/marvin/marvin/integration/lib/base/Account.py b/tools/marvin/marvin/integration/lib/base/Account.py index fad606723c6..1b25bb64fb5 100644 --- a/tools/marvin/marvin/integration/lib/base/Account.py +++ b/tools/marvin/marvin/integration/lib/base/Account.py @@ -14,36 +14,69 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import enableAccount +from marvin.cloudstackAPI import lockAccount +from marvin.cloudstackAPI import createAccount +from marvin.cloudstackAPI import listAccounts +from marvin.cloudstackAPI import updateAccount +from marvin.cloudstackAPI import disableAccount +from marvin.cloudstackAPI import deleteAccount class Account(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def enable(self, apiclient, **kwargs): - pass + cmd = enableAccount.enableAccountCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + account = apiclient.enableAccount(cmd) + def lock(self, apiclient, account, domainid, **kwargs): - pass + cmd = lockAccount.lockAccountCmd() + cmd.account = account + cmd.domainid = domainid + [setattr(cmd, key, value) for key,value in kwargs.items] + account = apiclient.lockAccount(cmd) + @classmethod def create(cls, apiclient, AccountFactory, **kwargs): cmd = createAccount.createAccountCmd() [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in AccountFactory.attributes()] [setattr(cmd, key, value) for key,value in kwargs.items] - return Account(apiclient.createAccount(cmd).__dict__) + account = apiclient.createAccount(cmd) + return Account(account.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listAccounts.listAccountsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + account = apiclient.listAccounts(cmd) + return map(lambda e: Account(e.__dict__), account) + def update(self, apiclient, newname, **kwargs): - pass + cmd = updateAccount.updateAccountCmd() + cmd.newname = newname + [setattr(cmd, key, value) for key,value in kwargs.items] + account = apiclient.updateAccount(cmd) + def disable(self, apiclient, lock, **kwargs): - pass + cmd = disableAccount.disableAccountCmd() + cmd.lock = lock + [setattr(cmd, key, value) for key,value in kwargs.items] + account = apiclient.disableAccount(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteAccount.deleteAccountCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + account = apiclient.deleteAccount(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/AccountFromProject.py b/tools/marvin/marvin/integration/lib/base/AccountFromProject.py index 8f78f39be92..34ccb19d006 100644 --- a/tools/marvin/marvin/integration/lib/base/AccountFromProject.py +++ b/tools/marvin/marvin/integration/lib/base/AccountFromProject.py @@ -14,12 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import deleteAccountFromProject + class AccountFromProject(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def delete(self, apiclient, projectid, account, **kwargs): - pass + cmd = deleteAccountFromProject.deleteAccountFromProjectCmd() + cmd.account = account + cmd.projectid = projectid + [setattr(cmd, key, value) for key,value in kwargs.items] + accountfromproject = apiclient.deleteAccountFromProject(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/AccountToProject.py b/tools/marvin/marvin/integration/lib/base/AccountToProject.py index 5f7d4718737..7fac6ebee5f 100644 --- a/tools/marvin/marvin/integration/lib/base/AccountToProject.py +++ b/tools/marvin/marvin/integration/lib/base/AccountToProject.py @@ -14,12 +14,18 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import addAccountToProject + class AccountToProject(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def add(self, apiclient, projectid, **kwargs): - pass + cmd = addAccountToProject.addAccountToProjectCmd() + cmd.projectid = projectid + [setattr(cmd, key, value) for key,value in kwargs.items] + accounttoproject = apiclient.addAccountToProject(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Alerts.py b/tools/marvin/marvin/integration/lib/base/Alerts.py index 07e552fa044..2c09c630de9 100644 --- a/tools/marvin/marvin/integration/lib/base/Alerts.py +++ b/tools/marvin/marvin/integration/lib/base/Alerts.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listAlerts + class Alerts(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listAlerts.listAlertsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + alerts = apiclient.listAlerts(cmd) + return map(lambda e: Alerts(e.__dict__), alerts) diff --git a/tools/marvin/marvin/integration/lib/base/ApiLimit.py b/tools/marvin/marvin/integration/lib/base/ApiLimit.py index ee33668ecc7..c3ec02593ed 100644 --- a/tools/marvin/marvin/integration/lib/base/ApiLimit.py +++ b/tools/marvin/marvin/integration/lib/base/ApiLimit.py @@ -14,15 +14,25 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import resetApiLimit +from marvin.cloudstackAPI import getApiLimit + class ApiLimit(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def reset(self, apiclient, **kwargs): - pass + cmd = resetApiLimit.resetApiLimitCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + apilimit = apiclient.resetApiLimit(cmd) + + + def get(self, apiclient, **kwargs): + cmd = getApiLimit.getApiLimitCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + apilimit = apiclient.getApiLimit(cmd) - def get(self, apiclient): - pass diff --git a/tools/marvin/marvin/integration/lib/base/Apis.py b/tools/marvin/marvin/integration/lib/base/Apis.py index 6cad6c8d2b8..e6f9c79cace 100644 --- a/tools/marvin/marvin/integration/lib/base/Apis.py +++ b/tools/marvin/marvin/integration/lib/base/Apis.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listApis + class Apis(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listApis.listApisCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + apis = apiclient.listApis(cmd) + return map(lambda e: Apis(e.__dict__), apis) diff --git a/tools/marvin/marvin/integration/lib/base/AsyncJobResult.py b/tools/marvin/marvin/integration/lib/base/AsyncJobResult.py index 2805e50ab50..079865d2040 100644 --- a/tools/marvin/marvin/integration/lib/base/AsyncJobResult.py +++ b/tools/marvin/marvin/integration/lib/base/AsyncJobResult.py @@ -14,12 +14,18 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import queryAsyncJobResult + class AsyncJobResult(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def query(self, apiclient, jobid, **kwargs): - pass + cmd = queryAsyncJobResult.queryAsyncJobResultCmd() + cmd.jobid = jobid + [setattr(cmd, key, value) for key,value in kwargs.items] + asyncjobresult = apiclient.queryAsyncJobResult(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/AsyncJobs.py b/tools/marvin/marvin/integration/lib/base/AsyncJobs.py index 0f25bc611a4..1ef632e2dba 100644 --- a/tools/marvin/marvin/integration/lib/base/AsyncJobs.py +++ b/tools/marvin/marvin/integration/lib/base/AsyncJobs.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listAsyncJobs + class AsyncJobs(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listAsyncJobs.listAsyncJobsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + asyncjobs = apiclient.listAsyncJobs(cmd) + return map(lambda e: AsyncJobs(e.__dict__), asyncjobs) diff --git a/tools/marvin/marvin/integration/lib/base/AutoScalePolicies.py b/tools/marvin/marvin/integration/lib/base/AutoScalePolicies.py index 1ac5502bd83..af5a5530aed 100644 --- a/tools/marvin/marvin/integration/lib/base/AutoScalePolicies.py +++ b/tools/marvin/marvin/integration/lib/base/AutoScalePolicies.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listAutoScalePolicies + class AutoScalePolicies(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listAutoScalePolicies.listAutoScalePoliciesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + autoscalepolicies = apiclient.listAutoScalePolicies(cmd) + return map(lambda e: AutoScalePolicies(e.__dict__), autoscalepolicies) diff --git a/tools/marvin/marvin/integration/lib/base/AutoScalePolicy.py b/tools/marvin/marvin/integration/lib/base/AutoScalePolicy.py index 541f11bc443..be07a7d0abf 100644 --- a/tools/marvin/marvin/integration/lib/base/AutoScalePolicy.py +++ b/tools/marvin/marvin/integration/lib/base/AutoScalePolicy.py @@ -14,19 +14,36 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createAutoScalePolicy +from marvin.cloudstackAPI import updateAutoScalePolicy +from marvin.cloudstackAPI import deleteAutoScalePolicy + class AutoScalePolicy(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, AutoScalePolicyFactory, **kwargs): - pass + cmd = createAutoScalePolicy.createAutoScalePolicyCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in AutoScalePolicyFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + autoscalepolicy = apiclient.createAutoScalePolicy(cmd) + return AutoScalePolicy(autoscalepolicy.__dict__) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateAutoScalePolicy.updateAutoScalePolicyCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + autoscalepolicy = apiclient.updateAutoScalePolicy(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteAutoScalePolicy.deleteAutoScalePolicyCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + autoscalepolicy = apiclient.deleteAutoScalePolicy(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/AutoScaleVmGroup.py b/tools/marvin/marvin/integration/lib/base/AutoScaleVmGroup.py index 98ae58f9b8d..4de66448866 100644 --- a/tools/marvin/marvin/integration/lib/base/AutoScaleVmGroup.py +++ b/tools/marvin/marvin/integration/lib/base/AutoScaleVmGroup.py @@ -14,29 +14,61 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import enableAutoScaleVmGroup +from marvin.cloudstackAPI import createAutoScaleVmGroup +from marvin.cloudstackAPI import listAutoScaleVmGroups +from marvin.cloudstackAPI import updateAutoScaleVmGroup +from marvin.cloudstackAPI import disableAutoScaleVmGroup +from marvin.cloudstackAPI import deleteAutoScaleVmGroup + class AutoScaleVmGroup(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def enable(self, apiclient, id, **kwargs): - pass + cmd = enableAutoScaleVmGroup.enableAutoScaleVmGroupCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + autoscalevmgroup = apiclient.enableAutoScaleVmGroup(cmd) + @classmethod def create(cls, apiclient, AutoScaleVmGroupFactory, **kwargs): - pass + cmd = createAutoScaleVmGroup.createAutoScaleVmGroupCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in AutoScaleVmGroupFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + autoscalevmgroup = apiclient.createAutoScaleVmGroup(cmd) + return AutoScaleVmGroup(autoscalevmgroup.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listAutoScaleVmGroups.listAutoScaleVmGroupsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + autoscalevmgroup = apiclient.listAutoScaleVmGroups(cmd) + return map(lambda e: AutoScaleVmGroup(e.__dict__), autoscalevmgroup) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateAutoScaleVmGroup.updateAutoScaleVmGroupCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + autoscalevmgroup = apiclient.updateAutoScaleVmGroup(cmd) + def disable(self, apiclient, id, **kwargs): - pass + cmd = disableAutoScaleVmGroup.disableAutoScaleVmGroupCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + autoscalevmgroup = apiclient.disableAutoScaleVmGroup(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteAutoScaleVmGroup.deleteAutoScaleVmGroupCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + autoscalevmgroup = apiclient.deleteAutoScaleVmGroup(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/AutoScaleVmProfile.py b/tools/marvin/marvin/integration/lib/base/AutoScaleVmProfile.py index 4607801cbab..bd0cc7910c2 100644 --- a/tools/marvin/marvin/integration/lib/base/AutoScaleVmProfile.py +++ b/tools/marvin/marvin/integration/lib/base/AutoScaleVmProfile.py @@ -14,23 +14,45 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createAutoScaleVmProfile +from marvin.cloudstackAPI import listAutoScaleVmProfiles +from marvin.cloudstackAPI import updateAutoScaleVmProfile +from marvin.cloudstackAPI import deleteAutoScaleVmProfile + class AutoScaleVmProfile(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, AutoScaleVmProfileFactory, **kwargs): - pass + cmd = createAutoScaleVmProfile.createAutoScaleVmProfileCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in AutoScaleVmProfileFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + autoscalevmprofile = apiclient.createAutoScaleVmProfile(cmd) + return AutoScaleVmProfile(autoscalevmprofile.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listAutoScaleVmProfiles.listAutoScaleVmProfilesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + autoscalevmprofile = apiclient.listAutoScaleVmProfiles(cmd) + return map(lambda e: AutoScaleVmProfile(e.__dict__), autoscalevmprofile) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateAutoScaleVmProfile.updateAutoScaleVmProfileCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + autoscalevmprofile = apiclient.updateAutoScaleVmProfile(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteAutoScaleVmProfile.deleteAutoScaleVmProfileCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + autoscalevmprofile = apiclient.deleteAutoScaleVmProfile(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Capabilities.py b/tools/marvin/marvin/integration/lib/base/Capabilities.py index ba33f86eadd..48779103020 100644 --- a/tools/marvin/marvin/integration/lib/base/Capabilities.py +++ b/tools/marvin/marvin/integration/lib/base/Capabilities.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listCapabilities + class Capabilities(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient): - pass + def list(self, apiclient, **kwargs): + cmd = listCapabilities.listCapabilitiesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + capabilities = apiclient.listCapabilities(cmd) + return map(lambda e: Capabilities(e.__dict__), capabilities) diff --git a/tools/marvin/marvin/integration/lib/base/Capacity.py b/tools/marvin/marvin/integration/lib/base/Capacity.py index 21fec409baf..b42367a9009 100644 --- a/tools/marvin/marvin/integration/lib/base/Capacity.py +++ b/tools/marvin/marvin/integration/lib/base/Capacity.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listCapacity + class Capacity(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listCapacity.listCapacityCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + capacity = apiclient.listCapacity(cmd) + return map(lambda e: Capacity(e.__dict__), capacity) diff --git a/tools/marvin/marvin/integration/lib/base/CloudIdentifier.py b/tools/marvin/marvin/integration/lib/base/CloudIdentifier.py index 3496609170b..1a7e8379dfc 100644 --- a/tools/marvin/marvin/integration/lib/base/CloudIdentifier.py +++ b/tools/marvin/marvin/integration/lib/base/CloudIdentifier.py @@ -14,12 +14,18 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import getCloudIdentifier + class CloudIdentifier(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def get(self, apiclient, userid, **kwargs): - pass + cmd = getCloudIdentifier.getCloudIdentifierCmd() + cmd.userid = userid + [setattr(cmd, key, value) for key,value in kwargs.items] + cloudidentifier = apiclient.getCloudIdentifier(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Cluster.py b/tools/marvin/marvin/integration/lib/base/Cluster.py index 73ffc42abc1..eff74ef582d 100644 --- a/tools/marvin/marvin/integration/lib/base/Cluster.py +++ b/tools/marvin/marvin/integration/lib/base/Cluster.py @@ -14,22 +14,47 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import addCluster +from marvin.cloudstackAPI import listClusters +from marvin.cloudstackAPI import updateCluster +from marvin.cloudstackAPI import deleteCluster + class Cluster(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def add(self, apiclient, clustername, hypervisor, zoneid, clustertype, podid, **kwargs): - pass + cmd = addCluster.addClusterCmd() + cmd.clustername = clustername + cmd.clustertype = clustertype + cmd.hypervisor = hypervisor + cmd.podid = podid + cmd.zoneid = zoneid + [setattr(cmd, key, value) for key,value in kwargs.items] + cluster = apiclient.addCluster(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listClusters.listClustersCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + cluster = apiclient.listClusters(cmd) + return map(lambda e: Cluster(e.__dict__), cluster) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateCluster.updateClusterCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + cluster = apiclient.updateCluster(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteCluster.deleteClusterCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + cluster = apiclient.deleteCluster(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Condition.py b/tools/marvin/marvin/integration/lib/base/Condition.py index debaccfca19..2abc263bb90 100644 --- a/tools/marvin/marvin/integration/lib/base/Condition.py +++ b/tools/marvin/marvin/integration/lib/base/Condition.py @@ -14,20 +14,37 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createCondition +from marvin.cloudstackAPI import listConditions +from marvin.cloudstackAPI import deleteCondition + class Condition(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, ConditionFactory, **kwargs): - pass + cmd = createCondition.createConditionCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in ConditionFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + condition = apiclient.createCondition(cmd) + return Condition(condition.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listConditions.listConditionsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + condition = apiclient.listConditions(cmd) + return map(lambda e: Condition(e.__dict__), condition) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteCondition.deleteConditionCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + condition = apiclient.deleteCondition(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Config.py b/tools/marvin/marvin/integration/lib/base/Config.py index 794255756cf..b17d5ce8856 100644 --- a/tools/marvin/marvin/integration/lib/base/Config.py +++ b/tools/marvin/marvin/integration/lib/base/Config.py @@ -14,12 +14,20 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import ldapConfig + class Config(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def ldap(self, apiclient, queryfilter, hostname, searchbase, **kwargs): - pass + cmd = ldapConfig.ldapConfigCmd() + cmd.hostname = hostname + cmd.queryfilter = queryfilter + cmd.searchbase = searchbase + [setattr(cmd, key, value) for key,value in kwargs.items] + config = apiclient.ldapConfig(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Configuration.py b/tools/marvin/marvin/integration/lib/base/Configuration.py index 4d9780840f9..f5973e4dbd5 100644 --- a/tools/marvin/marvin/integration/lib/base/Configuration.py +++ b/tools/marvin/marvin/integration/lib/base/Configuration.py @@ -14,16 +14,27 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listConfigurations +from marvin.cloudstackAPI import updateConfiguration + class Configuration(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listConfigurations.listConfigurationsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + configuration = apiclient.listConfigurations(cmd) + return map(lambda e: Configuration(e.__dict__), configuration) + def update(self, apiclient, name, **kwargs): - pass + cmd = updateConfiguration.updateConfigurationCmd() + cmd.name = name + [setattr(cmd, key, value) for key,value in kwargs.items] + configuration = apiclient.updateConfiguration(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Counter.py b/tools/marvin/marvin/integration/lib/base/Counter.py index 3de71bc5324..3990acc37fc 100644 --- a/tools/marvin/marvin/integration/lib/base/Counter.py +++ b/tools/marvin/marvin/integration/lib/base/Counter.py @@ -14,20 +14,37 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createCounter +from marvin.cloudstackAPI import listCounters +from marvin.cloudstackAPI import deleteCounter + class Counter(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, CounterFactory, **kwargs): - pass + cmd = createCounter.createCounterCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in CounterFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + counter = apiclient.createCounter(cmd) + return Counter(counter.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listCounters.listCountersCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + counter = apiclient.listCounters(cmd) + return map(lambda e: Counter(e.__dict__), counter) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteCounter.deleteCounterCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + counter = apiclient.deleteCounter(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/CustomCertificate.py b/tools/marvin/marvin/integration/lib/base/CustomCertificate.py index aac637f65ef..7c4653b1d66 100644 --- a/tools/marvin/marvin/integration/lib/base/CustomCertificate.py +++ b/tools/marvin/marvin/integration/lib/base/CustomCertificate.py @@ -14,12 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import uploadCustomCertificate + class CustomCertificate(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def upload(self, apiclient, domainsuffix, certificate, **kwargs): - pass + cmd = uploadCustomCertificate.uploadCustomCertificateCmd() + cmd.certificate = certificate + cmd.domainsuffix = domainsuffix + [setattr(cmd, key, value) for key,value in kwargs.items] + customcertificate = apiclient.uploadCustomCertificate(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/DefaultZoneForAccount.py b/tools/marvin/marvin/integration/lib/base/DefaultZoneForAccount.py index 7dbd755687b..b5a87800d88 100644 --- a/tools/marvin/marvin/integration/lib/base/DefaultZoneForAccount.py +++ b/tools/marvin/marvin/integration/lib/base/DefaultZoneForAccount.py @@ -14,12 +14,20 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import markDefaultZoneForAccount + class DefaultZoneForAccount(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def mark(self, apiclient, account, domainid, zoneid, **kwargs): - pass + cmd = markDefaultZoneForAccount.markDefaultZoneForAccountCmd() + cmd.account = account + cmd.domainid = domainid + cmd.zoneid = zoneid + [setattr(cmd, key, value) for key,value in kwargs.items] + defaultzoneforaccount = apiclient.markDefaultZoneForAccount(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/DiskOffering.py b/tools/marvin/marvin/integration/lib/base/DiskOffering.py index f1436cf5bdb..4168d7715a3 100644 --- a/tools/marvin/marvin/integration/lib/base/DiskOffering.py +++ b/tools/marvin/marvin/integration/lib/base/DiskOffering.py @@ -14,23 +14,45 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createDiskOffering +from marvin.cloudstackAPI import listDiskOfferings +from marvin.cloudstackAPI import updateDiskOffering +from marvin.cloudstackAPI import deleteDiskOffering + class DiskOffering(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, DiskOfferingFactory, **kwargs): - pass + cmd = createDiskOffering.createDiskOfferingCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in DiskOfferingFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + diskoffering = apiclient.createDiskOffering(cmd) + return DiskOffering(diskoffering.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listDiskOfferings.listDiskOfferingsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + diskoffering = apiclient.listDiskOfferings(cmd) + return map(lambda e: DiskOffering(e.__dict__), diskoffering) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateDiskOffering.updateDiskOfferingCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + diskoffering = apiclient.updateDiskOffering(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteDiskOffering.deleteDiskOfferingCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + diskoffering = apiclient.deleteDiskOffering(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Domain.py b/tools/marvin/marvin/integration/lib/base/Domain.py index 5904aa4ae04..0134e2a8c17 100644 --- a/tools/marvin/marvin/integration/lib/base/Domain.py +++ b/tools/marvin/marvin/integration/lib/base/Domain.py @@ -14,23 +14,45 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createDomain +from marvin.cloudstackAPI import listDomains +from marvin.cloudstackAPI import updateDomain +from marvin.cloudstackAPI import deleteDomain + class Domain(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, DomainFactory, **kwargs): - pass + cmd = createDomain.createDomainCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in DomainFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + domain = apiclient.createDomain(cmd) + return Domain(domain.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listDomains.listDomainsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + domain = apiclient.listDomains(cmd) + return map(lambda e: Domain(e.__dict__), domain) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateDomain.updateDomainCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + domain = apiclient.updateDomain(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteDomain.deleteDomainCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + domain = apiclient.deleteDomain(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/DomainChildren.py b/tools/marvin/marvin/integration/lib/base/DomainChildren.py index cfd80152056..6527656ab11 100644 --- a/tools/marvin/marvin/integration/lib/base/DomainChildren.py +++ b/tools/marvin/marvin/integration/lib/base/DomainChildren.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listDomainChildren + class DomainChildren(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listDomainChildren.listDomainChildrenCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + domainchildren = apiclient.listDomainChildren(cmd) + return map(lambda e: DomainChildren(e.__dict__), domainchildren) diff --git a/tools/marvin/marvin/integration/lib/base/EventTypes.py b/tools/marvin/marvin/integration/lib/base/EventTypes.py index 208fe1b33fc..3565768cac9 100644 --- a/tools/marvin/marvin/integration/lib/base/EventTypes.py +++ b/tools/marvin/marvin/integration/lib/base/EventTypes.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listEventTypes + class EventTypes(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient): - pass + def list(self, apiclient, **kwargs): + cmd = listEventTypes.listEventTypesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + eventtypes = apiclient.listEventTypes(cmd) + return map(lambda e: EventTypes(e.__dict__), eventtypes) diff --git a/tools/marvin/marvin/integration/lib/base/Events.py b/tools/marvin/marvin/integration/lib/base/Events.py index 7acccd1832d..27c3099d7d4 100644 --- a/tools/marvin/marvin/integration/lib/base/Events.py +++ b/tools/marvin/marvin/integration/lib/base/Events.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listEvents + class Events(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listEvents.listEventsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + events = apiclient.listEvents(cmd) + return map(lambda e: Events(e.__dict__), events) diff --git a/tools/marvin/marvin/integration/lib/base/FirewallRule.py b/tools/marvin/marvin/integration/lib/base/FirewallRule.py index 7ff5777e553..232e7e6214b 100644 --- a/tools/marvin/marvin/integration/lib/base/FirewallRule.py +++ b/tools/marvin/marvin/integration/lib/base/FirewallRule.py @@ -14,20 +14,37 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createFirewallRule +from marvin.cloudstackAPI import listFirewallRules +from marvin.cloudstackAPI import deleteFirewallRule + class FirewallRule(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, FirewallRuleFactory, **kwargs): - pass + cmd = createFirewallRule.createFirewallRuleCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in FirewallRuleFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + firewallrule = apiclient.createFirewallRule(cmd) + return FirewallRule(firewallrule.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listFirewallRules.listFirewallRulesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + firewallrule = apiclient.listFirewallRules(cmd) + return map(lambda e: FirewallRule(e.__dict__), firewallrule) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteFirewallRule.deleteFirewallRuleCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + firewallrule = apiclient.deleteFirewallRule(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/FromLoadBalancerRule.py b/tools/marvin/marvin/integration/lib/base/FromLoadBalancerRule.py index 23dc9ad0ead..c3882c569d3 100644 --- a/tools/marvin/marvin/integration/lib/base/FromLoadBalancerRule.py +++ b/tools/marvin/marvin/integration/lib/base/FromLoadBalancerRule.py @@ -14,12 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import removeFromLoadBalancerRule + class FromLoadBalancerRule(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def remove(self, apiclient, id, virtualmachineids, **kwargs): - pass + cmd = removeFromLoadBalancerRule.removeFromLoadBalancerRuleCmd() + cmd.id = id + cmd.virtualmachineids = virtualmachineids + [setattr(cmd, key, value) for key,value in kwargs.items] + fromloadbalancerrule = apiclient.removeFromLoadBalancerRule(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Host.py b/tools/marvin/marvin/integration/lib/base/Host.py index f488bb16fd5..b8524e4f646 100644 --- a/tools/marvin/marvin/integration/lib/base/Host.py +++ b/tools/marvin/marvin/integration/lib/base/Host.py @@ -14,25 +14,56 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import addHost +from marvin.cloudstackAPI import listHosts +from marvin.cloudstackAPI import updateHost +from marvin.cloudstackAPI import reconnectHost +from marvin.cloudstackAPI import deleteHost + class Host(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def add(self, apiclient, username, podid, url, hypervisor, zoneid, password, **kwargs): - pass + cmd = addHost.addHostCmd() + cmd.hypervisor = hypervisor + cmd.password = password + cmd.podid = podid + cmd.url = url + cmd.username = username + cmd.zoneid = zoneid + [setattr(cmd, key, value) for key,value in kwargs.items] + host = apiclient.addHost(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listHosts.listHostsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + host = apiclient.listHosts(cmd) + return map(lambda e: Host(e.__dict__), host) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateHost.updateHostCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + host = apiclient.updateHost(cmd) + def reconnect(self, apiclient, id, **kwargs): - pass + cmd = reconnectHost.reconnectHostCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + host = apiclient.reconnectHost(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteHost.deleteHostCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + host = apiclient.deleteHost(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/HostForMaintenance.py b/tools/marvin/marvin/integration/lib/base/HostForMaintenance.py index 93baabad041..c277bd75acd 100644 --- a/tools/marvin/marvin/integration/lib/base/HostForMaintenance.py +++ b/tools/marvin/marvin/integration/lib/base/HostForMaintenance.py @@ -14,12 +14,18 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import prepareHostForMaintenance + class HostForMaintenance(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def prepare(self, apiclient, id, **kwargs): - pass + cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + hostformaintenance = apiclient.prepareHostForMaintenance(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/HostMaintenance.py b/tools/marvin/marvin/integration/lib/base/HostMaintenance.py index 05b4fc935fc..b76eddcc61c 100644 --- a/tools/marvin/marvin/integration/lib/base/HostMaintenance.py +++ b/tools/marvin/marvin/integration/lib/base/HostMaintenance.py @@ -14,12 +14,18 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import cancelHostMaintenance + class HostMaintenance(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def cancel(self, apiclient, id, **kwargs): - pass + cmd = cancelHostMaintenance.cancelHostMaintenanceCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + hostmaintenance = apiclient.cancelHostMaintenance(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/HostPassword.py b/tools/marvin/marvin/integration/lib/base/HostPassword.py index 12f250f15e3..fa5b636e115 100644 --- a/tools/marvin/marvin/integration/lib/base/HostPassword.py +++ b/tools/marvin/marvin/integration/lib/base/HostPassword.py @@ -14,12 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import updateHostPassword + class HostPassword(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def update(self, apiclient, username, password, **kwargs): - pass + cmd = updateHostPassword.updateHostPasswordCmd() + cmd.password = password + cmd.username = username + [setattr(cmd, key, value) for key,value in kwargs.items] + hostpassword = apiclient.updateHostPassword(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/HypervisorCapabilities.py b/tools/marvin/marvin/integration/lib/base/HypervisorCapabilities.py index da5ba70a9e0..7db42788c5c 100644 --- a/tools/marvin/marvin/integration/lib/base/HypervisorCapabilities.py +++ b/tools/marvin/marvin/integration/lib/base/HypervisorCapabilities.py @@ -14,16 +14,26 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listHypervisorCapabilities +from marvin.cloudstackAPI import updateHypervisorCapabilities + class HypervisorCapabilities(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listHypervisorCapabilities.listHypervisorCapabilitiesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + hypervisorcapabilities = apiclient.listHypervisorCapabilities(cmd) + return map(lambda e: HypervisorCapabilities(e.__dict__), hypervisorcapabilities) + def update(self, apiclient, **kwargs): - pass + cmd = updateHypervisorCapabilities.updateHypervisorCapabilitiesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + hypervisorcapabilities = apiclient.updateHypervisorCapabilities(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Hypervisors.py b/tools/marvin/marvin/integration/lib/base/Hypervisors.py index 2b338da0ded..f7795dea4f3 100644 --- a/tools/marvin/marvin/integration/lib/base/Hypervisors.py +++ b/tools/marvin/marvin/integration/lib/base/Hypervisors.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listHypervisors + class Hypervisors(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listHypervisors.listHypervisorsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + hypervisors = apiclient.listHypervisors(cmd) + return map(lambda e: Hypervisors(e.__dict__), hypervisors) diff --git a/tools/marvin/marvin/integration/lib/base/InstanceGroup.py b/tools/marvin/marvin/integration/lib/base/InstanceGroup.py index bbd54a7dd7e..24ce434b27b 100644 --- a/tools/marvin/marvin/integration/lib/base/InstanceGroup.py +++ b/tools/marvin/marvin/integration/lib/base/InstanceGroup.py @@ -14,23 +14,45 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createInstanceGroup +from marvin.cloudstackAPI import listInstanceGroups +from marvin.cloudstackAPI import updateInstanceGroup +from marvin.cloudstackAPI import deleteInstanceGroup + class InstanceGroup(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, InstanceGroupFactory, **kwargs): - pass + cmd = createInstanceGroup.createInstanceGroupCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in InstanceGroupFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + instancegroup = apiclient.createInstanceGroup(cmd) + return InstanceGroup(instancegroup.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listInstanceGroups.listInstanceGroupsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + instancegroup = apiclient.listInstanceGroups(cmd) + return map(lambda e: InstanceGroup(e.__dict__), instancegroup) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateInstanceGroup.updateInstanceGroupCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + instancegroup = apiclient.updateInstanceGroup(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteInstanceGroup.deleteInstanceGroupCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + instancegroup = apiclient.deleteInstanceGroup(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/IpAddress.py b/tools/marvin/marvin/integration/lib/base/IpAddress.py index f8a37d6a998..f4d0380b5f6 100644 --- a/tools/marvin/marvin/integration/lib/base/IpAddress.py +++ b/tools/marvin/marvin/integration/lib/base/IpAddress.py @@ -14,15 +14,25 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import disassociateIpAddress +from marvin.cloudstackAPI import associateIpAddress + class IpAddress(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def disassociate(self, apiclient, id, **kwargs): - pass + cmd = disassociateIpAddress.disassociateIpAddressCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + ipaddress = apiclient.disassociateIpAddress(cmd) + def associate(self, apiclient, **kwargs): - pass + cmd = associateIpAddress.associateIpAddressCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + ipaddress = apiclient.associateIpAddress(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/IpForwardingRule.py b/tools/marvin/marvin/integration/lib/base/IpForwardingRule.py index 7d38a96c189..aab954c5145 100644 --- a/tools/marvin/marvin/integration/lib/base/IpForwardingRule.py +++ b/tools/marvin/marvin/integration/lib/base/IpForwardingRule.py @@ -14,20 +14,37 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createIpForwardingRule +from marvin.cloudstackAPI import listIpForwardingRules +from marvin.cloudstackAPI import deleteIpForwardingRule + class IpForwardingRule(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, IpForwardingRuleFactory, **kwargs): - pass + cmd = createIpForwardingRule.createIpForwardingRuleCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in IpForwardingRuleFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + ipforwardingrule = apiclient.createIpForwardingRule(cmd) + return IpForwardingRule(ipforwardingrule.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listIpForwardingRules.listIpForwardingRulesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + ipforwardingrule = apiclient.listIpForwardingRules(cmd) + return map(lambda e: IpForwardingRule(e.__dict__), ipforwardingrule) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteIpForwardingRule.deleteIpForwardingRuleCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + ipforwardingrule = apiclient.deleteIpForwardingRule(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Iso.py b/tools/marvin/marvin/integration/lib/base/Iso.py index 5bca76689df..b55f65b58a1 100644 --- a/tools/marvin/marvin/integration/lib/base/Iso.py +++ b/tools/marvin/marvin/integration/lib/base/Iso.py @@ -14,34 +14,82 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import copyIso +from marvin.cloudstackAPI import registerIso +from marvin.cloudstackAPI import listIsos +from marvin.cloudstackAPI import updateIso +from marvin.cloudstackAPI import attachIso +from marvin.cloudstackAPI import detachIso +from marvin.cloudstackAPI import extractIso +from marvin.cloudstackAPI import deleteIso + class Iso(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def copy(self, apiclient, sourcezoneid, id, destzoneid, **kwargs): - pass + cmd = copyIso.copyIsoCmd() + cmd.id = id + cmd.destzoneid = destzoneid + cmd.sourcezoneid = sourcezoneid + [setattr(cmd, key, value) for key,value in kwargs.items] + iso = apiclient.copyIso(cmd) + def register(self, apiclient, url, displaytext, name, zoneid, **kwargs): - pass + cmd = registerIso.registerIsoCmd() + cmd.displaytext = displaytext + cmd.name = name + cmd.url = url + cmd.zoneid = zoneid + [setattr(cmd, key, value) for key,value in kwargs.items] + iso = apiclient.registerIso(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listIsos.listIsosCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + iso = apiclient.listIsos(cmd) + return map(lambda e: Iso(e.__dict__), iso) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateIso.updateIsoCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + iso = apiclient.updateIso(cmd) + def attach(self, apiclient, id, virtualmachineid, **kwargs): - pass + cmd = attachIso.attachIsoCmd() + cmd.id = id + cmd.virtualmachineid = virtualmachineid + [setattr(cmd, key, value) for key,value in kwargs.items] + iso = apiclient.attachIso(cmd) + def detach(self, apiclient, virtualmachineid, **kwargs): - pass + cmd = detachIso.detachIsoCmd() + cmd.virtualmachineid = virtualmachineid + [setattr(cmd, key, value) for key,value in kwargs.items] + iso = apiclient.detachIso(cmd) + def extract(self, apiclient, id, mode, **kwargs): - pass + cmd = extractIso.extractIsoCmd() + cmd.id = id + cmd.mode = mode + [setattr(cmd, key, value) for key,value in kwargs.items] + iso = apiclient.extractIso(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteIso.deleteIsoCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + iso = apiclient.deleteIso(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/IsoPermissions.py b/tools/marvin/marvin/integration/lib/base/IsoPermissions.py index 9a9e1db827e..1e97b8149b4 100644 --- a/tools/marvin/marvin/integration/lib/base/IsoPermissions.py +++ b/tools/marvin/marvin/integration/lib/base/IsoPermissions.py @@ -14,16 +14,28 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listIsoPermissions +from marvin.cloudstackAPI import updateIsoPermissions + class IsoPermissions(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, id, **kwargs): + cmd = listIsoPermissions.listIsoPermissionsCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + isopermissions = apiclient.listIsoPermissions(cmd) + return map(lambda e: IsoPermissions(e.__dict__), isopermissions) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateIsoPermissions.updateIsoPermissionsCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + isopermissions = apiclient.updateIsoPermissions(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/LBStickinessPolicies.py b/tools/marvin/marvin/integration/lib/base/LBStickinessPolicies.py index a71fcc135cf..6d25ce35085 100644 --- a/tools/marvin/marvin/integration/lib/base/LBStickinessPolicies.py +++ b/tools/marvin/marvin/integration/lib/base/LBStickinessPolicies.py @@ -14,13 +14,20 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listLBStickinessPolicies + class LBStickinessPolicies(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, lbruleid, **kwargs): + cmd = listLBStickinessPolicies.listLBStickinessPoliciesCmd() + cmd.lbruleid = lbruleid + [setattr(cmd, key, value) for key,value in kwargs.items] + lbstickinesspolicies = apiclient.listLBStickinessPolicies(cmd) + return map(lambda e: LBStickinessPolicies(e.__dict__), lbstickinesspolicies) diff --git a/tools/marvin/marvin/integration/lib/base/LBStickinessPolicy.py b/tools/marvin/marvin/integration/lib/base/LBStickinessPolicy.py index a1367912ea5..feef54b819d 100644 --- a/tools/marvin/marvin/integration/lib/base/LBStickinessPolicy.py +++ b/tools/marvin/marvin/integration/lib/base/LBStickinessPolicy.py @@ -14,16 +14,28 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createLBStickinessPolicy +from marvin.cloudstackAPI import deleteLBStickinessPolicy + class LBStickinessPolicy(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, LBStickinessPolicyFactory, **kwargs): - pass + cmd = createLBStickinessPolicy.createLBStickinessPolicyCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in LBStickinessPolicyFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + lbstickinesspolicy = apiclient.createLBStickinessPolicy(cmd) + return LBStickinessPolicy(lbstickinesspolicy.__dict__) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteLBStickinessPolicy.deleteLBStickinessPolicyCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + lbstickinesspolicy = apiclient.deleteLBStickinessPolicy(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/LoadBalancerRule.py b/tools/marvin/marvin/integration/lib/base/LoadBalancerRule.py index aca6b02cf61..2aa69a8c2e0 100644 --- a/tools/marvin/marvin/integration/lib/base/LoadBalancerRule.py +++ b/tools/marvin/marvin/integration/lib/base/LoadBalancerRule.py @@ -14,23 +14,45 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createLoadBalancerRule +from marvin.cloudstackAPI import listLoadBalancerRules +from marvin.cloudstackAPI import updateLoadBalancerRule +from marvin.cloudstackAPI import deleteLoadBalancerRule + class LoadBalancerRule(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, LoadBalancerRuleFactory, **kwargs): - pass + cmd = createLoadBalancerRule.createLoadBalancerRuleCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in LoadBalancerRuleFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + loadbalancerrule = apiclient.createLoadBalancerRule(cmd) + return LoadBalancerRule(loadbalancerrule.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listLoadBalancerRules.listLoadBalancerRulesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + loadbalancerrule = apiclient.listLoadBalancerRules(cmd) + return map(lambda e: LoadBalancerRule(e.__dict__), loadbalancerrule) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateLoadBalancerRule.updateLoadBalancerRuleCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + loadbalancerrule = apiclient.updateLoadBalancerRule(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteLoadBalancerRule.deleteLoadBalancerRuleCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + loadbalancerrule = apiclient.deleteLoadBalancerRule(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/LoadBalancerRuleInstances.py b/tools/marvin/marvin/integration/lib/base/LoadBalancerRuleInstances.py index 60202f1ef37..8d1bbb8e081 100644 --- a/tools/marvin/marvin/integration/lib/base/LoadBalancerRuleInstances.py +++ b/tools/marvin/marvin/integration/lib/base/LoadBalancerRuleInstances.py @@ -14,13 +14,20 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listLoadBalancerRuleInstances + class LoadBalancerRuleInstances(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, id, **kwargs): + cmd = listLoadBalancerRuleInstances.listLoadBalancerRuleInstancesCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + loadbalancerruleinstances = apiclient.listLoadBalancerRuleInstances(cmd) + return map(lambda e: LoadBalancerRuleInstances(e.__dict__), loadbalancerruleinstances) diff --git a/tools/marvin/marvin/integration/lib/base/Network.py b/tools/marvin/marvin/integration/lib/base/Network.py index 14cb9de68d8..4d2723e9671 100644 --- a/tools/marvin/marvin/integration/lib/base/Network.py +++ b/tools/marvin/marvin/integration/lib/base/Network.py @@ -14,26 +14,53 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createNetwork +from marvin.cloudstackAPI import listNetworks +from marvin.cloudstackAPI import updateNetwork +from marvin.cloudstackAPI import restartNetwork +from marvin.cloudstackAPI import deleteNetwork + class Network(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, NetworkFactory, **kwargs): - pass + cmd = createNetwork.createNetworkCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in NetworkFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + network = apiclient.createNetwork(cmd) + return Network(network.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listNetworks.listNetworksCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + network = apiclient.listNetworks(cmd) + return map(lambda e: Network(e.__dict__), network) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateNetwork.updateNetworkCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + network = apiclient.updateNetwork(cmd) + def restart(self, apiclient, id, **kwargs): - pass + cmd = restartNetwork.restartNetworkCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + network = apiclient.restartNetwork(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteNetwork.deleteNetworkCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + network = apiclient.deleteNetwork(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/NetworkACL.py b/tools/marvin/marvin/integration/lib/base/NetworkACL.py index 6f7f02c2489..c6b9eeb45b1 100644 --- a/tools/marvin/marvin/integration/lib/base/NetworkACL.py +++ b/tools/marvin/marvin/integration/lib/base/NetworkACL.py @@ -14,20 +14,37 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createNetworkACL +from marvin.cloudstackAPI import listNetworkACLs +from marvin.cloudstackAPI import deleteNetworkACL + class NetworkACL(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, NetworkACLFactory, **kwargs): - pass + cmd = createNetworkACL.createNetworkACLCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in NetworkACLFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + networkacl = apiclient.createNetworkACL(cmd) + return NetworkACL(networkacl.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listNetworkACLs.listNetworkACLsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + networkacl = apiclient.listNetworkACLs(cmd) + return map(lambda e: NetworkACL(e.__dict__), networkacl) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteNetworkACL.deleteNetworkACLCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + networkacl = apiclient.deleteNetworkACL(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/NetworkDevice.py b/tools/marvin/marvin/integration/lib/base/NetworkDevice.py index aa00778cd85..0ab6d4d1132 100644 --- a/tools/marvin/marvin/integration/lib/base/NetworkDevice.py +++ b/tools/marvin/marvin/integration/lib/base/NetworkDevice.py @@ -14,19 +14,34 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import addNetworkDevice +from marvin.cloudstackAPI import listNetworkDevice +from marvin.cloudstackAPI import deleteNetworkDevice + class NetworkDevice(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def add(self, apiclient, **kwargs): - pass + cmd = addNetworkDevice.addNetworkDeviceCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + networkdevice = apiclient.addNetworkDevice(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listNetworkDevice.listNetworkDeviceCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + networkdevice = apiclient.listNetworkDevice(cmd) + return map(lambda e: NetworkDevice(e.__dict__), networkdevice) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteNetworkDevice.deleteNetworkDeviceCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + networkdevice = apiclient.deleteNetworkDevice(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/NetworkOffering.py b/tools/marvin/marvin/integration/lib/base/NetworkOffering.py index 1f5fee82e16..4393285a914 100644 --- a/tools/marvin/marvin/integration/lib/base/NetworkOffering.py +++ b/tools/marvin/marvin/integration/lib/base/NetworkOffering.py @@ -14,23 +14,44 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createNetworkOffering +from marvin.cloudstackAPI import listNetworkOfferings +from marvin.cloudstackAPI import updateNetworkOffering +from marvin.cloudstackAPI import deleteNetworkOffering + class NetworkOffering(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, NetworkOfferingFactory, **kwargs): - pass + cmd = createNetworkOffering.createNetworkOfferingCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in NetworkOfferingFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + networkoffering = apiclient.createNetworkOffering(cmd) + return NetworkOffering(networkoffering.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listNetworkOfferings.listNetworkOfferingsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + networkoffering = apiclient.listNetworkOfferings(cmd) + return map(lambda e: NetworkOffering(e.__dict__), networkoffering) + def update(self, apiclient, **kwargs): - pass + cmd = updateNetworkOffering.updateNetworkOfferingCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + networkoffering = apiclient.updateNetworkOffering(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteNetworkOffering.deleteNetworkOfferingCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + networkoffering = apiclient.deleteNetworkOffering(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/NetworkServiceProvider.py b/tools/marvin/marvin/integration/lib/base/NetworkServiceProvider.py index 2e79ea148d9..887183b027a 100644 --- a/tools/marvin/marvin/integration/lib/base/NetworkServiceProvider.py +++ b/tools/marvin/marvin/integration/lib/base/NetworkServiceProvider.py @@ -14,22 +14,44 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import addNetworkServiceProvider +from marvin.cloudstackAPI import listNetworkServiceProviders +from marvin.cloudstackAPI import updateNetworkServiceProvider +from marvin.cloudstackAPI import deleteNetworkServiceProvider + class NetworkServiceProvider(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def add(self, apiclient, physicalnetworkid, name, **kwargs): - pass + cmd = addNetworkServiceProvider.addNetworkServiceProviderCmd() + cmd.name = name + cmd.physicalnetworkid = physicalnetworkid + [setattr(cmd, key, value) for key,value in kwargs.items] + networkserviceprovider = apiclient.addNetworkServiceProvider(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listNetworkServiceProviders.listNetworkServiceProvidersCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + networkserviceprovider = apiclient.listNetworkServiceProviders(cmd) + return map(lambda e: NetworkServiceProvider(e.__dict__), networkserviceprovider) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateNetworkServiceProvider.updateNetworkServiceProviderCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + networkserviceprovider = apiclient.updateNetworkServiceProvider(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteNetworkServiceProvider.deleteNetworkServiceProviderCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + networkserviceprovider = apiclient.deleteNetworkServiceProvider(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/NiciraNvpDevice.py b/tools/marvin/marvin/integration/lib/base/NiciraNvpDevice.py index f70f015abc3..2bb5257cb95 100644 --- a/tools/marvin/marvin/integration/lib/base/NiciraNvpDevice.py +++ b/tools/marvin/marvin/integration/lib/base/NiciraNvpDevice.py @@ -14,19 +14,39 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import addNiciraNvpDevice +from marvin.cloudstackAPI import listNiciraNvpDevices +from marvin.cloudstackAPI import deleteNiciraNvpDevice + class NiciraNvpDevice(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def add(self, apiclient, username, physicalnetworkid, password, hostname, transportzoneuuid, **kwargs): - pass + cmd = addNiciraNvpDevice.addNiciraNvpDeviceCmd() + cmd.hostname = hostname + cmd.password = password + cmd.physicalnetworkid = physicalnetworkid + cmd.transportzoneuuid = transportzoneuuid + cmd.username = username + [setattr(cmd, key, value) for key,value in kwargs.items] + niciranvpdevice = apiclient.addNiciraNvpDevice(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listNiciraNvpDevices.listNiciraNvpDevicesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + niciranvpdevice = apiclient.listNiciraNvpDevices(cmd) + return map(lambda e: NiciraNvpDevice(e.__dict__), niciranvpdevice) + def delete(self, apiclient, nvpdeviceid, **kwargs): - pass + cmd = deleteNiciraNvpDevice.deleteNiciraNvpDeviceCmd() + cmd.nvpdeviceid = nvpdeviceid + [setattr(cmd, key, value) for key,value in kwargs.items] + niciranvpdevice = apiclient.deleteNiciraNvpDevice(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/NiciraNvpDeviceNetworks.py b/tools/marvin/marvin/integration/lib/base/NiciraNvpDeviceNetworks.py index 97e69a5e218..6d15b9578fa 100644 --- a/tools/marvin/marvin/integration/lib/base/NiciraNvpDeviceNetworks.py +++ b/tools/marvin/marvin/integration/lib/base/NiciraNvpDeviceNetworks.py @@ -14,13 +14,20 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listNiciraNvpDeviceNetworks + class NiciraNvpDeviceNetworks(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, nvpdeviceid, **kwargs): + cmd = listNiciraNvpDeviceNetworks.listNiciraNvpDeviceNetworksCmd() + cmd.nvpdeviceid = nvpdeviceid + [setattr(cmd, key, value) for key,value in kwargs.items] + niciranvpdevicenetworks = apiclient.listNiciraNvpDeviceNetworks(cmd) + return map(lambda e: NiciraNvpDeviceNetworks(e.__dict__), niciranvpdevicenetworks) diff --git a/tools/marvin/marvin/integration/lib/base/OsCategories.py b/tools/marvin/marvin/integration/lib/base/OsCategories.py index 0083539aa1e..45c75311b64 100644 --- a/tools/marvin/marvin/integration/lib/base/OsCategories.py +++ b/tools/marvin/marvin/integration/lib/base/OsCategories.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listOsCategories + class OsCategories(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listOsCategories.listOsCategoriesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + oscategories = apiclient.listOsCategories(cmd) + return map(lambda e: OsCategories(e.__dict__), oscategories) diff --git a/tools/marvin/marvin/integration/lib/base/OsTypes.py b/tools/marvin/marvin/integration/lib/base/OsTypes.py index e30fd36412d..361b1e76426 100644 --- a/tools/marvin/marvin/integration/lib/base/OsTypes.py +++ b/tools/marvin/marvin/integration/lib/base/OsTypes.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listOsTypes + class OsTypes(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listOsTypes.listOsTypesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + ostypes = apiclient.listOsTypes(cmd) + return map(lambda e: OsTypes(e.__dict__), ostypes) diff --git a/tools/marvin/marvin/integration/lib/base/PasswordForVirtualMachine.py b/tools/marvin/marvin/integration/lib/base/PasswordForVirtualMachine.py index 4e4103d6fd0..f297314661a 100644 --- a/tools/marvin/marvin/integration/lib/base/PasswordForVirtualMachine.py +++ b/tools/marvin/marvin/integration/lib/base/PasswordForVirtualMachine.py @@ -14,12 +14,18 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import resetPasswordForVirtualMachine + class PasswordForVirtualMachine(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def reset(self, apiclient, id, **kwargs): - pass + cmd = resetPasswordForVirtualMachine.resetPasswordForVirtualMachineCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + passwordforvirtualmachine = apiclient.resetPasswordForVirtualMachine(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/PhysicalNetwork.py b/tools/marvin/marvin/integration/lib/base/PhysicalNetwork.py index cb4219e967b..ac70ebb6a2d 100644 --- a/tools/marvin/marvin/integration/lib/base/PhysicalNetwork.py +++ b/tools/marvin/marvin/integration/lib/base/PhysicalNetwork.py @@ -14,23 +14,45 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createPhysicalNetwork +from marvin.cloudstackAPI import listPhysicalNetworks +from marvin.cloudstackAPI import updatePhysicalNetwork +from marvin.cloudstackAPI import deletePhysicalNetwork + class PhysicalNetwork(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, PhysicalNetworkFactory, **kwargs): - pass + cmd = createPhysicalNetwork.createPhysicalNetworkCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in PhysicalNetworkFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + physicalnetwork = apiclient.createPhysicalNetwork(cmd) + return PhysicalNetwork(physicalnetwork.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listPhysicalNetworks.listPhysicalNetworksCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + physicalnetwork = apiclient.listPhysicalNetworks(cmd) + return map(lambda e: PhysicalNetwork(e.__dict__), physicalnetwork) + def update(self, apiclient, id, **kwargs): - pass + cmd = updatePhysicalNetwork.updatePhysicalNetworkCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + physicalnetwork = apiclient.updatePhysicalNetwork(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deletePhysicalNetwork.deletePhysicalNetworkCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + physicalnetwork = apiclient.deletePhysicalNetwork(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Pod.py b/tools/marvin/marvin/integration/lib/base/Pod.py index c3aee80652d..f967910cba7 100644 --- a/tools/marvin/marvin/integration/lib/base/Pod.py +++ b/tools/marvin/marvin/integration/lib/base/Pod.py @@ -14,23 +14,45 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createPod +from marvin.cloudstackAPI import listPods +from marvin.cloudstackAPI import updatePod +from marvin.cloudstackAPI import deletePod + class Pod(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, PodFactory, **kwargs): - pass + cmd = createPod.createPodCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in PodFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + pod = apiclient.createPod(cmd) + return Pod(pod.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listPods.listPodsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + pod = apiclient.listPods(cmd) + return map(lambda e: Pod(e.__dict__), pod) + def update(self, apiclient, id, **kwargs): - pass + cmd = updatePod.updatePodCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + pod = apiclient.updatePod(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deletePod.deletePodCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + pod = apiclient.deletePod(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/PortForwardingRule.py b/tools/marvin/marvin/integration/lib/base/PortForwardingRule.py index 89c573997d0..3638bac333d 100644 --- a/tools/marvin/marvin/integration/lib/base/PortForwardingRule.py +++ b/tools/marvin/marvin/integration/lib/base/PortForwardingRule.py @@ -14,23 +14,48 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createPortForwardingRule +from marvin.cloudstackAPI import listPortForwardingRules +from marvin.cloudstackAPI import updatePortForwardingRule +from marvin.cloudstackAPI import deletePortForwardingRule + class PortForwardingRule(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, PortForwardingRuleFactory, **kwargs): - pass + cmd = createPortForwardingRule.createPortForwardingRuleCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in PortForwardingRuleFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + portforwardingrule = apiclient.createPortForwardingRule(cmd) + return PortForwardingRule(portforwardingrule.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listPortForwardingRules.listPortForwardingRulesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + portforwardingrule = apiclient.listPortForwardingRules(cmd) + return map(lambda e: PortForwardingRule(e.__dict__), portforwardingrule) + def update(self, apiclient, publicport, protocol, ipaddressid, privateport, **kwargs): - pass + cmd = updatePortForwardingRule.updatePortForwardingRuleCmd() + cmd.ipaddressid = ipaddressid + cmd.privateport = privateport + cmd.protocol = protocol + cmd.publicport = publicport + [setattr(cmd, key, value) for key,value in kwargs.items] + portforwardingrule = apiclient.updatePortForwardingRule(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deletePortForwardingRule.deletePortForwardingRuleCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + portforwardingrule = apiclient.deletePortForwardingRule(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/PrivateGateway.py b/tools/marvin/marvin/integration/lib/base/PrivateGateway.py index 1a7b1f61455..40f2a8442de 100644 --- a/tools/marvin/marvin/integration/lib/base/PrivateGateway.py +++ b/tools/marvin/marvin/integration/lib/base/PrivateGateway.py @@ -14,20 +14,37 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createPrivateGateway +from marvin.cloudstackAPI import listPrivateGateways +from marvin.cloudstackAPI import deletePrivateGateway + class PrivateGateway(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, PrivateGatewayFactory, **kwargs): - pass + cmd = createPrivateGateway.createPrivateGatewayCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in PrivateGatewayFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + privategateway = apiclient.createPrivateGateway(cmd) + return PrivateGateway(privategateway.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listPrivateGateways.listPrivateGatewaysCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + privategateway = apiclient.listPrivateGateways(cmd) + return map(lambda e: PrivateGateway(e.__dict__), privategateway) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deletePrivateGateway.deletePrivateGatewayCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + privategateway = apiclient.deletePrivateGateway(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Project.py b/tools/marvin/marvin/integration/lib/base/Project.py index 1f7adef8934..a3e96f6f31b 100644 --- a/tools/marvin/marvin/integration/lib/base/Project.py +++ b/tools/marvin/marvin/integration/lib/base/Project.py @@ -14,29 +14,61 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import suspendProject +from marvin.cloudstackAPI import createProject +from marvin.cloudstackAPI import listProjects +from marvin.cloudstackAPI import updateProject +from marvin.cloudstackAPI import activateProject +from marvin.cloudstackAPI import deleteProject + class Project(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def suspend(self, apiclient, id, **kwargs): - pass + cmd = suspendProject.suspendProjectCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + project = apiclient.suspendProject(cmd) + @classmethod def create(cls, apiclient, ProjectFactory, **kwargs): - pass + cmd = createProject.createProjectCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in ProjectFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + project = apiclient.createProject(cmd) + return Project(project.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listProjects.listProjectsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + project = apiclient.listProjects(cmd) + return map(lambda e: Project(e.__dict__), project) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateProject.updateProjectCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + project = apiclient.updateProject(cmd) + def activate(self, apiclient, id, **kwargs): - pass + cmd = activateProject.activateProjectCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + project = apiclient.activateProject(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteProject.deleteProjectCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + project = apiclient.deleteProject(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/ProjectAccounts.py b/tools/marvin/marvin/integration/lib/base/ProjectAccounts.py index e5b592a2b1b..e17224eeba9 100644 --- a/tools/marvin/marvin/integration/lib/base/ProjectAccounts.py +++ b/tools/marvin/marvin/integration/lib/base/ProjectAccounts.py @@ -14,13 +14,20 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listProjectAccounts + class ProjectAccounts(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, projectid, **kwargs): + cmd = listProjectAccounts.listProjectAccountsCmd() + cmd.projectid = projectid + [setattr(cmd, key, value) for key,value in kwargs.items] + projectaccounts = apiclient.listProjectAccounts(cmd) + return map(lambda e: ProjectAccounts(e.__dict__), projectaccounts) diff --git a/tools/marvin/marvin/integration/lib/base/ProjectInvitation.py b/tools/marvin/marvin/integration/lib/base/ProjectInvitation.py index 27931e2a287..9601acd7fd3 100644 --- a/tools/marvin/marvin/integration/lib/base/ProjectInvitation.py +++ b/tools/marvin/marvin/integration/lib/base/ProjectInvitation.py @@ -14,19 +14,35 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listProjectInvitations +from marvin.cloudstackAPI import updateProjectInvitation +from marvin.cloudstackAPI import deleteProjectInvitation + class ProjectInvitation(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listProjectInvitations.listProjectInvitationsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + projectinvitation = apiclient.listProjectInvitations(cmd) + return map(lambda e: ProjectInvitation(e.__dict__), projectinvitation) + def update(self, apiclient, projectid, **kwargs): - pass + cmd = updateProjectInvitation.updateProjectInvitationCmd() + cmd.projectid = projectid + [setattr(cmd, key, value) for key,value in kwargs.items] + projectinvitation = apiclient.updateProjectInvitation(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteProjectInvitation.deleteProjectInvitationCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + projectinvitation = apiclient.deleteProjectInvitation(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/PublicIpAddresses.py b/tools/marvin/marvin/integration/lib/base/PublicIpAddresses.py index 57191df7855..36df7a223aa 100644 --- a/tools/marvin/marvin/integration/lib/base/PublicIpAddresses.py +++ b/tools/marvin/marvin/integration/lib/base/PublicIpAddresses.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listPublicIpAddresses + class PublicIpAddresses(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listPublicIpAddresses.listPublicIpAddressesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + publicipaddresses = apiclient.listPublicIpAddresses(cmd) + return map(lambda e: PublicIpAddresses(e.__dict__), publicipaddresses) diff --git a/tools/marvin/marvin/integration/lib/base/RemoteAccessVpn.py b/tools/marvin/marvin/integration/lib/base/RemoteAccessVpn.py index fc7c935c15a..d18d5c1e141 100644 --- a/tools/marvin/marvin/integration/lib/base/RemoteAccessVpn.py +++ b/tools/marvin/marvin/integration/lib/base/RemoteAccessVpn.py @@ -14,20 +14,38 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createRemoteAccessVpn +from marvin.cloudstackAPI import listRemoteAccessVpns +from marvin.cloudstackAPI import deleteRemoteAccessVpn + class RemoteAccessVpn(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, RemoteAccessVpnFactory, **kwargs): - pass + cmd = createRemoteAccessVpn.createRemoteAccessVpnCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in RemoteAccessVpnFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + remoteaccessvpn = apiclient.createRemoteAccessVpn(cmd) + return RemoteAccessVpn(remoteaccessvpn.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, publicipid, **kwargs): + cmd = listRemoteAccessVpns.listRemoteAccessVpnsCmd() + cmd.publicipid = publicipid + [setattr(cmd, key, value) for key,value in kwargs.items] + remoteaccessvpn = apiclient.listRemoteAccessVpns(cmd) + return map(lambda e: RemoteAccessVpn(e.__dict__), remoteaccessvpn) + def delete(self, apiclient, publicipid, **kwargs): - pass + cmd = deleteRemoteAccessVpn.deleteRemoteAccessVpnCmd() + cmd.publicipid = publicipid + [setattr(cmd, key, value) for key,value in kwargs.items] + remoteaccessvpn = apiclient.deleteRemoteAccessVpn(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Remove.py b/tools/marvin/marvin/integration/lib/base/Remove.py index 18245b8acd4..2c52330eac0 100644 --- a/tools/marvin/marvin/integration/lib/base/Remove.py +++ b/tools/marvin/marvin/integration/lib/base/Remove.py @@ -14,12 +14,17 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import ldapRemove + class Remove(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) - def ldap(self, apiclient): - pass + def ldap(self, apiclient, **kwargs): + cmd = ldapRemove.ldapRemoveCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + remove = apiclient.ldapRemove(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/ResourceCount.py b/tools/marvin/marvin/integration/lib/base/ResourceCount.py index 28578ca9220..a9c52a9566e 100644 --- a/tools/marvin/marvin/integration/lib/base/ResourceCount.py +++ b/tools/marvin/marvin/integration/lib/base/ResourceCount.py @@ -14,12 +14,18 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import updateResourceCount + class ResourceCount(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def update(self, apiclient, domainid, **kwargs): - pass + cmd = updateResourceCount.updateResourceCountCmd() + cmd.domainid = domainid + [setattr(cmd, key, value) for key,value in kwargs.items] + resourcecount = apiclient.updateResourceCount(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/ResourceLimit.py b/tools/marvin/marvin/integration/lib/base/ResourceLimit.py index db24a8f0a06..a22ae994979 100644 --- a/tools/marvin/marvin/integration/lib/base/ResourceLimit.py +++ b/tools/marvin/marvin/integration/lib/base/ResourceLimit.py @@ -14,16 +14,27 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listResourceLimits +from marvin.cloudstackAPI import updateResourceLimit + class ResourceLimit(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listResourceLimits.listResourceLimitsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + resourcelimit = apiclient.listResourceLimits(cmd) + return map(lambda e: ResourceLimit(e.__dict__), resourcelimit) + def update(self, apiclient, resourcetype, **kwargs): - pass + cmd = updateResourceLimit.updateResourceLimitCmd() + cmd.resourcetype = resourcetype + [setattr(cmd, key, value) for key,value in kwargs.items] + resourcelimit = apiclient.updateResourceLimit(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Router.py b/tools/marvin/marvin/integration/lib/base/Router.py index b4c09168a49..1afae0c0429 100644 --- a/tools/marvin/marvin/integration/lib/base/Router.py +++ b/tools/marvin/marvin/integration/lib/base/Router.py @@ -14,25 +14,51 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import destroyRouter +from marvin.cloudstackAPI import listRouters +from marvin.cloudstackAPI import stopRouter +from marvin.cloudstackAPI import rebootRouter +from marvin.cloudstackAPI import startRouter + class Router(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def destroy(self, apiclient, id, **kwargs): - pass + cmd = destroyRouter.destroyRouterCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + router = apiclient.destroyRouter(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listRouters.listRoutersCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + router = apiclient.listRouters(cmd) + return map(lambda e: Router(e.__dict__), router) + def stop(self, apiclient, id, **kwargs): - pass + cmd = stopRouter.stopRouterCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + router = apiclient.stopRouter(cmd) + def reboot(self, apiclient, id, **kwargs): - pass + cmd = rebootRouter.rebootRouterCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + router = apiclient.rebootRouter(cmd) + def start(self, apiclient, id, **kwargs): - pass + cmd = startRouter.startRouterCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + router = apiclient.startRouter(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/S3.py b/tools/marvin/marvin/integration/lib/base/S3.py index 053fc6c1af5..ebc20a79306 100644 --- a/tools/marvin/marvin/integration/lib/base/S3.py +++ b/tools/marvin/marvin/integration/lib/base/S3.py @@ -14,16 +14,29 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import addS3 +from marvin.cloudstackAPI import listS3s + class S3(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def add(self, apiclient, secretkey, accesskey, bucket, **kwargs): - pass + cmd = addS3.addS3Cmd() + cmd.accesskey = accesskey + cmd.bucket = bucket + cmd.secretkey = secretkey + [setattr(cmd, key, value) for key,value in kwargs.items] + s3 = apiclient.addS3(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listS3s.listS3sCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + s3 = apiclient.listS3s(cmd) + return map(lambda e: S3(e.__dict__), s3) diff --git a/tools/marvin/marvin/integration/lib/base/SSHKeyPair.py b/tools/marvin/marvin/integration/lib/base/SSHKeyPair.py index e33bb32a5e4..f0e97755178 100644 --- a/tools/marvin/marvin/integration/lib/base/SSHKeyPair.py +++ b/tools/marvin/marvin/integration/lib/base/SSHKeyPair.py @@ -14,23 +14,46 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createSSHKeyPair +from marvin.cloudstackAPI import registerSSHKeyPair +from marvin.cloudstackAPI import listSSHKeyPairs +from marvin.cloudstackAPI import deleteSSHKeyPair + class SSHKeyPair(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, SSHKeyPairFactory, **kwargs): - pass + cmd = createSSHKeyPair.createSSHKeyPairCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in SSHKeyPairFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + sshkeypair = apiclient.createSSHKeyPair(cmd) + return SSHKeyPair(sshkeypair.__dict__) + def register(self, apiclient, publickey, name, **kwargs): - pass + cmd = registerSSHKeyPair.registerSSHKeyPairCmd() + cmd.name = name + cmd.publickey = publickey + [setattr(cmd, key, value) for key,value in kwargs.items] + sshkeypair = apiclient.registerSSHKeyPair(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listSSHKeyPairs.listSSHKeyPairsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + sshkeypair = apiclient.listSSHKeyPairs(cmd) + return map(lambda e: SSHKeyPair(e.__dict__), sshkeypair) + def delete(self, apiclient, name, **kwargs): - pass + cmd = deleteSSHKeyPair.deleteSSHKeyPairCmd() + cmd.name = name + [setattr(cmd, key, value) for key,value in kwargs.items] + sshkeypair = apiclient.deleteSSHKeyPair(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/SecondaryStorage.py b/tools/marvin/marvin/integration/lib/base/SecondaryStorage.py index e8e5070586a..b11401c6ee8 100644 --- a/tools/marvin/marvin/integration/lib/base/SecondaryStorage.py +++ b/tools/marvin/marvin/integration/lib/base/SecondaryStorage.py @@ -14,12 +14,18 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import addSecondaryStorage + class SecondaryStorage(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def add(self, apiclient, url, **kwargs): - pass + cmd = addSecondaryStorage.addSecondaryStorageCmd() + cmd.url = url + [setattr(cmd, key, value) for key,value in kwargs.items] + secondarystorage = apiclient.addSecondaryStorage(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/SecurityGroup.py b/tools/marvin/marvin/integration/lib/base/SecurityGroup.py index ca2ec001fe1..fbe74909f6e 100644 --- a/tools/marvin/marvin/integration/lib/base/SecurityGroup.py +++ b/tools/marvin/marvin/integration/lib/base/SecurityGroup.py @@ -14,20 +14,36 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createSecurityGroup +from marvin.cloudstackAPI import listSecurityGroups +from marvin.cloudstackAPI import deleteSecurityGroup + class SecurityGroup(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, SecurityGroupFactory, **kwargs): - pass + cmd = createSecurityGroup.createSecurityGroupCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in SecurityGroupFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + securitygroup = apiclient.createSecurityGroup(cmd) + return SecurityGroup(securitygroup.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listSecurityGroups.listSecurityGroupsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + securitygroup = apiclient.listSecurityGroups(cmd) + return map(lambda e: SecurityGroup(e.__dict__), securitygroup) + def delete(self, apiclient, **kwargs): - pass + cmd = deleteSecurityGroup.deleteSecurityGroupCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + securitygroup = apiclient.deleteSecurityGroup(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/SecurityGroupEgress.py b/tools/marvin/marvin/integration/lib/base/SecurityGroupEgress.py index 7a05f9e8b8f..d03c02ffb92 100644 --- a/tools/marvin/marvin/integration/lib/base/SecurityGroupEgress.py +++ b/tools/marvin/marvin/integration/lib/base/SecurityGroupEgress.py @@ -14,15 +14,25 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import authorizeSecurityGroupEgress +from marvin.cloudstackAPI import revokeSecurityGroupEgress + class SecurityGroupEgress(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def authorize(self, apiclient, **kwargs): - pass + cmd = authorizeSecurityGroupEgress.authorizeSecurityGroupEgressCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + securitygroupegress = apiclient.authorizeSecurityGroupEgress(cmd) + def revoke(self, apiclient, id, **kwargs): - pass + cmd = revokeSecurityGroupEgress.revokeSecurityGroupEgressCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + securitygroupegress = apiclient.revokeSecurityGroupEgress(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/SecurityGroupIngress.py b/tools/marvin/marvin/integration/lib/base/SecurityGroupIngress.py index b6dac2bcba3..5f79934ecba 100644 --- a/tools/marvin/marvin/integration/lib/base/SecurityGroupIngress.py +++ b/tools/marvin/marvin/integration/lib/base/SecurityGroupIngress.py @@ -14,15 +14,25 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import authorizeSecurityGroupIngress +from marvin.cloudstackAPI import revokeSecurityGroupIngress + class SecurityGroupIngress(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def authorize(self, apiclient, **kwargs): - pass + cmd = authorizeSecurityGroupIngress.authorizeSecurityGroupIngressCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + securitygroupingress = apiclient.authorizeSecurityGroupIngress(cmd) + def revoke(self, apiclient, id, **kwargs): - pass + cmd = revokeSecurityGroupIngress.revokeSecurityGroupIngressCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + securitygroupingress = apiclient.revokeSecurityGroupIngress(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/ServiceForRouter.py b/tools/marvin/marvin/integration/lib/base/ServiceForRouter.py index 300c3f62012..b928fe06058 100644 --- a/tools/marvin/marvin/integration/lib/base/ServiceForRouter.py +++ b/tools/marvin/marvin/integration/lib/base/ServiceForRouter.py @@ -14,12 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import changeServiceForRouter + class ServiceForRouter(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def change(self, apiclient, id, serviceofferingid, **kwargs): - pass + cmd = changeServiceForRouter.changeServiceForRouterCmd() + cmd.id = id + cmd.serviceofferingid = serviceofferingid + [setattr(cmd, key, value) for key,value in kwargs.items] + serviceforrouter = apiclient.changeServiceForRouter(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/ServiceForSystemVm.py b/tools/marvin/marvin/integration/lib/base/ServiceForSystemVm.py index 3123d8d8dd9..15f26e85eef 100644 --- a/tools/marvin/marvin/integration/lib/base/ServiceForSystemVm.py +++ b/tools/marvin/marvin/integration/lib/base/ServiceForSystemVm.py @@ -14,12 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import changeServiceForSystemVm + class ServiceForSystemVm(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def change(self, apiclient, id, serviceofferingid, **kwargs): - pass + cmd = changeServiceForSystemVm.changeServiceForSystemVmCmd() + cmd.id = id + cmd.serviceofferingid = serviceofferingid + [setattr(cmd, key, value) for key,value in kwargs.items] + serviceforsystemvm = apiclient.changeServiceForSystemVm(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/ServiceForVirtualMachine.py b/tools/marvin/marvin/integration/lib/base/ServiceForVirtualMachine.py index 7a1ea598518..716b8d9d8f9 100644 --- a/tools/marvin/marvin/integration/lib/base/ServiceForVirtualMachine.py +++ b/tools/marvin/marvin/integration/lib/base/ServiceForVirtualMachine.py @@ -14,12 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import changeServiceForVirtualMachine + class ServiceForVirtualMachine(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def change(self, apiclient, id, serviceofferingid, **kwargs): - pass + cmd = changeServiceForVirtualMachine.changeServiceForVirtualMachineCmd() + cmd.id = id + cmd.serviceofferingid = serviceofferingid + [setattr(cmd, key, value) for key,value in kwargs.items] + serviceforvirtualmachine = apiclient.changeServiceForVirtualMachine(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/ServiceOffering.py b/tools/marvin/marvin/integration/lib/base/ServiceOffering.py index 81ff7ec3973..2dda2a03171 100644 --- a/tools/marvin/marvin/integration/lib/base/ServiceOffering.py +++ b/tools/marvin/marvin/integration/lib/base/ServiceOffering.py @@ -14,23 +14,45 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createServiceOffering +from marvin.cloudstackAPI import listServiceOfferings +from marvin.cloudstackAPI import updateServiceOffering +from marvin.cloudstackAPI import deleteServiceOffering + class ServiceOffering(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, ServiceOfferingFactory, **kwargs): - pass + cmd = createServiceOffering.createServiceOfferingCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in ServiceOfferingFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + serviceoffering = apiclient.createServiceOffering(cmd) + return ServiceOffering(serviceoffering.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listServiceOfferings.listServiceOfferingsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + serviceoffering = apiclient.listServiceOfferings(cmd) + return map(lambda e: ServiceOffering(e.__dict__), serviceoffering) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateServiceOffering.updateServiceOfferingCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + serviceoffering = apiclient.updateServiceOffering(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteServiceOffering.deleteServiceOfferingCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + serviceoffering = apiclient.deleteServiceOffering(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Snapshot.py b/tools/marvin/marvin/integration/lib/base/Snapshot.py index 01ddf65c86e..90c42788ef2 100644 --- a/tools/marvin/marvin/integration/lib/base/Snapshot.py +++ b/tools/marvin/marvin/integration/lib/base/Snapshot.py @@ -14,20 +14,37 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createSnapshot +from marvin.cloudstackAPI import listSnapshots +from marvin.cloudstackAPI import deleteSnapshot + class Snapshot(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, SnapshotFactory, **kwargs): - pass + cmd = createSnapshot.createSnapshotCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in SnapshotFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + snapshot = apiclient.createSnapshot(cmd) + return Snapshot(snapshot.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listSnapshots.listSnapshotsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + snapshot = apiclient.listSnapshots(cmd) + return map(lambda e: Snapshot(e.__dict__), snapshot) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteSnapshot.deleteSnapshotCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + snapshot = apiclient.deleteSnapshot(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/SnapshotPolicies.py b/tools/marvin/marvin/integration/lib/base/SnapshotPolicies.py index 7f545d46fc5..e1b68d46fe5 100644 --- a/tools/marvin/marvin/integration/lib/base/SnapshotPolicies.py +++ b/tools/marvin/marvin/integration/lib/base/SnapshotPolicies.py @@ -14,16 +14,27 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listSnapshotPolicies +from marvin.cloudstackAPI import deleteSnapshotPolicies + class SnapshotPolicies(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, volumeid, **kwargs): + cmd = listSnapshotPolicies.listSnapshotPoliciesCmd() + cmd.volumeid = volumeid + [setattr(cmd, key, value) for key,value in kwargs.items] + snapshotpolicies = apiclient.listSnapshotPolicies(cmd) + return map(lambda e: SnapshotPolicies(e.__dict__), snapshotpolicies) + def delete(self, apiclient, **kwargs): - pass + cmd = deleteSnapshotPolicies.deleteSnapshotPoliciesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + snapshotpolicies = apiclient.deleteSnapshotPolicies(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/SnapshotPolicy.py b/tools/marvin/marvin/integration/lib/base/SnapshotPolicy.py index d0c8662e1fd..1dff0d2e87b 100644 --- a/tools/marvin/marvin/integration/lib/base/SnapshotPolicy.py +++ b/tools/marvin/marvin/integration/lib/base/SnapshotPolicy.py @@ -14,13 +14,20 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createSnapshotPolicy + class SnapshotPolicy(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, SnapshotPolicyFactory, **kwargs): - pass + cmd = createSnapshotPolicy.createSnapshotPolicyCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in SnapshotPolicyFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + snapshotpolicy = apiclient.createSnapshotPolicy(cmd) + return SnapshotPolicy(snapshotpolicy.__dict__) diff --git a/tools/marvin/marvin/integration/lib/base/StaticNat.py b/tools/marvin/marvin/integration/lib/base/StaticNat.py index b403e1a42cd..c357be42468 100644 --- a/tools/marvin/marvin/integration/lib/base/StaticNat.py +++ b/tools/marvin/marvin/integration/lib/base/StaticNat.py @@ -14,15 +14,27 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import enableStaticNat +from marvin.cloudstackAPI import disableStaticNat + class StaticNat(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def enable(self, apiclient, ipaddressid, virtualmachineid, **kwargs): - pass + cmd = enableStaticNat.enableStaticNatCmd() + cmd.ipaddressid = ipaddressid + cmd.virtualmachineid = virtualmachineid + [setattr(cmd, key, value) for key,value in kwargs.items] + staticnat = apiclient.enableStaticNat(cmd) + def disable(self, apiclient, ipaddressid, **kwargs): - pass + cmd = disableStaticNat.disableStaticNatCmd() + cmd.ipaddressid = ipaddressid + [setattr(cmd, key, value) for key,value in kwargs.items] + staticnat = apiclient.disableStaticNat(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/StaticRoute.py b/tools/marvin/marvin/integration/lib/base/StaticRoute.py index 75089679def..e24884c534b 100644 --- a/tools/marvin/marvin/integration/lib/base/StaticRoute.py +++ b/tools/marvin/marvin/integration/lib/base/StaticRoute.py @@ -14,20 +14,37 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createStaticRoute +from marvin.cloudstackAPI import listStaticRoutes +from marvin.cloudstackAPI import deleteStaticRoute + class StaticRoute(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, StaticRouteFactory, **kwargs): - pass + cmd = createStaticRoute.createStaticRouteCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in StaticRouteFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + staticroute = apiclient.createStaticRoute(cmd) + return StaticRoute(staticroute.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listStaticRoutes.listStaticRoutesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + staticroute = apiclient.listStaticRoutes(cmd) + return map(lambda e: StaticRoute(e.__dict__), staticroute) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteStaticRoute.deleteStaticRouteCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + staticroute = apiclient.deleteStaticRoute(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/StorageMaintenance.py b/tools/marvin/marvin/integration/lib/base/StorageMaintenance.py index 29cb27ff37b..ebb75a0fed2 100644 --- a/tools/marvin/marvin/integration/lib/base/StorageMaintenance.py +++ b/tools/marvin/marvin/integration/lib/base/StorageMaintenance.py @@ -14,15 +14,26 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import cancelStorageMaintenance +from marvin.cloudstackAPI import enableStorageMaintenance + class StorageMaintenance(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def cancel(self, apiclient, id, **kwargs): - pass + cmd = cancelStorageMaintenance.cancelStorageMaintenanceCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + storagemaintenance = apiclient.cancelStorageMaintenance(cmd) + def enable(self, apiclient, id, **kwargs): - pass + cmd = enableStorageMaintenance.enableStorageMaintenanceCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + storagemaintenance = apiclient.enableStorageMaintenance(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/StorageNetworkIpRange.py b/tools/marvin/marvin/integration/lib/base/StorageNetworkIpRange.py index 86155528e4f..e4797fc1c12 100644 --- a/tools/marvin/marvin/integration/lib/base/StorageNetworkIpRange.py +++ b/tools/marvin/marvin/integration/lib/base/StorageNetworkIpRange.py @@ -14,23 +14,45 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createStorageNetworkIpRange +from marvin.cloudstackAPI import listStorageNetworkIpRange +from marvin.cloudstackAPI import updateStorageNetworkIpRange +from marvin.cloudstackAPI import deleteStorageNetworkIpRange + class StorageNetworkIpRange(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, StorageNetworkIpRangeFactory, **kwargs): - pass + cmd = createStorageNetworkIpRange.createStorageNetworkIpRangeCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in StorageNetworkIpRangeFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + storagenetworkiprange = apiclient.createStorageNetworkIpRange(cmd) + return StorageNetworkIpRange(storagenetworkiprange.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listStorageNetworkIpRange.listStorageNetworkIpRangeCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + storagenetworkiprange = apiclient.listStorageNetworkIpRange(cmd) + return map(lambda e: StorageNetworkIpRange(e.__dict__), storagenetworkiprange) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateStorageNetworkIpRange.updateStorageNetworkIpRangeCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + storagenetworkiprange = apiclient.updateStorageNetworkIpRange(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteStorageNetworkIpRange.deleteStorageNetworkIpRangeCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + storagenetworkiprange = apiclient.deleteStorageNetworkIpRange(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/StoragePool.py b/tools/marvin/marvin/integration/lib/base/StoragePool.py index ee0ece6de3e..478407a8584 100644 --- a/tools/marvin/marvin/integration/lib/base/StoragePool.py +++ b/tools/marvin/marvin/integration/lib/base/StoragePool.py @@ -14,23 +14,45 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createStoragePool +from marvin.cloudstackAPI import listStoragePools +from marvin.cloudstackAPI import updateStoragePool +from marvin.cloudstackAPI import deleteStoragePool + class StoragePool(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, StoragePoolFactory, **kwargs): - pass + cmd = createStoragePool.createStoragePoolCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in StoragePoolFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + storagepool = apiclient.createStoragePool(cmd) + return StoragePool(storagepool.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listStoragePools.listStoragePoolsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + storagepool = apiclient.listStoragePools(cmd) + return map(lambda e: StoragePool(e.__dict__), storagepool) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateStoragePool.updateStoragePoolCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + storagepool = apiclient.updateStoragePool(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteStoragePool.deleteStoragePoolCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + storagepool = apiclient.deleteStoragePool(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/SupportedNetworkServices.py b/tools/marvin/marvin/integration/lib/base/SupportedNetworkServices.py index cbcbaadb386..078d1b83c08 100644 --- a/tools/marvin/marvin/integration/lib/base/SupportedNetworkServices.py +++ b/tools/marvin/marvin/integration/lib/base/SupportedNetworkServices.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listSupportedNetworkServices + class SupportedNetworkServices(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listSupportedNetworkServices.listSupportedNetworkServicesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + supportednetworkservices = apiclient.listSupportedNetworkServices(cmd) + return map(lambda e: SupportedNetworkServices(e.__dict__), supportednetworkservices) diff --git a/tools/marvin/marvin/integration/lib/base/Swift.py b/tools/marvin/marvin/integration/lib/base/Swift.py index e96089cd281..5a09340be57 100644 --- a/tools/marvin/marvin/integration/lib/base/Swift.py +++ b/tools/marvin/marvin/integration/lib/base/Swift.py @@ -14,16 +14,27 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import addSwift +from marvin.cloudstackAPI import listSwifts + class Swift(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def add(self, apiclient, url, **kwargs): - pass + cmd = addSwift.addSwiftCmd() + cmd.url = url + [setattr(cmd, key, value) for key,value in kwargs.items] + swift = apiclient.addSwift(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listSwifts.listSwiftsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + swift = apiclient.listSwifts(cmd) + return map(lambda e: Swift(e.__dict__), swift) diff --git a/tools/marvin/marvin/integration/lib/base/SystemVm.py b/tools/marvin/marvin/integration/lib/base/SystemVm.py index e8ea6096f94..18c40b73924 100644 --- a/tools/marvin/marvin/integration/lib/base/SystemVm.py +++ b/tools/marvin/marvin/integration/lib/base/SystemVm.py @@ -14,28 +14,60 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import migrateSystemVm +from marvin.cloudstackAPI import stopSystemVm +from marvin.cloudstackAPI import listSystemVms +from marvin.cloudstackAPI import rebootSystemVm +from marvin.cloudstackAPI import startSystemVm +from marvin.cloudstackAPI import destroySystemVm + class SystemVm(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def migrate(self, apiclient, hostid, virtualmachineid, **kwargs): - pass + cmd = migrateSystemVm.migrateSystemVmCmd() + cmd.hostid = hostid + cmd.virtualmachineid = virtualmachineid + [setattr(cmd, key, value) for key,value in kwargs.items] + systemvm = apiclient.migrateSystemVm(cmd) + def stop(self, apiclient, id, **kwargs): - pass + cmd = stopSystemVm.stopSystemVmCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + systemvm = apiclient.stopSystemVm(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listSystemVms.listSystemVmsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + systemvm = apiclient.listSystemVms(cmd) + return map(lambda e: SystemVm(e.__dict__), systemvm) + def reboot(self, apiclient, id, **kwargs): - pass + cmd = rebootSystemVm.rebootSystemVmCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + systemvm = apiclient.rebootSystemVm(cmd) + def start(self, apiclient, id, **kwargs): - pass + cmd = startSystemVm.startSystemVmCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + systemvm = apiclient.startSystemVm(cmd) + def destroy(self, apiclient, id, **kwargs): - pass + cmd = destroySystemVm.destroySystemVmCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + systemvm = apiclient.destroySystemVm(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Tags.py b/tools/marvin/marvin/integration/lib/base/Tags.py index 6c548cb1f68..240eab388d8 100644 --- a/tools/marvin/marvin/integration/lib/base/Tags.py +++ b/tools/marvin/marvin/integration/lib/base/Tags.py @@ -14,20 +14,38 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createTags +from marvin.cloudstackAPI import listTags +from marvin.cloudstackAPI import deleteTags + class Tags(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, TagsFactory, **kwargs): - pass + cmd = createTags.createTagsCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in TagsFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + tags = apiclient.createTags(cmd) + return Tags(tags.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listTags.listTagsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + tags = apiclient.listTags(cmd) + return map(lambda e: Tags(e.__dict__), tags) + def delete(self, apiclient, resourcetype, resourceids, **kwargs): - pass + cmd = deleteTags.deleteTagsCmd() + cmd.resourceids = resourceids + cmd.resourcetype = resourcetype + [setattr(cmd, key, value) for key,value in kwargs.items] + tags = apiclient.deleteTags(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Template.py b/tools/marvin/marvin/integration/lib/base/Template.py index 29d37788552..f7d2f93dd9c 100644 --- a/tools/marvin/marvin/integration/lib/base/Template.py +++ b/tools/marvin/marvin/integration/lib/base/Template.py @@ -14,35 +14,88 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import prepareTemplate +from marvin.cloudstackAPI import createTemplate +from marvin.cloudstackAPI import registerTemplate +from marvin.cloudstackAPI import listTemplates +from marvin.cloudstackAPI import updateTemplate +from marvin.cloudstackAPI import copyTemplate +from marvin.cloudstackAPI import extractTemplate +from marvin.cloudstackAPI import deleteTemplate + class Template(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def prepare(self, apiclient, zoneid, templateid, **kwargs): - pass + cmd = prepareTemplate.prepareTemplateCmd() + cmd.templateid = templateid + cmd.zoneid = zoneid + [setattr(cmd, key, value) for key,value in kwargs.items] + template = apiclient.prepareTemplate(cmd) + @classmethod def create(cls, apiclient, TemplateFactory, **kwargs): - pass + cmd = createTemplate.createTemplateCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in TemplateFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + template = apiclient.createTemplate(cmd) + return Template(template.__dict__) + def register(self, apiclient, name, format, url, hypervisor, zoneid, displaytext, ostypeid, **kwargs): - pass + cmd = registerTemplate.registerTemplateCmd() + cmd.displaytext = displaytext + cmd.format = format + cmd.hypervisor = hypervisor + cmd.name = name + cmd.ostypeid = ostypeid + cmd.url = url + cmd.zoneid = zoneid + [setattr(cmd, key, value) for key,value in kwargs.items] + template = apiclient.registerTemplate(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, templatefilter, **kwargs): + cmd = listTemplates.listTemplatesCmd() + cmd.templatefilter = templatefilter + [setattr(cmd, key, value) for key,value in kwargs.items] + template = apiclient.listTemplates(cmd) + return map(lambda e: Template(e.__dict__), template) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateTemplate.updateTemplateCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + template = apiclient.updateTemplate(cmd) + def copy(self, apiclient, sourcezoneid, id, destzoneid, **kwargs): - pass + cmd = copyTemplate.copyTemplateCmd() + cmd.id = id + cmd.destzoneid = destzoneid + cmd.sourcezoneid = sourcezoneid + [setattr(cmd, key, value) for key,value in kwargs.items] + template = apiclient.copyTemplate(cmd) + def extract(self, apiclient, id, mode, **kwargs): - pass + cmd = extractTemplate.extractTemplateCmd() + cmd.id = id + cmd.mode = mode + [setattr(cmd, key, value) for key,value in kwargs.items] + template = apiclient.extractTemplate(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteTemplate.deleteTemplateCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + template = apiclient.deleteTemplate(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/TemplatePermissions.py b/tools/marvin/marvin/integration/lib/base/TemplatePermissions.py index ad861d96127..769f1c640e9 100644 --- a/tools/marvin/marvin/integration/lib/base/TemplatePermissions.py +++ b/tools/marvin/marvin/integration/lib/base/TemplatePermissions.py @@ -14,16 +14,28 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listTemplatePermissions +from marvin.cloudstackAPI import updateTemplatePermissions + class TemplatePermissions(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, id, **kwargs): + cmd = listTemplatePermissions.listTemplatePermissionsCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + templatepermissions = apiclient.listTemplatePermissions(cmd) + return map(lambda e: TemplatePermissions(e.__dict__), templatepermissions) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateTemplatePermissions.updateTemplatePermissionsCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + templatepermissions = apiclient.updateTemplatePermissions(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/ToLoadBalancerRule.py b/tools/marvin/marvin/integration/lib/base/ToLoadBalancerRule.py index 16857ba28d5..605858f192b 100644 --- a/tools/marvin/marvin/integration/lib/base/ToLoadBalancerRule.py +++ b/tools/marvin/marvin/integration/lib/base/ToLoadBalancerRule.py @@ -14,12 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import assignToLoadBalancerRule + class ToLoadBalancerRule(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def assign(self, apiclient, id, virtualmachineids, **kwargs): - pass + cmd = assignToLoadBalancerRule.assignToLoadBalancerRuleCmd() + cmd.id = id + cmd.virtualmachineids = virtualmachineids + [setattr(cmd, key, value) for key,value in kwargs.items] + toloadbalancerrule = apiclient.assignToLoadBalancerRule(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/TrafficMonitor.py b/tools/marvin/marvin/integration/lib/base/TrafficMonitor.py index 0f5c4e2f1e6..e174fb585e9 100644 --- a/tools/marvin/marvin/integration/lib/base/TrafficMonitor.py +++ b/tools/marvin/marvin/integration/lib/base/TrafficMonitor.py @@ -14,19 +14,37 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import addTrafficMonitor +from marvin.cloudstackAPI import listTrafficMonitors +from marvin.cloudstackAPI import deleteTrafficMonitor + class TrafficMonitor(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def add(self, apiclient, url, zoneid, **kwargs): - pass + cmd = addTrafficMonitor.addTrafficMonitorCmd() + cmd.url = url + cmd.zoneid = zoneid + [setattr(cmd, key, value) for key,value in kwargs.items] + trafficmonitor = apiclient.addTrafficMonitor(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, zoneid, **kwargs): + cmd = listTrafficMonitors.listTrafficMonitorsCmd() + cmd.zoneid = zoneid + [setattr(cmd, key, value) for key,value in kwargs.items] + trafficmonitor = apiclient.listTrafficMonitors(cmd) + return map(lambda e: TrafficMonitor(e.__dict__), trafficmonitor) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteTrafficMonitor.deleteTrafficMonitorCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + trafficmonitor = apiclient.deleteTrafficMonitor(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/TrafficType.py b/tools/marvin/marvin/integration/lib/base/TrafficType.py index 568bd106c41..a5928013025 100644 --- a/tools/marvin/marvin/integration/lib/base/TrafficType.py +++ b/tools/marvin/marvin/integration/lib/base/TrafficType.py @@ -14,22 +14,45 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import addTrafficType +from marvin.cloudstackAPI import listTrafficTypes +from marvin.cloudstackAPI import updateTrafficType +from marvin.cloudstackAPI import deleteTrafficType + class TrafficType(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def add(self, apiclient, traffictype, physicalnetworkid, **kwargs): - pass + cmd = addTrafficType.addTrafficTypeCmd() + cmd.physicalnetworkid = physicalnetworkid + cmd.traffictype = traffictype + [setattr(cmd, key, value) for key,value in kwargs.items] + traffictype = apiclient.addTrafficType(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, physicalnetworkid, **kwargs): + cmd = listTrafficTypes.listTrafficTypesCmd() + cmd.physicalnetworkid = physicalnetworkid + [setattr(cmd, key, value) for key,value in kwargs.items] + traffictype = apiclient.listTrafficTypes(cmd) + return map(lambda e: TrafficType(e.__dict__), traffictype) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateTrafficType.updateTrafficTypeCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + traffictype = apiclient.updateTrafficType(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteTrafficType.deleteTrafficTypeCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + traffictype = apiclient.deleteTrafficType(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/TrafficTypeImplementors.py b/tools/marvin/marvin/integration/lib/base/TrafficTypeImplementors.py index a0713dc6069..3a2b99d5424 100644 --- a/tools/marvin/marvin/integration/lib/base/TrafficTypeImplementors.py +++ b/tools/marvin/marvin/integration/lib/base/TrafficTypeImplementors.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listTrafficTypeImplementors + class TrafficTypeImplementors(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listTrafficTypeImplementors.listTrafficTypeImplementorsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + traffictypeimplementors = apiclient.listTrafficTypeImplementors(cmd) + return map(lambda e: TrafficTypeImplementors(e.__dict__), traffictypeimplementors) diff --git a/tools/marvin/marvin/integration/lib/base/UsageRecords.py b/tools/marvin/marvin/integration/lib/base/UsageRecords.py index 92c77f69bfd..8c8dee70d3f 100644 --- a/tools/marvin/marvin/integration/lib/base/UsageRecords.py +++ b/tools/marvin/marvin/integration/lib/base/UsageRecords.py @@ -14,16 +14,30 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listUsageRecords +from marvin.cloudstackAPI import generateUsageRecords + class UsageRecords(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, startdate, enddate, **kwargs): + cmd = listUsageRecords.listUsageRecordsCmd() + cmd.enddate = enddate + cmd.startdate = startdate + [setattr(cmd, key, value) for key,value in kwargs.items] + usagerecords = apiclient.listUsageRecords(cmd) + return map(lambda e: UsageRecords(e.__dict__), usagerecords) + def generate(self, apiclient, startdate, enddate, **kwargs): - pass + cmd = generateUsageRecords.generateUsageRecordsCmd() + cmd.enddate = enddate + cmd.startdate = startdate + [setattr(cmd, key, value) for key,value in kwargs.items] + usagerecords = apiclient.generateUsageRecords(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/UsageTypes.py b/tools/marvin/marvin/integration/lib/base/UsageTypes.py index a8f934b39e2..3e8b0eb85f4 100644 --- a/tools/marvin/marvin/integration/lib/base/UsageTypes.py +++ b/tools/marvin/marvin/integration/lib/base/UsageTypes.py @@ -14,13 +14,19 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listUsageTypes + class UsageTypes(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod - def list(cls, apiclient): - pass + def list(self, apiclient, **kwargs): + cmd = listUsageTypes.listUsageTypesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + usagetypes = apiclient.listUsageTypes(cmd) + return map(lambda e: UsageTypes(e.__dict__), usagetypes) diff --git a/tools/marvin/marvin/integration/lib/base/User.py b/tools/marvin/marvin/integration/lib/base/User.py index 884a4ea6909..131a7b330bb 100644 --- a/tools/marvin/marvin/integration/lib/base/User.py +++ b/tools/marvin/marvin/integration/lib/base/User.py @@ -14,35 +14,77 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import enableUser +from marvin.cloudstackAPI import getUser +from marvin.cloudstackAPI import lockUser +from marvin.cloudstackAPI import createUser +from marvin.cloudstackAPI import listUsers +from marvin.cloudstackAPI import updateUser +from marvin.cloudstackAPI import disableUser +from marvin.cloudstackAPI import deleteUser + class User(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def enable(self, apiclient, id, **kwargs): - pass + cmd = enableUser.enableUserCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + user = apiclient.enableUser(cmd) + def get(self, apiclient, userapikey, **kwargs): - pass + cmd = getUser.getUserCmd() + cmd.userapikey = userapikey + [setattr(cmd, key, value) for key,value in kwargs.items] + user = apiclient.getUser(cmd) + def lock(self, apiclient, id, **kwargs): - pass + cmd = lockUser.lockUserCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + user = apiclient.lockUser(cmd) + @classmethod def create(cls, apiclient, UserFactory, **kwargs): - pass + cmd = createUser.createUserCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in UserFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + user = apiclient.createUser(cmd) + return User(user.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listUsers.listUsersCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + user = apiclient.listUsers(cmd) + return map(lambda e: User(e.__dict__), user) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateUser.updateUserCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + user = apiclient.updateUser(cmd) + def disable(self, apiclient, id, **kwargs): - pass + cmd = disableUser.disableUserCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + user = apiclient.disableUser(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteUser.deleteUserCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + user = apiclient.deleteUser(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/UserKeys.py b/tools/marvin/marvin/integration/lib/base/UserKeys.py index 9965f552a92..8416f6734b8 100644 --- a/tools/marvin/marvin/integration/lib/base/UserKeys.py +++ b/tools/marvin/marvin/integration/lib/base/UserKeys.py @@ -14,12 +14,18 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import registerUserKeys + class UserKeys(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def register(self, apiclient, id, **kwargs): - pass + cmd = registerUserKeys.registerUserKeysCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + userkeys = apiclient.registerUserKeys(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/VMPassword.py b/tools/marvin/marvin/integration/lib/base/VMPassword.py index ca13df56a7f..dd4c8fcdaa9 100644 --- a/tools/marvin/marvin/integration/lib/base/VMPassword.py +++ b/tools/marvin/marvin/integration/lib/base/VMPassword.py @@ -14,12 +14,18 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import getVMPassword + class VMPassword(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def get(self, apiclient, id, **kwargs): - pass + cmd = getVMPassword.getVMPasswordCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + vmpassword = apiclient.getVMPassword(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/VPC.py b/tools/marvin/marvin/integration/lib/base/VPC.py index 9c18b3165cf..b92676306a5 100644 --- a/tools/marvin/marvin/integration/lib/base/VPC.py +++ b/tools/marvin/marvin/integration/lib/base/VPC.py @@ -14,26 +14,51 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createVPC +from marvin.cloudstackAPI import listVPCs +from marvin.cloudstackAPI import updateVPC +from marvin.cloudstackAPI import restartVPC +from marvin.cloudstackAPI import deleteVPC + class VPC(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, VPCFactory, **kwargs): - pass + cmd = createVPC.createVPCCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VPCFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + vpc = apiclient.createVPC(cmd) + return VPC(vpc.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listVPCs.listVPCsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + vpc = apiclient.listVPCs(cmd) + return map(lambda e: VPC(e.__dict__), vpc) + def update(self, apiclient, **kwargs): - pass + cmd = updateVPC.updateVPCCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + vpc = apiclient.updateVPC(cmd) + def restart(self, apiclient, **kwargs): - pass + cmd = restartVPC.restartVPCCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + vpc = apiclient.restartVPC(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteVPC.deleteVPCCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + vpc = apiclient.deleteVPC(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/VPCOffering.py b/tools/marvin/marvin/integration/lib/base/VPCOffering.py index ae31fcb2b08..74addd649d1 100644 --- a/tools/marvin/marvin/integration/lib/base/VPCOffering.py +++ b/tools/marvin/marvin/integration/lib/base/VPCOffering.py @@ -14,23 +14,44 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createVPCOffering +from marvin.cloudstackAPI import listVPCOfferings +from marvin.cloudstackAPI import updateVPCOffering +from marvin.cloudstackAPI import deleteVPCOffering + class VPCOffering(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, VPCOfferingFactory, **kwargs): - pass + cmd = createVPCOffering.createVPCOfferingCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VPCOfferingFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + vpcoffering = apiclient.createVPCOffering(cmd) + return VPCOffering(vpcoffering.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listVPCOfferings.listVPCOfferingsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + vpcoffering = apiclient.listVPCOfferings(cmd) + return map(lambda e: VPCOffering(e.__dict__), vpcoffering) + def update(self, apiclient, **kwargs): - pass + cmd = updateVPCOffering.updateVPCOfferingCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + vpcoffering = apiclient.updateVPCOffering(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteVPCOffering.deleteVPCOfferingCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + vpcoffering = apiclient.deleteVPCOffering(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/VirtualMachine.py b/tools/marvin/marvin/integration/lib/base/VirtualMachine.py index 1d0f81243cb..498208c9de0 100644 --- a/tools/marvin/marvin/integration/lib/base/VirtualMachine.py +++ b/tools/marvin/marvin/integration/lib/base/VirtualMachine.py @@ -14,41 +14,95 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import restoreVirtualMachine +from marvin.cloudstackAPI import deployVirtualMachine +from marvin.cloudstackAPI import migrateVirtualMachine +from marvin.cloudstackAPI import listVirtualMachines +from marvin.cloudstackAPI import stopVirtualMachine +from marvin.cloudstackAPI import rebootVirtualMachine +from marvin.cloudstackAPI import updateVirtualMachine +from marvin.cloudstackAPI import startVirtualMachine +from marvin.cloudstackAPI import destroyVirtualMachine +from marvin.cloudstackAPI import assignVirtualMachine + class VirtualMachine(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def restore(self, apiclient, virtualmachineid, **kwargs): - pass + cmd = restoreVirtualMachine.restoreVirtualMachineCmd() + cmd.virtualmachineid = virtualmachineid + [setattr(cmd, key, value) for key,value in kwargs.items] + virtualmachine = apiclient.restoreVirtualMachine(cmd) + @classmethod def deploy(cls, apiclient, VirtualMachineFactory, **kwargs): - pass + cmd = deployVirtualMachine.deployVirtualMachineCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VirtualMachineFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + virtualmachine = apiclient.deployVirtualMachine(cmd) + return VirtualMachine(virtualmachine.__dict__) + def migrate(self, apiclient, virtualmachineid, **kwargs): - pass + cmd = migrateVirtualMachine.migrateVirtualMachineCmd() + cmd.virtualmachineid = virtualmachineid + [setattr(cmd, key, value) for key,value in kwargs.items] + virtualmachine = apiclient.migrateVirtualMachine(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listVirtualMachines.listVirtualMachinesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + virtualmachine = apiclient.listVirtualMachines(cmd) + return map(lambda e: VirtualMachine(e.__dict__), virtualmachine) + def stop(self, apiclient, id, **kwargs): - pass + cmd = stopVirtualMachine.stopVirtualMachineCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + virtualmachine = apiclient.stopVirtualMachine(cmd) + def reboot(self, apiclient, id, **kwargs): - pass + cmd = rebootVirtualMachine.rebootVirtualMachineCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + virtualmachine = apiclient.rebootVirtualMachine(cmd) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateVirtualMachine.updateVirtualMachineCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + virtualmachine = apiclient.updateVirtualMachine(cmd) + def start(self, apiclient, id, **kwargs): - pass + cmd = startVirtualMachine.startVirtualMachineCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + virtualmachine = apiclient.startVirtualMachine(cmd) + def destroy(self, apiclient, id, **kwargs): - pass + cmd = destroyVirtualMachine.destroyVirtualMachineCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + virtualmachine = apiclient.destroyVirtualMachine(cmd) + def assign(self, apiclient, account, domainid, virtualmachineid, **kwargs): - pass + cmd = assignVirtualMachine.assignVirtualMachineCmd() + cmd.account = account + cmd.domainid = domainid + cmd.virtualmachineid = virtualmachineid + [setattr(cmd, key, value) for key,value in kwargs.items] + virtualmachine = apiclient.assignVirtualMachine(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py b/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py index afbeda6433f..10df736f7e0 100644 --- a/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py +++ b/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py @@ -14,20 +14,38 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createVirtualRouterElement +from marvin.cloudstackAPI import listVirtualRouterElements +from marvin.cloudstackAPI import configureVirtualRouterElement + class VirtualRouterElement(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, VirtualRouterElementFactory, **kwargs): - pass + cmd = createVirtualRouterElement.createVirtualRouterElementCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VirtualRouterElementFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + virtualrouterelement = apiclient.createVirtualRouterElement(cmd) + return VirtualRouterElement(virtualrouterelement.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listVirtualRouterElements.listVirtualRouterElementsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + virtualrouterelement = apiclient.listVirtualRouterElements(cmd) + return map(lambda e: VirtualRouterElement(e.__dict__), virtualrouterelement) + def configure(self, apiclient, enabled, id, **kwargs): - pass + cmd = configureVirtualRouterElement.configureVirtualRouterElementCmd() + cmd.id = id + cmd.enabled = enabled + [setattr(cmd, key, value) for key,value in kwargs.items] + virtualrouterelement = apiclient.configureVirtualRouterElement(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/VlanIpRange.py b/tools/marvin/marvin/integration/lib/base/VlanIpRange.py index d988bdab186..1f99d5a8c6d 100644 --- a/tools/marvin/marvin/integration/lib/base/VlanIpRange.py +++ b/tools/marvin/marvin/integration/lib/base/VlanIpRange.py @@ -14,20 +14,37 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createVlanIpRange +from marvin.cloudstackAPI import listVlanIpRanges +from marvin.cloudstackAPI import deleteVlanIpRange + class VlanIpRange(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, VlanIpRangeFactory, **kwargs): - pass + cmd = createVlanIpRange.createVlanIpRangeCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VlanIpRangeFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + vlaniprange = apiclient.createVlanIpRange(cmd) + return VlanIpRange(vlaniprange.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listVlanIpRanges.listVlanIpRangesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + vlaniprange = apiclient.listVlanIpRanges(cmd) + return map(lambda e: VlanIpRange(e.__dict__), vlaniprange) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteVlanIpRange.deleteVlanIpRangeCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + vlaniprange = apiclient.deleteVlanIpRange(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Volume.py b/tools/marvin/marvin/integration/lib/base/Volume.py index e2e3f7d64f8..8ba630bacf1 100644 --- a/tools/marvin/marvin/integration/lib/base/Volume.py +++ b/tools/marvin/marvin/integration/lib/base/Volume.py @@ -14,35 +14,83 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import migrateVolume +from marvin.cloudstackAPI import createVolume +from marvin.cloudstackAPI import listVolumes +from marvin.cloudstackAPI import uploadVolume +from marvin.cloudstackAPI import attachVolume +from marvin.cloudstackAPI import detachVolume +from marvin.cloudstackAPI import extractVolume +from marvin.cloudstackAPI import deleteVolume + class Volume(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def migrate(self, apiclient, storageid, volumeid, **kwargs): - pass + cmd = migrateVolume.migrateVolumeCmd() + cmd.storageid = storageid + cmd.volumeid = volumeid + [setattr(cmd, key, value) for key,value in kwargs.items] + volume = apiclient.migrateVolume(cmd) + @classmethod def create(cls, apiclient, VolumeFactory, **kwargs): - pass + cmd = createVolume.createVolumeCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VolumeFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + volume = apiclient.createVolume(cmd) + return Volume(volume.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listVolumes.listVolumesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + volume = apiclient.listVolumes(cmd) + return map(lambda e: Volume(e.__dict__), volume) + def upload(self, apiclient, url, zoneid, name, format, **kwargs): - pass + cmd = uploadVolume.uploadVolumeCmd() + cmd.format = format + cmd.name = name + cmd.url = url + cmd.zoneid = zoneid + [setattr(cmd, key, value) for key,value in kwargs.items] + volume = apiclient.uploadVolume(cmd) + def attach(self, apiclient, id, virtualmachineid, **kwargs): - pass + cmd = attachVolume.attachVolumeCmd() + cmd.id = id + cmd.virtualmachineid = virtualmachineid + [setattr(cmd, key, value) for key,value in kwargs.items] + volume = apiclient.attachVolume(cmd) + def detach(self, apiclient, **kwargs): - pass + cmd = detachVolume.detachVolumeCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + volume = apiclient.detachVolume(cmd) + def extract(self, apiclient, zoneid, id, mode, **kwargs): - pass + cmd = extractVolume.extractVolumeCmd() + cmd.id = id + cmd.mode = mode + cmd.zoneid = zoneid + [setattr(cmd, key, value) for key,value in kwargs.items] + volume = apiclient.extractVolume(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteVolume.deleteVolumeCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + volume = apiclient.deleteVolume(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/VpnConnection.py b/tools/marvin/marvin/integration/lib/base/VpnConnection.py index 2579fb1d042..a2c5f5b7dab 100644 --- a/tools/marvin/marvin/integration/lib/base/VpnConnection.py +++ b/tools/marvin/marvin/integration/lib/base/VpnConnection.py @@ -14,23 +14,45 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import resetVpnConnection +from marvin.cloudstackAPI import createVpnConnection +from marvin.cloudstackAPI import listVpnConnections +from marvin.cloudstackAPI import deleteVpnConnection + class VpnConnection(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def reset(self, apiclient, id, **kwargs): - pass + cmd = resetVpnConnection.resetVpnConnectionCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + vpnconnection = apiclient.resetVpnConnection(cmd) + @classmethod def create(cls, apiclient, VpnConnectionFactory, **kwargs): - pass + cmd = createVpnConnection.createVpnConnectionCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VpnConnectionFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + vpnconnection = apiclient.createVpnConnection(cmd) + return VpnConnection(vpnconnection.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listVpnConnections.listVpnConnectionsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + vpnconnection = apiclient.listVpnConnections(cmd) + return map(lambda e: VpnConnection(e.__dict__), vpnconnection) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteVpnConnection.deleteVpnConnectionCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + vpnconnection = apiclient.deleteVpnConnection(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py b/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py index 90e69f275e9..eab0b6e7b0c 100644 --- a/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py +++ b/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py @@ -14,23 +14,50 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createVpnCustomerGateway +from marvin.cloudstackAPI import listVpnCustomerGateways +from marvin.cloudstackAPI import updateVpnCustomerGateway +from marvin.cloudstackAPI import deleteVpnCustomerGateway + class VpnCustomerGateway(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, VpnCustomerGatewayFactory, **kwargs): - pass + cmd = createVpnCustomerGateway.createVpnCustomerGatewayCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VpnCustomerGatewayFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + vpncustomergateway = apiclient.createVpnCustomerGateway(cmd) + return VpnCustomerGateway(vpncustomergateway.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listVpnCustomerGateways.listVpnCustomerGatewaysCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + vpncustomergateway = apiclient.listVpnCustomerGateways(cmd) + return map(lambda e: VpnCustomerGateway(e.__dict__), vpncustomergateway) + def update(self, apiclient, ikepolicy, cidrlist, gateway, ipsecpsk, esppolicy, id, **kwargs): - pass + cmd = updateVpnCustomerGateway.updateVpnCustomerGatewayCmd() + cmd.id = id + cmd.cidrlist = cidrlist + cmd.esppolicy = esppolicy + cmd.gateway = gateway + cmd.ikepolicy = ikepolicy + cmd.ipsecpsk = ipsecpsk + [setattr(cmd, key, value) for key,value in kwargs.items] + vpncustomergateway = apiclient.updateVpnCustomerGateway(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteVpnCustomerGateway.deleteVpnCustomerGatewayCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + vpncustomergateway = apiclient.deleteVpnCustomerGateway(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/VpnGateway.py b/tools/marvin/marvin/integration/lib/base/VpnGateway.py index 72453f3a592..7f2766a89af 100644 --- a/tools/marvin/marvin/integration/lib/base/VpnGateway.py +++ b/tools/marvin/marvin/integration/lib/base/VpnGateway.py @@ -14,20 +14,37 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createVpnGateway +from marvin.cloudstackAPI import listVpnGateways +from marvin.cloudstackAPI import deleteVpnGateway + class VpnGateway(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, VpnGatewayFactory, **kwargs): - pass + cmd = createVpnGateway.createVpnGatewayCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VpnGatewayFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + vpngateway = apiclient.createVpnGateway(cmd) + return VpnGateway(vpngateway.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listVpnGateways.listVpnGatewaysCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + vpngateway = apiclient.listVpnGateways(cmd) + return map(lambda e: VpnGateway(e.__dict__), vpngateway) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteVpnGateway.deleteVpnGatewayCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + vpngateway = apiclient.deleteVpnGateway(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/VpnUser.py b/tools/marvin/marvin/integration/lib/base/VpnUser.py index 5a8b9eb1536..edb7dc26f6f 100644 --- a/tools/marvin/marvin/integration/lib/base/VpnUser.py +++ b/tools/marvin/marvin/integration/lib/base/VpnUser.py @@ -14,19 +14,36 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import addVpnUser +from marvin.cloudstackAPI import listVpnUsers +from marvin.cloudstackAPI import removeVpnUser + class VpnUser(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) def add(self, apiclient, username, password, **kwargs): - pass + cmd = addVpnUser.addVpnUserCmd() + cmd.password = password + cmd.username = username + [setattr(cmd, key, value) for key,value in kwargs.items] + vpnuser = apiclient.addVpnUser(cmd) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listVpnUsers.listVpnUsersCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + vpnuser = apiclient.listVpnUsers(cmd) + return map(lambda e: VpnUser(e.__dict__), vpnuser) + def remove(self, apiclient, username, **kwargs): - pass + cmd = removeVpnUser.removeVpnUserCmd() + cmd.username = username + [setattr(cmd, key, value) for key,value in kwargs.items] + vpnuser = apiclient.removeVpnUser(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/Zone.py b/tools/marvin/marvin/integration/lib/base/Zone.py index 33876bc0a4b..7cf01ea408a 100644 --- a/tools/marvin/marvin/integration/lib/base/Zone.py +++ b/tools/marvin/marvin/integration/lib/base/Zone.py @@ -14,23 +14,45 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from . import CloudStackEntity +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createZone +from marvin.cloudstackAPI import listZones +from marvin.cloudstackAPI import updateZone +from marvin.cloudstackAPI import deleteZone + class Zone(CloudStackEntity): + def __init__(self, items): self.__dict__.update(items) @classmethod def create(cls, apiclient, ZoneFactory, **kwargs): - pass + cmd = createZone.createZoneCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in ZoneFactory.attributes()] + [setattr(cmd, key, value) for key,value in kwargs.items] + zone = apiclient.createZone(cmd) + return Zone(zone.__dict__) + @classmethod - def list(cls, apiclient, **kwargs): - pass + def list(self, apiclient, **kwargs): + cmd = listZones.listZonesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + zone = apiclient.listZones(cmd) + return map(lambda e: Zone(e.__dict__), zone) + def update(self, apiclient, id, **kwargs): - pass + cmd = updateZone.updateZoneCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + zone = apiclient.updateZone(cmd) + def delete(self, apiclient, id, **kwargs): - pass + cmd = deleteZone.deleteZoneCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + zone = apiclient.deleteZone(cmd) diff --git a/tools/marvin/marvin/integration/lib/factory/AccountFactory.py b/tools/marvin/marvin/integration/lib/factory/AccountFactory.py index 0e5428fac5f..acb93dc5bbf 100644 --- a/tools/marvin/marvin/integration/lib/factory/AccountFactory.py +++ b/tools/marvin/marvin/integration/lib/factory/AccountFactory.py @@ -15,15 +15,14 @@ # specific language governing permissions and limitations # under the License. import factory -import hashlib from marvin.integration.lib.base import Account +import hashlib from marvin.integration.lib.utils import random_gen class AccountFactory(factory.Factory): FACTORY_FOR = Account - #0 - User, 1 - Root Admin, 2 - Domain Admin accounttype = 0 email = factory.LazyAttribute(lambda e: '{0}.{1}@cloudstack.org'.format(e.firstname, e.lastname)).lower() firstname = 'fname-'+random_gen() @@ -35,11 +34,15 @@ class AccountFactory(factory.Factory): mdf.update('password') password = mdf.hexdigest() - class AdminAccountFactory(AccountFactory): accounttype = 1 class DomainAdminFactory(AccountFactory): accounttype = 2 - domainid = None + domainid = None accounttype = None + email = None + firstname = None + lastname = None + password = None + username = None diff --git a/tools/marvin/marvin/integration/lib/generateBase.py b/tools/marvin/marvin/integration/lib/generateBase.py index b3ab8e7913b..5f5e3dff721 100644 --- a/tools/marvin/marvin/integration/lib/generateBase.py +++ b/tools/marvin/marvin/integration/lib/generateBase.py @@ -100,7 +100,10 @@ def get_actionable_entities(): entity = entity[:-2] if entity not in entities: entities[entity] = { } - entities[entity][verb] = [requireds,optionals] + entities[entity][verb] = {} + entities[entity][verb]['args'] = requireds + entities[entity][verb]['apimodule'] = cmd.__class__.__module__.split('.')[-1] + entities[entity][verb]['apicmd'] = cmd.__class__.__name__ return entities def write_entity_classes(entities): @@ -108,31 +111,43 @@ def write_entity_classes(entities): entitydict = {} #TODO: Add license header for ASLv2 for entity, actions in entities.iteritems(): - code = 'from . import CloudStackEntity\n' - code += 'class %s(CloudStackEntity):'%entity - code += '\n\n' - code += tabspace + 'def __init__(self, items):\n' - code += tabspace*2 + 'self.__dict__.update(items)\n' - for action, args in actions.iteritems(): - code += '\n\n' + body = [] + imports = [] + imports.append('from marvin.integration.lib.base import CloudStackEntity') + body.append('class %s(CloudStackEntity):'%entity) + body.append('\n') + body.append(tabspace + 'def __init__(self, items):') + body.append(tabspace*2 + 'self.__dict__.update(items)') + body.append('\n') + for action, details in actions.iteritems(): + imports.append('from marvin.cloudstackAPI import %s'%details['apimodule']) if action in ['create', 'list', 'deploy']: - code += tabspace + '@classmethod\n' - code += tabspace + body.append(tabspace + '@classmethod') if action in ['create', 'deploy']: - code += 'def %s(cls, apiclient, %sFactory'%(action, entity) - elif action in ['list']: - code += 'def %s(cls, apiclient'%(action) + body.append(tabspace + 'def %s(cls, apiclient, %sFactory, **kwargs):'%(action, entity)) + body.append(tabspace*2 + 'cmd = %(module)s.%(command)s()'%{"module": details["apimodule"], "command": details["apicmd"]}) + body.append(tabspace*2 + '[setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in %sFactory.attributes()]'%entity) + body.append(tabspace*2 + '[setattr(cmd, key, value) for key,value in kwargs.items]') + body.append(tabspace*2 + '%s = apiclient.%s(cmd)'%(entity.lower(), details['apimodule'])) + body.append(tabspace*2 + 'return %s(%s.__dict__)'%(entity, entity.lower())) else: - code += 'def %s(self, apiclient'%(action) - if len(args[0]) > 0: - code += ', ' + ', '.join(list(set(args[0]))) - if len(args[1]) > 0: - code += ', **kwargs):\n' - else: - code += '):\n' - code += tabspace*2 - code += 'pass' - code += '\n\n' + if len(details['args']) > 0: + body.append(tabspace + 'def %s(self, apiclient, %s, **kwargs):'%(action, ', '.join(list(set(details['args']))))) + else: + body.append(tabspace + 'def %s(self, apiclient, **kwargs):'%(action)) + body.append(tabspace*2 + 'cmd = %(module)s.%(command)s()'%{"module": details["apimodule"], "command": details["apicmd"]}) + for arg in details['args']: + body.append(tabspace*2 + 'cmd.%s = %s'%(arg, arg)) + body.append(tabspace*2 + '[setattr(cmd, key, value) for key,value in kwargs.items]') + body.append(tabspace*2 + '%s = apiclient.%s(cmd)'%(entity.lower(), details['apimodule'])) + if action in ['list']: + body.append(tabspace*2 + 'return map(lambda e: %s(e.__dict__), %s)'%(entity, entity.lower())) + body.append('\n') + + imports = '\n'.join(imports) + body = '\n'.join(body) + code = imports + '\n\n' + body + entitydict[entity] = code write_entity_factory(entity, actions) with open("./base/%s.py"%entity, "w") as writer: @@ -146,18 +161,18 @@ def write_entity_factory(entity, actions): code = '' factory_defaults = [] if 'create' in actions: - factory_defaults.extend(actions['create']) + factory_defaults.extend(actions['create']['args']) elif 'deploy' in actions: - factory_defaults.extend(actions['deploy']) + factory_defaults.extend(actions['deploy']['args']) elif 'associate' in actions: - factory_defaults.extend(actions['associate']) + factory_defaults.extend(actions['associate']['args']) elif 'register' in actions: - factory_defaults.extend(actions['register']) + factory_defaults.extend(actions['register']['args']) else: return if os.path.exists("./factory/%sFactory.py"%entity): - for arg in factory_defaults[0]: + for arg in factory_defaults: code += tabspace + '%s = None\n'%arg with open("./factory/%sFactory.py"%entity, "r") as reader: rcode = reader.read() @@ -171,7 +186,7 @@ def write_entity_factory(entity, actions): code += 'class %sFactory(factory.Factory):'%entity code += '\n\n' code += tabspace + 'FACTORY_FOR = %s\n\n'%entity - for arg in factory_defaults[0]: + for arg in factory_defaults: code += tabspace + '%s = None\n'%arg with open("./factory/%sFactory.py"%entity, "w") as writer: writer.write(LICENSE)