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 CCBC01005A for ; Sun, 21 Apr 2013 17:03:27 +0000 (UTC) Received: (qmail 57449 invoked by uid 500); 21 Apr 2013 17:03:14 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 57379 invoked by uid 500); 21 Apr 2013 17:03:14 -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 56278 invoked by uid 99); 21 Apr 2013 17:03:13 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Apr 2013 17:03:13 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 853D981C01B; Sun, 21 Apr 2013 17:03:13 +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: Sun, 21 Apr 2013 17:03:58 -0000 Message-Id: <6ec2e93aa27743ac888fc8e2a844949f@git.apache.org> In-Reply-To: <2337005039b4446abd856c58122c68cf@git.apache.org> References: <2337005039b4446abd856c58122c68cf@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [47/49] git commit: updated refs/heads/marvin_refactor to 0b5fe9a ipaddress factories ipaddress doesn't require id to associate but only when disassociate Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e7ac9e68 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e7ac9e68 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e7ac9e68 Branch: refs/heads/marvin_refactor Commit: e7ac9e687b7787420883e3557fc13d42a51e91b7 Parents: f4006bf Author: Prasanna Santhanam Authored: Sun Apr 21 22:31:00 2013 +0530 Committer: Prasanna Santhanam Committed: Sun Apr 21 22:31:00 2013 +0530 ---------------------------------------------------------------------- tools/marvin/marvin/base/IpAddress.py | 2 +- tools/marvin/marvin/factory/IpAddressFactory.py | 4 +- tools/marvin/marvin/factory/test/testFactories.py | 43 +++++++++++++++- 3 files changed, 45 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7ac9e68/tools/marvin/marvin/base/IpAddress.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/base/IpAddress.py b/tools/marvin/marvin/base/IpAddress.py index 6fdfe1e..43d82a1 100644 --- a/tools/marvin/marvin/base/IpAddress.py +++ b/tools/marvin/marvin/base/IpAddress.py @@ -36,7 +36,7 @@ class IpAddress(CloudStackEntity.CloudStackEntity): def associate(self, apiclient, **kwargs): cmd = associateIpAddress.associateIpAddressCmd() - cmd.id = self.id +# cmd.id = self.id [setattr(cmd, key, value) for key,value in kwargs.iteritems()] ipaddress = apiclient.associateIpAddress(cmd) return ipaddress http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7ac9e68/tools/marvin/marvin/factory/IpAddressFactory.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/factory/IpAddressFactory.py b/tools/marvin/marvin/factory/IpAddressFactory.py index 6c14e9a..bb4cc8b 100644 --- a/tools/marvin/marvin/factory/IpAddressFactory.py +++ b/tools/marvin/marvin/factory/IpAddressFactory.py @@ -15,10 +15,10 @@ # specific language governing permissions and limitations # under the License. import factory -from marvin.base import IpAddress +from marvin.base.IpAddress import IpAddress class IpAddressFactory(factory.Factory): - FACTORY_FOR = IpAddress.IpAddress + FACTORY_FOR = IpAddress http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7ac9e68/tools/marvin/marvin/factory/test/testFactories.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/factory/test/testFactories.py b/tools/marvin/marvin/factory/test/testFactories.py index 81bcca6..d4e947e 100644 --- a/tools/marvin/marvin/factory/test/testFactories.py +++ b/tools/marvin/marvin/factory/test/testFactories.py @@ -28,9 +28,12 @@ from marvin.factory.VirtualMachineFactory import * from marvin.factory.UserFactory import * -from marvin.base.Zone import * +from marvin.base.ServiceOffering import ServiceOffering +from marvin.base.Zone import Zone from marvin.base.Account import Account from marvin.base.Template import Template +from marvin.base.IpAddress import IpAddress +from marvin.base.Network import Network @@ -148,3 +151,41 @@ class UserFactorySubFactoryTest(unittest.TestCase): self.assert_(uf.username == user[0].username, msg="Usernames don't match") +class IpAddressFactoryTest(unittest.TestCase): + def setUp(self): + self.apiClient = cloudstackTestClient(mgtSvr='localhost', logging=logging.getLogger('factories.cloudstack')).getApiClient() + + def tearDown(self): + pass + + def test_associateIpAddress(self): + all_ips = IpAddress.list(apiclient=self.apiClient) + self.assert_(len(all_ips) > 0, msg="No free public IPs") + firstip = all_ips[0] + firstip.associate(apiclient=self.apiClient, zoneid=firstip.zoneid) + + def test_vpcAssociateIpAddress(self): + #FIXME: To be written + self.assert_(1 == 1) + + def test_associateIpAddressToNetwork(self): + accnt = AccountFactory.create(apiclient=self.apiClient) + self.assert_(accnt is not None) + self.assert_(isinstance(accnt, Account)) + service = ServiceOffering.list(apiclient=self.apiClient, displaytext='Small') + self.assert_(len(service) > 0) + template = Template.list(apiclient=self.apiClient, templatefilter="featured") + self.assert_(len(template) > 0) + zones = Zone.list(apiclient=self.apiClient) + vm = VirtualMachineFactory.create( + apiclient=self.apiClient, + serviceofferingid = service[0].id, + templateid = template[0].id, + zoneid = zones[0].id, + account=accnt.account.name, + domainid=accnt.account.domainid) + all_ips = IpAddress.list(apiclient=self.apiClient) + firstip = all_ips[0] + networks = Network.list(apiclient=self.apiClient, account = accnt.account.name, domainid = accnt.account.domainid) + firstip.associate(apiclient=self.apiClient, networkid = networks[0].id) + vm.destroy(apiclient=self.apiClient) \ No newline at end of file