You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by gi...@git.apache.org on 2017/05/17 11:33:50 UTC

[GitHub] meenakshim1 commented on a change in pull request #2106: CLOUDSTACK-9168: TestPath to check if wrong value is inserted into nics table netmask field when creating a VM.

meenakshim1 commented on a change in pull request #2106: CLOUDSTACK-9168: TestPath to check if wrong value is inserted into nics table netmask field when creating a VM.
URL: https://github.com/apache/cloudstack/pull/2106#discussion_r116975800
 
 

 ##########
 File path: test/integration/testpaths/testpath_netmask.py
 ##########
 @@ -0,0 +1,200 @@
+# 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
+"""
+
+
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.utils import (cleanup_resources,
+                              )
+from marvin.lib.base import (Account,
+                             Network,
+                             NetworkOffering,
+                             ServiceOffering,
+                             VirtualMachine,
+                             )
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template,
+                               list_networks)
+
+
+def ipv4_cidr_to_netmask(bits):
+    """ Convert CIDR bits to netmask """
+    netmask = ''
+    for i in range(4):
+        if i:
+            netmask += '.'
+        if bits >= 8:
+            netmask += '%d' % (2 ** 8 - 1)
+            bits -= 8
+        else:
+            netmask += '%d' % (256 - 2 ** (8 - bits))
+            bits = 0
+    return netmask
+
+
+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
+            )
+
+            # Create user api client of the account
+            cls.userapiclient = testClient.getUserApiClient(
 
 Review comment:
   Updated
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services