You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2017/12/10 20:35:57 UTC

[GitHub] krissterckx commented on a change in pull request #2259: CLOUDSTACK-10024: Network migration support

krissterckx commented on a change in pull request #2259: CLOUDSTACK-10024: Network migration support
URL: https://github.com/apache/cloudstack/pull/2259#discussion_r155959221
 
 

 ##########
 File path: test/integration/plugins/nuagevsp/test_nuage_network_migration.py
 ##########
 @@ -0,0 +1,1949 @@
+# 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.
+
+""" Network migration test with Nuage VSP SDN plugin
+"""
+# Import Local Modules
+from nuageTestCase import nuageTestCase
+from marvin.lib.base import (Account, Host)
+from marvin.lib.utils import is_server_ssh_ready
+from marvin.cloudstackAPI import updateZone
+
+# Import System Modules
+from nose.plugins.attrib import attr
+import time
+import base64
+import unittest
+import re
+
+
+class TestNuageMigration(nuageTestCase):
+    """Test Native to Nuage Migration
+    """
+
+    @classmethod
+    def setUpClass(cls):
+        super(TestNuageMigration, cls).setUpClass()
+
+        if not hasattr(cls.vsp_physical_network, "tags") \
+                or cls.vsp_physical_network.tags != 'nuage':
+            raise unittest.SkipTest("Require migrateACS configuration - skip")
+
+        # create a native vpc offering
+        cls.native_vpc_offering = cls.create_VpcOffering(cls.test_data
+                                                         ["vpc_offering"])
+        # create a nuage vpc offering
+        cls.nuage_vpc_offering = \
+            cls.create_VpcOffering(cls.test_data["nuagevsp"]["vpc_offering"])
+
+        # tier network offerings
+        cls.nuage_vpc_network_offering = \
+            cls.create_NetworkOffering(cls.test_data["nuagevsp"]
+                                       ["vpc_network_offering"])
+        cls.native_vpc_network_offering = \
+            cls.create_NetworkOffering(cls.test_data
+                                       ["nw_offering_isolated_vpc"])
+
+        # create a Nuage isolated network offering with vr
+        cls.nuage_isolated_network_offering = cls.create_NetworkOffering(
+            cls.test_data["nuagevsp"]["isolated_network_offering"], True)
+
+        # create a Nuage isolated network offering with vr and persistent
+        cls.nuage_isolated_network_offering_persistent = \
+            cls.create_NetworkOffering(
+                cls.test_data["nuagevsp"]
+                ["isolated_network_offering_persistent"],
+                True)
+
+        # create a Nuage isolated network offering without vr
+        cls.nuage_isolated_network_offering_without_vr = \
+            cls.create_NetworkOffering(
+                cls.test_data["nuagevsp"]
+                ["isolated_network_offering_without_vr"],
+                True)
+
+        # create a Nuage isolated network offering without vr but persistent
+        cls.nuage_isolated_network_offering_without_vr_persistent = \
+            cls.create_NetworkOffering(
+                cls.test_data["nuagevsp"]
+                ["isolated_network_offering_without_vr_persistent"],
+                True)
+
+        # create a native isolated network offering
+        cls.native_isolated_network_offering = cls.create_NetworkOffering(
+            cls.test_data["isolated_network_offering"], True)
+
+        # create a native persistent isolated network offering
+        cls.native_isolated_network_offering_persistent = \
+            cls.create_NetworkOffering(
+                cls.test_data["nw_off_isolated_persistent"], True)
+
+        # create a native persistent staticNat isolated network offering
+        cls.native_isolated_network_staticnat_offering_persistent = \
+            cls.create_NetworkOffering(
+                cls.test_data["isolated_staticnat_network_offering"], True)
+
+        # create a Native shared network offering
+        cls.native_shared_network_offering = cls.create_NetworkOffering(
+            cls.test_data["shared_network_offering"], False)
+
+        # create a Nuage shared network offering
+        cls.nuage_shared_network_offering = cls.create_NetworkOffering(
+            cls.test_data["nuagevsp"]["shared_nuage_network_offering"],
+            False)
+
+        cls.vmware_info = None
+
+        cls._cleanup = [
+            cls.nuage_isolated_network_offering,
+            cls.nuage_isolated_network_offering_persistent,
+            cls.nuage_isolated_network_offering_without_vr,
+            cls.nuage_isolated_network_offering_without_vr_persistent,
+            cls.native_isolated_network_offering,
+            cls.native_isolated_network_offering_persistent,
+            cls.native_vpc_offering,
+            cls.nuage_vpc_offering,
+            cls.nuage_vpc_network_offering,
+            cls.native_vpc_network_offering,
+            cls.native_shared_network_offering,
+            cls.nuage_shared_network_offering
+        ]
+        return
+
+    def setUp(self):
+        # Create an account
+        self.account = Account.create(self.api_client,
+                                      self.test_data["account"],
+                                      admin=True,
+                                      domainid=self.domain.id
+                                      )
+        self.cleanup = [self.account]
+        return
+
+    def migrate_network(self, nw_off, network, resume=False):
+        return network.migrate(self.api_client, nw_off.id, resume)
+
+    def migrate_vpc(self, vpc, vpc_offering,
+                    network_offering_map, resume=False):
+        return vpc.migrate(self.api_client,
+                           vpc_offering.id,
+                           network_offering_map, resume)
+
+    def verify_pingtovmipaddress(self, ssh, pingtovmipaddress):
+        """verify ping to ipaddress of the vm and retry 3 times"""
+        successfull_ping = False
+        reapplied_vlans = False
+        nbr_retries = 0
+        max_retries = 5
+        cmd = 'ping -c 2 ' + pingtovmipaddress
+
+        while not successfull_ping and nbr_retries < max_retries:
+            self.debug("ping vm by ipaddress with command: " + cmd)
+            outputlist = ssh.execute(cmd)
+            self.debug("command is executed properly " + cmd)
+            completeoutput = str(outputlist).strip('[]')
+            self.debug("complete output is " + completeoutput)
+            if '2 received' in completeoutput:
+                self.debug("PASS as vm is pingeable: " + completeoutput)
+                successfull_ping = True
+            else:
+                self.debug("FAIL as vm is not pingeable: " + completeoutput)
+                time.sleep(3)
+                if self.vmware_info \
+                        and nbr_retries == max_retries - 1 \
+                        and not reapplied_vlans:
+                    self.debug("Reapplying VLANs...")
+                    from nuagify.vmware import vmware
 
 Review comment:
   This import needs to be removed

----------------------------------------------------------------
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