From aa4651bcc31ba36473a55ccff989f06d48896807 Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Tue, 9 Apr 2013 17:57:33 +0530 Subject: [PATCH] marvin_refactor: removing redundant entities Some entities do not conform to the CRUD format and define extra verbs - eg: markDefaultNicForVirtualMachine, ldapConfig, ldapRemove etc. These are refactored and combined into their respective entities. Signed-off-by: Prasanna Santhanam --- .../marvin/integration/lib/base/Account.py | 11 ++++ .../lib/base/AccountFromProject.py | 34 ---------- .../integration/lib/base/AccountToProject.py | 33 ---------- .../integration/lib/base/AutoScalePolicies.py | 32 --------- .../integration/lib/base/AutoScalePolicy.py | 8 +++ .../marvin/integration/lib/base/Config.py | 32 --------- .../lib/base/DefaultNicForVirtualMachine.py | 34 ---------- .../lib/base/DefaultZoneForAccount.py | 35 ---------- .../lib/base/FromGlobalLoadBalancerRule.py | 34 ---------- .../lib/base/FromLoadBalancerRule.py | 34 ---------- .../lib/base/GlobalLoadBalancerRule.py | 26 ++++++-- .../marvin/integration/lib/base/Host.py | 29 ++++++++ .../lib/base/HostForMaintenance.py | 33 ---------- .../integration/lib/base/HostMaintenance.py | 33 ---------- .../integration/lib/base/HostPassword.py | 34 ---------- .../marvin/integration/lib/base/IpFromNic.py | 33 ---------- .../marvin/integration/lib/base/IpToNic.py | 33 ---------- .../lib/base/LBHealthCheckPolicies.py | 33 ---------- .../lib/base/LBHealthCheckPolicy.py | 10 +++ .../lib/base/LBStickinessPolicies.py | 33 ---------- .../lib/base/LBStickinessPolicy.py | 10 +++ .../lib/base/{Remove.py => Ldap.py} | 13 +++- .../integration/lib/base/LoadBalancerRule.py | 36 ++++++++-- .../lib/base/LoadBalancerRuleInstances.py | 33 ---------- .../integration/lib/base/{Nics.py => Nic.py} | 22 ++++++- .../lib/base/NicFromVirtualMachine.py | 34 ---------- .../lib/base/NicToVirtualMachine.py | 34 ---------- .../integration/lib/base/NiciraNvpDevice.py | 9 +++ .../lib/base/NiciraNvpDeviceNetworks.py | 33 ---------- .../lib/base/PasswordForVirtualMachine.py | 33 ---------- .../integration/lib/base/PhysicalNetwork.py | 6 +- .../marvin/marvin/integration/lib/base/Pod.py | 6 +- .../lib/base/PortForwardingRule.py | 3 +- .../integration/lib/base/PrivateGateway.py | 3 +- .../marvin/integration/lib/base/Project.py | 41 +++++++++--- .../integration/lib/base/ProjectAccounts.py | 33 ---------- .../lib/base/SSHKeyForVirtualMachine.py | 34 ---------- .../integration/lib/base/SecurityGroup.py | 30 +++++++++ .../lib/base/SecurityGroupEgress.py | 42 ------------ .../lib/base/SecurityGroupIngress.py | 42 ------------ .../marvin/integration/lib/base/Snapshot.py | 3 +- .../integration/lib/base/SnapshotPolicies.py | 42 ------------ .../integration/lib/base/SnapshotPolicy.py | 19 ++++++ .../lib/base/StorageMaintenance.py | 43 ------------ .../integration/lib/base/StoragePool.py | 18 +++++ .../lib/base/ToGlobalLoadBalancerRule.py | 34 ---------- .../lib/base/ToLoadBalancerRule.py | 34 ---------- .../marvin/integration/lib/base/User.py | 9 +++ .../marvin/integration/lib/base/UserKeys.py | 33 ---------- .../integration/lib/base/VirtualMachine.py | 66 +++++++++++++++---- 50 files changed, 332 insertions(+), 1050 deletions(-) delete mode 100644 tools/marvin/marvin/integration/lib/base/AccountFromProject.py delete mode 100644 tools/marvin/marvin/integration/lib/base/AccountToProject.py delete mode 100644 tools/marvin/marvin/integration/lib/base/AutoScalePolicies.py delete mode 100644 tools/marvin/marvin/integration/lib/base/Config.py delete mode 100644 tools/marvin/marvin/integration/lib/base/DefaultNicForVirtualMachine.py delete mode 100644 tools/marvin/marvin/integration/lib/base/DefaultZoneForAccount.py delete mode 100644 tools/marvin/marvin/integration/lib/base/FromGlobalLoadBalancerRule.py delete mode 100644 tools/marvin/marvin/integration/lib/base/FromLoadBalancerRule.py delete mode 100644 tools/marvin/marvin/integration/lib/base/HostForMaintenance.py delete mode 100644 tools/marvin/marvin/integration/lib/base/HostMaintenance.py delete mode 100644 tools/marvin/marvin/integration/lib/base/HostPassword.py delete mode 100644 tools/marvin/marvin/integration/lib/base/IpFromNic.py delete mode 100644 tools/marvin/marvin/integration/lib/base/IpToNic.py delete mode 100644 tools/marvin/marvin/integration/lib/base/LBHealthCheckPolicies.py delete mode 100644 tools/marvin/marvin/integration/lib/base/LBStickinessPolicies.py rename tools/marvin/marvin/integration/lib/base/{Remove.py => Ldap.py} (75%) delete mode 100644 tools/marvin/marvin/integration/lib/base/LoadBalancerRuleInstances.py rename tools/marvin/marvin/integration/lib/base/{Nics.py => Nic.py} (63%) delete mode 100644 tools/marvin/marvin/integration/lib/base/NicFromVirtualMachine.py delete mode 100644 tools/marvin/marvin/integration/lib/base/NicToVirtualMachine.py delete mode 100644 tools/marvin/marvin/integration/lib/base/NiciraNvpDeviceNetworks.py delete mode 100644 tools/marvin/marvin/integration/lib/base/PasswordForVirtualMachine.py delete mode 100644 tools/marvin/marvin/integration/lib/base/ProjectAccounts.py delete mode 100644 tools/marvin/marvin/integration/lib/base/SSHKeyForVirtualMachine.py delete mode 100644 tools/marvin/marvin/integration/lib/base/SecurityGroupEgress.py delete mode 100644 tools/marvin/marvin/integration/lib/base/SecurityGroupIngress.py delete mode 100644 tools/marvin/marvin/integration/lib/base/SnapshotPolicies.py delete mode 100644 tools/marvin/marvin/integration/lib/base/StorageMaintenance.py delete mode 100644 tools/marvin/marvin/integration/lib/base/ToGlobalLoadBalancerRule.py delete mode 100644 tools/marvin/marvin/integration/lib/base/ToLoadBalancerRule.py delete mode 100644 tools/marvin/marvin/integration/lib/base/UserKeys.py diff --git a/tools/marvin/marvin/integration/lib/base/Account.py b/tools/marvin/marvin/integration/lib/base/Account.py index 79a61c9ebf4..b0aebbf12f4 100644 --- a/tools/marvin/marvin/integration/lib/base/Account.py +++ b/tools/marvin/marvin/integration/lib/base/Account.py @@ -22,6 +22,7 @@ from marvin.cloudstackAPI import listAccounts from marvin.cloudstackAPI import updateAccount from marvin.cloudstackAPI import disableAccount from marvin.cloudstackAPI import deleteAccount +from marvin.cloudstackAPI import markDefaultZoneForAccount class Account(CloudStackEntity.CloudStackEntity): @@ -90,3 +91,13 @@ class Account(CloudStackEntity.CloudStackEntity): [setattr(cmd, key, value) for key,value in kwargs.iteritems()] account = apiclient.deleteAccount(cmd) return account + + def mark(self, apiclient, zoneid, **kwargs): + cmd = markDefaultZoneForAccount.markDefaultZoneForAccountCmd() + cmd.id = self.id + cmd.account = self.account + cmd.domainid = self.domainid + cmd.zoneid = zoneid + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + defaultzoneforaccount = apiclient.markDefaultZoneForAccount(cmd) + return defaultzoneforaccount diff --git a/tools/marvin/marvin/integration/lib/base/AccountFromProject.py b/tools/marvin/marvin/integration/lib/base/AccountFromProject.py deleted file mode 100644 index 68b49b09b14..00000000000 --- a/tools/marvin/marvin/integration/lib/base/AccountFromProject.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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 deleteAccountFromProject - -class AccountFromProject(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def delete(self, apiclient, projectid, account, **kwargs): - cmd = deleteAccountFromProject.deleteAccountFromProjectCmd() - cmd.id = self.id - cmd.account = account - cmd.projectid = projectid - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - accountfromproject = apiclient.deleteAccountFromProject(cmd) - return accountfromproject diff --git a/tools/marvin/marvin/integration/lib/base/AccountToProject.py b/tools/marvin/marvin/integration/lib/base/AccountToProject.py deleted file mode 100644 index 0f197e95221..00000000000 --- a/tools/marvin/marvin/integration/lib/base/AccountToProject.py +++ /dev/null @@ -1,33 +0,0 @@ -# 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 addAccountToProject - -class AccountToProject(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def add(self, apiclient, projectid, **kwargs): - cmd = addAccountToProject.addAccountToProjectCmd() - cmd.id = self.id - cmd.projectid = projectid - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - accounttoproject = apiclient.addAccountToProject(cmd) - return accounttoproject diff --git a/tools/marvin/marvin/integration/lib/base/AutoScalePolicies.py b/tools/marvin/marvin/integration/lib/base/AutoScalePolicies.py deleted file mode 100644 index 4aa617f341d..00000000000 --- a/tools/marvin/marvin/integration/lib/base/AutoScalePolicies.py +++ /dev/null @@ -1,32 +0,0 @@ -# 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 listAutoScalePolicies - -class AutoScalePolicies(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - @classmethod - def list(self, apiclient, **kwargs): - cmd = listAutoScalePolicies.listAutoScalePoliciesCmd() - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - 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 975d49a86c2..6b42ec52382 100644 --- a/tools/marvin/marvin/integration/lib/base/AutoScalePolicy.py +++ b/tools/marvin/marvin/integration/lib/base/AutoScalePolicy.py @@ -18,6 +18,7 @@ from marvin.integration.lib.base import CloudStackEntity from marvin.cloudstackAPI import createAutoScalePolicy from marvin.cloudstackAPI import updateAutoScalePolicy from marvin.cloudstackAPI import deleteAutoScalePolicy +from marvin.cloudstackAPI import listAutoScalePolicies class AutoScalePolicy(CloudStackEntity.CloudStackEntity): @@ -51,3 +52,10 @@ class AutoScalePolicy(CloudStackEntity.CloudStackEntity): [setattr(cmd, key, value) for key,value in kwargs.iteritems()] autoscalepolicy = apiclient.deleteAutoScalePolicy(cmd) return autoscalepolicy + + @classmethod + def list(self, apiclient, **kwargs): + cmd = listAutoScalePolicies.listAutoScalePoliciesCmd() + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + autoscalepolicies = apiclient.listAutoScalePolicies(cmd) + return map(lambda e: AutoScalePolicy(e.__dict__), autoscalepolicies) diff --git a/tools/marvin/marvin/integration/lib/base/Config.py b/tools/marvin/marvin/integration/lib/base/Config.py deleted file mode 100644 index 0f22ffdfafd..00000000000 --- a/tools/marvin/marvin/integration/lib/base/Config.py +++ /dev/null @@ -1,32 +0,0 @@ -# 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 ldapConfig - -class Config(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def ldap(self, apiclient, **kwargs): - cmd = ldapConfig.ldapConfigCmd() - cmd.id = self.id - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - config = apiclient.ldapConfig(cmd) - return config diff --git a/tools/marvin/marvin/integration/lib/base/DefaultNicForVirtualMachine.py b/tools/marvin/marvin/integration/lib/base/DefaultNicForVirtualMachine.py deleted file mode 100644 index 09641d0b7ab..00000000000 --- a/tools/marvin/marvin/integration/lib/base/DefaultNicForVirtualMachine.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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 updateDefaultNicForVirtualMachine - -class DefaultNicForVirtualMachine(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def update(self, apiclient, nicid, virtualmachineid, **kwargs): - cmd = updateDefaultNicForVirtualMachine.updateDefaultNicForVirtualMachineCmd() - cmd.id = self.id - cmd.nicid = nicid - cmd.virtualmachineid = virtualmachineid - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - defaultnicforvirtualmachine = apiclient.updateDefaultNicForVirtualMachine(cmd) - return defaultnicforvirtualmachine diff --git a/tools/marvin/marvin/integration/lib/base/DefaultZoneForAccount.py b/tools/marvin/marvin/integration/lib/base/DefaultZoneForAccount.py deleted file mode 100644 index d8652d02d36..00000000000 --- a/tools/marvin/marvin/integration/lib/base/DefaultZoneForAccount.py +++ /dev/null @@ -1,35 +0,0 @@ -# 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 markDefaultZoneForAccount - -class DefaultZoneForAccount(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def mark(self, apiclient, account, domainid, zoneid, **kwargs): - cmd = markDefaultZoneForAccount.markDefaultZoneForAccountCmd() - cmd.id = self.id - cmd.account = account - cmd.domainid = domainid - cmd.zoneid = zoneid - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - defaultzoneforaccount = apiclient.markDefaultZoneForAccount(cmd) - return defaultzoneforaccount diff --git a/tools/marvin/marvin/integration/lib/base/FromGlobalLoadBalancerRule.py b/tools/marvin/marvin/integration/lib/base/FromGlobalLoadBalancerRule.py deleted file mode 100644 index 73c71234c64..00000000000 --- a/tools/marvin/marvin/integration/lib/base/FromGlobalLoadBalancerRule.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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 removeFromGlobalLoadBalancerRule - -class FromGlobalLoadBalancerRule(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def remove(self, apiclient, loadbalancerrulelist, id, **kwargs): - cmd = removeFromGlobalLoadBalancerRule.removeFromGlobalLoadBalancerRuleCmd() - cmd.id = self.id - cmd.id = id - cmd.loadbalancerrulelist = loadbalancerrulelist - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - fromgloballoadbalancerrule = apiclient.removeFromGlobalLoadBalancerRule(cmd) - return fromgloballoadbalancerrule diff --git a/tools/marvin/marvin/integration/lib/base/FromLoadBalancerRule.py b/tools/marvin/marvin/integration/lib/base/FromLoadBalancerRule.py deleted file mode 100644 index 0be12b6613e..00000000000 --- a/tools/marvin/marvin/integration/lib/base/FromLoadBalancerRule.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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 removeFromLoadBalancerRule - -class FromLoadBalancerRule(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def remove(self, apiclient, id, virtualmachineids, **kwargs): - cmd = removeFromLoadBalancerRule.removeFromLoadBalancerRuleCmd() - cmd.id = self.id - cmd.id = id - cmd.virtualmachineids = virtualmachineids - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - fromloadbalancerrule = apiclient.removeFromLoadBalancerRule(cmd) - return fromloadbalancerrule diff --git a/tools/marvin/marvin/integration/lib/base/GlobalLoadBalancerRule.py b/tools/marvin/marvin/integration/lib/base/GlobalLoadBalancerRule.py index 320d144249a..dbb821ed58c 100644 --- a/tools/marvin/marvin/integration/lib/base/GlobalLoadBalancerRule.py +++ b/tools/marvin/marvin/integration/lib/base/GlobalLoadBalancerRule.py @@ -19,6 +19,8 @@ from marvin.cloudstackAPI import createGlobalLoadBalancerRule from marvin.cloudstackAPI import listGlobalLoadBalancerRules from marvin.cloudstackAPI import updateGlobalLoadBalancerRule from marvin.cloudstackAPI import deleteGlobalLoadBalancerRule +from marvin.cloudstackAPI import removeFromGlobalLoadBalancerRule +from marvin.cloudstackAPI import assignToGlobalLoadBalancerRule class GlobalLoadBalancerRule(CloudStackEntity.CloudStackEntity): @@ -44,19 +46,35 @@ class GlobalLoadBalancerRule(CloudStackEntity.CloudStackEntity): return map(lambda e: GlobalLoadBalancerRule(e.__dict__), globalloadbalancerrule) - def update(self, apiclient, id, **kwargs): + def update(self, apiclient, **kwargs): cmd = updateGlobalLoadBalancerRule.updateGlobalLoadBalancerRuleCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] globalloadbalancerrule = apiclient.updateGlobalLoadBalancerRule(cmd) return globalloadbalancerrule - def delete(self, apiclient, id, **kwargs): + def delete(self, apiclient, **kwargs): cmd = deleteGlobalLoadBalancerRule.deleteGlobalLoadBalancerRuleCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] globalloadbalancerrule = apiclient.deleteGlobalLoadBalancerRule(cmd) return globalloadbalancerrule + + + def remove(self, apiclient, loadbalancerrulelist, **kwargs): + cmd = removeFromGlobalLoadBalancerRule.removeFromGlobalLoadBalancerRuleCmd() + cmd.id = self.id + cmd.loadbalancerrulelist = loadbalancerrulelist + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + fromgloballoadbalancerrule = apiclient.removeFromGlobalLoadBalancerRule(cmd) + return fromgloballoadbalancerrule + + + def assign(self, apiclient, loadbalancerrulelist, **kwargs): + cmd = assignToGlobalLoadBalancerRule.assignToGlobalLoadBalancerRuleCmd() + cmd.id = self.id + cmd.loadbalancerrulelist = loadbalancerrulelist + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + togloballoadbalancerrule = apiclient.assignToGlobalLoadBalancerRule(cmd) + return togloballoadbalancerrule \ No newline at end of file diff --git a/tools/marvin/marvin/integration/lib/base/Host.py b/tools/marvin/marvin/integration/lib/base/Host.py index dd6fd80d10b..04eaaf2002d 100644 --- a/tools/marvin/marvin/integration/lib/base/Host.py +++ b/tools/marvin/marvin/integration/lib/base/Host.py @@ -20,6 +20,9 @@ from marvin.cloudstackAPI import listHosts from marvin.cloudstackAPI import updateHost from marvin.cloudstackAPI import reconnectHost from marvin.cloudstackAPI import deleteHost +from marvin.cloudstackAPI import prepareHostForMaintenance +from marvin.cloudstackAPI import cancelHostMaintenance +from marvin.cloudstackAPI import updateHostPassword class Host(CloudStackEntity.CloudStackEntity): @@ -75,3 +78,29 @@ class Host(CloudStackEntity.CloudStackEntity): [setattr(cmd, key, value) for key,value in kwargs.iteritems()] host = apiclient.deleteHost(cmd) return host + + + def prepareMaintenance(self, apiclient, **kwargs): + cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd() + cmd.id = self.id + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + hostformaintenance = apiclient.prepareHostForMaintenance(cmd) + return hostformaintenance + + + def cancelMaintenance(self, apiclient, **kwargs): + cmd = cancelHostMaintenance.cancelHostMaintenanceCmd() + cmd.id = self.id + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + hostmaintenance = apiclient.cancelHostMaintenance(cmd) + return hostmaintenance + + + def updatePassword(self, apiclient, username, password, **kwargs): + cmd = updateHostPassword.updateHostPasswordCmd() + cmd.id = self.id + cmd.password = password + cmd.username = username + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + hostpassword = apiclient.updateHostPassword(cmd) + return hostpassword diff --git a/tools/marvin/marvin/integration/lib/base/HostForMaintenance.py b/tools/marvin/marvin/integration/lib/base/HostForMaintenance.py deleted file mode 100644 index b6d222b173b..00000000000 --- a/tools/marvin/marvin/integration/lib/base/HostForMaintenance.py +++ /dev/null @@ -1,33 +0,0 @@ -# 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 prepareHostForMaintenance - -class HostForMaintenance(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def prepare(self, apiclient, id, **kwargs): - cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd() - cmd.id = self.id - cmd.id = id - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - hostformaintenance = apiclient.prepareHostForMaintenance(cmd) - return hostformaintenance diff --git a/tools/marvin/marvin/integration/lib/base/HostMaintenance.py b/tools/marvin/marvin/integration/lib/base/HostMaintenance.py deleted file mode 100644 index 1a89d9e81ad..00000000000 --- a/tools/marvin/marvin/integration/lib/base/HostMaintenance.py +++ /dev/null @@ -1,33 +0,0 @@ -# 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 cancelHostMaintenance - -class HostMaintenance(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def cancel(self, apiclient, id, **kwargs): - cmd = cancelHostMaintenance.cancelHostMaintenanceCmd() - cmd.id = self.id - cmd.id = id - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - hostmaintenance = apiclient.cancelHostMaintenance(cmd) - return hostmaintenance diff --git a/tools/marvin/marvin/integration/lib/base/HostPassword.py b/tools/marvin/marvin/integration/lib/base/HostPassword.py deleted file mode 100644 index bd6d68b12e5..00000000000 --- a/tools/marvin/marvin/integration/lib/base/HostPassword.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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 updateHostPassword - -class HostPassword(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def update(self, apiclient, username, password, **kwargs): - cmd = updateHostPassword.updateHostPasswordCmd() - cmd.id = self.id - cmd.password = password - cmd.username = username - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - hostpassword = apiclient.updateHostPassword(cmd) - return hostpassword diff --git a/tools/marvin/marvin/integration/lib/base/IpFromNic.py b/tools/marvin/marvin/integration/lib/base/IpFromNic.py deleted file mode 100644 index f64763e7361..00000000000 --- a/tools/marvin/marvin/integration/lib/base/IpFromNic.py +++ /dev/null @@ -1,33 +0,0 @@ -# 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.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def remove(self, apiclient, id, **kwargs): - cmd = removeIpFromNic.removeIpFromNicCmd() - cmd.id = self.id - cmd.id = id - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - ipfromnic = apiclient.removeIpFromNic(cmd) - return ipfromnic diff --git a/tools/marvin/marvin/integration/lib/base/IpToNic.py b/tools/marvin/marvin/integration/lib/base/IpToNic.py deleted file mode 100644 index 42247bd8902..00000000000 --- a/tools/marvin/marvin/integration/lib/base/IpToNic.py +++ /dev/null @@ -1,33 +0,0 @@ -# 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.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def add(self, apiclient, nicid, **kwargs): - cmd = addIpToNic.addIpToNicCmd() - cmd.id = self.id - cmd.nicid = nicid - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - iptonic = apiclient.addIpToNic(cmd) - return iptonic diff --git a/tools/marvin/marvin/integration/lib/base/LBHealthCheckPolicies.py b/tools/marvin/marvin/integration/lib/base/LBHealthCheckPolicies.py deleted file mode 100644 index a2a79e18e54..00000000000 --- a/tools/marvin/marvin/integration/lib/base/LBHealthCheckPolicies.py +++ /dev/null @@ -1,33 +0,0 @@ -# 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 listLBHealthCheckPolicies - -class LBHealthCheckPolicies(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - @classmethod - def list(self, apiclient, lbruleid, **kwargs): - cmd = listLBHealthCheckPolicies.listLBHealthCheckPoliciesCmd() - cmd.lbruleid = lbruleid - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - lbhealthcheckpolicies = apiclient.listLBHealthCheckPolicies(cmd) - return map(lambda e: LBHealthCheckPolicies(e.__dict__), lbhealthcheckpolicies) diff --git a/tools/marvin/marvin/integration/lib/base/LBHealthCheckPolicy.py b/tools/marvin/marvin/integration/lib/base/LBHealthCheckPolicy.py index e6b10a3b12a..1ecc03daa24 100644 --- a/tools/marvin/marvin/integration/lib/base/LBHealthCheckPolicy.py +++ b/tools/marvin/marvin/integration/lib/base/LBHealthCheckPolicy.py @@ -17,6 +17,7 @@ from marvin.integration.lib.base import CloudStackEntity from marvin.cloudstackAPI import createLBHealthCheckPolicy from marvin.cloudstackAPI import deleteLBHealthCheckPolicy +from marvin.cloudstackAPI import listLBHealthCheckPolicies class LBHealthCheckPolicy(CloudStackEntity.CloudStackEntity): @@ -41,3 +42,12 @@ class LBHealthCheckPolicy(CloudStackEntity.CloudStackEntity): [setattr(cmd, key, value) for key,value in kwargs.iteritems()] lbhealthcheckpolicy = apiclient.deleteLBHealthCheckPolicy(cmd) return lbhealthcheckpolicy + + + @classmethod + def list(self, apiclient, lbruleid, **kwargs): + cmd = listLBHealthCheckPolicies.listLBHealthCheckPoliciesCmd() + cmd.lbruleid = lbruleid + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + lbhealthcheckpolicies = apiclient.listLBHealthCheckPolicies(cmd) + return map(lambda e: LBHealthCheckPolicy(e.__dict__), lbhealthcheckpolicies) diff --git a/tools/marvin/marvin/integration/lib/base/LBStickinessPolicies.py b/tools/marvin/marvin/integration/lib/base/LBStickinessPolicies.py deleted file mode 100644 index 3a7906096ca..00000000000 --- a/tools/marvin/marvin/integration/lib/base/LBStickinessPolicies.py +++ /dev/null @@ -1,33 +0,0 @@ -# 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 listLBStickinessPolicies - -class LBStickinessPolicies(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - @classmethod - def list(self, apiclient, lbruleid, **kwargs): - cmd = listLBStickinessPolicies.listLBStickinessPoliciesCmd() - cmd.lbruleid = lbruleid - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - 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 023f314f90d..280795b5ee8 100644 --- a/tools/marvin/marvin/integration/lib/base/LBStickinessPolicy.py +++ b/tools/marvin/marvin/integration/lib/base/LBStickinessPolicy.py @@ -17,6 +17,7 @@ from marvin.integration.lib.base import CloudStackEntity from marvin.cloudstackAPI import createLBStickinessPolicy from marvin.cloudstackAPI import deleteLBStickinessPolicy +from marvin.cloudstackAPI import listLBStickinessPolicies class LBStickinessPolicy(CloudStackEntity.CloudStackEntity): @@ -41,3 +42,12 @@ class LBStickinessPolicy(CloudStackEntity.CloudStackEntity): [setattr(cmd, key, value) for key,value in kwargs.iteritems()] lbstickinesspolicy = apiclient.deleteLBStickinessPolicy(cmd) return lbstickinesspolicy + + + @classmethod + def list(self, apiclient, lbruleid, **kwargs): + cmd = listLBStickinessPolicies.listLBStickinessPoliciesCmd() + cmd.lbruleid = lbruleid + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + lbstickinesspolicies = apiclient.listLBStickinessPolicies(cmd) + return map(lambda e: LBStickinessPolicy(e.__dict__), lbstickinesspolicies) diff --git a/tools/marvin/marvin/integration/lib/base/Remove.py b/tools/marvin/marvin/integration/lib/base/Ldap.py similarity index 75% rename from tools/marvin/marvin/integration/lib/base/Remove.py rename to tools/marvin/marvin/integration/lib/base/Ldap.py index 9d572382d88..3cd0561a0ee 100644 --- a/tools/marvin/marvin/integration/lib/base/Remove.py +++ b/tools/marvin/marvin/integration/lib/base/Ldap.py @@ -16,15 +16,24 @@ # under the License. from marvin.integration.lib.base import CloudStackEntity from marvin.cloudstackAPI import ldapRemove +from marvin.cloudstackAPI import ldapConfig -class Remove(CloudStackEntity.CloudStackEntity): +class Ldap(CloudStackEntity.CloudStackEntity): def __init__(self, items): self.__dict__.update(items) - def ldap(self, apiclient, **kwargs): + def config(self, apiclient, **kwargs): + cmd = ldapConfig.ldapConfigCmd() + cmd.id = self.id + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + config = apiclient.ldapConfig(cmd) + return config + + + def remove(self, apiclient, **kwargs): cmd = ldapRemove.ldapRemoveCmd() cmd.id = self.id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] diff --git a/tools/marvin/marvin/integration/lib/base/LoadBalancerRule.py b/tools/marvin/marvin/integration/lib/base/LoadBalancerRule.py index 4bdcf7f3ee3..68f2181b521 100644 --- a/tools/marvin/marvin/integration/lib/base/LoadBalancerRule.py +++ b/tools/marvin/marvin/integration/lib/base/LoadBalancerRule.py @@ -19,6 +19,9 @@ from marvin.cloudstackAPI import createLoadBalancerRule from marvin.cloudstackAPI import listLoadBalancerRules from marvin.cloudstackAPI import updateLoadBalancerRule from marvin.cloudstackAPI import deleteLoadBalancerRule +from marvin.cloudstackAPI import removeFromLoadBalancerRule +from marvin.cloudstackAPI import listLoadBalancerRuleInstances +from marvin.cloudstackAPI import assignToLoadBalancerRule class LoadBalancerRule(CloudStackEntity.CloudStackEntity): @@ -44,19 +47,44 @@ class LoadBalancerRule(CloudStackEntity.CloudStackEntity): return map(lambda e: LoadBalancerRule(e.__dict__), loadbalancerrule) - def update(self, apiclient, id, **kwargs): + def update(self, apiclient, **kwargs): cmd = updateLoadBalancerRule.updateLoadBalancerRuleCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] loadbalancerrule = apiclient.updateLoadBalancerRule(cmd) return loadbalancerrule - def delete(self, apiclient, id, **kwargs): + def delete(self, apiclient, **kwargs): cmd = deleteLoadBalancerRule.deleteLoadBalancerRuleCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] loadbalancerrule = apiclient.deleteLoadBalancerRule(cmd) return loadbalancerrule + + + def remove(self, apiclient, virtualmachineids, **kwargs): + cmd = removeFromLoadBalancerRule.removeFromLoadBalancerRuleCmd() + cmd.id = self.id + cmd.virtualmachineids = virtualmachineids + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + fromloadbalancerrule = apiclient.removeFromLoadBalancerRule(cmd) + return fromloadbalancerrule + + + def assign(self, apiclient, virtualmachineids, **kwargs): + cmd = assignToLoadBalancerRule.assignToLoadBalancerRuleCmd() + cmd.id = self.id + cmd.virtualmachineids = virtualmachineids + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + toloadbalancerrule = apiclient.assignToLoadBalancerRule(cmd) + return toloadbalancerrule + + + @classmethod + def listInstances(self, apiclient, **kwargs): + cmd = listLoadBalancerRuleInstances.listLoadBalancerRuleInstancesCmd() + cmd.id = self.id + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + loadbalancerruleinstances = apiclient.listLoadBalancerRuleInstances(cmd) + return map(lambda e: LoadBalancerRule(e.__dict__), loadbalancerruleinstances) diff --git a/tools/marvin/marvin/integration/lib/base/LoadBalancerRuleInstances.py b/tools/marvin/marvin/integration/lib/base/LoadBalancerRuleInstances.py deleted file mode 100644 index 42d526235f8..00000000000 --- a/tools/marvin/marvin/integration/lib/base/LoadBalancerRuleInstances.py +++ /dev/null @@ -1,33 +0,0 @@ -# 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 listLoadBalancerRuleInstances - -class LoadBalancerRuleInstances(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - @classmethod - def list(self, apiclient, id, **kwargs): - cmd = listLoadBalancerRuleInstances.listLoadBalancerRuleInstancesCmd() - cmd.id = id - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - loadbalancerruleinstances = apiclient.listLoadBalancerRuleInstances(cmd) - return map(lambda e: LoadBalancerRuleInstances(e.__dict__), loadbalancerruleinstances) diff --git a/tools/marvin/marvin/integration/lib/base/Nics.py b/tools/marvin/marvin/integration/lib/base/Nic.py similarity index 63% rename from tools/marvin/marvin/integration/lib/base/Nics.py rename to tools/marvin/marvin/integration/lib/base/Nic.py index 171889a5809..fda4499a29a 100644 --- a/tools/marvin/marvin/integration/lib/base/Nics.py +++ b/tools/marvin/marvin/integration/lib/base/Nic.py @@ -16,8 +16,10 @@ # under the License. from marvin.integration.lib.base import CloudStackEntity from marvin.cloudstackAPI import listNics +from marvin.cloudstackAPI import addIpToNic +from marvin.cloudstackAPI import removeIpFromNic -class Nics(CloudStackEntity.CloudStackEntity): +class Nic(CloudStackEntity.CloudStackEntity): def __init__(self, items): @@ -30,4 +32,20 @@ class Nics(CloudStackEntity.CloudStackEntity): cmd.virtualmachineid = virtualmachineid [setattr(cmd, key, value) for key,value in kwargs.iteritems()] nics = apiclient.listNics(cmd) - return map(lambda e: Nics(e.__dict__), nics) + return map(lambda e: Nic(e.__dict__), nics) + + + def add_ip(self, apiclient, **kwargs): + cmd = addIpToNic.addIpToNicCmd() + cmd.nicid = self.id + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + iptonic = apiclient.addIpToNic(cmd) + return iptonic + + + def remove_ip(self, apiclient, **kwargs): + cmd = removeIpFromNic.removeIpFromNicCmd() + cmd.id = self.id + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + ipfromnic = apiclient.removeIpFromNic(cmd) + return ipfromnic diff --git a/tools/marvin/marvin/integration/lib/base/NicFromVirtualMachine.py b/tools/marvin/marvin/integration/lib/base/NicFromVirtualMachine.py deleted file mode 100644 index 2008fd756de..00000000000 --- a/tools/marvin/marvin/integration/lib/base/NicFromVirtualMachine.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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 removeNicFromVirtualMachine - -class NicFromVirtualMachine(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def remove(self, apiclient, nicid, virtualmachineid, **kwargs): - cmd = removeNicFromVirtualMachine.removeNicFromVirtualMachineCmd() - cmd.id = self.id - cmd.nicid = nicid - cmd.virtualmachineid = virtualmachineid - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - nicfromvirtualmachine = apiclient.removeNicFromVirtualMachine(cmd) - return nicfromvirtualmachine diff --git a/tools/marvin/marvin/integration/lib/base/NicToVirtualMachine.py b/tools/marvin/marvin/integration/lib/base/NicToVirtualMachine.py deleted file mode 100644 index bb27a87de61..00000000000 --- a/tools/marvin/marvin/integration/lib/base/NicToVirtualMachine.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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 addNicToVirtualMachine - -class NicToVirtualMachine(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def add(self, apiclient, networkid, virtualmachineid, **kwargs): - cmd = addNicToVirtualMachine.addNicToVirtualMachineCmd() - cmd.id = self.id - cmd.networkid = networkid - cmd.virtualmachineid = virtualmachineid - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - nictovirtualmachine = apiclient.addNicToVirtualMachine(cmd) - return nictovirtualmachine diff --git a/tools/marvin/marvin/integration/lib/base/NiciraNvpDevice.py b/tools/marvin/marvin/integration/lib/base/NiciraNvpDevice.py index 590cb1b7f69..24a756d65ad 100644 --- a/tools/marvin/marvin/integration/lib/base/NiciraNvpDevice.py +++ b/tools/marvin/marvin/integration/lib/base/NiciraNvpDevice.py @@ -18,6 +18,7 @@ from marvin.integration.lib.base import CloudStackEntity from marvin.cloudstackAPI import addNiciraNvpDevice from marvin.cloudstackAPI import listNiciraNvpDevices from marvin.cloudstackAPI import deleteNiciraNvpDevice +from marvin.cloudstackAPI import listNiciraNvpDeviceNetworks class NiciraNvpDevice(CloudStackEntity.CloudStackEntity): @@ -54,3 +55,11 @@ class NiciraNvpDevice(CloudStackEntity.CloudStackEntity): [setattr(cmd, key, value) for key,value in kwargs.iteritems()] niciranvpdevice = apiclient.deleteNiciraNvpDevice(cmd) return niciranvpdevice + + @classmethod + def listNetworks(self, apiclient, nvpdeviceid, **kwargs): + cmd = listNiciraNvpDeviceNetworks.listNiciraNvpDeviceNetworksCmd() + cmd.nvpdeviceid = nvpdeviceid + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + niciranvpdevicenetworks = apiclient.listNiciraNvpDeviceNetworks(cmd) + return map(lambda e: NiciraNvpDevice(e.__dict__), niciranvpdevicenetworks) diff --git a/tools/marvin/marvin/integration/lib/base/NiciraNvpDeviceNetworks.py b/tools/marvin/marvin/integration/lib/base/NiciraNvpDeviceNetworks.py deleted file mode 100644 index 058aa4d354f..00000000000 --- a/tools/marvin/marvin/integration/lib/base/NiciraNvpDeviceNetworks.py +++ /dev/null @@ -1,33 +0,0 @@ -# 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 listNiciraNvpDeviceNetworks - -class NiciraNvpDeviceNetworks(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - @classmethod - def list(self, apiclient, nvpdeviceid, **kwargs): - cmd = listNiciraNvpDeviceNetworks.listNiciraNvpDeviceNetworksCmd() - cmd.nvpdeviceid = nvpdeviceid - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - niciranvpdevicenetworks = apiclient.listNiciraNvpDeviceNetworks(cmd) - return map(lambda e: NiciraNvpDeviceNetworks(e.__dict__), niciranvpdevicenetworks) diff --git a/tools/marvin/marvin/integration/lib/base/PasswordForVirtualMachine.py b/tools/marvin/marvin/integration/lib/base/PasswordForVirtualMachine.py deleted file mode 100644 index 2489d2f7500..00000000000 --- a/tools/marvin/marvin/integration/lib/base/PasswordForVirtualMachine.py +++ /dev/null @@ -1,33 +0,0 @@ -# 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 resetPasswordForVirtualMachine - -class PasswordForVirtualMachine(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def reset(self, apiclient, id, **kwargs): - cmd = resetPasswordForVirtualMachine.resetPasswordForVirtualMachineCmd() - cmd.id = self.id - cmd.id = id - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - passwordforvirtualmachine = apiclient.resetPasswordForVirtualMachine(cmd) - return passwordforvirtualmachine diff --git a/tools/marvin/marvin/integration/lib/base/PhysicalNetwork.py b/tools/marvin/marvin/integration/lib/base/PhysicalNetwork.py index d33205240ba..d790e60c200 100644 --- a/tools/marvin/marvin/integration/lib/base/PhysicalNetwork.py +++ b/tools/marvin/marvin/integration/lib/base/PhysicalNetwork.py @@ -44,19 +44,17 @@ class PhysicalNetwork(CloudStackEntity.CloudStackEntity): return map(lambda e: PhysicalNetwork(e.__dict__), physicalnetwork) - def update(self, apiclient, id, **kwargs): + def update(self, apiclient, **kwargs): cmd = updatePhysicalNetwork.updatePhysicalNetworkCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] physicalnetwork = apiclient.updatePhysicalNetwork(cmd) return physicalnetwork - def delete(self, apiclient, id, **kwargs): + def delete(self, apiclient, **kwargs): cmd = deletePhysicalNetwork.deletePhysicalNetworkCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] physicalnetwork = apiclient.deletePhysicalNetwork(cmd) return physicalnetwork diff --git a/tools/marvin/marvin/integration/lib/base/Pod.py b/tools/marvin/marvin/integration/lib/base/Pod.py index aa51d85bea7..516d5177f9d 100644 --- a/tools/marvin/marvin/integration/lib/base/Pod.py +++ b/tools/marvin/marvin/integration/lib/base/Pod.py @@ -44,19 +44,17 @@ class Pod(CloudStackEntity.CloudStackEntity): return map(lambda e: Pod(e.__dict__), pod) - def update(self, apiclient, id, **kwargs): + def update(self, apiclient, **kwargs): cmd = updatePod.updatePodCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] pod = apiclient.updatePod(cmd) return pod - def delete(self, apiclient, id, **kwargs): + def delete(self, apiclient, **kwargs): cmd = deletePod.deletePodCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] pod = apiclient.deletePod(cmd) return pod diff --git a/tools/marvin/marvin/integration/lib/base/PortForwardingRule.py b/tools/marvin/marvin/integration/lib/base/PortForwardingRule.py index 5afcda7e318..2cceca366db 100644 --- a/tools/marvin/marvin/integration/lib/base/PortForwardingRule.py +++ b/tools/marvin/marvin/integration/lib/base/PortForwardingRule.py @@ -56,10 +56,9 @@ class PortForwardingRule(CloudStackEntity.CloudStackEntity): return portforwardingrule - def delete(self, apiclient, id, **kwargs): + def delete(self, apiclient, **kwargs): cmd = deletePortForwardingRule.deletePortForwardingRuleCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] portforwardingrule = apiclient.deletePortForwardingRule(cmd) return portforwardingrule diff --git a/tools/marvin/marvin/integration/lib/base/PrivateGateway.py b/tools/marvin/marvin/integration/lib/base/PrivateGateway.py index b084772a454..65ad989bbc1 100644 --- a/tools/marvin/marvin/integration/lib/base/PrivateGateway.py +++ b/tools/marvin/marvin/integration/lib/base/PrivateGateway.py @@ -43,10 +43,9 @@ class PrivateGateway(CloudStackEntity.CloudStackEntity): return map(lambda e: PrivateGateway(e.__dict__), privategateway) - def delete(self, apiclient, id, **kwargs): + def delete(self, apiclient, **kwargs): cmd = deletePrivateGateway.deletePrivateGatewayCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] privategateway = apiclient.deletePrivateGateway(cmd) return privategateway diff --git a/tools/marvin/marvin/integration/lib/base/Project.py b/tools/marvin/marvin/integration/lib/base/Project.py index 03a4d6314a1..243d22d5aec 100644 --- a/tools/marvin/marvin/integration/lib/base/Project.py +++ b/tools/marvin/marvin/integration/lib/base/Project.py @@ -21,6 +21,9 @@ from marvin.cloudstackAPI import listProjects from marvin.cloudstackAPI import updateProject from marvin.cloudstackAPI import activateProject from marvin.cloudstackAPI import deleteProject +from marvin.cloudstackAPI import deleteAccountFromProject +from marvin.cloudstackAPI import addAccountToProject +from marvin.cloudstackAPI import listProjectAccounts class Project(CloudStackEntity.CloudStackEntity): @@ -29,10 +32,9 @@ class Project(CloudStackEntity.CloudStackEntity): self.__dict__.update(items) - def suspend(self, apiclient, id, **kwargs): + def suspend(self, apiclient, **kwargs): cmd = suspendProject.suspendProjectCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] project = apiclient.suspendProject(cmd) return project @@ -55,28 +57,51 @@ class Project(CloudStackEntity.CloudStackEntity): return map(lambda e: Project(e.__dict__), project) - def update(self, apiclient, id, **kwargs): + def update(self, apiclient, **kwargs): cmd = updateProject.updateProjectCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] project = apiclient.updateProject(cmd) return project - def activate(self, apiclient, id, **kwargs): + def activate(self, apiclient, **kwargs): cmd = activateProject.activateProjectCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] project = apiclient.activateProject(cmd) return project - def delete(self, apiclient, id, **kwargs): + def delete(self, apiclient, **kwargs): cmd = deleteProject.deleteProjectCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] project = apiclient.deleteProject(cmd) return project + + + def delete_account(self, apiclient, projectid, **kwargs): + cmd = deleteAccountFromProject.deleteAccountFromProjectCmd() + cmd.id = self.id + cmd.projectid = projectid + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + deletefromproject = apiclient.deleteAccountFromProject(cmd) + return deletefromproject + + + def add_account(self, apiclient, projectid, **kwargs): + cmd = addAccountToProject.addAccountToProjectCmd() + cmd.id = self.id + cmd.projectid = projectid + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + accounttoproject = apiclient.addAccountToProject(cmd) + return accounttoproject + + @classmethod + def list_accounts(self, apiclient, projectid, **kwargs): + cmd = listProjectAccounts.listProjectAccountsCmd() + cmd.projectid = projectid + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + projectaccounts = apiclient.listProjectAccounts(cmd) + return map(lambda e: Project(e.__dict__), projectaccounts) diff --git a/tools/marvin/marvin/integration/lib/base/ProjectAccounts.py b/tools/marvin/marvin/integration/lib/base/ProjectAccounts.py deleted file mode 100644 index b867e7985d1..00000000000 --- a/tools/marvin/marvin/integration/lib/base/ProjectAccounts.py +++ /dev/null @@ -1,33 +0,0 @@ -# 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 listProjectAccounts - -class ProjectAccounts(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - @classmethod - def list(self, apiclient, projectid, **kwargs): - cmd = listProjectAccounts.listProjectAccountsCmd() - cmd.projectid = projectid - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - projectaccounts = apiclient.listProjectAccounts(cmd) - return map(lambda e: ProjectAccounts(e.__dict__), projectaccounts) diff --git a/tools/marvin/marvin/integration/lib/base/SSHKeyForVirtualMachine.py b/tools/marvin/marvin/integration/lib/base/SSHKeyForVirtualMachine.py deleted file mode 100644 index 76df78c45cc..00000000000 --- a/tools/marvin/marvin/integration/lib/base/SSHKeyForVirtualMachine.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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 resetSSHKeyForVirtualMachine - -class SSHKeyForVirtualMachine(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def reset(self, apiclient, keypair, id, **kwargs): - cmd = resetSSHKeyForVirtualMachine.resetSSHKeyForVirtualMachineCmd() - cmd.id = self.id - cmd.id = id - cmd.keypair = keypair - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - sshkeyforvirtualmachine = apiclient.resetSSHKeyForVirtualMachine(cmd) - return sshkeyforvirtualmachine diff --git a/tools/marvin/marvin/integration/lib/base/SecurityGroup.py b/tools/marvin/marvin/integration/lib/base/SecurityGroup.py index c8862702455..70a03c5b09e 100644 --- a/tools/marvin/marvin/integration/lib/base/SecurityGroup.py +++ b/tools/marvin/marvin/integration/lib/base/SecurityGroup.py @@ -18,6 +18,10 @@ from marvin.integration.lib.base import CloudStackEntity from marvin.cloudstackAPI import createSecurityGroup from marvin.cloudstackAPI import listSecurityGroups from marvin.cloudstackAPI import deleteSecurityGroup +from marvin.cloudstackAPI import revokeSecurityGroupEgress +from marvin.cloudstackAPI import revokeSecurityGroupIngress +from marvin.cloudstackAPI import authorizeSecurityGroupEgress +from marvin.cloudstackAPI import authorizeSecurityGroupIngress class SecurityGroup(CloudStackEntity.CloudStackEntity): @@ -49,3 +53,29 @@ class SecurityGroup(CloudStackEntity.CloudStackEntity): [setattr(cmd, key, value) for key,value in kwargs.iteritems()] securitygroup = apiclient.deleteSecurityGroup(cmd) return securitygroup + + + def authorize(self, apiclient, ingress=True, **kwargs): + if ingress: + cmd = authorizeSecurityGroupIngress.authorizeSecurityGroupIngressCmd() + else: + cmd = authorizeSecurityGroupEgress.authorizeSecurityGroupEgressCmd() + cmd.id = self.id + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + if ingress: + return apiclient.authorizeSecurityGroupIngress(cmd) + else: + return apiclient.authorizeSecurityGroupEgress(cmd) + + + def revoke(self, apiclient, ingress=True, **kwargs): + if ingress: + cmd = revokeSecurityGroupIngress.revokeSecurityGroupIngressCmd() + else: + cmd = revokeSecurityGroupEgress.revokeSecurityGroupEgressCmd() + cmd.id = self.id + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + if ingress: + return apiclient.revokeSecurityGroupIngress(cmd) + else: + return apiclient.revokeSecurityGroupEgress(cmd) diff --git a/tools/marvin/marvin/integration/lib/base/SecurityGroupEgress.py b/tools/marvin/marvin/integration/lib/base/SecurityGroupEgress.py deleted file mode 100644 index 924b56887a3..00000000000 --- a/tools/marvin/marvin/integration/lib/base/SecurityGroupEgress.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 authorizeSecurityGroupEgress -from marvin.cloudstackAPI import revokeSecurityGroupEgress - -class SecurityGroupEgress(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def authorize(self, apiclient, **kwargs): - cmd = authorizeSecurityGroupEgress.authorizeSecurityGroupEgressCmd() - cmd.id = self.id - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - securitygroupegress = apiclient.authorizeSecurityGroupEgress(cmd) - return securitygroupegress - - - def revoke(self, apiclient, id, **kwargs): - cmd = revokeSecurityGroupEgress.revokeSecurityGroupEgressCmd() - cmd.id = self.id - cmd.id = id - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - securitygroupegress = apiclient.revokeSecurityGroupEgress(cmd) - return securitygroupegress diff --git a/tools/marvin/marvin/integration/lib/base/SecurityGroupIngress.py b/tools/marvin/marvin/integration/lib/base/SecurityGroupIngress.py deleted file mode 100644 index 82910212361..00000000000 --- a/tools/marvin/marvin/integration/lib/base/SecurityGroupIngress.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 authorizeSecurityGroupIngress -from marvin.cloudstackAPI import revokeSecurityGroupIngress - -class SecurityGroupIngress(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def authorize(self, apiclient, **kwargs): - cmd = authorizeSecurityGroupIngress.authorizeSecurityGroupIngressCmd() - cmd.id = self.id - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - securitygroupingress = apiclient.authorizeSecurityGroupIngress(cmd) - return securitygroupingress - - - def revoke(self, apiclient, id, **kwargs): - cmd = revokeSecurityGroupIngress.revokeSecurityGroupIngressCmd() - cmd.id = self.id - cmd.id = id - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - securitygroupingress = apiclient.revokeSecurityGroupIngress(cmd) - return securitygroupingress diff --git a/tools/marvin/marvin/integration/lib/base/Snapshot.py b/tools/marvin/marvin/integration/lib/base/Snapshot.py index 2dec8664162..9793329e0dc 100644 --- a/tools/marvin/marvin/integration/lib/base/Snapshot.py +++ b/tools/marvin/marvin/integration/lib/base/Snapshot.py @@ -43,10 +43,9 @@ class Snapshot(CloudStackEntity.CloudStackEntity): return map(lambda e: Snapshot(e.__dict__), snapshot) - def delete(self, apiclient, id, **kwargs): + def delete(self, apiclient, **kwargs): cmd = deleteSnapshot.deleteSnapshotCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] snapshot = apiclient.deleteSnapshot(cmd) return snapshot diff --git a/tools/marvin/marvin/integration/lib/base/SnapshotPolicies.py b/tools/marvin/marvin/integration/lib/base/SnapshotPolicies.py deleted file mode 100644 index 855febeb2ea..00000000000 --- a/tools/marvin/marvin/integration/lib/base/SnapshotPolicies.py +++ /dev/null @@ -1,42 +0,0 @@ -# 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 listSnapshotPolicies -from marvin.cloudstackAPI import deleteSnapshotPolicies - -class SnapshotPolicies(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - @classmethod - def list(self, apiclient, volumeid, **kwargs): - cmd = listSnapshotPolicies.listSnapshotPoliciesCmd() - cmd.volumeid = volumeid - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - snapshotpolicies = apiclient.listSnapshotPolicies(cmd) - return map(lambda e: SnapshotPolicies(e.__dict__), snapshotpolicies) - - - def delete(self, apiclient, **kwargs): - cmd = deleteSnapshotPolicies.deleteSnapshotPoliciesCmd() - cmd.id = self.id - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - snapshotpolicies = apiclient.deleteSnapshotPolicies(cmd) - return snapshotpolicies diff --git a/tools/marvin/marvin/integration/lib/base/SnapshotPolicy.py b/tools/marvin/marvin/integration/lib/base/SnapshotPolicy.py index 5641e031ac9..d18c4ba89d9 100644 --- a/tools/marvin/marvin/integration/lib/base/SnapshotPolicy.py +++ b/tools/marvin/marvin/integration/lib/base/SnapshotPolicy.py @@ -16,6 +16,8 @@ # under the License. from marvin.integration.lib.base import CloudStackEntity from marvin.cloudstackAPI import createSnapshotPolicy +from marvin.cloudstackAPI import listSnapshotPolicies +from marvin.cloudstackAPI import deleteSnapshotPolicies class SnapshotPolicy(CloudStackEntity.CloudStackEntity): @@ -31,3 +33,20 @@ class SnapshotPolicy(CloudStackEntity.CloudStackEntity): [setattr(cmd, key, value) for key,value in kwargs.iteritems()] snapshotpolicy = apiclient.createSnapshotPolicy(cmd) return SnapshotPolicy(snapshotpolicy.__dict__) + + + @classmethod + def list(self, apiclient, volumeid, **kwargs): + cmd = listSnapshotPolicies.listSnapshotPoliciesCmd() + cmd.volumeid = volumeid + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + snapshotpolicies = apiclient.listSnapshotPolicies(cmd) + return map(lambda e: SnapshotPolicy(e.__dict__), snapshotpolicies) + + + def delete(self, apiclient, **kwargs): + cmd = deleteSnapshotPolicies.deleteSnapshotPoliciesCmd() + cmd.id = self.id + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + snapshotpolicies = apiclient.deleteSnapshotPolicies(cmd) + return snapshotpolicies diff --git a/tools/marvin/marvin/integration/lib/base/StorageMaintenance.py b/tools/marvin/marvin/integration/lib/base/StorageMaintenance.py deleted file mode 100644 index c80399f7d93..00000000000 --- a/tools/marvin/marvin/integration/lib/base/StorageMaintenance.py +++ /dev/null @@ -1,43 +0,0 @@ -# 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 cancelStorageMaintenance -from marvin.cloudstackAPI import enableStorageMaintenance - -class StorageMaintenance(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def cancel(self, apiclient, id, **kwargs): - cmd = cancelStorageMaintenance.cancelStorageMaintenanceCmd() - cmd.id = self.id - cmd.id = id - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - storagemaintenance = apiclient.cancelStorageMaintenance(cmd) - return storagemaintenance - - - def enable(self, apiclient, id, **kwargs): - cmd = enableStorageMaintenance.enableStorageMaintenanceCmd() - cmd.id = self.id - cmd.id = id - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - storagemaintenance = apiclient.enableStorageMaintenance(cmd) - return storagemaintenance diff --git a/tools/marvin/marvin/integration/lib/base/StoragePool.py b/tools/marvin/marvin/integration/lib/base/StoragePool.py index cc9fc30a242..6215bde8af7 100644 --- a/tools/marvin/marvin/integration/lib/base/StoragePool.py +++ b/tools/marvin/marvin/integration/lib/base/StoragePool.py @@ -19,6 +19,8 @@ from marvin.cloudstackAPI import createStoragePool from marvin.cloudstackAPI import listStoragePools from marvin.cloudstackAPI import updateStoragePool from marvin.cloudstackAPI import deleteStoragePool +from marvin.cloudstackAPI import cancelStorageMaintenance +from marvin.cloudstackAPI import enableStorageMaintenance class StoragePool(CloudStackEntity.CloudStackEntity): @@ -60,3 +62,19 @@ class StoragePool(CloudStackEntity.CloudStackEntity): [setattr(cmd, key, value) for key,value in kwargs.iteritems()] storagepool = apiclient.deleteStoragePool(cmd) return storagepool + + + def cancel_maintenance(self, apiclient, **kwargs): + cmd = cancelStorageMaintenance.cancelStorageMaintenanceCmd() + cmd.id = self.id + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + storagemaintenance = apiclient.cancelStorageMaintenance(cmd) + return storagemaintenance + + + def enable_maintenance(self, apiclient, **kwargs): + cmd = enableStorageMaintenance.enableStorageMaintenanceCmd() + cmd.id = self.id + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + storagemaintenance = apiclient.enableStorageMaintenance(cmd) + return storagemaintenance diff --git a/tools/marvin/marvin/integration/lib/base/ToGlobalLoadBalancerRule.py b/tools/marvin/marvin/integration/lib/base/ToGlobalLoadBalancerRule.py deleted file mode 100644 index e5a2ede74c0..00000000000 --- a/tools/marvin/marvin/integration/lib/base/ToGlobalLoadBalancerRule.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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 assignToGlobalLoadBalancerRule - -class ToGlobalLoadBalancerRule(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def assign(self, apiclient, loadbalancerrulelist, id, **kwargs): - cmd = assignToGlobalLoadBalancerRule.assignToGlobalLoadBalancerRuleCmd() - cmd.id = self.id - cmd.id = id - cmd.loadbalancerrulelist = loadbalancerrulelist - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - togloballoadbalancerrule = apiclient.assignToGlobalLoadBalancerRule(cmd) - return togloballoadbalancerrule diff --git a/tools/marvin/marvin/integration/lib/base/ToLoadBalancerRule.py b/tools/marvin/marvin/integration/lib/base/ToLoadBalancerRule.py deleted file mode 100644 index 15c3d9528b2..00000000000 --- a/tools/marvin/marvin/integration/lib/base/ToLoadBalancerRule.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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 assignToLoadBalancerRule - -class ToLoadBalancerRule(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def assign(self, apiclient, id, virtualmachineids, **kwargs): - cmd = assignToLoadBalancerRule.assignToLoadBalancerRuleCmd() - cmd.id = self.id - cmd.id = id - cmd.virtualmachineids = virtualmachineids - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - toloadbalancerrule = apiclient.assignToLoadBalancerRule(cmd) - return toloadbalancerrule diff --git a/tools/marvin/marvin/integration/lib/base/User.py b/tools/marvin/marvin/integration/lib/base/User.py index 6a2e37ce956..71028f80dc4 100644 --- a/tools/marvin/marvin/integration/lib/base/User.py +++ b/tools/marvin/marvin/integration/lib/base/User.py @@ -23,6 +23,7 @@ from marvin.cloudstackAPI import listUsers from marvin.cloudstackAPI import updateUser from marvin.cloudstackAPI import disableUser from marvin.cloudstackAPI import deleteUser +from marvin.cloudstackAPI import registerUserKeys class User(CloudStackEntity.CloudStackEntity): @@ -100,3 +101,11 @@ class User(CloudStackEntity.CloudStackEntity): [setattr(cmd, key, value) for key,value in kwargs.iteritems()] user = apiclient.deleteUser(cmd) return user + + + def register_userkeys(self, apiclient, **kwargs): + cmd = registerUserKeys.registerUserKeysCmd() + cmd.id = self.id + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + userkeys = apiclient.registerUserKeys(cmd) + return userkeys diff --git a/tools/marvin/marvin/integration/lib/base/UserKeys.py b/tools/marvin/marvin/integration/lib/base/UserKeys.py deleted file mode 100644 index 8a6e8aa7ddc..00000000000 --- a/tools/marvin/marvin/integration/lib/base/UserKeys.py +++ /dev/null @@ -1,33 +0,0 @@ -# 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 registerUserKeys - -class UserKeys(CloudStackEntity.CloudStackEntity): - - - def __init__(self, items): - self.__dict__.update(items) - - - def register(self, apiclient, id, **kwargs): - cmd = registerUserKeys.registerUserKeysCmd() - cmd.id = self.id - cmd.id = id - [setattr(cmd, key, value) for key,value in kwargs.iteritems()] - userkeys = apiclient.registerUserKeys(cmd) - return userkeys diff --git a/tools/marvin/marvin/integration/lib/base/VirtualMachine.py b/tools/marvin/marvin/integration/lib/base/VirtualMachine.py index 591ec015b8e..e71ddfcefc9 100644 --- a/tools/marvin/marvin/integration/lib/base/VirtualMachine.py +++ b/tools/marvin/marvin/integration/lib/base/VirtualMachine.py @@ -26,6 +26,11 @@ from marvin.cloudstackAPI import updateVirtualMachine from marvin.cloudstackAPI import startVirtualMachine from marvin.cloudstackAPI import destroyVirtualMachine from marvin.cloudstackAPI import assignVirtualMachine +from marvin.cloudstackAPI import addNicToVirtualMachine +from marvin.cloudstackAPI import removeNicFromVirtualMachine +from marvin.cloudstackAPI import resetPasswordForVirtualMachine +from marvin.cloudstackAPI import resetSSHKeyForVirtualMachine +from marvin.cloudstackAPI import updateDefaultNicForVirtualMachine class VirtualMachine(CloudStackEntity.CloudStackEntity): @@ -43,10 +48,9 @@ class VirtualMachine(CloudStackEntity.CloudStackEntity): return virtualmachine - def scale(self, apiclient, id, serviceofferingid, **kwargs): + def scale(self, apiclient, serviceofferingid, **kwargs): cmd = scaleVirtualMachine.scaleVirtualMachineCmd() cmd.id = self.id - cmd.id = id cmd.serviceofferingid = serviceofferingid [setattr(cmd, key, value) for key,value in kwargs.iteritems()] virtualmachine = apiclient.scaleVirtualMachine(cmd) @@ -79,46 +83,41 @@ class VirtualMachine(CloudStackEntity.CloudStackEntity): return map(lambda e: VirtualMachine(e.__dict__), virtualmachine) - def stop(self, apiclient, id, **kwargs): + def stop(self, apiclient, **kwargs): cmd = stopVirtualMachine.stopVirtualMachineCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] virtualmachine = apiclient.stopVirtualMachine(cmd) return virtualmachine - def reboot(self, apiclient, id, **kwargs): + def reboot(self, apiclient, **kwargs): cmd = rebootVirtualMachine.rebootVirtualMachineCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] virtualmachine = apiclient.rebootVirtualMachine(cmd) return virtualmachine - def update(self, apiclient, id, **kwargs): + def update(self, apiclient, **kwargs): cmd = updateVirtualMachine.updateVirtualMachineCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] virtualmachine = apiclient.updateVirtualMachine(cmd) return virtualmachine - def start(self, apiclient, id, **kwargs): + def start(self, apiclient, **kwargs): cmd = startVirtualMachine.startVirtualMachineCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] virtualmachine = apiclient.startVirtualMachine(cmd) return virtualmachine - def destroy(self, apiclient, id, **kwargs): + def destroy(self, apiclient, **kwargs): cmd = destroyVirtualMachine.destroyVirtualMachineCmd() cmd.id = self.id - cmd.id = id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] virtualmachine = apiclient.destroyVirtualMachine(cmd) return virtualmachine @@ -133,3 +132,46 @@ class VirtualMachine(CloudStackEntity.CloudStackEntity): [setattr(cmd, key, value) for key,value in kwargs.iteritems()] virtualmachine = apiclient.assignVirtualMachine(cmd) return virtualmachine + + def remove_nic(self, apiclient, nicid, **kwargs): + cmd = removeNicFromVirtualMachine.removeNicFromVirtualMachineCmd() + cmd.virtualmachineid = self.id + cmd.nicid = nicid + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + nicfromvirtualmachine = apiclient.removeNicFromVirtualMachine(cmd) + return nicfromvirtualmachine + + + def add_nic(self, apiclient, networkid, **kwargs): + cmd = addNicToVirtualMachine.addNicToVirtualMachineCmd() + cmd.virtualmachineid = self.id + cmd.networkid = networkid + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + nictovirtualmachine = apiclient.addNicToVirtualMachine(cmd) + return nictovirtualmachine + + + def update_default_nic(self, apiclient, nicid, **kwargs): + cmd = updateDefaultNicForVirtualMachine.updateDefaultNicForVirtualMachineCmd() + cmd.virtualmachineid = self.id + cmd.nicid = nicid + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + defaultnicforvirtualmachine = apiclient.updateDefaultNicForVirtualMachine(cmd) + return defaultnicforvirtualmachine + + + def reset_password(self, apiclient, **kwargs): + cmd = resetPasswordForVirtualMachine.resetPasswordForVirtualMachineCmd() + cmd.id = self.id + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + passwordforvirtualmachine = apiclient.resetPasswordForVirtualMachine(cmd) + return passwordforvirtualmachine + + + def reset_sshkey(self, apiclient, keypair, **kwargs): + cmd = resetSSHKeyForVirtualMachine.resetSSHKeyForVirtualMachineCmd() + cmd.id = self.id + cmd.keypair = keypair + [setattr(cmd, key, value) for key,value in kwargs.iteritems()] + sshkeyforvirtualmachine = apiclient.resetSSHKeyForVirtualMachine(cmd) + return sshkeyforvirtualmachine