Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A4954F1F6 for ; Tue, 9 Apr 2013 13:20:48 +0000 (UTC) Received: (qmail 93770 invoked by uid 500); 9 Apr 2013 13:20:47 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 91870 invoked by uid 500); 9 Apr 2013 13:20:44 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 91176 invoked by uid 99); 9 Apr 2013 13:20:38 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Apr 2013 13:20:38 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 33932817370; Tue, 9 Apr 2013 13:20:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tsp@apache.org To: commits@cloudstack.apache.org Date: Tue, 09 Apr 2013 13:20:40 -0000 Message-Id: <712229cb412940d382421984c65e8bfe@git.apache.org> In-Reply-To: <06e2d3e745e44030b768d209fb51bfd3@git.apache.org> References: <06e2d3e745e44030b768d209fb51bfd3@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [03/50] [abbrv] git commit: updated refs/heads/marvin_refactor to 2a99064 VNS device APIs, VMSnapshot APIs, changes to factory creation Signed-off-by: Prasanna Santhanam Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9ebc6f9a Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9ebc6f9a Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9ebc6f9a Branch: refs/heads/marvin_refactor Commit: 9ebc6f9a296fff15b602ef3f95fac5cff5c0a84d Parents: dc573f5 Author: Prasanna Santhanam Authored: Mon Mar 18 17:56:09 2013 +0530 Committer: Prasanna Santhanam Committed: Sun Mar 31 22:00:35 2013 +0530 ---------------------------------------------------------------------- .../marvin/marvin/integration/lib/base/Account.py | 6 +- .../marvin/integration/lib/base/AutoScalePolicy.py | 4 +- .../integration/lib/base/AutoScaleVmGroup.py | 4 +- .../integration/lib/base/AutoScaleVmProfile.py | 4 +- .../integration/lib/base/BigSwitchVnsDevice.py | 49 ++++++++++++ .../marvin/integration/lib/base/Condition.py | 4 +- .../marvin/marvin/integration/lib/base/Counter.py | 4 +- .../marvin/integration/lib/base/DiskOffering.py | 4 +- tools/marvin/marvin/integration/lib/base/Domain.py | 4 +- .../integration/lib/base/EgressFirewallRule.py | 4 +- .../marvin/integration/lib/base/FirewallRule.py | 4 +- .../marvin/integration/lib/base/InstanceGroup.py | 4 +- .../integration/lib/base/IpForwardingRule.py | 4 +- .../marvin/integration/lib/base/IpFromNic.py | 31 ++++++++ .../marvin/marvin/integration/lib/base/IpToNic.py | 31 ++++++++ .../integration/lib/base/LBStickinessPolicy.py | 4 +- .../integration/lib/base/LoadBalancerRule.py | 4 +- .../marvin/marvin/integration/lib/base/Network.py | 4 +- .../marvin/integration/lib/base/NetworkACL.py | 4 +- .../marvin/integration/lib/base/NetworkOffering.py | 4 +- tools/marvin/marvin/integration/lib/base/Nics.py | 33 ++++++++ .../marvin/integration/lib/base/PhysicalNetwork.py | 4 +- tools/marvin/marvin/integration/lib/base/Pod.py | 4 +- .../integration/lib/base/PortForwardingRule.py | 4 +- .../marvin/integration/lib/base/PrivateGateway.py | 4 +- .../marvin/marvin/integration/lib/base/Project.py | 4 +- tools/marvin/marvin/integration/lib/base/Region.py | 58 +++++++++++++++ .../marvin/integration/lib/base/RemoteAccessVpn.py | 4 +- .../marvin/integration/lib/base/SSHKeyPair.py | 4 +- .../marvin/integration/lib/base/SecurityGroup.py | 4 +- .../marvin/integration/lib/base/ServiceOffering.py | 4 +- .../marvin/integration/lib/base/Simulator.py | 32 ++++++++ .../marvin/marvin/integration/lib/base/Snapshot.py | 4 +- .../marvin/integration/lib/base/SnapshotPolicy.py | 4 +- .../marvin/integration/lib/base/StaticRoute.py | 4 +- .../integration/lib/base/StorageNetworkIpRange.py | 4 +- .../marvin/integration/lib/base/StoragePool.py | 4 +- tools/marvin/marvin/integration/lib/base/Tags.py | 4 +- .../marvin/marvin/integration/lib/base/Template.py | 4 +- tools/marvin/marvin/integration/lib/base/User.py | 4 +- .../marvin/integration/lib/base/VMSnapshot.py | 50 +++++++++++++ tools/marvin/marvin/integration/lib/base/VPC.py | 4 +- .../marvin/integration/lib/base/VPCOffering.py | 4 +- .../marvin/integration/lib/base/VirtualMachine.py | 4 +- .../integration/lib/base/VirtualRouterElement.py | 4 +- .../marvin/integration/lib/base/VlanIpRange.py | 4 +- tools/marvin/marvin/integration/lib/base/Volume.py | 4 +- .../marvin/integration/lib/base/VpnConnection.py | 4 +- .../integration/lib/base/VpnCustomerGateway.py | 4 +- .../marvin/integration/lib/base/VpnGateway.py | 4 +- tools/marvin/marvin/integration/lib/base/Zone.py | 4 +- .../integration/lib/factory/AccountFactory.py | 3 +- .../integration/lib/factory/StoragePoolFactory.py | 3 + .../integration/lib/factory/VMSnapshotFactory.py | 23 ++++++ .../integration/lib/factory/test/__init__.py | 16 ++++ .../integration/lib/factory/test/testFactories.py | 33 ++++++++ .../marvin/marvin/integration/lib/generateBase.py | 6 +- 57 files changed, 453 insertions(+), 93 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/Account.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Account.py b/tools/marvin/marvin/integration/lib/base/Account.py index cef5506..b5ad12a 100644 --- a/tools/marvin/marvin/integration/lib/base/Account.py +++ b/tools/marvin/marvin/integration/lib/base/Account.py @@ -23,7 +23,7 @@ from marvin.cloudstackAPI import updateAccount from marvin.cloudstackAPI import disableAccount from marvin.cloudstackAPI import deleteAccount -class Account(CloudStackEntity.CloudStackEntity): +class Account(CloudStackEntity): def __init__(self, items): @@ -47,8 +47,8 @@ class Account(CloudStackEntity.CloudStackEntity): @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] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in AccountFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] account = apiclient.createAccount(cmd) return Account(account.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/AutoScalePolicy.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/AutoScalePolicy.py b/tools/marvin/marvin/integration/lib/base/AutoScalePolicy.py index 4a8b736..5655b48 100644 --- a/tools/marvin/marvin/integration/lib/base/AutoScalePolicy.py +++ b/tools/marvin/marvin/integration/lib/base/AutoScalePolicy.py @@ -29,8 +29,8 @@ class AutoScalePolicy(CloudStackEntity): @classmethod def create(cls, apiclient, AutoScalePolicyFactory, **kwargs): cmd = createAutoScalePolicy.createAutoScalePolicyCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in AutoScalePolicyFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in AutoScalePolicyFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] autoscalepolicy = apiclient.createAutoScalePolicy(cmd) return AutoScalePolicy(autoscalepolicy.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/AutoScaleVmGroup.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/AutoScaleVmGroup.py b/tools/marvin/marvin/integration/lib/base/AutoScaleVmGroup.py index fdc8147..43aed7a 100644 --- a/tools/marvin/marvin/integration/lib/base/AutoScaleVmGroup.py +++ b/tools/marvin/marvin/integration/lib/base/AutoScaleVmGroup.py @@ -39,8 +39,8 @@ class AutoScaleVmGroup(CloudStackEntity): @classmethod def create(cls, apiclient, AutoScaleVmGroupFactory, **kwargs): cmd = createAutoScaleVmGroup.createAutoScaleVmGroupCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in AutoScaleVmGroupFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in AutoScaleVmGroupFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] autoscalevmgroup = apiclient.createAutoScaleVmGroup(cmd) return AutoScaleVmGroup(autoscalevmgroup.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/AutoScaleVmProfile.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/AutoScaleVmProfile.py b/tools/marvin/marvin/integration/lib/base/AutoScaleVmProfile.py index 436b81c..36adbb1 100644 --- a/tools/marvin/marvin/integration/lib/base/AutoScaleVmProfile.py +++ b/tools/marvin/marvin/integration/lib/base/AutoScaleVmProfile.py @@ -30,8 +30,8 @@ class AutoScaleVmProfile(CloudStackEntity): @classmethod def create(cls, apiclient, AutoScaleVmProfileFactory, **kwargs): cmd = createAutoScaleVmProfile.createAutoScaleVmProfileCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in AutoScaleVmProfileFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in AutoScaleVmProfileFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] autoscalevmprofile = apiclient.createAutoScaleVmProfile(cmd) return AutoScaleVmProfile(autoscalevmprofile.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/BigSwitchVnsDevice.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/BigSwitchVnsDevice.py b/tools/marvin/marvin/integration/lib/base/BigSwitchVnsDevice.py new file mode 100644 index 0000000..3bccb35 --- /dev/null +++ b/tools/marvin/marvin/integration/lib/base/BigSwitchVnsDevice.py @@ -0,0 +1,49 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import addBigSwitchVnsDevice +from marvin.cloudstackAPI import listBigSwitchVnsDevices +from marvin.cloudstackAPI import deleteBigSwitchVnsDevice + +class BigSwitchVnsDevice(CloudStackEntity): + + + def __init__(self, items): + self.__dict__.update(items) + + + def add(self, apiclient, physicalnetworkid, hostname, **kwargs): + cmd = addBigSwitchVnsDevice.addBigSwitchVnsDeviceCmd() + cmd.hostname = hostname + cmd.physicalnetworkid = physicalnetworkid + [setattr(cmd, key, value) for key,value in kwargs.items] + bigswitchvnsdevice = apiclient.addBigSwitchVnsDevice(cmd) + + + @classmethod + def list(self, apiclient, **kwargs): + cmd = listBigSwitchVnsDevices.listBigSwitchVnsDevicesCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + bigswitchvnsdevice = apiclient.listBigSwitchVnsDevices(cmd) + return map(lambda e: BigSwitchVnsDevice(e.__dict__), bigswitchvnsdevice) + + + def delete(self, apiclient, vnsdeviceid, **kwargs): + cmd = deleteBigSwitchVnsDevice.deleteBigSwitchVnsDeviceCmd() + cmd.vnsdeviceid = vnsdeviceid + [setattr(cmd, key, value) for key,value in kwargs.items] + bigswitchvnsdevice = apiclient.deleteBigSwitchVnsDevice(cmd) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/Condition.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Condition.py b/tools/marvin/marvin/integration/lib/base/Condition.py index 22d8fc7..5973956 100644 --- a/tools/marvin/marvin/integration/lib/base/Condition.py +++ b/tools/marvin/marvin/integration/lib/base/Condition.py @@ -29,8 +29,8 @@ class Condition(CloudStackEntity): @classmethod def create(cls, apiclient, ConditionFactory, **kwargs): cmd = createCondition.createConditionCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in ConditionFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in ConditionFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] condition = apiclient.createCondition(cmd) return Condition(condition.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/Counter.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Counter.py b/tools/marvin/marvin/integration/lib/base/Counter.py index 76a6097..e41ce12 100644 --- a/tools/marvin/marvin/integration/lib/base/Counter.py +++ b/tools/marvin/marvin/integration/lib/base/Counter.py @@ -29,8 +29,8 @@ class Counter(CloudStackEntity): @classmethod def create(cls, apiclient, CounterFactory, **kwargs): cmd = createCounter.createCounterCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in CounterFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in CounterFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] counter = apiclient.createCounter(cmd) return Counter(counter.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/DiskOffering.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/DiskOffering.py b/tools/marvin/marvin/integration/lib/base/DiskOffering.py index d20b2b8..a94412a 100644 --- a/tools/marvin/marvin/integration/lib/base/DiskOffering.py +++ b/tools/marvin/marvin/integration/lib/base/DiskOffering.py @@ -30,8 +30,8 @@ class DiskOffering(CloudStackEntity): @classmethod def create(cls, apiclient, DiskOfferingFactory, **kwargs): cmd = createDiskOffering.createDiskOfferingCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in DiskOfferingFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in DiskOfferingFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] diskoffering = apiclient.createDiskOffering(cmd) return DiskOffering(diskoffering.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/Domain.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Domain.py b/tools/marvin/marvin/integration/lib/base/Domain.py index feecc38..2d66d2e 100644 --- a/tools/marvin/marvin/integration/lib/base/Domain.py +++ b/tools/marvin/marvin/integration/lib/base/Domain.py @@ -30,8 +30,8 @@ class Domain(CloudStackEntity): @classmethod def create(cls, apiclient, DomainFactory, **kwargs): cmd = createDomain.createDomainCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in DomainFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in DomainFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] domain = apiclient.createDomain(cmd) return Domain(domain.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/EgressFirewallRule.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/EgressFirewallRule.py b/tools/marvin/marvin/integration/lib/base/EgressFirewallRule.py index 5f74351..750ccea 100644 --- a/tools/marvin/marvin/integration/lib/base/EgressFirewallRule.py +++ b/tools/marvin/marvin/integration/lib/base/EgressFirewallRule.py @@ -29,8 +29,8 @@ class EgressFirewallRule(CloudStackEntity): @classmethod def create(cls, apiclient, EgressFirewallRuleFactory, **kwargs): cmd = createEgressFirewallRule.createEgressFirewallRuleCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in EgressFirewallRuleFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in EgressFirewallRuleFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] egressfirewallrule = apiclient.createEgressFirewallRule(cmd) return EgressFirewallRule(egressfirewallrule.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/FirewallRule.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/FirewallRule.py b/tools/marvin/marvin/integration/lib/base/FirewallRule.py index 55f1fd0..2e90907 100644 --- a/tools/marvin/marvin/integration/lib/base/FirewallRule.py +++ b/tools/marvin/marvin/integration/lib/base/FirewallRule.py @@ -29,8 +29,8 @@ class FirewallRule(CloudStackEntity): @classmethod def create(cls, apiclient, FirewallRuleFactory, **kwargs): cmd = createFirewallRule.createFirewallRuleCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in FirewallRuleFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in FirewallRuleFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] firewallrule = apiclient.createFirewallRule(cmd) return FirewallRule(firewallrule.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/InstanceGroup.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/InstanceGroup.py b/tools/marvin/marvin/integration/lib/base/InstanceGroup.py index 906d640..852b7f4 100644 --- a/tools/marvin/marvin/integration/lib/base/InstanceGroup.py +++ b/tools/marvin/marvin/integration/lib/base/InstanceGroup.py @@ -30,8 +30,8 @@ class InstanceGroup(CloudStackEntity): @classmethod def create(cls, apiclient, InstanceGroupFactory, **kwargs): cmd = createInstanceGroup.createInstanceGroupCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in InstanceGroupFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in InstanceGroupFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] instancegroup = apiclient.createInstanceGroup(cmd) return InstanceGroup(instancegroup.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/IpForwardingRule.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/IpForwardingRule.py b/tools/marvin/marvin/integration/lib/base/IpForwardingRule.py index 1adc746..0279f15 100644 --- a/tools/marvin/marvin/integration/lib/base/IpForwardingRule.py +++ b/tools/marvin/marvin/integration/lib/base/IpForwardingRule.py @@ -29,8 +29,8 @@ class IpForwardingRule(CloudStackEntity): @classmethod def create(cls, apiclient, IpForwardingRuleFactory, **kwargs): cmd = createIpForwardingRule.createIpForwardingRuleCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in IpForwardingRuleFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in IpForwardingRuleFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] ipforwardingrule = apiclient.createIpForwardingRule(cmd) return IpForwardingRule(ipforwardingrule.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/IpFromNic.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/IpFromNic.py b/tools/marvin/marvin/integration/lib/base/IpFromNic.py new file mode 100644 index 0000000..750e142 --- /dev/null +++ b/tools/marvin/marvin/integration/lib/base/IpFromNic.py @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import removeIpFromNic + +class IpFromNic(CloudStackEntity): + + + def __init__(self, items): + self.__dict__.update(items) + + + def remove(self, apiclient, id, **kwargs): + cmd = removeIpFromNic.removeIpFromNicCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + ipfromnic = apiclient.removeIpFromNic(cmd) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/IpToNic.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/IpToNic.py b/tools/marvin/marvin/integration/lib/base/IpToNic.py new file mode 100644 index 0000000..713c07d --- /dev/null +++ b/tools/marvin/marvin/integration/lib/base/IpToNic.py @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import addIpToNic + +class IpToNic(CloudStackEntity): + + + def __init__(self, items): + self.__dict__.update(items) + + + def add(self, apiclient, nicid, **kwargs): + cmd = addIpToNic.addIpToNicCmd() + cmd.nicid = nicid + [setattr(cmd, key, value) for key,value in kwargs.items] + iptonic = apiclient.addIpToNic(cmd) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/LBStickinessPolicy.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/LBStickinessPolicy.py b/tools/marvin/marvin/integration/lib/base/LBStickinessPolicy.py index 70a8b2f..f5b5613 100644 --- a/tools/marvin/marvin/integration/lib/base/LBStickinessPolicy.py +++ b/tools/marvin/marvin/integration/lib/base/LBStickinessPolicy.py @@ -28,8 +28,8 @@ class LBStickinessPolicy(CloudStackEntity): @classmethod def create(cls, apiclient, LBStickinessPolicyFactory, **kwargs): cmd = createLBStickinessPolicy.createLBStickinessPolicyCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in LBStickinessPolicyFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in LBStickinessPolicyFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] lbstickinesspolicy = apiclient.createLBStickinessPolicy(cmd) return LBStickinessPolicy(lbstickinesspolicy.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/LoadBalancerRule.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/LoadBalancerRule.py b/tools/marvin/marvin/integration/lib/base/LoadBalancerRule.py index 77db0e9..dc2c8ea 100644 --- a/tools/marvin/marvin/integration/lib/base/LoadBalancerRule.py +++ b/tools/marvin/marvin/integration/lib/base/LoadBalancerRule.py @@ -30,8 +30,8 @@ class LoadBalancerRule(CloudStackEntity): @classmethod def create(cls, apiclient, LoadBalancerRuleFactory, **kwargs): cmd = createLoadBalancerRule.createLoadBalancerRuleCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in LoadBalancerRuleFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in LoadBalancerRuleFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] loadbalancerrule = apiclient.createLoadBalancerRule(cmd) return LoadBalancerRule(loadbalancerrule.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/Network.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Network.py b/tools/marvin/marvin/integration/lib/base/Network.py index 2a2c43f..1abfbc8 100644 --- a/tools/marvin/marvin/integration/lib/base/Network.py +++ b/tools/marvin/marvin/integration/lib/base/Network.py @@ -31,8 +31,8 @@ class Network(CloudStackEntity): @classmethod def create(cls, apiclient, NetworkFactory, **kwargs): cmd = createNetwork.createNetworkCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in NetworkFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in NetworkFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] network = apiclient.createNetwork(cmd) return Network(network.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/NetworkACL.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/NetworkACL.py b/tools/marvin/marvin/integration/lib/base/NetworkACL.py index eafa511..82e0f25 100644 --- a/tools/marvin/marvin/integration/lib/base/NetworkACL.py +++ b/tools/marvin/marvin/integration/lib/base/NetworkACL.py @@ -29,8 +29,8 @@ class NetworkACL(CloudStackEntity): @classmethod def create(cls, apiclient, NetworkACLFactory, **kwargs): cmd = createNetworkACL.createNetworkACLCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in NetworkACLFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in NetworkACLFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] networkacl = apiclient.createNetworkACL(cmd) return NetworkACL(networkacl.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/NetworkOffering.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/NetworkOffering.py b/tools/marvin/marvin/integration/lib/base/NetworkOffering.py index 0f27383..41a57d4 100644 --- a/tools/marvin/marvin/integration/lib/base/NetworkOffering.py +++ b/tools/marvin/marvin/integration/lib/base/NetworkOffering.py @@ -30,8 +30,8 @@ class NetworkOffering(CloudStackEntity): @classmethod def create(cls, apiclient, NetworkOfferingFactory, **kwargs): cmd = createNetworkOffering.createNetworkOfferingCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in NetworkOfferingFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in NetworkOfferingFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] networkoffering = apiclient.createNetworkOffering(cmd) return NetworkOffering(networkoffering.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/Nics.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Nics.py b/tools/marvin/marvin/integration/lib/base/Nics.py new file mode 100644 index 0000000..57338ce --- /dev/null +++ b/tools/marvin/marvin/integration/lib/base/Nics.py @@ -0,0 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import listNics + +class Nics(CloudStackEntity): + + + def __init__(self, items): + self.__dict__.update(items) + + + @classmethod + def list(self, apiclient, virtualmachineid, **kwargs): + cmd = listNics.listNicsCmd() + cmd.virtualmachineid = virtualmachineid + [setattr(cmd, key, value) for key,value in kwargs.items] + nics = apiclient.listNics(cmd) + return map(lambda e: Nics(e.__dict__), nics) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/PhysicalNetwork.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/PhysicalNetwork.py b/tools/marvin/marvin/integration/lib/base/PhysicalNetwork.py index 08faa33..69be06b 100644 --- a/tools/marvin/marvin/integration/lib/base/PhysicalNetwork.py +++ b/tools/marvin/marvin/integration/lib/base/PhysicalNetwork.py @@ -30,8 +30,8 @@ class PhysicalNetwork(CloudStackEntity): @classmethod def create(cls, apiclient, PhysicalNetworkFactory, **kwargs): cmd = createPhysicalNetwork.createPhysicalNetworkCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in PhysicalNetworkFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in PhysicalNetworkFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] physicalnetwork = apiclient.createPhysicalNetwork(cmd) return PhysicalNetwork(physicalnetwork.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/Pod.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Pod.py b/tools/marvin/marvin/integration/lib/base/Pod.py index 3c57d09..d3d822f 100644 --- a/tools/marvin/marvin/integration/lib/base/Pod.py +++ b/tools/marvin/marvin/integration/lib/base/Pod.py @@ -30,8 +30,8 @@ class Pod(CloudStackEntity): @classmethod def create(cls, apiclient, PodFactory, **kwargs): cmd = createPod.createPodCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in PodFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in PodFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] pod = apiclient.createPod(cmd) return Pod(pod.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/PortForwardingRule.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/PortForwardingRule.py b/tools/marvin/marvin/integration/lib/base/PortForwardingRule.py index ad32244..5d69a1a 100644 --- a/tools/marvin/marvin/integration/lib/base/PortForwardingRule.py +++ b/tools/marvin/marvin/integration/lib/base/PortForwardingRule.py @@ -30,8 +30,8 @@ class PortForwardingRule(CloudStackEntity): @classmethod def create(cls, apiclient, PortForwardingRuleFactory, **kwargs): cmd = createPortForwardingRule.createPortForwardingRuleCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in PortForwardingRuleFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in PortForwardingRuleFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] portforwardingrule = apiclient.createPortForwardingRule(cmd) return PortForwardingRule(portforwardingrule.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/PrivateGateway.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/PrivateGateway.py b/tools/marvin/marvin/integration/lib/base/PrivateGateway.py index 543dc73..c121cc0 100644 --- a/tools/marvin/marvin/integration/lib/base/PrivateGateway.py +++ b/tools/marvin/marvin/integration/lib/base/PrivateGateway.py @@ -29,8 +29,8 @@ class PrivateGateway(CloudStackEntity): @classmethod def create(cls, apiclient, PrivateGatewayFactory, **kwargs): cmd = createPrivateGateway.createPrivateGatewayCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in PrivateGatewayFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in PrivateGatewayFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] privategateway = apiclient.createPrivateGateway(cmd) return PrivateGateway(privategateway.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/Project.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Project.py b/tools/marvin/marvin/integration/lib/base/Project.py index ce3ca29..8ca176e 100644 --- a/tools/marvin/marvin/integration/lib/base/Project.py +++ b/tools/marvin/marvin/integration/lib/base/Project.py @@ -39,8 +39,8 @@ class Project(CloudStackEntity): @classmethod def create(cls, apiclient, ProjectFactory, **kwargs): cmd = createProject.createProjectCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in ProjectFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in ProjectFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] project = apiclient.createProject(cmd) return Project(project.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/Region.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Region.py b/tools/marvin/marvin/integration/lib/base/Region.py new file mode 100644 index 0000000..03631ab --- /dev/null +++ b/tools/marvin/marvin/integration/lib/base/Region.py @@ -0,0 +1,58 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import addRegion +from marvin.cloudstackAPI import listRegions +from marvin.cloudstackAPI import updateRegion +from marvin.cloudstackAPI import removeRegion + +class Region(CloudStackEntity): + + + def __init__(self, items): + self.__dict__.update(items) + + + def add(self, apiclient, endpoint, id, name, **kwargs): + cmd = addRegion.addRegionCmd() + cmd.id = id + cmd.endpoint = endpoint + cmd.name = name + [setattr(cmd, key, value) for key,value in kwargs.items] + region = apiclient.addRegion(cmd) + + + @classmethod + def list(self, apiclient, **kwargs): + cmd = listRegions.listRegionsCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + region = apiclient.listRegions(cmd) + return map(lambda e: Region(e.__dict__), region) + + + def update(self, apiclient, id, **kwargs): + cmd = updateRegion.updateRegionCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + region = apiclient.updateRegion(cmd) + + + def remove(self, apiclient, id, **kwargs): + cmd = removeRegion.removeRegionCmd() + cmd.id = id + [setattr(cmd, key, value) for key,value in kwargs.items] + region = apiclient.removeRegion(cmd) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/RemoteAccessVpn.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/RemoteAccessVpn.py b/tools/marvin/marvin/integration/lib/base/RemoteAccessVpn.py index 7eb1871..047559f 100644 --- a/tools/marvin/marvin/integration/lib/base/RemoteAccessVpn.py +++ b/tools/marvin/marvin/integration/lib/base/RemoteAccessVpn.py @@ -29,8 +29,8 @@ class RemoteAccessVpn(CloudStackEntity): @classmethod def create(cls, apiclient, RemoteAccessVpnFactory, **kwargs): cmd = createRemoteAccessVpn.createRemoteAccessVpnCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in RemoteAccessVpnFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in RemoteAccessVpnFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] remoteaccessvpn = apiclient.createRemoteAccessVpn(cmd) return RemoteAccessVpn(remoteaccessvpn.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/SSHKeyPair.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/SSHKeyPair.py b/tools/marvin/marvin/integration/lib/base/SSHKeyPair.py index ed1dd4a..88859d5 100644 --- a/tools/marvin/marvin/integration/lib/base/SSHKeyPair.py +++ b/tools/marvin/marvin/integration/lib/base/SSHKeyPair.py @@ -30,8 +30,8 @@ class SSHKeyPair(CloudStackEntity): @classmethod def create(cls, apiclient, SSHKeyPairFactory, **kwargs): cmd = createSSHKeyPair.createSSHKeyPairCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in SSHKeyPairFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in SSHKeyPairFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] sshkeypair = apiclient.createSSHKeyPair(cmd) return SSHKeyPair(sshkeypair.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/SecurityGroup.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/SecurityGroup.py b/tools/marvin/marvin/integration/lib/base/SecurityGroup.py index 204f778..9103538 100644 --- a/tools/marvin/marvin/integration/lib/base/SecurityGroup.py +++ b/tools/marvin/marvin/integration/lib/base/SecurityGroup.py @@ -29,8 +29,8 @@ class SecurityGroup(CloudStackEntity): @classmethod def create(cls, apiclient, SecurityGroupFactory, **kwargs): cmd = createSecurityGroup.createSecurityGroupCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in SecurityGroupFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in SecurityGroupFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] securitygroup = apiclient.createSecurityGroup(cmd) return SecurityGroup(securitygroup.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/ServiceOffering.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/ServiceOffering.py b/tools/marvin/marvin/integration/lib/base/ServiceOffering.py index 088b27a..8e8174c 100644 --- a/tools/marvin/marvin/integration/lib/base/ServiceOffering.py +++ b/tools/marvin/marvin/integration/lib/base/ServiceOffering.py @@ -30,8 +30,8 @@ class ServiceOffering(CloudStackEntity): @classmethod def create(cls, apiclient, ServiceOfferingFactory, **kwargs): cmd = createServiceOffering.createServiceOfferingCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in ServiceOfferingFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in ServiceOfferingFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] serviceoffering = apiclient.createServiceOffering(cmd) return ServiceOffering(serviceoffering.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/Simulator.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Simulator.py b/tools/marvin/marvin/integration/lib/base/Simulator.py new file mode 100644 index 0000000..5c58dde --- /dev/null +++ b/tools/marvin/marvin/integration/lib/base/Simulator.py @@ -0,0 +1,32 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import configureSimulator + +class Simulator(CloudStackEntity): + + + def __init__(self, items): + self.__dict__.update(items) + + + def configure(self, apiclient, name, value, **kwargs): + cmd = configureSimulator.configureSimulatorCmd() + cmd.name = name + cmd.value = value + [setattr(cmd, key, value) for key,value in kwargs.items] + simulator = apiclient.configureSimulator(cmd) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/Snapshot.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Snapshot.py b/tools/marvin/marvin/integration/lib/base/Snapshot.py index ab4eebd..989e7fb 100644 --- a/tools/marvin/marvin/integration/lib/base/Snapshot.py +++ b/tools/marvin/marvin/integration/lib/base/Snapshot.py @@ -29,8 +29,8 @@ class Snapshot(CloudStackEntity): @classmethod def create(cls, apiclient, SnapshotFactory, **kwargs): cmd = createSnapshot.createSnapshotCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in SnapshotFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in SnapshotFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] snapshot = apiclient.createSnapshot(cmd) return Snapshot(snapshot.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/SnapshotPolicy.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/SnapshotPolicy.py b/tools/marvin/marvin/integration/lib/base/SnapshotPolicy.py index 2ce10e4..18394b1 100644 --- a/tools/marvin/marvin/integration/lib/base/SnapshotPolicy.py +++ b/tools/marvin/marvin/integration/lib/base/SnapshotPolicy.py @@ -27,8 +27,8 @@ class SnapshotPolicy(CloudStackEntity): @classmethod def create(cls, apiclient, SnapshotPolicyFactory, **kwargs): cmd = createSnapshotPolicy.createSnapshotPolicyCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in SnapshotPolicyFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in SnapshotPolicyFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] snapshotpolicy = apiclient.createSnapshotPolicy(cmd) return SnapshotPolicy(snapshotpolicy.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/StaticRoute.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/StaticRoute.py b/tools/marvin/marvin/integration/lib/base/StaticRoute.py index 10830bd..f96a4dc 100644 --- a/tools/marvin/marvin/integration/lib/base/StaticRoute.py +++ b/tools/marvin/marvin/integration/lib/base/StaticRoute.py @@ -29,8 +29,8 @@ class StaticRoute(CloudStackEntity): @classmethod def create(cls, apiclient, StaticRouteFactory, **kwargs): cmd = createStaticRoute.createStaticRouteCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in StaticRouteFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in StaticRouteFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] staticroute = apiclient.createStaticRoute(cmd) return StaticRoute(staticroute.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/StorageNetworkIpRange.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/StorageNetworkIpRange.py b/tools/marvin/marvin/integration/lib/base/StorageNetworkIpRange.py index 220f8c6..2bc6b5b 100644 --- a/tools/marvin/marvin/integration/lib/base/StorageNetworkIpRange.py +++ b/tools/marvin/marvin/integration/lib/base/StorageNetworkIpRange.py @@ -30,8 +30,8 @@ class StorageNetworkIpRange(CloudStackEntity): @classmethod def create(cls, apiclient, StorageNetworkIpRangeFactory, **kwargs): cmd = createStorageNetworkIpRange.createStorageNetworkIpRangeCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in StorageNetworkIpRangeFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in StorageNetworkIpRangeFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] storagenetworkiprange = apiclient.createStorageNetworkIpRange(cmd) return StorageNetworkIpRange(storagenetworkiprange.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/StoragePool.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/StoragePool.py b/tools/marvin/marvin/integration/lib/base/StoragePool.py index 3dc8bcb..d15de83 100644 --- a/tools/marvin/marvin/integration/lib/base/StoragePool.py +++ b/tools/marvin/marvin/integration/lib/base/StoragePool.py @@ -30,8 +30,8 @@ class StoragePool(CloudStackEntity): @classmethod def create(cls, apiclient, StoragePoolFactory, **kwargs): cmd = createStoragePool.createStoragePoolCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in StoragePoolFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in StoragePoolFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] storagepool = apiclient.createStoragePool(cmd) return StoragePool(storagepool.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/Tags.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Tags.py b/tools/marvin/marvin/integration/lib/base/Tags.py index 9bf22fb..e46742b 100644 --- a/tools/marvin/marvin/integration/lib/base/Tags.py +++ b/tools/marvin/marvin/integration/lib/base/Tags.py @@ -29,8 +29,8 @@ class Tags(CloudStackEntity): @classmethod def create(cls, apiclient, TagsFactory, **kwargs): cmd = createTags.createTagsCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in TagsFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in TagsFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] tags = apiclient.createTags(cmd) return Tags(tags.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/Template.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Template.py b/tools/marvin/marvin/integration/lib/base/Template.py index 559e1f2..1f62158 100644 --- a/tools/marvin/marvin/integration/lib/base/Template.py +++ b/tools/marvin/marvin/integration/lib/base/Template.py @@ -42,8 +42,8 @@ class Template(CloudStackEntity): @classmethod def create(cls, apiclient, TemplateFactory, **kwargs): cmd = createTemplate.createTemplateCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in TemplateFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in TemplateFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] template = apiclient.createTemplate(cmd) return Template(template.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/User.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/User.py b/tools/marvin/marvin/integration/lib/base/User.py index a89969b..37097bf 100644 --- a/tools/marvin/marvin/integration/lib/base/User.py +++ b/tools/marvin/marvin/integration/lib/base/User.py @@ -55,8 +55,8 @@ class User(CloudStackEntity): @classmethod def create(cls, apiclient, UserFactory, **kwargs): cmd = createUser.createUserCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in UserFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in UserFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] user = apiclient.createUser(cmd) return User(user.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/VMSnapshot.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/VMSnapshot.py b/tools/marvin/marvin/integration/lib/base/VMSnapshot.py new file mode 100644 index 0000000..66a1707 --- /dev/null +++ b/tools/marvin/marvin/integration/lib/base/VMSnapshot.py @@ -0,0 +1,50 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from marvin.integration.lib.base import CloudStackEntity +from marvin.cloudstackAPI import createVMSnapshot +from marvin.cloudstackAPI import listVMSnapshot +from marvin.cloudstackAPI import deleteVMSnapshot + +class VMSnapshot(CloudStackEntity): + + + def __init__(self, items): + self.__dict__.update(items) + + + @classmethod + def create(cls, apiclient, VMSnapshotFactory, **kwargs): + cmd = createVMSnapshot.createVMSnapshotCmd() + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VMSnapshotFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + vmsnapshot = apiclient.createVMSnapshot(cmd) + return VMSnapshot(vmsnapshot.__dict__) + + + @classmethod + def list(self, apiclient, **kwargs): + cmd = listVMSnapshot.listVMSnapshotCmd() + [setattr(cmd, key, value) for key,value in kwargs.items] + vmsnapshot = apiclient.listVMSnapshot(cmd) + return map(lambda e: VMSnapshot(e.__dict__), vmsnapshot) + + + def delete(self, apiclient, vmsnapshotid, **kwargs): + cmd = deleteVMSnapshot.deleteVMSnapshotCmd() + cmd.vmsnapshotid = vmsnapshotid + [setattr(cmd, key, value) for key,value in kwargs.items] + vmsnapshot = apiclient.deleteVMSnapshot(cmd) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/VPC.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/VPC.py b/tools/marvin/marvin/integration/lib/base/VPC.py index 4e1b59a..6e48ce3 100644 --- a/tools/marvin/marvin/integration/lib/base/VPC.py +++ b/tools/marvin/marvin/integration/lib/base/VPC.py @@ -31,8 +31,8 @@ class VPC(CloudStackEntity): @classmethod def create(cls, apiclient, VPCFactory, **kwargs): cmd = createVPC.createVPCCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VPCFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VPCFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] vpc = apiclient.createVPC(cmd) return VPC(vpc.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/VPCOffering.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/VPCOffering.py b/tools/marvin/marvin/integration/lib/base/VPCOffering.py index 557b94e..c6d2bab 100644 --- a/tools/marvin/marvin/integration/lib/base/VPCOffering.py +++ b/tools/marvin/marvin/integration/lib/base/VPCOffering.py @@ -30,8 +30,8 @@ class VPCOffering(CloudStackEntity): @classmethod def create(cls, apiclient, VPCOfferingFactory, **kwargs): cmd = createVPCOffering.createVPCOfferingCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VPCOfferingFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VPCOfferingFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] vpcoffering = apiclient.createVPCOffering(cmd) return VPCOffering(vpcoffering.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/VirtualMachine.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/VirtualMachine.py b/tools/marvin/marvin/integration/lib/base/VirtualMachine.py index 804729e..c788f0c 100644 --- a/tools/marvin/marvin/integration/lib/base/VirtualMachine.py +++ b/tools/marvin/marvin/integration/lib/base/VirtualMachine.py @@ -43,8 +43,8 @@ class VirtualMachine(CloudStackEntity): @classmethod def deploy(cls, apiclient, VirtualMachineFactory, **kwargs): cmd = deployVirtualMachine.deployVirtualMachineCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VirtualMachineFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VirtualMachineFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] virtualmachine = apiclient.deployVirtualMachine(cmd) return VirtualMachine(virtualmachine.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py b/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py index 45b77db..246162c 100644 --- a/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py +++ b/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py @@ -29,8 +29,8 @@ class VirtualRouterElement(CloudStackEntity): @classmethod def create(cls, apiclient, VirtualRouterElementFactory, **kwargs): cmd = createVirtualRouterElement.createVirtualRouterElementCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VirtualRouterElementFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VirtualRouterElementFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] virtualrouterelement = apiclient.createVirtualRouterElement(cmd) return VirtualRouterElement(virtualrouterelement.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/VlanIpRange.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/VlanIpRange.py b/tools/marvin/marvin/integration/lib/base/VlanIpRange.py index 17eb7da..db1e4f0 100644 --- a/tools/marvin/marvin/integration/lib/base/VlanIpRange.py +++ b/tools/marvin/marvin/integration/lib/base/VlanIpRange.py @@ -29,8 +29,8 @@ class VlanIpRange(CloudStackEntity): @classmethod def create(cls, apiclient, VlanIpRangeFactory, **kwargs): cmd = createVlanIpRange.createVlanIpRangeCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VlanIpRangeFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VlanIpRangeFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] vlaniprange = apiclient.createVlanIpRange(cmd) return VlanIpRange(vlaniprange.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/Volume.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Volume.py b/tools/marvin/marvin/integration/lib/base/Volume.py index 797113a..8c421c9 100644 --- a/tools/marvin/marvin/integration/lib/base/Volume.py +++ b/tools/marvin/marvin/integration/lib/base/Volume.py @@ -42,8 +42,8 @@ class Volume(CloudStackEntity): @classmethod def create(cls, apiclient, VolumeFactory, **kwargs): cmd = createVolume.createVolumeCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VolumeFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VolumeFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] volume = apiclient.createVolume(cmd) return Volume(volume.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/VpnConnection.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/VpnConnection.py b/tools/marvin/marvin/integration/lib/base/VpnConnection.py index 8b90ae1..d76e5de 100644 --- a/tools/marvin/marvin/integration/lib/base/VpnConnection.py +++ b/tools/marvin/marvin/integration/lib/base/VpnConnection.py @@ -37,8 +37,8 @@ class VpnConnection(CloudStackEntity): @classmethod def create(cls, apiclient, VpnConnectionFactory, **kwargs): cmd = createVpnConnection.createVpnConnectionCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VpnConnectionFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VpnConnectionFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] vpnconnection = apiclient.createVpnConnection(cmd) return VpnConnection(vpnconnection.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py b/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py index 562fccb..c57054b 100644 --- a/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py +++ b/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py @@ -30,8 +30,8 @@ class VpnCustomerGateway(CloudStackEntity): @classmethod def create(cls, apiclient, VpnCustomerGatewayFactory, **kwargs): cmd = createVpnCustomerGateway.createVpnCustomerGatewayCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VpnCustomerGatewayFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VpnCustomerGatewayFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] vpncustomergateway = apiclient.createVpnCustomerGateway(cmd) return VpnCustomerGateway(vpncustomergateway.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/VpnGateway.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/VpnGateway.py b/tools/marvin/marvin/integration/lib/base/VpnGateway.py index d5cd0df..f39e7a7 100644 --- a/tools/marvin/marvin/integration/lib/base/VpnGateway.py +++ b/tools/marvin/marvin/integration/lib/base/VpnGateway.py @@ -29,8 +29,8 @@ class VpnGateway(CloudStackEntity): @classmethod def create(cls, apiclient, VpnGatewayFactory, **kwargs): cmd = createVpnGateway.createVpnGatewayCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VpnGatewayFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VpnGatewayFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] vpngateway = apiclient.createVpnGateway(cmd) return VpnGateway(vpngateway.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/base/Zone.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Zone.py b/tools/marvin/marvin/integration/lib/base/Zone.py index f84e454..feac7c6 100644 --- a/tools/marvin/marvin/integration/lib/base/Zone.py +++ b/tools/marvin/marvin/integration/lib/base/Zone.py @@ -30,8 +30,8 @@ class Zone(CloudStackEntity): @classmethod def create(cls, apiclient, ZoneFactory, **kwargs): cmd = createZone.createZoneCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in ZoneFactory.attributes()] - [setattr(cmd, key, value) for key,value in kwargs.items] + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in ZoneFactory.__dict__.iteritems()] + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] zone = apiclient.createZone(cmd) return Zone(zone.__dict__) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/factory/AccountFactory.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/factory/AccountFactory.py b/tools/marvin/marvin/integration/lib/factory/AccountFactory.py index 894f92e..dc543d4 100644 --- a/tools/marvin/marvin/integration/lib/factory/AccountFactory.py +++ b/tools/marvin/marvin/integration/lib/factory/AccountFactory.py @@ -28,13 +28,14 @@ class AccountFactory(CloudStackBaseFactory): email = factory.LazyAttribute(lambda e: '{0}.{1}@cloudstack.org'.format(e.firstname, e.lastname).lower()) firstname = 'fname-'+random_gen() lastname = 'lname-'+random_gen() - username = None + username = firstname + lastname # Password Encoding mdf = hashlib.md5() mdf.update('password') password = mdf.hexdigest() + class AdminAccountFactory(AccountFactory): accounttype = 1 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/factory/StoragePoolFactory.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/factory/StoragePoolFactory.py b/tools/marvin/marvin/integration/lib/factory/StoragePoolFactory.py index 3803bfc..775375d 100644 --- a/tools/marvin/marvin/integration/lib/factory/StoragePoolFactory.py +++ b/tools/marvin/marvin/integration/lib/factory/StoragePoolFactory.py @@ -25,3 +25,6 @@ class StoragePoolFactory(factory.Factory): podid = None url = None zoneid = None + name = None + url = None + zoneid = None http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/factory/VMSnapshotFactory.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/factory/VMSnapshotFactory.py b/tools/marvin/marvin/integration/lib/factory/VMSnapshotFactory.py new file mode 100644 index 0000000..bbd0bd7 --- /dev/null +++ b/tools/marvin/marvin/integration/lib/factory/VMSnapshotFactory.py @@ -0,0 +1,23 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +import factory +from marvin.integration.lib.base import VMSnapshot +class VMSnapshotFactory(factory.Factory): + + FACTORY_FOR = VMSnapshot.VMSnapshot + + virtualmachineid = None http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/factory/test/__init__.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/factory/test/__init__.py b/tools/marvin/marvin/integration/lib/factory/test/__init__.py new file mode 100644 index 0000000..d216be4 --- /dev/null +++ b/tools/marvin/marvin/integration/lib/factory/test/__init__.py @@ -0,0 +1,16 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/factory/test/testFactories.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/factory/test/testFactories.py b/tools/marvin/marvin/integration/lib/factory/test/testFactories.py new file mode 100644 index 0000000..eec44de --- /dev/null +++ b/tools/marvin/marvin/integration/lib/factory/test/testFactories.py @@ -0,0 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import unittest +from marvin.integration.lib.factory import AccountFactory +from marvin.integration.lib.base import Account +from marvin.cloudstackTestClient import cloudstackTestClient + +class AccountFactoryTest(unittest.TestCase): + def setUp(self): + self.apiClient = cloudstackTestClient(mgtSvr='localhost') + + def test_userAccountFactory(self): + af = AccountFactory.AdminAccountFactory() + accnt = Account.Account.create(apiclient=self.apiClient, AccountFactory=af) + self.assertTrue(accnt is not None, msg="no account created by factory") + + def tearDown(self): + self.apiClient.close() \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ebc6f9a/tools/marvin/marvin/integration/lib/generateBase.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/generateBase.py b/tools/marvin/marvin/integration/lib/generateBase.py index 5f5e3df..f94043e 100644 --- a/tools/marvin/marvin/integration/lib/generateBase.py +++ b/tools/marvin/marvin/integration/lib/generateBase.py @@ -126,8 +126,8 @@ def write_entity_classes(entities): if action in ['create', 'deploy']: 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 + '[setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in %sFactory.__dict__.iteritems()]'%entity) + body.append(tabspace*2 + '[setattr(cmd, key, value) for key,value in kwargs.iteritems()]') body.append(tabspace*2 + '%s = apiclient.%s(cmd)'%(entity.lower(), details['apimodule'])) body.append(tabspace*2 + 'return %s(%s.__dict__)'%(entity, entity.lower())) else: @@ -185,7 +185,7 @@ def write_entity_factory(entity, actions): code += 'from marvin.integration.lib.base import %s\n'%entity code += 'class %sFactory(factory.Factory):'%entity code += '\n\n' - code += tabspace + 'FACTORY_FOR = %s\n\n'%entity + code += tabspace + 'FACTORY_FOR = %s.%s\n\n'%(entity,entity) for arg in factory_defaults: code += tabspace + '%s = None\n'%arg with open("./factory/%sFactory.py"%entity, "w") as writer: