cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-9168) Testcase to check if wrong value is inserted into nics table netmask field when creating a VM
Date Wed, 03 Feb 2016 07:22:39 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-9168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15129952#comment-15129952
] 

ASF GitHub Bot commented on CLOUDSTACK-9168:
--------------------------------------------

Github user sanju1010 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1245#discussion_r51686104
  
    --- Diff: test/integration/testpaths/testpath_netmask.py ---
    @@ -0,0 +1,152 @@
    +# 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.
    +""" Test cases to Check Snapshots size in database
    +"""
    +
    +import re
    +
    +from nose.plugins.attrib import attr
    +from marvin.cloudstackTestCase import cloudstackTestCase
    +from marvin.lib.utils import (cleanup_resources,
    +                              )
    +from marvin.lib.base import (Account,
    +                             ServiceOffering,
    +                             VirtualMachine,
    +                             )
    +from marvin.lib.common import (get_domain,
    +                               get_zone,
    +                               get_template,
    +                               )
    +
    +
    +class TestCheckNetmask(cloudstackTestCase):
    +
    +    @classmethod
    +    def setUpClass(cls):
    +        testClient = super(TestCheckNetmask, 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._cleanup = []
    +
    +        cls.skiptest = False
    +
    +        if cls.hypervisor.lower() not in ["xenserver"]:
    +            cls.skiptest = True
    +            return
    +
    +        try:
    +
    +            # Create an account
    +            cls.account = Account.create(
    +                cls.apiclient,
    +                cls.testdata["account"],
    +                domainid=cls.domain.id
    +            )
    +            cls._cleanup.append(cls.account)
    +
    +            # Create user api client of the account
    +            cls.userapiclient = testClient.getUserApiClient(
    +                UserName=cls.account.name,
    +                DomainName=cls.account.domain
    +            )
    +
    +            # Create Service offering
    +            cls.service_offering = ServiceOffering.create(
    +                cls.apiclient,
    +                cls.testdata["service_offering"],
    +            )
    +            cls._cleanup.append(cls.service_offering)
    +
    +            cls.vm = VirtualMachine.create(
    +                cls.apiclient,
    +                cls.testdata["small"],
    +                templateid=cls.template.id,
    +                accountid=cls.account.name,
    +                domainid=cls.account.domainid,
    +                serviceofferingid=cls.service_offering.id,
    +                zoneid=cls.zone.id,
    +                mode=cls.zone.networktype
    +            )
    +
    +        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(
    +                "Test not to be run on %s" %
    +                self.hypervisor)
    +        self.apiclient = self.testClient.getApiClient()
    +        self.dbclient = self.testClient.getDbConnection()
    +        self.cleanup = []
    +
    +    def tearDown(self):
    +        try:
    +            cleanup_resources(self.apiclient, self.cleanup)
    +        except Exception as e:
    +            raise Exception("Warning: Exception during cleanup : %s" % e)
    +        return
    +
    +    @attr(tags=["basic"], required_hardware="false")
    +    def test_01_netmask_value_check(self):
    +        """ Check Netmask value in database
    +            1. Check if netmask attribute in nics table
    +                stores correct value.
    +        """
    +
    +        qryresult_netmask = self.dbclient.execute(
    +            " select id, uuid, netmask\
    +                    from nics where netmask = '%s';" %
    +            self.vm.nic[0].netmask)
    +
    +        self.assertNotEqual(
    +            len(qryresult_netmask),
    +            0,
    +            "Check if netmask attribute in nics table \
    +            stores correct value")
    +
    +        netmask_id = qryresult_netmask[0][2]
    +        if netmask_id != "NULL":
    +            netmask_value = re.match(
    --- End diff --
    
    This regex only checks for valid netmask. However, it does not validate whether the netmask
is from the guest cidr.


> Testcase to check if wrong value is inserted into nics table netmask field when creating
a VM
> ---------------------------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-9168
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9168
>             Project: CloudStack
>          Issue Type: Task
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: Automation
>    Affects Versions: 4.5.1
>            Reporter: Priti Sarap
>
> Testcase to verify if netmask is inserted in correct format or not in nics table.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message