cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [2/3] git commit: updated refs/heads/master to cd15c66
Date Wed, 02 Dec 2015 16:54:52 GMT
Add marvin test for bug CS-38356
Bug-Id: CS-38356
Reviewed-By: Self


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/41ce802c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/41ce802c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/41ce802c

Branch: refs/heads/master
Commit: 41ce802c939ebdb63eb61a7a3cc06ba6606ac60b
Parents: 41b0139
Author: sanjeevn <sanjeev.neelarapu@citrix.com>
Authored: Wed Nov 25 17:30:07 2015 +0530
Committer: sanjeev <sanjeev@apache.org>
Committed: Wed Dec 2 16:06:26 2015 +0530

----------------------------------------------------------------------
 test/integration/component/test_tags.py | 146 ++++++++++++++++++++++++++-
 1 file changed, 144 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/41ce802c/test/integration/component/test_tags.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_tags.py b/test/integration/component/test_tags.py
index 3552064..cf19cd0 100644
--- a/test/integration/component/test_tags.py
+++ b/test/integration/component/test_tags.py
@@ -36,12 +36,14 @@ from marvin.lib.base import (Tag,
                              Template,
                              Snapshot,
                              ServiceOffering,
-                             Project)
+                             Project,
+                             Domain)
 from marvin.lib.common import (get_zone,
                                get_domain,
                                get_template,
                                find_storage_pool_type,
-                               list_clusters)
+                               list_clusters,
+                               createEnabledNetworkOffering)
 from marvin.codes import FAILED, PASS
 import time
 
@@ -2401,3 +2403,143 @@ class TestResourceTags(cloudstackTestCase):
             if not id in host_ids_for_migration:
                 self.fail("Not all hosts are available for vm migration")
         return
+
+    @attr(tags=["advanced"], required_hardware="false")
+    def test_24_public_IP_tag(self):
+        """ Testcreation, adding and removing tag on public IP address
+        """
+        # Validate the following
+        # 1. Create a domain and admin account under the new domain
+        # 2. Create  a tag on acquired public IP address using createTags API
+        # 3. Delete above created tag using deleteTags API
+        # 4. Perform steps 3&4 using domain-admin
+
+        self.debug("Creating a sub-domain under: %s" % self.domain.name)
+        self.child_domain = Domain.create(
+            self.apiclient,
+            services=self.services["domain"],
+            parentdomainid=self.domain.id
+        )
+        self.child_do_admin = Account.create(
+            self.apiclient,
+            self.services["account"],
+            admin=True,
+            domainid=self.child_domain.id
+        )
+        # Cleanup the resources created at end of test
+        self.cleanup.append(self.child_do_admin)
+        self.cleanup.append(self.child_domain)
+        self.dom_admin_api_client = self.testClient.getUserApiClient(
+            UserName=self.child_do_admin.name,
+            DomainName=self.child_do_admin.domain
+        )
+        result = createEnabledNetworkOffering(
+            self.apiclient,
+            self.services["network_offering"]
+        )
+        assert result[0] == PASS, \
+            "Network offering create/enable failed with error %s" % result[2]
+        self.network_offering = result[1]
+        self.network = Network.create(
+            self.dom_admin_api_client,
+            self.services["network"],
+            networkofferingid=self.network_offering.id,
+            accountid=self.child_do_admin.name,
+            domainid=self.child_do_admin.domainid,
+            zoneid=self.zone.id
+        )
+        self.debug("Fetching the network details for account: %s" %
+                   self.child_do_admin.name
+        )
+        networks = Network.list(
+            self.dom_admin_api_client,
+            account=self.child_do_admin.name,
+            domainid=self.child_do_admin.domainid,
+            listall=True
+        )
+        self.assertEqual(
+            isinstance(networks, list),
+            True,
+            "List networks should not return an empty response"
+        )
+        network = networks[0]
+        self.debug("Network for the account: %s is %s" %
+                   (self.child_do_admin.name, network.name)
+        )
+        self.debug("Associating public IP for network: %s" % network.id)
+        public_ip = PublicIPAddress.create(
+            self.dom_admin_api_client,
+            accountid=self.child_do_admin.name,
+            zoneid=self.zone.id,
+            domainid=self.child_do_admin.domainid,
+            networkid=network.id
+        )
+        self.debug("Creating a tag for Public IP")
+        tag = Tag.create(
+            self.dom_admin_api_client,
+            resourceIds=public_ip.ipaddress.id,
+            resourceType='PublicIpAddress',
+            tags={'region': 'India'}
+        )
+        self.debug("Tag created: %s" % tag.__dict__)
+
+        tags = Tag.list(
+            self.dom_admin_api_client,
+            listall=True,
+            resourceType='PublicIpAddress',
+            account=self.child_do_admin.name,
+            domainid=self.child_do_admin.domainid,
+            key='region',
+            value='India'
+        )
+        self.assertEqual(
+            isinstance(tags, list),
+            True,
+            "List tags should not return empty response"
+        )
+        self.assertEqual(
+            tags[0].value,
+            'India',
+            'The tag should have original value'
+        )
+        publicIps = PublicIPAddress.list(
+            self.dom_admin_api_client,
+            account=self.child_do_admin.name,
+            domainid=self.child_do_admin.domainid,
+            listall=True,
+            key='region',
+            value='India'
+        )
+        self.assertEqual(
+            isinstance(publicIps, list),
+            True,
+            "List Public IPs should not return an empty response"
+        )
+
+        self.debug("Deleting the created tag..")
+        try:
+            tag.delete(
+                self.dom_admin_api_client,
+                resourceIds=public_ip.ipaddress.id,
+                resourceType='PublicIpAddress',
+                tags={'region': 'India'}
+            )
+        except Exception as e:
+            self.fail("Failed to delete the tag - %s" % e)
+
+        self.debug("Verifying if tag is actually deleted!")
+        tags = Tag.list(
+            self.dom_admin_api_client,
+            listall=True,
+            resourceType='PublicIpAddress',
+            account=self.child_do_admin.name,
+            domainid=self.child_do_admin.domainid,
+            key='region',
+            value='India'
+        )
+        self.assertEqual(
+            tags,
+            None,
+            "List tags should return empty response"
+        )
+        return


Mime
View raw message