cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gir...@apache.org
Subject git commit: updated refs/heads/4.3-forward to c8422b3
Date Tue, 18 Feb 2014 10:23:28 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.3-forward ccc168c70 -> c8422b3b5


CLOUDSTACK-4840: Adding first set of test cases for Multiple IPs per NIC feature


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

Branch: refs/heads/4.3-forward
Commit: c8422b3b50769b4064e7a497b0b6cd09a736fd26
Parents: ccc168c
Author: Ashutosh K <ashutosh@clogeny.com>
Authored: Tue Feb 18 15:51:57 2014 +0530
Committer: Girish Shilamkar <girish@clogeny.com>
Committed: Tue Feb 18 15:53:20 2014 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/codes.py                  |  4 ++
 tools/marvin/marvin/integration/lib/base.py   | 29 +++++++++++
 tools/marvin/marvin/integration/lib/common.py | 56 +++++++++++++++++++++-
 3 files changed, 87 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8422b3b/tools/marvin/marvin/codes.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/codes.py b/tools/marvin/marvin/codes.py
index 74fb05d..3882f0d 100644
--- a/tools/marvin/marvin/codes.py
+++ b/tools/marvin/marvin/codes.py
@@ -47,3 +47,7 @@ YES = "yes"
 FAILED = "FAILED"
 UNKNOWN_ERROR = "Unknown Error"
 EXCEPTION = "EXCEPTION"
+BASIC_ZONE = "basic"
+ISOLATED_NETWORK = "ISOLATED"
+SHARED_NETWORK = "SHARED"
+VPC_NETWORK = "VPC"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8422b3b/tools/marvin/marvin/integration/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base.py b/tools/marvin/marvin/integration/lib/base.py
index 409530c..f76f07e 100755
--- a/tools/marvin/marvin/integration/lib/base.py
+++ b/tools/marvin/marvin/integration/lib/base.py
@@ -3626,3 +3626,32 @@ class Resources:
         cmd = updateResourceCount.updateResourceCountCmd()
         [setattr(cmd, k, v) for k, v in kwargs.items()]
         return(apiclient.updateResourceCount(cmd))
+
+class NIC:
+    """NIC related API"""
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def addIp(cls, apiclient, id, ipaddress=None):
+        """Add Ip (secondary) to NIC"""
+        cmd = addIpToNic.addIpToNicCmd()
+        cmd.nicid = id
+        if ipaddress:
+            cmd.ipaddress = ipaddress
+        return(apiclient.addIpToNic(cmd))
+
+    @classmethod
+    def removeIp(cls,apiclient,ipaddressid):
+        """Remove secondary Ip from NIC"""
+        cmd = removeIpFromNic.removeIpFromNicCmd()
+        cmd.id = ipaddressid
+        return(apiclient.addIpToNic(cmd))
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List NICs belonging to a virtual machine"""
+
+        cmd = listNics.listNicsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listNics(cmd))

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8422b3b/tools/marvin/marvin/integration/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/common.py b/tools/marvin/marvin/integration/lib/common.py
index e202391..5b56c73 100644
--- a/tools/marvin/marvin/integration/lib/common.py
+++ b/tools/marvin/marvin/integration/lib/common.py
@@ -63,13 +63,14 @@ from marvin.integration.lib.base import (Configurations,
                                          Resources,
                                          PhysicalNetwork,
                                          Host,
-                                         PublicIPAddress)
+                                         PublicIPAddress,
+                                         NetworkOffering)
 from marvin.integration.lib.utils import (get_process_status,
                                           xsplit,
                                           validateList)
 
 from marvin.sshClient import SshClient
-from marvin.codes import PASS
+from marvin.codes import PASS, ISOLATED_NETWORK, VPC_NETWORK, BASIC_ZONE, FAIL
 import random
 
 #Import System modules
@@ -917,3 +918,54 @@ def is_public_ip_in_correct_state(apiclient, ipaddressid, state):
             time.sleep(60)
             continue
     return True
+
+def setSharedNetworkParams(networkServices, range=20):
+    """Fill up the services dictionary for shared network using random subnet"""
+
+    # @range: range decides the endip. Pass the range as "x" if you want the difference between
the startip
+    # and endip as "x"
+    # Set the subnet number of shared networks randomly prior to execution
+    # of each test case to avoid overlapping of ip addresses
+    shared_network_subnet_number = random.randrange(1,254)
+
+    networkServices["gateway"] = "172.16."+str(shared_network_subnet_number)+".1"
+    networkServices["startip"] = "172.16."+str(shared_network_subnet_number)+".2"
+    networkServices["endip"] = "172.16."+str(shared_network_subnet_number)+"."+str(range+1)
+    networkServices["netmask"] = "255.255.255.0"
+    return networkServices
+
+def createEnabledNetworkOffering(apiclient, networkServices):
+    """Create and enable network offering according to the type
+
+       @output: List, containing [ Result,Network Offering,Reason ]
+                 Ist Argument('Result') : FAIL : If exception or assertion error occurs
+                                          PASS : If network offering
+                                          is created and enabled successfully
+                 IInd Argument(Net Off) : Enabled network offering
+                                                In case of exception or
+                                                assertion error, it will be None
+                 IIIrd Argument(Reason) :  Reason for failure,
+                                              default to None
+    """
+    try:
+        resultSet = [FAIL, None, None]
+        # Create network offering
+        network_offering = NetworkOffering.create(apiclient, networkServices, conservemode=False)
+
+        # Update network offering state from disabled to enabled.
+        NetworkOffering.update(network_offering, apiclient, id=network_offering.id,
+                               state="enabled")
+    except Exception as e:
+        resultSet[2] = e
+        return resultSet
+    return [PASS, network_offering, None]
+
+def shouldTestBeSkipped(networkType, zoneType):
+    """Decide which test to skip, according to type of network and zone type"""
+
+    # If network type is isolated or vpc and zone type is basic, then test should be skipped
+    skipIt = False
+    if ((networkType.lower() == str(ISOLATED_NETWORK).lower() or networkType.lower() == str(VPC_NETWORK).lower())
+            and (zoneType.lower() == BASIC_ZONE)):
+        skipIt = True
+    return skipIt


Mime
View raw message