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

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

rhtyd closed pull request #2374: CLOUDSTACK-10024: Network Migration: Tackle 
review comments
URL: https://github.com/apache/cloudstack/pull/2374
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/api/src/org/apache/cloudstack/api/command/admin/network/MigrateNetworkCmd.java
 
b/api/src/org/apache/cloudstack/api/command/admin/network/MigrateNetworkCmd.java
index 651fce87fd3..298d9b043e8 100644
--- 
a/api/src/org/apache/cloudstack/api/command/admin/network/MigrateNetworkCmd.java
+++ 
b/api/src/org/apache/cloudstack/api/command/admin/network/MigrateNetworkCmd.java
@@ -18,12 +18,14 @@
 
 import org.apache.log4j.Logger;
 
+import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 import org.apache.cloudstack.api.ACL;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ResponseObject.ResponseView;
 import org.apache.cloudstack.api.ServerApiException;
@@ -38,12 +40,18 @@
 import com.cloud.user.Account;
 import com.cloud.user.User;
 
-@APICommand(name = "migrateNetwork", description = "moves a network to another 
physical network", responseObject = NetworkResponse.class, responseView = 
ResponseView.Restricted, entityType = {Network.class},
-        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+@APICommand(name = MigrateNetworkCmd.APINAME, description = "moves a network 
to another physical network",
+            responseObject = NetworkResponse.class,
+            responseView = ResponseView.Restricted,
+            entityType = {Network.class},
+            requestHasSensitiveInfo = false,
+            responseHasSensitiveInfo = false,
+            since = "4.11.0",
+            authorized = {RoleType.Admin})
 public class MigrateNetworkCmd extends BaseAsyncCmd {
     public static final Logger s_logger = 
Logger.getLogger(MigrateNetworkCmd.class.getName());
 
-    private static final String s_name = "migratenetworkresponse";
+    public static final String APINAME = "migrateNetwork";
 
     /////////////////////////////////////////////////////
     //////////////// API parameters /////////////////////
@@ -81,7 +89,7 @@ public Boolean getResume() {
 
     @Override
     public String getCommandName() {
-        return s_name;
+        return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
     }
 
     @Override
diff --git 
a/api/src/org/apache/cloudstack/api/command/admin/network/MigrateVPCCmd.java 
b/api/src/org/apache/cloudstack/api/command/admin/network/MigrateVPCCmd.java
index 6cf115742a8..a5611c67aa4 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/MigrateVPCCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/MigrateVPCCmd.java
@@ -16,34 +16,44 @@
 // under the License.
 package org.apache.cloudstack.api.command.admin.network;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.acl.SecurityChecker;
 import org.apache.cloudstack.api.ACL;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ResponseObject;
 import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.response.VpcOfferingResponse;
 import org.apache.cloudstack.api.response.VpcResponse;
 import org.apache.cloudstack.context.CallContext;
-import org.apache.log4j.Logger;
-
-import java.util.HashMap;
-import java.util.Map;
 
 import com.cloud.event.EventTypes;
 import com.cloud.network.vpc.Vpc;
 import com.cloud.user.Account;
 import com.cloud.user.User;
 
-@APICommand(name = "migrateVPC", description = "moves a vpc to another 
physical network", responseObject = VpcResponse.class, responseView = 
ResponseObject.ResponseView.Restricted, entityType = {Vpc.class},
-        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+@APICommand(name = MigrateVPCCmd.APINAME,
+            description = "moves a vpc to another physical network",
+            responseObject = VpcResponse.class,
+            responseView = ResponseObject.ResponseView.Restricted,
+            entityType = {Vpc.class},
+            requestHasSensitiveInfo = false,
+            responseHasSensitiveInfo = false,
+            since = "4.11.0",
+            authorized = {RoleType.Admin})
 public class MigrateVPCCmd extends BaseAsyncCmd {
     public static final Logger s_logger = 
Logger.getLogger(MigrateVPCCmd.class.getName());
 
-    private static final String s_name = "migratevpcresponse";
+    public static final String APINAME = "migrateVPC";
 
     /////////////////////////////////////////////////////
     //////////////// API parameters /////////////////////
@@ -86,7 +96,7 @@ public Boolean getResume() {
         }
 
         for (HashMap<String, String> map : tierNetworkOfferings.values()) {
-             flatMap.put(map.get("networkid"), map.get("networkofferingid"));
+            flatMap.put(map.get("networkid"), map.get("networkofferingid"));
         }
 
         return flatMap;
@@ -98,7 +108,7 @@ public Boolean getResume() {
 
     @Override
     public String getCommandName() {
-        return s_name;
+        return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
     }
 
     @Override
diff --git 
a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtReplugNicCommandWrapper.java
 
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtReplugNicCommandWrapper.java
index 8c20a33e608..c91e719aabe 100644
--- 
a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtReplugNicCommandWrapper.java
+++ 
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtReplugNicCommandWrapper.java
@@ -87,14 +87,6 @@ public Answer execute(final ReplugNicCommand command, final 
LibvirtComputingReso
             s_logger.debug("ReplugNic: Updating interface" + interfaceDef);
             vm.updateDeviceFlags(interfaceDef.toString(), 
DomainAffect.LIVE.getValue());
 
-            /*
-            // Manual replug
-            for (final VifDriver vifDriver : 
libvirtComputingResource.getAllVifDrivers()) {
-                vifDriver.detach(oldPluggedNic);
-            }
-            newVifDriver.attach(interfaceDef);
-            */
-
             // We don't know which "traffic type" is associated with
             // each interface at this point, so inform all vif drivers
             for (final VifDriver vifDriver : 
libvirtComputingResource.getAllVifDrivers()) {
diff --git 
a/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/AssociateNuageVspDomainTemplateCmd.java
 
b/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/AssociateNuageVspDomainTemplateCmd.java
index 3eadf1013f9..760916a5b10 100644
--- 
a/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/AssociateNuageVspDomainTemplateCmd.java
+++ 
b/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/AssociateNuageVspDomainTemplateCmd.java
@@ -19,13 +19,7 @@
 
 package com.cloud.api.commands;
 
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.manager.NuageVspManager;
-import com.cloud.utils.exception.CloudRuntimeException;
+import javax.inject.Inject;
 
 import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.api.APICommand;
@@ -40,11 +34,20 @@
 import org.apache.cloudstack.api.response.ZoneResponse;
 import org.apache.cloudstack.context.CallContext;
 
-import javax.inject.Inject;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.manager.NuageVspManager;
+import com.cloud.utils.exception.CloudRuntimeException;
 
-@APICommand(name = AssociateNuageVspDomainTemplateCmd.APINAME, responseObject 
= SuccessResponse.class, description = "associate a vpc with a domain 
template", authorized = {RoleType.Admin, RoleType.DomainAdmin, RoleType.User})
+@APICommand(name = AssociateNuageVspDomainTemplateCmd.APINAME, responseObject 
= SuccessResponse.class,
+            description = "associate a vpc with a domain template", authorized 
= {RoleType.Admin, RoleType.DomainAdmin, RoleType.User},
+            since = "4.11.0")
 public class AssociateNuageVspDomainTemplateCmd extends BaseCmd {
     static final String APINAME = "associateNuageVspDomainTemplate";
+
     @Inject
     NuageVspManager _nuageVspManager;
 
diff --git 
a/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/ListNuageVspDomainTemplatesCmd.java
 
b/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/ListNuageVspDomainTemplatesCmd.java
index 2fc7a89afdc..8b000578a51 100644
--- 
a/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/ListNuageVspDomainTemplatesCmd.java
+++ 
b/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/ListNuageVspDomainTemplatesCmd.java
@@ -43,7 +43,7 @@
 import javax.inject.Inject;
 import java.util.List;
 
-@APICommand(name = ListNuageVspDomainTemplatesCmd.APINAME, responseObject = 
BaseResponse.class, description = "Lists Nuage VSP domain templates", since = 
"4.11", responseHasSensitiveInfo = false, authorized = {RoleType.Admin, 
RoleType.DomainAdmin, RoleType.User})
+@APICommand(name = ListNuageVspDomainTemplatesCmd.APINAME, responseObject = 
BaseResponse.class, description = "Lists Nuage VSP domain templates", since = 
"4.11.0", responseHasSensitiveInfo = false, authorized = {RoleType.Admin, 
RoleType.DomainAdmin, RoleType.User})
 public class ListNuageVspDomainTemplatesCmd extends BaseCmd {
     static final String APINAME = "listNuageVspDomainTemplates";
 
diff --git 
a/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/ListNuageVspGlobalDomainTemplateCmd.java
 
b/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/ListNuageVspGlobalDomainTemplateCmd.java
index a4dfd45ddf8..902417020a0 100644
--- 
a/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/ListNuageVspGlobalDomainTemplateCmd.java
+++ 
b/plugins/network-elements/nuage-vsp/src/com/cloud/api/commands/ListNuageVspGlobalDomainTemplateCmd.java
@@ -19,6 +19,11 @@
 
 package com.cloud.api.commands;
 
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.inject.Inject;
+
 import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiErrorCode;
@@ -27,11 +32,6 @@
 import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.response.ListResponse;
 
-import javax.inject.Inject;
-
-import java.util.LinkedList;
-import java.util.List;
-
 import com.cloud.api.response.NuageVspDomainTemplateResponse;
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientCapacityException;
@@ -43,7 +43,9 @@
 import com.cloud.user.Account;
 import com.cloud.utils.exception.CloudRuntimeException;
 
-@APICommand(name = ListNuageVspGlobalDomainTemplateCmd.APINAME, responseObject 
= BaseResponse.class, description = "Lists Nuage VSP domain templates", 
authorized = {RoleType.Admin, RoleType.DomainAdmin, RoleType.User})
+@APICommand(name = ListNuageVspGlobalDomainTemplateCmd.APINAME, responseObject 
= BaseResponse.class,
+            description = "Lists Nuage VSP domain templates", authorized = 
{RoleType.Admin, RoleType.DomainAdmin, RoleType.User},
+            since = "4.11.0")
 public class ListNuageVspGlobalDomainTemplateCmd  extends BaseCmd {
     static final String APINAME = "listNuageVspGlobalDomainTemplate";
 
diff --git a/test/integration/plugins/nuagevsp/test_nuage_network_migration.py 
b/test/integration/plugins/nuagevsp/test_nuage_network_migration.py
index d346a9a008a..5d64e4fdf5a 100644
--- a/test/integration/plugins/nuagevsp/test_nuage_network_migration.py
+++ b/test/integration/plugins/nuagevsp/test_nuage_network_migration.py
@@ -31,6 +31,29 @@
 import re
 
 
+class Services:
+    """Test network services
+    """
+    def __init__(self):
+        self.services = {
+            "shared_network_offering": {
+                "name": "MySharedOffering-shared",
+                "displaytext": "MySharedOffering",
+                "guestiptype": "Shared",
+                "supportedservices": "Dhcp,Dns,UserData",
+                "specifyVlan": "True",
+                "specifyIpRanges": "True",
+                "traffictype": "GUEST",
+                "tags": "native",
+                "serviceProviderList": {
+                    "Dhcp": "VirtualRouter",
+                    "Dns": "VirtualRouter",
+                    "UserData": "VirtualRouter"
+                }
+            }
+        }
+
+
 class TestNuageMigration(nuageTestCase):
     """Test Native to Nuage Migration
     """
@@ -38,6 +61,7 @@ class TestNuageMigration(nuageTestCase):
     @classmethod
     def setUpClass(cls):
         super(TestNuageMigration, cls).setUpClass()
+        cls.services = Services().services
 
         if not hasattr(cls.vsp_physical_network, "tags") \
                 or cls.vsp_physical_network.tags != 'nuage':
@@ -99,7 +123,7 @@ def setUpClass(cls):
 
         # create a Native shared network offering
         cls.native_shared_network_offering = cls.create_NetworkOffering(
-            cls.test_data["shared_network_offering"], False)
+            cls.services["shared_network_offering"], False)
 
         # create a Nuage shared network offering
         cls.nuage_shared_network_offering = cls.create_NetworkOffering(
@@ -1217,7 +1241,7 @@ def 
test_11_migrate_native_vpc_staticnat_to_nuage_traffic(self):
         self.debug("Creating Native VSP VPC offering with Static NAT service "
                    "provider as VPCVR...")
         native_vpc_off = self.create_VpcOffering(
-                self.test_data["vpc_offering_native"])
+                self.test_data["vpc_offering_reduced"])
         self.validate_VpcOffering(native_vpc_off, state="Enabled")
 
         self.debug("Creating a VPC with Static NAT service provider as "
@@ -1228,7 +1252,7 @@ def 
test_11_migrate_native_vpc_staticnat_to_nuage_traffic(self):
         self.debug("Creating native VPC Network Tier offering "
                    "with Static NAT service provider as VPCVR")
         native_tiernet_off = self.create_NetworkOffering(
-                self.test_data["vpc_network_offering_native"])
+                self.test_data["nw_offering_reduced_vpc"])
         self.validate_NetworkOffering(native_tiernet_off, state="Enabled")
 
         acl_list = self.create_NetworkAclList(
@@ -1479,7 +1503,7 @@ def 
test_12_migrate_native_vpc_multinic_to_nuage_traffic(self):
         self.debug("Creating Native VSP VPC offering with Static NAT service "
                    "provider as VPCVR...")
         native_vpc_off = self.create_VpcOffering(
-                self.test_data["vpc_offering_native"])
+                self.test_data["vpc_offering_reduced"])
         self.validate_VpcOffering(native_vpc_off, state="Enabled")
 
         self.debug("Creating a VPC with Static NAT service provider as "
@@ -1490,7 +1514,7 @@ def 
test_12_migrate_native_vpc_multinic_to_nuage_traffic(self):
         self.debug("Creating native VPC Network Tier offering "
                    "with Static NAT service provider as VPCVR")
         native_tiernet_off = self.create_NetworkOffering(
-                self.test_data["vpc_network_offering_native"])
+                self.test_data["nw_offering_reduced_vpc"])
         self.validate_NetworkOffering(native_tiernet_off, state="Enabled")
 
         acl_list = self.create_NetworkAclList(
@@ -1797,7 +1821,7 @@ def 
test_13_verify_guestvmip2_when_migrating_to_nuage(self):
         self.debug("Creating Native VSP VPC offering with Static NAT service "
                    "provider as VPCVR...")
         native_vpc_off = self.create_VpcOffering(
-                self.test_data["vpc_offering_native"])
+                self.test_data["vpc_offering_reduced"])
         self.validate_VpcOffering(native_vpc_off, state="Enabled")
 
         self.debug("Creating a VPC with Static NAT service provider as "
@@ -1808,7 +1832,7 @@ def 
test_13_verify_guestvmip2_when_migrating_to_nuage(self):
         self.debug("Creating native VPC Network Tier offering "
                    "with Static NAT service provider as VPCVR")
         native_tiernet_off = self.create_NetworkOffering(
-                self.test_data["vpc_network_offering_native"])
+                self.test_data["nw_offering_reduced_vpc"])
         self.validate_NetworkOffering(native_tiernet_off, state="Enabled")
 
         acl_list = self.create_NetworkAclList(
@@ -1917,7 +1941,7 @@ def test_15_native_to_native_vpc_migration(self):
         self.debug("Creating Native VSP VPC offering with Static NAT service "
                    "provider as VPCVR...")
         native_vpc_off = self.create_VpcOffering(
-                self.test_data["vpc_offering_native"])
+                self.test_data["vpc_offering_reduced"])
         self.validate_VpcOffering(native_vpc_off, state="Enabled")
 
         self.debug("Creating a VPC with Static NAT service provider as "
@@ -1928,7 +1952,7 @@ def test_15_native_to_native_vpc_migration(self):
         self.debug("Creating native VPC Network Tier offering "
                    "with Static NAT service provider as VPCVR")
         native_tiernet_off = self.create_NetworkOffering(
-                self.test_data["vpc_network_offering_native"])
+                self.test_data["nw_offering_reduced_vpc"])
         self.validate_NetworkOffering(native_tiernet_off, state="Enabled")
 
         acl_list = self.create_NetworkAclList(
diff --git a/test/integration/smoke/test_migration.py 
b/test/integration/smoke/test_migration.py
new file mode 100644
index 00000000000..f0cd5745d6d
--- /dev/null
+++ b/test/integration/smoke/test_migration.py
@@ -0,0 +1,333 @@
+# 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
+"""
+# Import Local Modules
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.lib.base import (
+    Account,
+    ServiceOffering,
+    VirtualMachine,
+    NetworkOffering,
+    Network,
+    VpcOffering,
+    VPC
+)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template,
+                               list_virtual_machines)
+
+from marvin.lib.utils import (get_hypervisor_type,
+                              cleanup_resources)
+
+
+# Import System Modules
+from nose.plugins.attrib import attr
+
+
+class Services:
+    """Test network services
+    """
+    def __init__(self):
+        self.services = {
+            "vpc": {
+                "name": "TestVPC",
+                "displaytext": "TestVPC",
+                "cidr": '10.0.0.1/24'
+            },
+            "network": {
+                "name": "Test Network",
+                "displaytext": "Test Network",
+                "netmask": '255.255.255.0'
+            },
+            "virtual_machine": {
+                "displayname": "Test VM",
+                "username": "root",
+                "password": "password",
+                "ssh_port": 22,
+                "privateport": 22,
+                "publicport": 22,
+                "protocol": 'TCP',
+            },
+        }
+
+
+class TestNetworkMigration(cloudstackTestCase):
+    @classmethod
+    def setUpClass(cls):
+        cls.testClient = super(TestNetworkMigration, cls).getClsTestClient()
+        cls.api_client = cls.testClient.getApiClient()
+        cls.test_data = cls.testClient.getParsedTestDataConfig()
+        cls.services = Services().services
+
+        hypervisor = get_hypervisor_type(cls.api_client)
+        if hypervisor.lower() not in ["vmware", "kvm"]:
+            raise unittest.SkipTest("This feature is supported "
+                                    "only on Vmware and KVM")
+
+    # Get Domain, Zone, Template
+        cls.domain = get_domain(cls.api_client)
+        cls.zone = get_zone(
+                cls.api_client,
+                cls.testClient.getZoneForTests())
+        cls.template = get_template(
+                cls.api_client,
+                cls.zone.id,
+                cls.test_data["ostype"]
+        )
+        cls.services["virtual_machine"]["template"] = cls.template.id
+        if cls.zone.localstorageenabled:
+            cls.storagetype = 'local'
+            cls.test_data["service_offerings"][
+                "tiny"]["storagetype"] = 'local'
+        else:
+            cls.storagetype = 'shared'
+            cls.test_data["service_offerings"][
+                "tiny"]["storagetype"] = 'shared'
+
+        cls.service_offering = ServiceOffering.create(
+                cls.api_client,
+                cls.test_data["service_offerings"]["tiny"]
+        )
+
+        # Create Network offering without userdata
+        cls.network_offering_nouserdata = NetworkOffering.create(
+                cls.api_client,
+                cls.test_data["network_offering"]
+        )
+        # Enable Network offering
+        cls.network_offering_nouserdata.update(cls.api_client,
+                                               state='Enabled')
+
+        # Create Network Offering with all the serices
+        cls.network_offering_all = NetworkOffering.create(
+                cls.api_client,
+                cls.test_data["isolated_network_offering"]
+        )
+        # Enable Network offering
+        cls.network_offering_all.update(cls.api_client, state='Enabled')
+
+        cls.native_vpc_network_offering = NetworkOffering.create(
+                    cls.api_client,
+                    cls.test_data["nw_offering_isolated_vpc"],
+                    conservemode=False)
+        cls.native_vpc_network_offering.update(cls.api_client,
+                                               state='Enabled')
+
+        cls._cleanup = [
+            cls.service_offering,
+            cls.network_offering_nouserdata,
+            cls.network_offering_all,
+            cls.native_vpc_network_offering
+        ]
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.hypervisor = self.testClient.getHypervisorInfo()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                self.apiclient,
+                self.test_data["account"],
+                admin=True,
+                domainid=self.domain.id
+        )
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            self.account.delete(self.apiclient)
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            # Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    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)
+
+    @attr(tags=["advanced", "smoke", "nativeisoonly"],
+          required_hardware="false")
+    def test_01_native_to_native_network_migration(self):
+        """
+        Verify Migration for an isolated network nativeOnly
+        1. create native non-persistent isolated network
+        2. migrate to other non-persistent isolated network
+        3. migrate back to first native non-persistent network
+        4. deploy VM in non-persistent isolated network
+        5. migrate to native persistent isolated network
+        6. migrate back to native non-persistent network
+        """
+
+        isolated_network = Network.create(
+                self.apiclient,
+                self.test_data["isolated_network"],
+                accountid=self.account.name,
+                domainid=self.account.domainid,
+                networkofferingid=self.network_offering_all.id,
+                zoneid=self.zone.id
+        )
+
+        self.migrate_network(
+                self.network_offering_nouserdata,
+                isolated_network, resume=False)
+
+        self.migrate_network(
+                self.network_offering_all,
+                isolated_network, resume=False)
+
+        deployVmResponse = VirtualMachine.create(
+                self.apiclient,
+                services=self.test_data["virtual_machine_userdata"],
+                accountid=self.account.name,
+                domainid=self.account.domainid,
+                serviceofferingid=self.service_offering.id,
+                networkids=[str(isolated_network.id)],
+                templateid=self.template.id,
+                zoneid=self.zone.id
+        )
+        vms = list_virtual_machines(
+                self.apiclient,
+                account=self.account.name,
+                domainid=self.account.domainid,
+                id=deployVmResponse.id
+        )
+        self.assert_(len(vms) > 0, "There are no Vms deployed in the account"
+                                   " %s" % self.account.name)
+        vm = vms[0]
+        self.assert_(vm.id == str(deployVmResponse.id),
+                     "Vm deployed is different from the test")
+        self.assert_(vm.state == "Running", "VM is not in Running state")
+
+        self.migrate_network(
+                self.network_offering_nouserdata,
+                isolated_network, resume=False)
+
+        self.migrate_network(
+                self.network_offering_all,
+                isolated_network, resume=False)
+
+    @attr(tags=["advanced", "smoke", "nativevpconly"],
+          required_hardware="false")
+    def test_02_native_to_native_vpc_migration(self):
+        """
+        Verify Migration for a vpc network nativeOnly
+        1. create native vpc with 2 tier networks
+        2. migrate to native vpc, check VR state
+        3. deploy VM in vpc tier network
+        4. acquire ip and enable staticnat
+        5. migrate to native vpc network
+        """
+
+        self.debug("Creating Native VSP VPC offering with Static NAT service "
+                   "provider as VPCVR...")
+        native_vpc_off = VpcOffering.create(
+                self.apiclient,
+                self.test_data["vpc_offering_reduced"])
+
+        self.debug("Enabling the VPC offering created")
+        native_vpc_off.update(self.apiclient, state='Enabled')
+
+        self.debug("Creating a VPC with Static NAT service provider as "
+                   "VpcVirtualRouter")
+        self.services["vpc"]["cidr"] = '10.1.1.1/16'
+        vpc = VPC.create(
+                self.apiclient,
+                self.services["vpc"],
+                vpcofferingid=native_vpc_off.id,
+                zoneid=self.zone.id,
+                account=self.account.name,
+                domainid=self.account.domainid
+        )
+        self.debug("Creating native VPC Network Tier offering "
+                   "with Static NAT service provider as VPCVR")
+        native_tiernet_off = \
+            NetworkOffering.create(self.apiclient,
+                                   self.test_data
+                                   ["nw_offering_reduced_vpc"],
+                                   conservemode=False)
+        native_tiernet_off.update(self.apiclient, state='Enabled')
+
+        self.debug("Creating a VPC tier network with Static NAT service")
+        vpc_tier = Network.create(self.apiclient,
+                                  self.services["network"],
+                                  accountid=self.account.name,
+                                  domainid=self.account.domainid,
+                                  networkofferingid=native_tiernet_off.id,
+                                  zoneid=self.zone.id,
+                                  gateway='10.1.1.1',
+                                  vpcid=vpc.id if vpc else self.vpc.id
+                                  )
+        self.debug("Created network with ID: %s" % vpc_tier.id)
+
+        network_offering_map = \
+            [{"networkid": vpc_tier.id,
+              "networkofferingid": self.native_vpc_network_offering.id}]
+
+        self.migrate_vpc(vpc, native_vpc_off,
+                         network_offering_map, resume=False)
+
+        network_offering_map = \
+            [{"networkid": vpc_tier.id,
+              "networkofferingid": native_tiernet_off.id}]
+
+        self.migrate_vpc(vpc, native_vpc_off,
+                         network_offering_map, resume=False)
+
+        self.debug('Creating VM in network=%s' % native_tiernet_off.name)
+        vm = VirtualMachine.create(
+                self.apiclient,
+                self.services["virtual_machine"],
+                accountid=self.account.name,
+                domainid=self.account.domainid,
+                serviceofferingid=self.service_offering.id,
+                networkids=[str(vpc_tier.id)],
+                templateid=self.template.id,
+                zoneid=self.zone.id
+        )
+        self.debug('Created VM=%s in network=%s' %
+                   (vm.id, native_tiernet_off.name))
+
+        network_offering_map = \
+            [{"networkid": vpc_tier.id,
+              "networkofferingid": self.native_vpc_network_offering.id}]
+
+        self.migrate_vpc(vpc, native_vpc_off,
+                         network_offering_map, resume=False)
+
+        network_offering_map = \
+            [{"networkid": vpc_tier.id,
+              "networkofferingid": native_tiernet_off.id}]
+
+        self.migrate_vpc(vpc, native_vpc_off,
+                         network_offering_map, resume=False)
diff --git a/tools/marvin/marvin/config/test_data.py 
b/tools/marvin/marvin/config/test_data.py
index e99c8ba0f38..a22e55859f6 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -419,8 +419,8 @@
         "displaytext": "MySharedOffering",
         "guestiptype": "Shared",
         "supportedservices": "Dhcp,Dns,UserData",
-        "specifyVlan": "True",
-        "specifyIpRanges": "True",
+        "specifyVlan": "False",
+        "specifyIpRanges": "False",
         "traffictype": "GUEST",
         "tags": "native",
         "serviceProviderList": {
@@ -483,6 +483,12 @@
         "supportedservices":
             
"Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat,NetworkACL"
     },
+    "vpc_offering_reduced": {
+        "name": "VPC reduced off",
+        "displaytext": "VPC reduced off",
+        "supportedservices":
+            "Dhcp,Dns,SourceNat,UserData,StaticNat,NetworkACL"
+    },
     "vpc_offering_multi_lb": {
         "name": "VPC offering with multiple Lb service providers",
         "displaytext": "VPC offering with multiple Lb service providers",
@@ -499,12 +505,6 @@
             "NetworkACL": 'VpcVirtualRouter'
         }
     },
-    "vpc_offering_native": {
-        "name": "VPC native off",
-        "displaytext": "VPC native off",
-        "supportedservices":
-            "Dhcp,Dns,SourceNat,UserData,StaticNat,NetworkACL"
-    },
     "vpc": {
         "name": "TestVPC",
         "displaytext": "TestVPC",
@@ -654,6 +654,26 @@
             "Lb": "VpcVirtualRouter"
         }
     },
+    "nw_offering_reduced_vpc": {
+        "name": 'Reduced Network for VPC',
+        "displaytext": 'Reduced Network for VPC',
+        "guestiptype": 'Isolated',
+        "supportedservices": 'Dhcp,StaticNat,SourceNat,NetworkACL,UserData,'
+                             'Dns',
+        "traffictype": 'GUEST',
+        "availability": 'Optional',
+        "tags": "native",
+        "useVpc": 'on',
+        "ispersistent": 'True',
+        "serviceProviderList": {
+            "Dhcp": "VpcVirtualRouter",
+            "StaticNat": "VpcVirtualRouter",
+            "SourceNat": "VpcVirtualRouter",
+            "NetworkACL": "VpcVirtualRouter",
+            "UserData": "VpcVirtualRouter",
+            "Dns": "VpcVirtualRouter"
+        }
+    },
     "nw_off_persistent_VPCVR_LB": {
         "name": "Persistent Network VPC with LB",
         "displaytext": "Persistent Network VPC No LB",
@@ -715,25 +735,6 @@
             "StaticNat": "VirtualRouter"
         }
     },
-    "vpc_network_offering_native": {
-        "name": 'vpc_net_off_marvin_native',
-        "displaytext": 'vpc_net_off_marvin_native',
-        "guestiptype": 'Isolated',
-        "supportedservices": 
'Dhcp,StaticNat,SourceNat,NetworkACL,UserData,Dns',
-        "traffictype": 'GUEST',
-        "availability": 'Optional',
-        "tags": "native",
-        "useVpc": 'on',
-        "ispersistent": 'True',
-        "serviceProviderList": {
-            "Dhcp": "VpcVirtualRouter",
-            "StaticNat": "VpcVirtualRouter",
-            "SourceNat": "VpcVirtualRouter",
-            "NetworkACL": "VpcVirtualRouter",
-            "UserData": "VpcVirtualRouter",
-            "Dns": "VpcVirtualRouter"
-        }
-    },
     "fwrule": {
         "startport": 22,
         "endport": 22,


 

----------------------------------------------------------------
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:
us...@infra.apache.org


> Physical Networking Migration
> -----------------------------
>
>                 Key: CLOUDSTACK-10024
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10024
>             Project: CloudStack
>          Issue Type: New Feature
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: API, KVM, Management Server, VMware
>            Reporter: Frank Maximus
>            Assignee: Frank Maximus
>             Fix For: 4.11.0.0
>
>
> *As a* Cloud Owner
> *I want to* migrate my existing guest networks to another physical network 
> infrastructure
> *In order to* leverage new network technologies, e.g. leverage SDN.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to