You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by pritisarap12 <gi...@git.apache.org> on 2015/12/11 11:27:21 UTC

[GitHub] cloudstack pull request: CLOUDSTACK-9140: Testcase to verify if De...

GitHub user pritisarap12 opened a pull request:

    https://github.com/apache/cloudstack/pull/1218

    CLOUDSTACK-9140: Testcase to verify if Dedicated cluster is used for virtual routers that belong to non dedicated account

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/pritisarap12/cloudstack CLOUDSTACK-9140-Testcase-to-verify-if-Dedicated-cluster-is-used-for-virtual-routers-that-belong-to-non-dedicated-account

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cloudstack/pull/1218.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1218
    
----
commit dff3bf2c0ee5dc8bbc8de82e6eb9a3a974a3d94a
Author: Priti Sarap <pr...@clogeny.com>
Date:   2015-12-11T10:17:21Z

    CLOUDSTACK-9140: Testcase to verify if Dedicated cluster is used for virtual routers that belong to non dedicated account

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-9140: Testcase to verify if De...

Posted by sanju1010 <gi...@git.apache.org>.
Github user sanju1010 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1218#discussion_r51694011
  
    --- Diff: test/integration/component/maint/testpath_disable_enable_zone.py ---
    @@ -1691,3 +1696,159 @@ def test_01_disable_enable_host(self):
                              )
     
             return
    +
    +
    +class TestClusterDedication(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestClusterDedication, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +
    +        # Get Zone, Domain and templates
    +        cls.domain = get_domain(cls.apiclient)
    +        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
    +
    +        cls.template = get_template(
    +            cls.apiclient,
    +            cls.zone.id,
    +            cls.testdata["ostype"])
    +
    +        cls.Skiptest = False
    +        cls._cleanup = []
    +        cls.clusters = Cluster.list(cls.apiclient, zoneid=cls.zone.id)
    +        if len(cls.clusters) < 2:
    +            cls.Skiptest = True
    +
    +        try:
    +            # Create an account
    +            cls.account_1 = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +
    +            cls._cleanup.append(cls.account_1)
    +
    +            cls.account_2 = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +
    +            cls._cleanup.append(cls.account_2)
    +            # Create user api client of the account
    +            cls.userapiclient_1 = testClient.getUserApiClient(
    +                UserName=cls.account_1.name,
    +                DomainName=cls.account_1.domain
    +            )
    +            cls.userapiclient_2 = testClient.getUserApiClient(
    +                UserName=cls.account_2.name,
    +                DomainName=cls.account_2.domain
    +            )
    +
    +            # Create Service offering
    +            cls.service_offering = ServiceOffering.create(
    +                cls.apiclient,
    +                cls.testdata["service_offering"],
    +            )
    +            cls._cleanup.append(cls.service_offering)
    +
    +            cls.disk_offering = DiskOffering.create(
    +                cls.apiclient,
    +                cls.testdata["disk_offering"],
    +            )
    +
    +            cls._cleanup.append(cls.disk_offering)
    +
    +        except Exception as e:
    +            cls.tearDownClass()
    +            raise e
    +        return
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            cleanup_resources(cls.apiclient, cls._cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +
    +    def setUp(self):
    +
    +        if self.Skiptest:
    +            self.skipTest("Insufficient clusters to run the test")
    +
    +        self.apiclient = self.testClient.getApiClient()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.cleanup = []
    +
    +    def tearDown(self):
    +        try:
    +            listClusterscmd = listDedicatedClusters.listDedicatedClustersCmd()
    +            listClusterscmd.clusterid = self.clusters[0].id
    +            ret_list = self.apiclient.listDedicatedClusters(listClusterscmd)
    +            if ret_list:
    +                dedicateCmd = releaseDedicatedCluster.releaseDedicatedClusterCmd()
    +                dedicateCmd.clusterid = self.clusters[0].id
    +                self.apiclient.releaseDedicatedCluster(dedicateCmd)
    +
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    @attr(tags=["basic", "advanced"], required_hardware="false")
    +    def test_01_dedicated_cluster_allocation(self):
    +        """ Dedicated cluster and router allocation
    +            1.   Dedicate a cluster to one account
    +            2.   Deploy a VM on dedicated account
    +            3.   Deploy another VM on another account.
    +            4.   Verify the dedicated cluster is not used for
    +                virtual routers that belong to non-dedicated account
    +        """
    +
    +        # Step 1
    +        dedicateCmd = dedicateCluster.dedicateClusterCmd()
    +        dedicateCmd.clusterid = self.clusters[0].id
    +        dedicateCmd.domainid = self.domain.id
    +        dedicateCmd.account = self.account_1.name
    +        self.apiclient.dedicateCluster(dedicateCmd)
    +
    +        # Step 2
    +        self.vm = VirtualMachine.create(
    +            self.userapiclient_1,
    +            self.testdata["small"],
    +            templateid=self.template.id,
    +            accountid=self.account_1.name,
    +            domainid=self.account_1.domainid,
    +            serviceofferingid=self.service_offering.id,
    +            zoneid=self.zone.id,
    +            mode=self.zone.networktype
    +        )
    +
    +        # Step 3
    +        self.vm_1 = VirtualMachine.create(
    +            self.userapiclient_2,
    +            self.testdata["small"],
    +            templateid=self.template.id,
    +            accountid=self.account_2.name,
    +            domainid=self.account_2.domainid,
    +            serviceofferingid=self.service_offering.id,
    +            zoneid=self.zone.id,
    +            mode=self.zone.networktype
    +        )
    +
    +        # Step 4
    +        routerList = list_routers(self.apiclient,
    +                                  clusterid=self.clusters[0].id,
    +                                  networkid=self.vm_1.nic[0].networkid
    +                                  )
    +        self.assertEqual(
    --- End diff --
    
    Add similar validation for vm_1 as well


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-9140: Testcase to verify if De...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cloudstack/pull/1218


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-9140: Testcase to verify if De...

Posted by sanju1010 <gi...@git.apache.org>.
Github user sanju1010 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1218#discussion_r51693967
  
    --- Diff: test/integration/component/maint/testpath_disable_enable_zone.py ---
    @@ -1691,3 +1696,159 @@ def test_01_disable_enable_host(self):
                              )
     
             return
    +
    +
    +class TestClusterDedication(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestClusterDedication, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +
    +        # Get Zone, Domain and templates
    +        cls.domain = get_domain(cls.apiclient)
    +        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
    +
    +        cls.template = get_template(
    +            cls.apiclient,
    +            cls.zone.id,
    +            cls.testdata["ostype"])
    +
    +        cls.Skiptest = False
    +        cls._cleanup = []
    +        cls.clusters = Cluster.list(cls.apiclient, zoneid=cls.zone.id)
    +        if len(cls.clusters) < 2:
    +            cls.Skiptest = True
    +
    +        try:
    +            # Create an account
    +            cls.account_1 = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +
    +            cls._cleanup.append(cls.account_1)
    +
    +            cls.account_2 = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +
    +            cls._cleanup.append(cls.account_2)
    +            # Create user api client of the account
    +            cls.userapiclient_1 = testClient.getUserApiClient(
    +                UserName=cls.account_1.name,
    +                DomainName=cls.account_1.domain
    +            )
    +            cls.userapiclient_2 = testClient.getUserApiClient(
    +                UserName=cls.account_2.name,
    +                DomainName=cls.account_2.domain
    +            )
    +
    +            # Create Service offering
    +            cls.service_offering = ServiceOffering.create(
    +                cls.apiclient,
    +                cls.testdata["service_offering"],
    +            )
    +            cls._cleanup.append(cls.service_offering)
    +
    +            cls.disk_offering = DiskOffering.create(
    +                cls.apiclient,
    +                cls.testdata["disk_offering"],
    +            )
    +
    +            cls._cleanup.append(cls.disk_offering)
    +
    +        except Exception as e:
    +            cls.tearDownClass()
    +            raise e
    +        return
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            cleanup_resources(cls.apiclient, cls._cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +
    +    def setUp(self):
    +
    +        if self.Skiptest:
    +            self.skipTest("Insufficient clusters to run the test")
    +
    +        self.apiclient = self.testClient.getApiClient()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.cleanup = []
    +
    +    def tearDown(self):
    +        try:
    +            listClusterscmd = listDedicatedClusters.listDedicatedClustersCmd()
    +            listClusterscmd.clusterid = self.clusters[0].id
    +            ret_list = self.apiclient.listDedicatedClusters(listClusterscmd)
    +            if ret_list:
    +                dedicateCmd = releaseDedicatedCluster.releaseDedicatedClusterCmd()
    +                dedicateCmd.clusterid = self.clusters[0].id
    +                self.apiclient.releaseDedicatedCluster(dedicateCmd)
    +
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    @attr(tags=["basic", "advanced"], required_hardware="false")
    +    def test_01_dedicated_cluster_allocation(self):
    +        """ Dedicated cluster and router allocation
    +            1.   Dedicate a cluster to one account
    +            2.   Deploy a VM on dedicated account
    +            3.   Deploy another VM on another account.
    +            4.   Verify the dedicated cluster is not used for
    +                virtual routers that belong to non-dedicated account
    +        """
    +
    +        # Step 1
    +        dedicateCmd = dedicateCluster.dedicateClusterCmd()
    +        dedicateCmd.clusterid = self.clusters[0].id
    +        dedicateCmd.domainid = self.domain.id
    +        dedicateCmd.account = self.account_1.name
    +        self.apiclient.dedicateCluster(dedicateCmd)
    +
    +        # Step 2
    +        self.vm = VirtualMachine.create(
    +            self.userapiclient_1,
    +            self.testdata["small"],
    +            templateid=self.template.id,
    +            accountid=self.account_1.name,
    +            domainid=self.account_1.domainid,
    +            serviceofferingid=self.service_offering.id,
    +            zoneid=self.zone.id,
    +            mode=self.zone.networktype
    +        )
    +
    --- End diff --
    
    Can you please add few verification steps to make sure that vm and VR are being deployed on dedicated cluster when deploying with dedicated account?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-9140: Testcase to verify if De...

Posted by pritisarap12 <gi...@git.apache.org>.
Github user pritisarap12 commented on the pull request:

    https://github.com/apache/cloudstack/pull/1218#issuecomment-163903907
  
    Testcase Result:
    
    Dedicated cluster and router allocation ... === TestName: test_01_dedicated_cluster_allocation | Status : SUCCESS ===
    ok
    
    ----------------------------------------------------------------------
    Ran 1 test in 302.277s
    
    OK



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-9140: Testcase to verify if De...

Posted by shwetaag <gi...@git.apache.org>.
Github user shwetaag commented on the pull request:

    https://github.com/apache/cloudstack/pull/1218#issuecomment-188178629
  
    did code walk through. LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Re: [GitHub] cloudstack pull request: CLOUDSTACK-9140: Testcase to verify if De...

Posted by Sanjeev N <sa...@apache.org>.
LGTM !!

On Wed, Feb 17, 2016 at 12:46 PM, pritisarap12 <gi...@git.apache.org> wrote:

> Github user pritisarap12 commented on the pull request:
>
>     https://github.com/apache/cloudstack/pull/1218#issuecomment-185067571
>
>     Testcase result after modifications:
>
>     Dedicated cluster and router allocation ... === TestName:
> test_01_dedicated_cluster_allocation | Status : SUCCESS ===
>     ok
>
>     ----------------------------------------------------------------------
>     Ran 1 test in 278.037s
>
>     OK
>
>
>
> ---
> If your project is set up for it, you can reply to this email and have your
> reply appear on GitHub as well. If your project does not have this feature
> enabled and wishes so, or if the feature is enabled but not working, please
> contact infrastructure at infrastructure@apache.org or file a JIRA ticket
> with INFRA.
> ---
>

[GitHub] cloudstack pull request: CLOUDSTACK-9140: Testcase to verify if De...

Posted by pritisarap12 <gi...@git.apache.org>.
Github user pritisarap12 commented on the pull request:

    https://github.com/apache/cloudstack/pull/1218#issuecomment-185067571
  
    Testcase result after modifications:
    
    Dedicated cluster and router allocation ... === TestName: test_01_dedicated_cluster_allocation | Status : SUCCESS ===
    ok
    
    ----------------------------------------------------------------------
    Ran 1 test in 278.037s
    
    OK



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] cloudstack pull request: CLOUDSTACK-9140: Testcase to verify if De...

Posted by pritisarap12 <gi...@git.apache.org>.
Github user pritisarap12 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1218#discussion_r53127878
  
    --- Diff: test/integration/component/maint/testpath_disable_enable_zone.py ---
    @@ -1691,3 +1696,159 @@ def test_01_disable_enable_host(self):
                              )
     
             return
    +
    +
    +class TestClusterDedication(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestClusterDedication, cls).getClsTestClient()
    +        cls.apiclient = testClient.getApiClient()
    +        cls.testdata = testClient.getParsedTestDataConfig()
    +        cls.hypervisor = cls.testClient.getHypervisorInfo()
    +
    +        # Get Zone, Domain and templates
    +        cls.domain = get_domain(cls.apiclient)
    +        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
    +
    +        cls.template = get_template(
    +            cls.apiclient,
    +            cls.zone.id,
    +            cls.testdata["ostype"])
    +
    +        cls.Skiptest = False
    +        cls._cleanup = []
    +        cls.clusters = Cluster.list(cls.apiclient, zoneid=cls.zone.id)
    +        if len(cls.clusters) < 2:
    +            cls.Skiptest = True
    +
    +        try:
    +            # Create an account
    +            cls.account_1 = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +
    +            cls._cleanup.append(cls.account_1)
    +
    +            cls.account_2 = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +
    +            cls._cleanup.append(cls.account_2)
    +            # Create user api client of the account
    +            cls.userapiclient_1 = testClient.getUserApiClient(
    +                UserName=cls.account_1.name,
    +                DomainName=cls.account_1.domain
    +            )
    +            cls.userapiclient_2 = testClient.getUserApiClient(
    +                UserName=cls.account_2.name,
    +                DomainName=cls.account_2.domain
    +            )
    +
    +            # Create Service offering
    +            cls.service_offering = ServiceOffering.create(
    +                cls.apiclient,
    +                cls.testdata["service_offering"],
    +            )
    +            cls._cleanup.append(cls.service_offering)
    +
    +            cls.disk_offering = DiskOffering.create(
    +                cls.apiclient,
    +                cls.testdata["disk_offering"],
    +            )
    +
    +            cls._cleanup.append(cls.disk_offering)
    +
    +        except Exception as e:
    +            cls.tearDownClass()
    +            raise e
    +        return
    +
    +    @classmethod
    +    def tearDownClass(cls):
    +        try:
    +            cleanup_resources(cls.apiclient, cls._cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +
    +    def setUp(self):
    +
    +        if self.Skiptest:
    +            self.skipTest("Insufficient clusters to run the test")
    +
    +        self.apiclient = self.testClient.getApiClient()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.cleanup = []
    +
    +    def tearDown(self):
    +        try:
    +            listClusterscmd = listDedicatedClusters.listDedicatedClustersCmd()
    +            listClusterscmd.clusterid = self.clusters[0].id
    +            ret_list = self.apiclient.listDedicatedClusters(listClusterscmd)
    +            if ret_list:
    +                dedicateCmd = releaseDedicatedCluster.releaseDedicatedClusterCmd()
    +                dedicateCmd.clusterid = self.clusters[0].id
    +                self.apiclient.releaseDedicatedCluster(dedicateCmd)
    +
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    @attr(tags=["basic", "advanced"], required_hardware="false")
    +    def test_01_dedicated_cluster_allocation(self):
    +        """ Dedicated cluster and router allocation
    +            1.   Dedicate a cluster to one account
    +            2.   Deploy a VM on dedicated account
    +            3.   Deploy another VM on another account.
    +            4.   Verify the dedicated cluster is not used for
    +                virtual routers that belong to non-dedicated account
    +        """
    +
    +        # Step 1
    +        dedicateCmd = dedicateCluster.dedicateClusterCmd()
    +        dedicateCmd.clusterid = self.clusters[0].id
    +        dedicateCmd.domainid = self.domain.id
    +        dedicateCmd.account = self.account_1.name
    +        self.apiclient.dedicateCluster(dedicateCmd)
    +
    +        # Step 2
    +        self.vm = VirtualMachine.create(
    +            self.userapiclient_1,
    +            self.testdata["small"],
    +            templateid=self.template.id,
    +            accountid=self.account_1.name,
    +            domainid=self.account_1.domainid,
    +            serviceofferingid=self.service_offering.id,
    +            zoneid=self.zone.id,
    +            mode=self.zone.networktype
    +        )
    +
    --- End diff --
    
    Added verification steps:
    While a cluster gets dedicated to an account a default affinity group gets created, 
    then deploy VM using that affinity group to ensure that the VM is deployed on dedicated cluster.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---