http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b0c27e48/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/NuageVspPluginClientLoader.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/NuageVspPluginClientLoader.java
 
b/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/NuageVspPluginClientLoader.java
index 57935b9..72ce290 100644
--- 
a/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/NuageVspPluginClientLoader.java
+++ 
b/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/NuageVspPluginClientLoader.java
@@ -19,82 +19,53 @@
 
 package net.nuage.vsp.acs;
 
-import net.nuage.vsp.acs.client.NuageVspApiClient;
-import net.nuage.vsp.acs.client.NuageVspElementClient;
-import net.nuage.vsp.acs.client.NuageVspGuruClient;
-import net.nuage.vsp.acs.client.NuageVspManagerClient;
-import net.nuage.vsp.acs.client.NuageVspSyncClient;
+import net.nuage.vsp.acs.client.api.NuageVspApiClient;
+import net.nuage.vsp.acs.client.api.NuageVspElementClient;
+import net.nuage.vsp.acs.client.api.NuageVspGuruClient;
+import net.nuage.vsp.acs.client.api.NuageVspManagerClient;
+import net.nuage.vsp.acs.client.api.impl.NuageVspApiClientImpl;
+import net.nuage.vsp.acs.client.api.impl.NuageVspElementClientImpl;
+import net.nuage.vsp.acs.client.api.impl.NuageVspGuruClientImpl;
+import net.nuage.vsp.acs.client.api.impl.NuageVspManagerClientImpl;
+import net.nuage.vsp.acs.client.api.model.VspHost;
 import org.apache.log4j.Logger;
 
-import javax.naming.ConfigurationException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
 
 public class NuageVspPluginClientLoader {
 
-    private ClassLoader _loader = null;
     private static final Logger s_logger = 
Logger.getLogger(NuageVspPluginClientLoader.class);
 
     private NuageVspApiClient _nuageVspApiClient;
     private NuageVspElementClient _nuageVspElementClient;
     private NuageVspGuruClient _nuageVspGuruClient;
     private NuageVspManagerClient _nuageVspManagerClient;
-    private NuageVspSyncClient _nuageVspSyncClient;
 
-    private static final String NUAGE_PLUGIN_CLIENT_JAR_FILE = 
"/usr/share/nuagevsp/lib/nuage-vsp-acs-client.jar";
-    private static final String NUAGE_VSP_API_CLIENT_IMPL = 
"net.nuage.vsp.acs.client.impl.NuageVspApiClientImpl";
-    private static final String NUAGE_VSP_SYNC_CLIENT_IMPL = 
"net.nuage.vsp.acs.client.impl.NuageVspSyncClientImpl";
-    private static final String NUAGE_VSP_ELEMENT_CLIENT_IMPL = 
"net.nuage.vsp.acs.client.impl.NuageVspElementClientImpl";
-    private static final String NUAGE_VSP_GURU_CLIENT_IMPL = 
"net.nuage.vsp.acs.client.impl.NuageVspGuruClientImpl";
-    private static final String NUAGE_VSP_MANAGER_CLIENT_IMPL = 
"net.nuage.vsp.acs.client.impl.NuageVspManagerClientImpl";
+    private NuageVspPluginClientLoader() {
 
-    private NuageVspPluginClientLoader(String nuagePluginClientJarLocation) {
-        try {
-            _loader = URLClassLoader.newInstance(new URL[] {new 
URL("jar:file:" + nuagePluginClientJarLocation + "!/")},
-                    getClass().getClassLoader());
-        } catch (MalformedURLException e) {
-            throw new IllegalArgumentException(e);
-        }
     }
 
-    public static NuageVspPluginClientLoader getClientLoader(String 
relativePath, String[] cmsUserInfo, int numRetries, int retryInterval,
-            String nuageVspCmsId) throws ConfigurationException {
-        NuageVspPluginClientLoader nuageVspPluginClientClassloader = new 
NuageVspPluginClientLoader(NUAGE_PLUGIN_CLIENT_JAR_FILE);
-        nuageVspPluginClientClassloader.loadClasses(relativePath, cmsUserInfo, 
numRetries, retryInterval, nuageVspCmsId);
+    public static NuageVspPluginClientLoader getClientLoader(String 
relativePath, String cmsUserEnterprise, String cmsUserLogin,
+            String cmsUserPassword, int numRetries, int retryInterval, String 
nuageVspCmsId) {
+        NuageVspPluginClientLoader nuageVspPluginClientClassloader = new 
NuageVspPluginClientLoader();
+        nuageVspPluginClientClassloader.loadClasses(relativePath, 
cmsUserEnterprise, cmsUserLogin, cmsUserPassword, numRetries, retryInterval, 
nuageVspCmsId);
         return nuageVspPluginClientClassloader;
     }
 
-    private void loadClasses(String relativePath, String[] cmsUserInfo, int 
numRetries, int retryInterval, String nuageVspCmsId) throws 
ConfigurationException {
-        try {
-            Class<?> nuageVspApiClientClass = 
Class.forName(NUAGE_VSP_API_CLIENT_IMPL, true, _loader);
-            Class<?> nuageVspSyncClientClass = 
Class.forName(NUAGE_VSP_SYNC_CLIENT_IMPL, true, _loader);
-            Class<?> nuageVspGuruClientClass = 
Class.forName(NUAGE_VSP_GURU_CLIENT_IMPL, true, _loader);
-            Class<?> nuageVspElementClientClass = 
Class.forName(NUAGE_VSP_ELEMENT_CLIENT_IMPL, true, _loader);
-            Class<?> nuageVspManagerClientClass = 
Class.forName(NUAGE_VSP_MANAGER_CLIENT_IMPL, true, _loader);
-
-            //Instantiate the instances
-            _nuageVspApiClient = 
(NuageVspApiClient)nuageVspApiClientClass.newInstance();
-            _nuageVspApiClient.setNuageVspHost(relativePath, cmsUserInfo, 
numRetries, retryInterval, nuageVspCmsId);
-            _nuageVspSyncClient = 
(NuageVspSyncClient)nuageVspSyncClientClass.newInstance();
-            _nuageVspSyncClient.setNuageVspApiClient(_nuageVspApiClient);
-            _nuageVspGuruClient = 
(NuageVspGuruClient)nuageVspGuruClientClass.newInstance();
-            _nuageVspGuruClient.setNuageVspApiClient(_nuageVspApiClient);
-            _nuageVspElementClient = 
(NuageVspElementClient)nuageVspElementClientClass.newInstance();
-            _nuageVspElementClient.setNuageVspApiClient(_nuageVspApiClient);
-            _nuageVspManagerClient = 
(NuageVspManagerClient)nuageVspManagerClientClass.newInstance();
-            _nuageVspManagerClient.setNuageVspApiClient(_nuageVspApiClient);
-        } catch (ClassNotFoundException cnfe) {
-            s_logger.error("Error while loading classes of Nuage VSP client", 
cnfe);
-            throw new ConfigurationException("Error while loading classes of 
Nuage VSP client");
-        } catch (InstantiationException ie) {
-            s_logger.error("Error while initializing classes of Nuage VSP 
client", ie);
-            throw new ConfigurationException("Error while initializing classes 
of Nuage VSP client");
-        } catch (IllegalAccessException iae) {
-            s_logger.error("Error while accessing classes of Nuage VSP 
client", iae);
-            throw new ConfigurationException("Error while accessing classes of 
Nuage VSP client");
-        }
-
+    private void loadClasses(String relativePath, String cmsUserEnterprise, 
String cmsUserLogin, String cmsUserPassword, int numRetries,
+            int retryInterval, String nuageVspCmsId) {
+        VspHost vspHost = new VspHost.Builder()
+                .restRelativePath(relativePath)
+                .cmsUserEnterprise(cmsUserEnterprise)
+                .cmsUserLogin(cmsUserLogin)
+                .cmsUserPassword(cmsUserPassword)
+                .noofRetry(numRetries)
+                .retryInterval(retryInterval)
+                .nuageVspCmsId(nuageVspCmsId)
+                .build();
+        _nuageVspApiClient = new NuageVspApiClientImpl(vspHost);
+        _nuageVspElementClient = new 
NuageVspElementClientImpl(_nuageVspApiClient);
+        _nuageVspGuruClient = new NuageVspGuruClientImpl(_nuageVspApiClient);
+        _nuageVspManagerClient = new 
NuageVspManagerClientImpl(_nuageVspApiClient);
     }
 
     public NuageVspApiClient getNuageVspApiClient() {
@@ -112,8 +83,4 @@ public class NuageVspPluginClientLoader {
     public NuageVspManagerClient getNuageVspManagerClient() {
         return _nuageVspManagerClient;
     }
-
-    public NuageVspSyncClient getNuageVspSyncClient() {
-        return _nuageVspSyncClient;
-    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b0c27e48/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspApiClient.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspApiClient.java
 
b/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspApiClient.java
deleted file mode 100644
index d80daf9..0000000
--- 
a/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspApiClient.java
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// 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.
-//
-
-package net.nuage.vsp.acs.client;
-
-import java.util.concurrent.ExecutionException;
-
-public interface NuageVspApiClient {
-
-    void login() throws ExecutionException;
-
-    void setNuageVspHost(String restRelativePath, String[] cmsUserInfo, int 
noofRetry, int retryInterval, String nuageVspCmsId);
-
-    String executeRestApi(String method, String resource, String resourceId, 
String childResource, Object entityDetails, String resourceFilter, String 
proxyUserUuid,
-                                 String proxyUserDomainuuid) throws 
ExecutionException;
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b0c27e48/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspElementClient.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspElementClient.java
 
b/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspElementClient.java
deleted file mode 100644
index acd4256..0000000
--- 
a/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspElementClient.java
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// 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.
-//
-
-package net.nuage.vsp.acs.client;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-
-public interface NuageVspElementClient {
-
-    boolean implement(long networkId, String networkDomainUuid, String 
networkUuid, String networkName, String vpcOrSubnetUuid, boolean isL2Network, 
boolean isL3Network,
-                             boolean isVpc, boolean isShared, String 
domainTemplateName, boolean isFirewallServiceSupported, List<String> 
dnsServers, List<Map<String, Object>> ingressFirewallRules,
-                             List<Map<String, Object>> egressFirewallRules, 
List<String> acsFipUuid, boolean egressDefaultPolicy) throws ExecutionException;
-
-    void applyStaticNats(String networkDomainUuid, String networkUuid, String 
vpcOrSubnetUuid, boolean isL3Network, boolean isVpc,
-                                List<Map<String, Object>> staticNatDetails) 
throws ExecutionException;
-
-    void applyAclRules(boolean isNetworkAcl, String networkUuid, String 
networkDomainUuid, String vpcOrSubnetUuid, String networkName, boolean 
isL2Network,
-                              List<Map<String, Object>> rules, long networkId, 
boolean egressDefaultPolicy, Boolean isAcsIngressAcl, boolean networkReset, 
String domainTemplateName) throws ExecutionException;
-
-    void shutdownVpc(String domainUuid, String vpcUuid, String 
domainTemplateName) throws ExecutionException;
-
-    <C extends NuageVspApiClient> void setNuageVspApiClient(NuageVspApiClient 
nuageVspApiClient);
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b0c27e48/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspGuruClient.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspGuruClient.java
 
b/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspGuruClient.java
deleted file mode 100644
index 2b3a63a..0000000
--- 
a/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspGuruClient.java
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// 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.
-//
-
-package net.nuage.vsp.acs.client;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-public interface NuageVspGuruClient {
-
-    void implement(String networkDomainName, String networkDomainPath, String 
networkDomainUuid, String networkAccountName, String networkAccountUuid, String 
networkName,
-                          String networkCidr, String networkGateway, Long 
networkAclId, List<String> dnsServers, List<String> gatewaySystemIds, boolean 
isL3Network, boolean isVpc, boolean isSharedNetwork,
-                          String networkUuid, String vpcName, String vpcUuid, 
boolean defaultEgressPolicy, Collection<String[]> ipAddressRange, String 
domainTemplateName) throws ExecutionException;
-
-    void reserve(String nicUuid, String nicMacAddress, String networkUuid, 
boolean isL3Network, boolean isSharedNetwork, String vpcUuid, String 
networkDomainUuid,
-                                             String networksAccountUuid, 
boolean isDomainRouter, String domainRouterIp, String vmInstanceName, String 
vmUuid, boolean useStaticIp, String staticIp, String staticNatIpUuid,
-                                             String staticNatIpAddress, 
boolean isStaticNatIpAllocated, boolean isOneToOneNat, String 
staticNatVlanUuid, String staticNatVlanGateway, String staticNatVlanNetmask) 
throws ExecutionException;
-
-    void deallocate(String networkUuid, String nicFrmDdUuid, String 
nicMacAddress, String nicIp4Address, boolean isL3Network, boolean 
isSharedNetwork,
-                           String vpcUuid, String networksDomainUuid, String 
vmInstanceName, String vmUuid, boolean isExpungingState) throws 
ExecutionException;
-
-    void trash(String domainUuid, String networkUuid, boolean isL3Network, 
boolean isSharedNetwork, String vpcUuid, String domainTemplateName) throws 
ExecutionException;
-
-    void setNuageVspApiClient(NuageVspApiClient nuageVspApiClient);
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b0c27e48/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspManagerClient.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspManagerClient.java
 
b/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspManagerClient.java
deleted file mode 100644
index f134111..0000000
--- 
a/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspManagerClient.java
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// 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.
-//
-
-package net.nuage.vsp.acs.client;
-
-import org.apache.commons.lang3.tuple.Pair;
-
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-
-public interface NuageVspManagerClient {
-
-    Pair<Boolean, String> auditNuageVspCmsId(String nuageVspCmsId, boolean 
auditOnly) throws ExecutionException;
-
-    String registerNuageVspCmsId() throws ExecutionException;
-
-    boolean unregisterNuageVspCmsId(String nuageVspCmsId) throws 
ExecutionException;
-
-    boolean isSupportedApiVersion(String version);
-
-    Map<String, Object> getClientDefaults() throws ExecutionException;
-
-    boolean syncDomainWithNuageVsp(String domainUuid, String domainName, 
String domainPath, boolean add, boolean remove) throws ExecutionException;
-
-    <C extends NuageVspApiClient> void setNuageVspApiClient(NuageVspApiClient 
nuageVspApiClient);
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b0c27e48/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspSyncClient.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspSyncClient.java
 
b/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspSyncClient.java
deleted file mode 100644
index 951ee5a..0000000
--- 
a/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/client/NuageVspSyncClient.java
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// 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.
-//
-
-package net.nuage.vsp.acs.client;
-
-import java.util.concurrent.ExecutionException;
-
-public interface NuageVspSyncClient {
-
-    void syncWithNuageVsp(String nuageVspEntity) throws ExecutionException;
-
-    void setNuageVspApiClient(NuageVspApiClient nuageVspApiClient);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b0c27e48/plugins/network-elements/nuage-vsp/test/com/cloud/NuageTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/test/com/cloud/NuageTest.java 
b/plugins/network-elements/nuage-vsp/test/com/cloud/NuageTest.java
new file mode 100644
index 0000000..845a8be
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/test/com/cloud/NuageTest.java
@@ -0,0 +1,157 @@
+//
+// 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.
+//
+
+package com.cloud;
+
+import com.cloud.dc.VlanVO;
+import com.cloud.domain.Domain;
+import com.cloud.network.Network;
+import com.cloud.network.NetworkModel;
+import com.cloud.network.dao.IPAddressVO;
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.vpc.NetworkACLItem;
+import com.cloud.util.NuageVspEntityBuilder;
+import com.cloud.vm.NicProfile;
+import com.cloud.vm.NicVO;
+import com.cloud.vm.VirtualMachine;
+import net.nuage.vsp.acs.client.api.model.VspAclRule;
+import net.nuage.vsp.acs.client.api.model.VspDomain;
+import net.nuage.vsp.acs.client.api.model.VspNetwork;
+import net.nuage.vsp.acs.client.api.model.VspNic;
+import net.nuage.vsp.acs.client.api.model.VspStaticNat;
+import net.nuage.vsp.acs.client.api.model.VspVm;
+import net.nuage.vsp.acs.client.common.model.Pair;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.junit.Before;
+
+import java.util.ArrayList;
+
+import static 
com.cloud.network.manager.NuageVspManager.NuageVspIsolatedNetworkDomainTemplateName;
+import static 
com.cloud.network.manager.NuageVspManager.NuageVspSharedNetworkDomainTemplateName;
+import static 
com.cloud.network.manager.NuageVspManager.NuageVspVpcDomainTemplateName;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class NuageTest {
+
+    protected static final long NETWORK_ID = 42L;
+    protected NetworkModel _networkModel = mock(NetworkModel.class);
+    protected ConfigurationDao _configurationDao = 
mock(ConfigurationDao.class);
+    protected NuageVspEntityBuilder _nuageVspEntityBuilder = 
mock(NuageVspEntityBuilder.class);
+
+    @Before
+    public void setUp() throws Exception {
+        // Standard responses
+        when(_networkModel.isProviderForNetwork(Network.Provider.NuageVsp, 
NETWORK_ID)).thenReturn(true);
+        
when(_configurationDao.getValue(NuageVspIsolatedNetworkDomainTemplateName.key())).thenReturn("IsolatedDomainTemplate");
+        
when(_configurationDao.getValue(NuageVspVpcDomainTemplateName.key())).thenReturn("VpcDomainTemplate");
+        
when(_configurationDao.getValue(NuageVspSharedNetworkDomainTemplateName.key())).thenReturn("SharedDomainTemplate");
+
+        
when(_nuageVspEntityBuilder.buildVspDomain(any(Domain.class))).thenReturn(buildVspDomain());
+        when(_nuageVspEntityBuilder.buildVspNetwork(any(Network.class), 
anyBoolean())).thenReturn(buildVspNetwork());
+        when(_nuageVspEntityBuilder.buildVspVm(any(VirtualMachine.class), 
any(Network.class))).thenReturn(buildVspVm());
+        when(_nuageVspEntityBuilder.buildVspNic(anyString(), 
any(NicProfile.class))).thenReturn(buildVspNic());
+        
when(_nuageVspEntityBuilder.buildVspNic(any(NicVO.class))).thenReturn(buildVspNic());
+        when(_nuageVspEntityBuilder.buildVspStaticNat(anyBoolean(), 
any(IPAddressVO.class), any(VlanVO.class), 
any(NicVO.class))).thenReturn(buildVspStaticNat());
+        when(_nuageVspEntityBuilder.buildVspAclRule(any(FirewallRule.class), 
any(Network.class))).thenReturn(buildVspAclRule());
+        
when(_nuageVspEntityBuilder.buildVspAclRule(any(NetworkACLItem.class))).thenReturn(buildVspAclRule());
+    }
+
+    protected VspDomain buildVspDomain() {
+        return new VspDomain.Builder()
+                .uuid("domainUuid")
+                .name("domainName")
+                .path("domainPath")
+                .build();
+    }
+
+    protected VspNetwork buildVspNetwork() {
+        return new VspNetwork.Builder()
+                .id(NETWORK_ID)
+                .uuid("networkUuid")
+                .name("networkName")
+                .domain(buildVspDomain())
+                .accountUuid("networkAccountUuid")
+                .accountName("networkAccountName")
+                .vpcUuid("vpcUuid")
+                .vpcName("vpcName")
+                .networkType(VspNetwork.NetworkType.L3)
+                .firewallServiceSupported(true)
+                .egressDefaultPolicy(true)
+                .domainTemplateName("domainTemplateName")
+                .cidr("networkCidr")
+                .gateway("networkGateway")
+                .virtualRouterIp("virtualRouterIp")
+                .ipAddressRanges(new ArrayList<Pair<String, String>>())
+                .build();
+    }
+
+    protected VspVm buildVspVm() {
+        return new VspVm.Builder()
+                .state(VspVm.State.Running)
+                .uuid("vmUuid")
+                .name("vmName")
+                .domainRouter(true)
+                .domainRouterIp("domainRouterIp")
+                .build();
+    }
+
+    protected VspNic buildVspNic() {
+        return new VspNic.Builder()
+                .uuid("nicUuid")
+                .macAddress("macAddress")
+                .useStaticIp(true)
+                .ip("ip")
+                .build();
+    }
+
+    protected VspStaticNat buildVspStaticNat() {
+        return new VspStaticNat.Builder()
+                .state(VspStaticNat.State.Allocating)
+                .ipUuid("ipUuid")
+                .ipAddress("ipAddress")
+                .nic(buildVspNic())
+                .revoke(false)
+                .oneToOneNat(true)
+                .vlanUuid("vlanUuid")
+                .vlanGateway("vlanGateway")
+                .vlanNetmask("vlanNetmask")
+                .build();
+    }
+
+    protected VspAclRule buildVspAclRule() {
+        return new VspAclRule.Builder()
+                .uuid("aclRuleUuid")
+                .protocol("protcol")
+                .startPort(1)
+                .endPort(9)
+                .state(VspAclRule.ACLState.Add)
+                .trafficType(VspAclRule.ACLTrafficType.Ingress)
+                .action(VspAclRule.ACLAction.Allow)
+                .sourceIpAddress("sourceIpAddress")
+                .sourceCidrList(new ArrayList<String>())
+                .priority(1)
+                .type(VspAclRule.ACLType.NetworkACL)
+                .build();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b0c27e48/plugins/network-elements/nuage-vsp/test/com/cloud/agent/api/CommandsTest.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/nuage-vsp/test/com/cloud/agent/api/CommandsTest.java 
b/plugins/network-elements/nuage-vsp/test/com/cloud/agent/api/CommandsTest.java
index 817ab7a..2a0b07a 100644
--- 
a/plugins/network-elements/nuage-vsp/test/com/cloud/agent/api/CommandsTest.java
+++ 
b/plugins/network-elements/nuage-vsp/test/com/cloud/agent/api/CommandsTest.java
@@ -30,43 +30,41 @@ import com.cloud.agent.api.guru.TrashNetworkVspCommand;
 import com.cloud.agent.api.manager.SupportedApiVersionCommand;
 import com.cloud.agent.api.sync.SyncDomainCommand;
 import com.cloud.agent.api.sync.SyncNuageVspCmsIdCommand;
-import com.cloud.agent.api.sync.SyncVspCommand;
 import com.google.common.collect.Maps;
 import com.google.common.testing.EqualsTester;
 import org.junit.Test;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.util.Map;
 
 public class CommandsTest {
 
     @Test
     public void testCommandEquals() throws IllegalAccessException, 
InvocationTargetException, InstantiationException {
-        ApplyAclRuleVspCommand applyAclRuleVspCommand = fillBuilderObject(new 
ApplyAclRuleVspCommand.Builder()).build();
-        ApplyAclRuleVspCommand otherApplyAclRuleVspCommand = 
fillBuilderObject(new ApplyAclRuleVspCommand.Builder()).build();
+        ApplyAclRuleVspCommand applyAclRuleVspCommand = 
fillObject(ApplyAclRuleVspCommand.class);
+        ApplyAclRuleVspCommand otherApplyAclRuleVspCommand = 
fillObject(ApplyAclRuleVspCommand.class);
 
-        ApplyStaticNatVspCommand applyStaticNatVspCommand = 
fillBuilderObject(new ApplyStaticNatVspCommand.Builder()).build();
-        ApplyStaticNatVspCommand otherApplyStaticNatVspCommand = 
fillBuilderObject(new ApplyStaticNatVspCommand.Builder()).build();
+        ApplyStaticNatVspCommand applyStaticNatVspCommand = 
fillObject(ApplyStaticNatVspCommand.class);
+        ApplyStaticNatVspCommand otherApplyStaticNatVspCommand = 
fillObject(ApplyStaticNatVspCommand.class);
 
-        ImplementVspCommand implementVspCommand = fillBuilderObject(new 
ImplementVspCommand.Builder()).build();
-        ImplementVspCommand otherImplementVspCommand = fillBuilderObject(new 
ImplementVspCommand.Builder()).build();
+        ImplementVspCommand implementVspCommand = 
fillObject(ImplementVspCommand.class);
+        ImplementVspCommand otherImplementVspCommand = 
fillObject(ImplementVspCommand.class);
 
-        ShutDownVpcVspCommand shutDownVpcVspCommand = fillBuilderObject(new 
ShutDownVpcVspCommand.Builder()).build();
-        ShutDownVpcVspCommand otherShutDownVpcVspCommand = 
fillBuilderObject(new ShutDownVpcVspCommand.Builder()).build();
+        ShutDownVpcVspCommand shutDownVpcVspCommand = 
fillObject(ShutDownVpcVspCommand.class);
+        ShutDownVpcVspCommand otherShutDownVpcVspCommand = 
fillObject(ShutDownVpcVspCommand.class);
 
-        DeallocateVmVspCommand deallocateVmVspCommand = fillBuilderObject(new 
DeallocateVmVspCommand.Builder()).build();
-        DeallocateVmVspCommand otherDeallocateVmVspCommand = 
fillBuilderObject(new DeallocateVmVspCommand.Builder()).build();
+        DeallocateVmVspCommand deallocateVmVspCommand = 
fillObject(DeallocateVmVspCommand.class);
+        DeallocateVmVspCommand otherDeallocateVmVspCommand = 
fillObject(DeallocateVmVspCommand.class);
 
-        ImplementNetworkVspCommand implementNetworkVspCommand = 
fillBuilderObject(new ImplementNetworkVspCommand.Builder()).build();
-        ImplementNetworkVspCommand otherImplementNetworkVspCommand = 
fillBuilderObject(new ImplementNetworkVspCommand.Builder()).build();
+        ImplementNetworkVspCommand implementNetworkVspCommand = 
fillObject(ImplementNetworkVspCommand.class);
+        ImplementNetworkVspCommand otherImplementNetworkVspCommand = 
fillObject(ImplementNetworkVspCommand.class);
 
-        ReserveVmInterfaceVspCommand reserveVmInterfaceVspCommand = 
fillBuilderObject(new ReserveVmInterfaceVspCommand.Builder()).build();
-        ReserveVmInterfaceVspCommand otherReserveVmInterfaceVspCommand = 
fillBuilderObject(new ReserveVmInterfaceVspCommand.Builder()).build();
+        ReserveVmInterfaceVspCommand reserveVmInterfaceVspCommand = 
fillObject(ReserveVmInterfaceVspCommand.class);
+        ReserveVmInterfaceVspCommand otherReserveVmInterfaceVspCommand = 
fillObject(ReserveVmInterfaceVspCommand.class);
 
-        TrashNetworkVspCommand trashNetworkVspCommand = fillBuilderObject(new 
TrashNetworkVspCommand.Builder()).build();
-        TrashNetworkVspCommand otherTrashNetworkVspCommand  = 
fillBuilderObject(new TrashNetworkVspCommand.Builder()).build();
+        TrashNetworkVspCommand trashNetworkVspCommand = 
fillObject(TrashNetworkVspCommand.class);
+        TrashNetworkVspCommand otherTrashNetworkVspCommand  = 
fillObject(TrashNetworkVspCommand.class);
 
         SupportedApiVersionCommand supportedApiVersionCommand = new 
SupportedApiVersionCommand("3.2");
         SupportedApiVersionCommand otherSupportedApiVersionCommand = new 
SupportedApiVersionCommand("3.2");
@@ -77,15 +75,9 @@ public class CommandsTest {
         SyncNuageVspCmsIdCommand syncNuageVspCmsIdCommand = 
fillObject(SyncNuageVspCmsIdCommand.class);
         SyncNuageVspCmsIdCommand otherSyncNuageVspCmsIdCommand = 
fillObject(SyncNuageVspCmsIdCommand.class);
 
-        SyncVspCommand syncVspCommand = fillObject(SyncVspCommand.class);
-        SyncVspCommand otherSyncVspCommand = fillObject(SyncVspCommand.class);
-
         PingNuageVspCommand pingNuageVspCommand = 
fillObject(PingNuageVspCommand.class);
         PingNuageVspCommand otherPingNuageVspCommand = 
fillObject(PingNuageVspCommand.class);
 
-        VspResourceCommand vspResourceCommand = 
fillObject(VspResourceCommand.class);
-        VspResourceCommand otherVspResourceCommand = 
fillObject(VspResourceCommand.class);
-
         new EqualsTester()
                 .addEqualityGroup(applyAclRuleVspCommand, 
otherApplyAclRuleVspCommand)
                 .addEqualityGroup(applyStaticNatVspCommand, 
otherApplyStaticNatVspCommand)
@@ -98,33 +90,10 @@ public class CommandsTest {
                 .addEqualityGroup(supportedApiVersionCommand, 
otherSupportedApiVersionCommand)
                 .addEqualityGroup(syncDomainCommand, otherSyncDomainCommand)
                 .addEqualityGroup(syncNuageVspCmsIdCommand, 
otherSyncNuageVspCmsIdCommand)
-                .addEqualityGroup(syncVspCommand, otherSyncVspCommand)
                 .addEqualityGroup(pingNuageVspCommand, 
otherPingNuageVspCommand)
-                .addEqualityGroup(vspResourceCommand, otherVspResourceCommand)
                 .testEquals();
     }
 
-    private <T extends CmdBuilder> T fillBuilderObject(T obj) throws 
IllegalAccessException, InvocationTargetException {
-        Class clazz = obj.getClass();
-        for (Method method : clazz.getDeclaredMethods()) {
-            if (method.getParameterTypes().length == 1) {
-                Class paramType = method.getParameterTypes()[0];
-                if (isNumericType(paramType)) {
-                    if (Long.class.isAssignableFrom(paramType)) {
-                        method.invoke(obj, 
Long.valueOf(method.getName().length()));
-                    } else {
-                        method.invoke(obj, method.getName().length());
-                    }
-                } else if (String.class.isAssignableFrom(paramType)) {
-                    method.invoke(obj, method.getName());
-                } else if (Boolean.class.isAssignableFrom(paramType) || 
boolean.class.isAssignableFrom(paramType)) {
-                    method.invoke(obj, method.getName().length() % 2 == 0);
-                }
-            }
-        }
-        return obj;
-    }
-
     private <T> T fillObject(Class<T> clazz) throws IllegalAccessException, 
InvocationTargetException, InstantiationException {
         Constructor constructor = clazz.getDeclaredConstructors()[0];
         Object[] constructorArgs = new 
Object[constructor.getParameterTypes().length];

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b0c27e48/plugins/network-elements/nuage-vsp/test/com/cloud/network/element/NuageVspElementTest.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/nuage-vsp/test/com/cloud/network/element/NuageVspElementTest.java
 
b/plugins/network-elements/nuage-vsp/test/com/cloud/network/element/NuageVspElementTest.java
index 2f5ce7d..e9f92b6 100644
--- 
a/plugins/network-elements/nuage-vsp/test/com/cloud/network/element/NuageVspElementTest.java
+++ 
b/plugins/network-elements/nuage-vsp/test/com/cloud/network/element/NuageVspElementTest.java
@@ -19,6 +19,7 @@
 
 package com.cloud.network.element;
 
+import com.cloud.NuageTest;
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
@@ -35,7 +36,6 @@ import com.cloud.network.Network;
 import com.cloud.network.Network.GuestType;
 import com.cloud.network.Network.Provider;
 import com.cloud.network.Network.Service;
-import com.cloud.network.NetworkModel;
 import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.NuageVspDeviceVO;
@@ -59,15 +59,13 @@ import com.cloud.offerings.dao.NetworkOfferingDao;
 import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
 import com.cloud.resource.ResourceManager;
 import com.cloud.user.Account;
+import com.cloud.util.NuageVspEntityBuilder;
 import com.cloud.vm.ReservationContext;
 import com.google.common.collect.Lists;
-import 
org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
-import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.resourcedetail.dao.VpcDetailsDao;
 import org.junit.Before;
 import org.junit.Test;
-import org.mockito.invocation.InvocationOnMock;
 
-import javax.naming.ConfigurationException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
@@ -76,9 +74,6 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
-import static 
com.cloud.network.manager.NuageVspManager.NuageVspIsolatedNetworkDomainTemplateName;
-import static 
com.cloud.network.manager.NuageVspManager.NuageVspSharedNetworkDomainTemplateName;
-import static 
com.cloud.network.manager.NuageVspManager.NuageVspVpcDomainTemplateName;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
@@ -86,55 +81,46 @@ import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-public class NuageVspElementTest {
-
-    private static final long NETWORK_ID = 42L;
-    NuageVspElement element = new NuageVspElement();
-    NetworkOrchestrationService networkManager = 
mock(NetworkOrchestrationService.class);
-    NetworkModel networkModel = mock(NetworkModel.class);
-    NetworkServiceMapDao ntwkSrvcDao = mock(NetworkServiceMapDao.class);
-    AgentManager agentManager = mock(AgentManager.class);
-    HostDao hostDao = mock(HostDao.class);
-    NuageVspDao nuageVspDao = mock(NuageVspDao.class);
-    DomainDao domainDao = mock(DomainDao.class);
-    NetworkOfferingDao ntwkOfferingDao = mock(NetworkOfferingDao.class);
-    NetworkOfferingServiceMapDao ntwkOfferingSrvcDao = 
mock(NetworkOfferingServiceMapDao.class);
-    ConfigurationDao configDao = mock(ConfigurationDao.class);
-    NuageVspManager nuageVspManager = mock(NuageVspManager.class);
-    FirewallRulesDao firewallRulesDao = mock(FirewallRulesDao.class);
-    IPAddressDao ipAddressDao = mock(IPAddressDao.class);
-    PhysicalNetworkDao physNetDao = mock(PhysicalNetworkDao.class);
-
-    org.mockito.stubbing.Answer<Object> genericAnswer = new 
org.mockito.stubbing.Answer<Object>() {
-        public Object answer(InvocationOnMock invocation) {
-            return null;
-        }
-    };
+public class NuageVspElementTest extends NuageTest {
+
+    private NuageVspElement _nuageVspElement = new NuageVspElement();
+
+    private NetworkServiceMapDao _networkServiceMapDao = 
mock(NetworkServiceMapDao.class);
+    private AgentManager _agentManager = mock(AgentManager.class);
+    private HostDao _hostDao = mock(HostDao.class);
+    private NuageVspDao _nuageVspDao = mock(NuageVspDao.class);
+    private DomainDao _domainDao = mock(DomainDao.class);
+    private NetworkOfferingDao _networkOfferingDao = 
mock(NetworkOfferingDao.class);
+    private NetworkOfferingServiceMapDao _networkOfferingServiceMapDao = 
mock(NetworkOfferingServiceMapDao.class);
+    private NuageVspManager _nuageVspManager = mock(NuageVspManager.class);
+    private FirewallRulesDao _firewallRulesDao = mock(FirewallRulesDao.class);
+    private IPAddressDao _ipAddressDao = mock(IPAddressDao.class);
+    private PhysicalNetworkDao _physicalNetworkDao = 
mock(PhysicalNetworkDao.class);
+    private NuageVspEntityBuilder _nuageVspEntityBuilder = 
mock(NuageVspEntityBuilder.class);
+    private VpcDetailsDao _vpcDetailsDao = mock(VpcDetailsDao.class);
 
     @Before
-    public void setUp() throws ConfigurationException {
-        element._resourceMgr = mock(ResourceManager.class);
-        element._ntwkSrvcDao = ntwkSrvcDao;
-        element._networkModel = networkModel;
-        element._agentMgr = agentManager;
-        element._hostDao = hostDao;
-        element._nuageVspDao = nuageVspDao;
-        element._ntwkOfferingSrvcDao = ntwkOfferingSrvcDao;
-        element._domainDao = domainDao;
-        element._ntwkOfferingDao = ntwkOfferingDao;
-        element._configDao = configDao;
-        element._nuageVspManager = nuageVspManager;
-        element._firewallRulesDao = firewallRulesDao;
-        element._ipAddressDao = ipAddressDao;
-        element._physicalNetworkDao = physNetDao;
-
-        // Standard responses
-        when(networkModel.isProviderForNetwork(Provider.NuageVsp, 
NETWORK_ID)).thenReturn(true);
-        
when(configDao.getValue(NuageVspIsolatedNetworkDomainTemplateName.key())).thenReturn("IsolatedDomainTemplate");
-        
when(configDao.getValue(NuageVspVpcDomainTemplateName.key())).thenReturn("VpcDomainTemplate");
-        
when(configDao.getValue(NuageVspSharedNetworkDomainTemplateName.key())).thenReturn("SharedDomainTemplate");
-
-        element.configure("NuageVspTestElement", Collections.<String, Object> 
emptyMap());
+    public void setUp() throws Exception {
+        super.setUp();
+
+        _nuageVspElement._resourceMgr = mock(ResourceManager.class);
+        _nuageVspElement._ntwkSrvcDao = _networkServiceMapDao;
+        _nuageVspElement._networkModel = _networkModel;
+        _nuageVspElement._agentMgr = _agentManager;
+        _nuageVspElement._hostDao = _hostDao;
+        _nuageVspElement._nuageVspDao = _nuageVspDao;
+        _nuageVspElement._ntwkOfferingSrvcDao = _networkOfferingServiceMapDao;
+        _nuageVspElement._domainDao = _domainDao;
+        _nuageVspElement._ntwkOfferingDao = _networkOfferingDao;
+        _nuageVspElement._configDao = _configurationDao;
+        _nuageVspElement._nuageVspManager = _nuageVspManager;
+        _nuageVspElement._firewallRulesDao = _firewallRulesDao;
+        _nuageVspElement._ipAddressDao = _ipAddressDao;
+        _nuageVspElement._physicalNetworkDao = _physicalNetworkDao;
+        _nuageVspElement._nuageVspEntityBuilder = _nuageVspEntityBuilder;
+        _nuageVspElement._vpcDetailsDao = _vpcDetailsDao;
+
+        _nuageVspElement.configure("NuageVspTestElement", Collections.<String, 
Object>emptyMap());
     }
 
     @Test
@@ -147,29 +133,29 @@ public class NuageVspElementTest {
         final NetworkOfferingVO ntwkoffer = mock(NetworkOfferingVO.class);
         when(ntwkoffer.getId()).thenReturn(NETWORK_ID);
         when(ntwkoffer.getIsPersistent()).thenReturn(true);
-        when(ntwkOfferingDao.findById(NETWORK_ID)).thenReturn(ntwkoffer);
+        when(_networkOfferingDao.findById(NETWORK_ID)).thenReturn(ntwkoffer);
 
-        when(ntwkSrvcDao.canProviderSupportServiceInNetwork(NETWORK_ID, 
Service.Connectivity, Provider.NuageVsp)).thenReturn(true);
+        
when(_networkServiceMapDao.canProviderSupportServiceInNetwork(NETWORK_ID, 
Service.Connectivity, Provider.NuageVsp)).thenReturn(true);
         // Golden path
-        assertTrue(element.canHandle(net, Service.Connectivity));
+        assertTrue(_nuageVspElement.canHandle(net, Service.Connectivity));
 
         
when(net.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Vlan);
         // Only broadcastdomaintype Vsp is supported
-        assertFalse(element.canHandle(net, Service.Connectivity));
+        assertFalse(_nuageVspElement.canHandle(net, Service.Connectivity));
 
         when(net.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Vsp);
-        when(ntwkSrvcDao.canProviderSupportServiceInNetwork(NETWORK_ID, 
Service.Connectivity, Provider.NuageVsp)).thenReturn(false);
+        
when(_networkServiceMapDao.canProviderSupportServiceInNetwork(NETWORK_ID, 
Service.Connectivity, Provider.NuageVsp)).thenReturn(false);
         // No NuageVsp provider in the network
-        assertFalse(element.canHandle(net, Service.Connectivity));
+        assertFalse(_nuageVspElement.canHandle(net, Service.Connectivity));
 
-        when(networkModel.isProviderForNetwork(Provider.NuageVsp, 
NETWORK_ID)).thenReturn(false);
-        when(ntwkSrvcDao.canProviderSupportServiceInNetwork(NETWORK_ID, 
Service.Connectivity, Provider.NuageVsp)).thenReturn(true);
+        when(_networkModel.isProviderForNetwork(Provider.NuageVsp, 
NETWORK_ID)).thenReturn(false);
+        
when(_networkServiceMapDao.canProviderSupportServiceInNetwork(NETWORK_ID, 
Service.Connectivity, Provider.NuageVsp)).thenReturn(true);
         // NusageVsp provider does not provide Connectivity for this network
-        assertFalse(element.canHandle(net, Service.Connectivity));
+        assertFalse(_nuageVspElement.canHandle(net, Service.Connectivity));
 
-        when(networkModel.isProviderForNetwork(Provider.NuageVsp, 
NETWORK_ID)).thenReturn(true);
+        when(_networkModel.isProviderForNetwork(Provider.NuageVsp, 
NETWORK_ID)).thenReturn(true);
         // Only service Connectivity is supported
-        assertFalse(element.canHandle(net, Service.Dhcp));
+        assertFalse(_nuageVspElement.canHandle(net, Service.Dhcp));
 
     }
 
@@ -182,8 +168,8 @@ public class NuageVspElementTest {
         when(network.getBroadcastUri()).thenReturn(new URI(""));
         when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
         when(network.getDomainId()).thenReturn(NETWORK_ID);
-        when(networkModel.isProviderForNetwork(Provider.NuageVsp, 
NETWORK_ID)).thenReturn(true);
-        when(ntwkSrvcDao.canProviderSupportServiceInNetwork(NETWORK_ID, 
Service.Connectivity, Provider.NuageVsp)).thenReturn(true);
+        when(_networkModel.isProviderForNetwork(Provider.NuageVsp, 
NETWORK_ID)).thenReturn(true);
+        
when(_networkServiceMapDao.canProviderSupportServiceInNetwork(NETWORK_ID, 
Service.Connectivity, Provider.NuageVsp)).thenReturn(true);
 
         final NetworkOffering offering = mock(NetworkOffering.class);
         when(offering.getId()).thenReturn(NETWORK_ID);
@@ -194,7 +180,7 @@ public class NuageVspElementTest {
 
         final DomainVO dom = mock(DomainVO.class);
         when(dom.getName()).thenReturn("domain");
-        when(domainDao.findById(NETWORK_ID)).thenReturn(dom);
+        when(_domainDao.findById(NETWORK_ID)).thenReturn(dom);
         final Account acc = mock(Account.class);
         when(acc.getAccountName()).thenReturn("accountname");
         final ReservationContext context = mock(ReservationContext.class);
@@ -205,15 +191,15 @@ public class NuageVspElementTest {
         when(host.getId()).thenReturn(NETWORK_ID);
         final NuageVspDeviceVO nuageVspDevice = mock(NuageVspDeviceVO.class);
         when(nuageVspDevice.getHostId()).thenReturn(NETWORK_ID);
-        
when(nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[] {nuageVspDevice}));
-        when(hostDao.findById(NETWORK_ID)).thenReturn(host);
+        
when(_nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[]{nuageVspDevice}));
+        when(_hostDao.findById(NETWORK_ID)).thenReturn(host);
 
-        when(firewallRulesDao.listByNetworkPurposeTrafficType(NETWORK_ID, 
FirewallRule.Purpose.Firewall, 
FirewallRule.TrafficType.Ingress)).thenReturn(new ArrayList<FirewallRuleVO>());
-        when(firewallRulesDao.listByNetworkPurposeTrafficType(NETWORK_ID, 
FirewallRule.Purpose.Firewall, FirewallRule.TrafficType.Egress)).thenReturn(new 
ArrayList<FirewallRuleVO>());
-        when(ipAddressDao.listStaticNatPublicIps(NETWORK_ID)).thenReturn(new 
ArrayList<IPAddressVO>());
-        when(nuageVspManager.getDnsDetails(network)).thenReturn(new 
ArrayList<String>());
+        when(_firewallRulesDao.listByNetworkPurposeTrafficType(NETWORK_ID, 
FirewallRule.Purpose.Firewall, 
FirewallRule.TrafficType.Ingress)).thenReturn(new ArrayList<FirewallRuleVO>());
+        when(_firewallRulesDao.listByNetworkPurposeTrafficType(NETWORK_ID, 
FirewallRule.Purpose.Firewall, FirewallRule.TrafficType.Egress)).thenReturn(new 
ArrayList<FirewallRuleVO>());
+        when(_ipAddressDao.listStaticNatPublicIps(NETWORK_ID)).thenReturn(new 
ArrayList<IPAddressVO>());
+        when(_nuageVspManager.getDnsDetails(network)).thenReturn(new 
ArrayList<String>());
 
-        assertTrue(element.implement(network, offering, deployDest, context));
+        assertTrue(_nuageVspElement.implement(network, offering, deployDest, 
context));
     }
 
     @Test
@@ -224,14 +210,14 @@ public class NuageVspElementTest {
         services.add(Service.SourceNat);
         services.add(Service.Connectivity);
         services.add(Service.Firewall);
-        assertTrue(element.verifyServicesCombination(services));
+        assertTrue(_nuageVspElement.verifyServicesCombination(services));
 
         services = new HashSet<Service>();
         services.add(Service.Dhcp);
         services.add(Service.StaticNat);
         services.add(Service.Connectivity);
         services.add(Service.Firewall);
-        assertFalse(element.verifyServicesCombination(services));
+        assertFalse(_nuageVspElement.verifyServicesCombination(services));
     }
 
     @Test
@@ -244,25 +230,24 @@ public class NuageVspElementTest {
         when(network.getDomainId()).thenReturn(NETWORK_ID);
 
         final DomainVO domVo = mock(DomainVO.class);
-        when(domainDao.findById(41l)).thenReturn(domVo);
+        when(_domainDao.findById(41l)).thenReturn(domVo);
 
         final NetworkOfferingVO ntwkoffer = mock(NetworkOfferingVO.class);
         when(ntwkoffer.getId()).thenReturn(NETWORK_ID);
-        when(ntwkOfferingDao.findById(NETWORK_ID)).thenReturn(ntwkoffer);
-        when(element.isL3Network(NETWORK_ID)).thenReturn(true);
+        when(_networkOfferingDao.findById(NETWORK_ID)).thenReturn(ntwkoffer);
 
         final HostVO host = mock(HostVO.class);
         when(host.getId()).thenReturn(NETWORK_ID);
         final NuageVspDeviceVO nuageVspDevice = mock(NuageVspDeviceVO.class);
         when(nuageVspDevice.getHostId()).thenReturn(NETWORK_ID);
-        
when(nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[] {nuageVspDevice}));
-        when(hostDao.findById(NETWORK_ID)).thenReturn(host);
+        
when(_nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[]{nuageVspDevice}));
+        when(_hostDao.findById(NETWORK_ID)).thenReturn(host);
 
-        when(domainDao.findById(NETWORK_ID)).thenReturn(mock(DomainVO.class));
+        when(_domainDao.findById(NETWORK_ID)).thenReturn(mock(DomainVO.class));
         final Answer answer = mock(Answer.class);
         when(answer.getResult()).thenReturn(true);
-        when(agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
-        assertTrue(element.applyStaticNats(network, new 
ArrayList<StaticNat>()));
+        when(_agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
+        assertTrue(_nuageVspElement.applyStaticNats(network, new 
ArrayList<StaticNat>()));
     }
 
     @Test
@@ -277,21 +262,21 @@ public class NuageVspElementTest {
         final NetworkOfferingVO ntwkoffer = mock(NetworkOfferingVO.class);
         when(ntwkoffer.getId()).thenReturn(NETWORK_ID);
         when(ntwkoffer.getEgressDefaultPolicy()).thenReturn(true);
-        when(ntwkOfferingDao.findById(NETWORK_ID)).thenReturn(ntwkoffer);
+        when(_networkOfferingDao.findById(NETWORK_ID)).thenReturn(ntwkoffer);
 
         final HostVO host = mock(HostVO.class);
         when(host.getId()).thenReturn(NETWORK_ID);
         final NuageVspDeviceVO nuageVspDevice = mock(NuageVspDeviceVO.class);
         when(nuageVspDevice.getHostId()).thenReturn(NETWORK_ID);
-        
when(nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[] {nuageVspDevice}));
-        when(hostDao.findById(NETWORK_ID)).thenReturn(host);
+        
when(_nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[]{nuageVspDevice}));
+        when(_hostDao.findById(NETWORK_ID)).thenReturn(host);
 
-        when(domainDao.findById(NETWORK_ID)).thenReturn(mock(DomainVO.class));
+        when(_domainDao.findById(NETWORK_ID)).thenReturn(mock(DomainVO.class));
 
         final Answer answer = mock(Answer.class);
         when(answer.getResult()).thenReturn(true);
-        when(agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
-        assertTrue(element.applyFWRules(network, new 
ArrayList<FirewallRule>()));
+        when(_agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
+        assertTrue(_nuageVspElement.applyFWRules(network, new 
ArrayList<FirewallRule>()));
     }
 
     @Test
@@ -306,20 +291,20 @@ public class NuageVspElementTest {
         final NetworkOfferingVO ntwkoffer = mock(NetworkOfferingVO.class);
         when(ntwkoffer.getId()).thenReturn(NETWORK_ID);
         when(ntwkoffer.getEgressDefaultPolicy()).thenReturn(true);
-        when(ntwkOfferingDao.findById(NETWORK_ID)).thenReturn(ntwkoffer);
+        when(_networkOfferingDao.findById(NETWORK_ID)).thenReturn(ntwkoffer);
 
         final HostVO host = mock(HostVO.class);
         when(host.getId()).thenReturn(NETWORK_ID);
         final NuageVspDeviceVO nuageVspDevice = mock(NuageVspDeviceVO.class);
         when(nuageVspDevice.getHostId()).thenReturn(NETWORK_ID);
-        
when(nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[] {nuageVspDevice}));
-        when(hostDao.findById(NETWORK_ID)).thenReturn(host);
+        
when(_nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[]{nuageVspDevice}));
+        when(_hostDao.findById(NETWORK_ID)).thenReturn(host);
 
-        when(domainDao.findById(NETWORK_ID)).thenReturn(mock(DomainVO.class));
+        when(_domainDao.findById(NETWORK_ID)).thenReturn(mock(DomainVO.class));
         final Answer answer = mock(Answer.class);
         when(answer.getResult()).thenReturn(true);
-        when(agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
-        assertTrue(element.applyNetworkACLs(network, new 
ArrayList<NetworkACLItem>()));
+        when(_agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
+        assertTrue(_nuageVspElement.applyNetworkACLs(network, new 
ArrayList<NetworkACLItem>()));
     }
 
     @Test
@@ -332,7 +317,7 @@ public class NuageVspElementTest {
 
         final DomainVO dom = mock(DomainVO.class);
         when(dom.getName()).thenReturn("domain");
-        when(domainDao.findById(NETWORK_ID)).thenReturn(dom);
+        when(_domainDao.findById(NETWORK_ID)).thenReturn(dom);
         final Account acc = mock(Account.class);
         when(acc.getAccountName()).thenReturn("accountname");
         final ReservationContext context = mock(ReservationContext.class);
@@ -342,18 +327,18 @@ public class NuageVspElementTest {
         PhysicalNetworkVO physNet = mock(PhysicalNetworkVO.class);
         
when(physNet.getIsolationMethods()).thenReturn(Lists.newArrayList(PhysicalNetwork.IsolationMethod.VSP.name()));
         when(physNet.getId()).thenReturn(NETWORK_ID);
-        
when(physNetDao.listByZone(NETWORK_ID)).thenReturn(Lists.newArrayList(physNet));
+        
when(_physicalNetworkDao.listByZone(NETWORK_ID)).thenReturn(Lists.newArrayList(physNet));
 
         final HostVO host = mock(HostVO.class);
         when(host.getId()).thenReturn(NETWORK_ID);
         final NuageVspDeviceVO nuageVspDevice = mock(NuageVspDeviceVO.class);
         when(nuageVspDevice.getHostId()).thenReturn(NETWORK_ID);
-        
when(nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[] {nuageVspDevice}));
-        when(hostDao.findById(NETWORK_ID)).thenReturn(host);
+        
when(_nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[]{nuageVspDevice}));
+        when(_hostDao.findById(NETWORK_ID)).thenReturn(host);
 
         final Answer answer = mock(Answer.class);
         when(answer.getResult()).thenReturn(true);
-        when(agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
-        assertTrue(element.shutdownVpc(vpc, context));
+        when(_agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
+        assertTrue(_nuageVspElement.shutdownVpc(vpc, context));
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b0c27e48/plugins/network-elements/nuage-vsp/test/com/cloud/network/guru/NuageVspGuestNetworkGuruTest.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/nuage-vsp/test/com/cloud/network/guru/NuageVspGuestNetworkGuruTest.java
 
b/plugins/network-elements/nuage-vsp/test/com/cloud/network/guru/NuageVspGuestNetworkGuruTest.java
index c8d23ab..f101e1e 100644
--- 
a/plugins/network-elements/nuage-vsp/test/com/cloud/network/guru/NuageVspGuestNetworkGuruTest.java
+++ 
b/plugins/network-elements/nuage-vsp/test/com/cloud/network/guru/NuageVspGuestNetworkGuruTest.java
@@ -19,6 +19,7 @@
 
 package com.cloud.network.guru;
 
+import com.cloud.NuageTest;
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
@@ -46,6 +47,7 @@ import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.NuageVspDeviceVO;
 import com.cloud.network.dao.IPAddressDao;
 import com.cloud.network.dao.NetworkDao;
+import com.cloud.network.dao.NetworkDetailsDao;
 import com.cloud.network.dao.NetworkVO;
 import com.cloud.network.dao.NuageVspDao;
 import com.cloud.network.dao.PhysicalNetworkDao;
@@ -64,7 +66,6 @@ import com.cloud.vm.ReservationContext;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
 import com.cloud.vm.dao.NicDao;
-import 
org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.junit.Before;
 import org.junit.Test;
@@ -86,60 +87,61 @@ import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-public class NuageVspGuestNetworkGuruTest {
+public class NuageVspGuestNetworkGuruTest extends NuageTest {
     private static final long NETWORK_ID = 42L;
-    PhysicalNetworkDao physnetdao = mock(PhysicalNetworkDao.class);
-    DataCenterDao dcdao = mock(DataCenterDao.class);
-    NetworkOfferingServiceMapDao nosd = 
mock(NetworkOfferingServiceMapDao.class);
-    AgentManager agentManager = mock(AgentManager.class);
-    NetworkOrchestrationService netmgr = 
mock(NetworkOrchestrationService.class);
-    NetworkModel networkModel = mock(NetworkModel.class);
-    AccountDao accountDao = mock(AccountDao.class);
-    DomainDao domainDao = mock(DomainDao.class);
-    NicDao nicDao = mock(NicDao.class);
-    NetworkOfferingDao ntwkOfferDao = mock(NetworkOfferingDao.class);
-    NuageVspDao nuageVspDao = mock(NuageVspDao.class);
-    HostDao hostDao = mock(HostDao.class);
-    NetworkDao networkDao = mock(NetworkDao.class);
-    ConfigurationDao configDao = mock(ConfigurationDao.class);
-    IPAddressDao ipAddressDao = mock(IPAddressDao.class);
-    NuageVspManager nuageVspManager = mock(NuageVspManager.class);
-    ConfigurationManager configurationManager = 
mock(ConfigurationManager.class);
-
-    NetworkDao netdao = mock(NetworkDao.class);
-    NuageVspGuestNetworkGuru guru;
+    private PhysicalNetworkDao _physicalNetworkDao = 
mock(PhysicalNetworkDao.class);
+    private DataCenterDao _dataCenterDao = mock(DataCenterDao.class);
+    private NetworkOfferingServiceMapDao _networkOfferingServiceMapDao = 
mock(NetworkOfferingServiceMapDao.class);
+    private AgentManager _agentManager = mock(AgentManager.class);
+    private NetworkModel _networkModel = mock(NetworkModel.class);
+    private AccountDao _accountDao = mock(AccountDao.class);
+    private DomainDao _domainDao = mock(DomainDao.class);
+    private NicDao _nicDao = mock(NicDao.class);
+    private NetworkOfferingDao _networkOfferingDao = 
mock(NetworkOfferingDao.class);
+    private NuageVspDao _nuageVspDao = mock(NuageVspDao.class);
+    private HostDao _hostDao = mock(HostDao.class);
+    private NetworkDao _networkDao = mock(NetworkDao.class);
+    private ConfigurationDao _configurationDao = mock(ConfigurationDao.class);
+    private IPAddressDao _ipAddressDao = mock(IPAddressDao.class);
+    private NuageVspManager _nuageVspManager = mock(NuageVspManager.class);
+    private ConfigurationManager _configurationManager = 
mock(ConfigurationManager.class);
+    private NetworkDetailsDao _networkDetailsDao = 
mock(NetworkDetailsDao.class);
+    private NuageVspGuestNetworkGuru _nuageVspGuestNetworkGuru;
 
     @Before
-    public void setUp() {
-        guru = new NuageVspGuestNetworkGuru();
-        guru._physicalNetworkDao = physnetdao;
-        guru._physicalNetworkDao = physnetdao;
-        guru._nuageVspDao = nuageVspDao;
-        guru._dcDao = dcdao;
-        guru._ntwkOfferingSrvcDao = nosd;
-        guru._networkModel = networkModel;
-        guru._hostDao = hostDao;
-        guru._agentMgr = agentManager;
-        guru._networkDao = netdao;
-        guru._networkDao = networkDao;
-        guru._accountDao = accountDao;
-        guru._domainDao = domainDao;
-        guru._nicDao = nicDao;
-        guru._ntwkOfferingDao = ntwkOfferDao;
-        guru._configDao = configDao;
-        guru._ipAddressDao = ipAddressDao;
-        guru._nuageVspManager = nuageVspManager;
-        guru._configMgr = configurationManager;
+    public void setUp() throws Exception {
+        super.setUp();
+
+        _nuageVspGuestNetworkGuru = new NuageVspGuestNetworkGuru();
+        _nuageVspGuestNetworkGuru._physicalNetworkDao = _physicalNetworkDao;
+        _nuageVspGuestNetworkGuru._physicalNetworkDao = _physicalNetworkDao;
+        _nuageVspGuestNetworkGuru._nuageVspDao = _nuageVspDao;
+        _nuageVspGuestNetworkGuru._dcDao = _dataCenterDao;
+        _nuageVspGuestNetworkGuru._ntwkOfferingSrvcDao = 
_networkOfferingServiceMapDao;
+        _nuageVspGuestNetworkGuru._networkModel = _networkModel;
+        _nuageVspGuestNetworkGuru._hostDao = _hostDao;
+        _nuageVspGuestNetworkGuru._agentMgr = _agentManager;
+        _nuageVspGuestNetworkGuru._networkDao = _networkDao;
+        _nuageVspGuestNetworkGuru._accountDao = _accountDao;
+        _nuageVspGuestNetworkGuru._domainDao = _domainDao;
+        _nuageVspGuestNetworkGuru._nicDao = _nicDao;
+        _nuageVspGuestNetworkGuru._ntwkOfferingDao = _networkOfferingDao;
+        _nuageVspGuestNetworkGuru._configDao = _configurationDao;
+        _nuageVspGuestNetworkGuru._ipAddressDao = _ipAddressDao;
+        _nuageVspGuestNetworkGuru._nuageVspManager = _nuageVspManager;
+        _nuageVspGuestNetworkGuru._configMgr = _configurationManager;
+        _nuageVspGuestNetworkGuru._nuageVspEntityBuilder = 
_nuageVspEntityBuilder;
+        _nuageVspGuestNetworkGuru._networkDetailsDao = _networkDetailsDao;
 
         final DataCenterVO dc = mock(DataCenterVO.class);
         when(dc.getNetworkType()).thenReturn(NetworkType.Advanced);
         when(dc.getGuestNetworkCidr()).thenReturn("10.1.1.1/24");
 
-        when(dcdao.findById((Long)any())).thenReturn(dc);
+        when(_dataCenterDao.findById((Long)any())).thenReturn(dc);
 
-        
when(configDao.getValue(NuageVspIsolatedNetworkDomainTemplateName.key())).thenReturn("IsolatedDomainTemplate");
-        
when(configDao.getValue(NuageVspVpcDomainTemplateName.key())).thenReturn("VpcDomainTemplate");
-        
when(configDao.getValue(NuageVspSharedNetworkDomainTemplateName.key())).thenReturn("SharedDomainTemplate");
+        
when(_configurationDao.getValue(NuageVspIsolatedNetworkDomainTemplateName.key())).thenReturn("IsolatedDomainTemplate");
+        
when(_configurationDao.getValue(NuageVspVpcDomainTemplateName.key())).thenReturn("VpcDomainTemplate");
+        
when(_configurationDao.getValue(NuageVspSharedNetworkDomainTemplateName.key())).thenReturn("SharedDomainTemplate");
     }
 
     @Test
@@ -149,47 +151,47 @@ public class NuageVspGuestNetworkGuruTest {
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
         when(offering.getIsPersistent()).thenReturn(false);
-        
when(configurationManager.isOfferingForVpc(any(NetworkOffering.class))).thenReturn(false);
+        
when(_configurationManager.isOfferingForVpc(any(NetworkOffering.class))).thenReturn(false);
 
         final PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new 
String[] {"VSP"}));
         when(physnet.getId()).thenReturn(NETWORK_ID);
 
-        when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, 
Service.Connectivity)).thenReturn(true);
+        
when(_networkOfferingServiceMapDao.areServicesSupportedByNetworkOffering(NETWORK_ID,
 Service.Connectivity)).thenReturn(true);
 
-        assertTrue(guru.canHandle(offering, NetworkType.Advanced, physnet));
+        assertTrue(_nuageVspGuestNetworkGuru.canHandle(offering, 
NetworkType.Advanced, physnet) == true);
 
         // Not supported TrafficType != Guest
         when(offering.getTrafficType()).thenReturn(TrafficType.Management);
-        assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet));
+        assertFalse(_nuageVspGuestNetworkGuru.canHandle(offering, 
NetworkType.Advanced, physnet) == true);
 
         // Supported: GuestType Shared
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Shared);
-        assertTrue(guru.canHandle(offering, NetworkType.Advanced, physnet));
+        assertTrue(_nuageVspGuestNetworkGuru.canHandle(offering, 
NetworkType.Advanced, physnet) == true);
 
         // Not supported: Basic networking
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
-        assertFalse(guru.canHandle(offering, NetworkType.Basic, physnet));
+        assertFalse(_nuageVspGuestNetworkGuru.canHandle(offering, 
NetworkType.Basic, physnet) == true);
 
         // Not supported: IsolationMethod != STT
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new 
String[] {"VLAN"}));
-        assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet));
+        assertFalse(_nuageVspGuestNetworkGuru.canHandle(offering, 
NetworkType.Advanced, physnet) == true);
 
         // Not supported: Non-persistent VPC tier
-        
when(configurationManager.isOfferingForVpc(any(NetworkOffering.class))).thenReturn(true);
-        assertFalse(guru.canHandle(offering, NetworkType.Advanced, physnet));
+        
when(_configurationManager.isOfferingForVpc(any(NetworkOffering.class))).thenReturn(true);
+        assertFalse(_nuageVspGuestNetworkGuru.canHandle(offering, 
NetworkType.Advanced, physnet));
     }
 
     @Test
     public void testDesign() {
         final PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
-        when(physnetdao.findById((Long)any())).thenReturn(physnet);
+        when(_physicalNetworkDao.findById((Long)any())).thenReturn(physnet);
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new 
String[] {"VSP"}));
         when(physnet.getId()).thenReturn(NETWORK_ID);
 
         final NuageVspDeviceVO device = mock(NuageVspDeviceVO.class);
-        
when(nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[] {device}));
+        
when(_nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[]{device}));
         when(device.getId()).thenReturn(1L);
 
         final NetworkOffering offering = mock(NetworkOffering.class);
@@ -197,32 +199,32 @@ public class NuageVspGuestNetworkGuruTest {
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
         when(offering.getIsPersistent()).thenReturn(false);
-        
when(configurationManager.isOfferingForVpc(any(NetworkOffering.class))).thenReturn(false);
+        
when(_configurationManager.isOfferingForVpc(any(NetworkOffering.class))).thenReturn(false);
 
-        when(nosd.areServicesSupportedByNetworkOffering(NETWORK_ID, 
Service.Connectivity)).thenReturn(true);
+        
when(_networkOfferingServiceMapDao.areServicesSupportedByNetworkOffering(NETWORK_ID,
 Service.Connectivity)).thenReturn(true);
 
         final DeploymentPlan plan = mock(DeploymentPlan.class);
         final Network network = mock(Network.class);
         final Account account = mock(Account.class);
 
-        final Network designednetwork = guru.design(offering, plan, network, 
account);
+        final Network designednetwork = 
_nuageVspGuestNetworkGuru.design(offering, plan, network, account);
         assertTrue(designednetwork != null);
         assertTrue(designednetwork.getBroadcastDomainType() == 
BroadcastDomainType.Vsp);
 
         // Can't design non-persistent VPC tier
-        
when(configurationManager.isOfferingForVpc(any(NetworkOffering.class))).thenReturn(true);
-        assertNull(guru.design(offering, plan, network, account));
+        
when(_configurationManager.isOfferingForVpc(any(NetworkOffering.class))).thenReturn(true);
+        assertNull(_nuageVspGuestNetworkGuru.design(offering, plan, network, 
account));
     }
 
     @Test
     public void testDesignNoElementOnPhysicalNetwork() {
         final PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
-        when(physnetdao.findById((Long)any())).thenReturn(physnet);
+        when(_physicalNetworkDao.findById((Long)any())).thenReturn(physnet);
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new 
String[] {"STT"}));
         when(physnet.getId()).thenReturn(NETWORK_ID);
 
         mock(NuageVspDeviceVO.class);
-        
when(nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Collections.<NuageVspDeviceVO>
 emptyList());
+        
when(_nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Collections.<NuageVspDeviceVO>emptyList());
 
         final NetworkOffering offering = mock(NetworkOffering.class);
         when(offering.getId()).thenReturn(NETWORK_ID);
@@ -233,19 +235,19 @@ public class NuageVspGuestNetworkGuruTest {
         final Network network = mock(Network.class);
         final Account account = mock(Account.class);
 
-        final Network designednetwork = guru.design(offering, plan, network, 
account);
+        final Network designednetwork = 
_nuageVspGuestNetworkGuru.design(offering, plan, network, account);
         assertTrue(designednetwork == null);
     }
 
     @Test
     public void testDesignNoIsolationMethodVSP() {
         final PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class);
-        when(physnetdao.findById((Long)any())).thenReturn(physnet);
+        when(_physicalNetworkDao.findById((Long)any())).thenReturn(physnet);
         when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new 
String[] {"VLAN"}));
         when(physnet.getId()).thenReturn(NETWORK_ID);
 
         mock(NuageVspDeviceVO.class);
-        
when(nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Collections.<NuageVspDeviceVO>
 emptyList());
+        
when(_nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Collections.<NuageVspDeviceVO>emptyList());
 
         final NetworkOffering offering = mock(NetworkOffering.class);
         when(offering.getId()).thenReturn(NETWORK_ID);
@@ -256,7 +258,7 @@ public class NuageVspGuestNetworkGuruTest {
         final Network network = mock(Network.class);
         final Account account = mock(Account.class);
 
-        final Network designednetwork = guru.design(offering, plan, network, 
account);
+        final Network designednetwork = 
_nuageVspGuestNetworkGuru.design(offering, plan, network, account);
         assertTrue(designednetwork == null);
     }
 
@@ -274,20 +276,20 @@ public class NuageVspGuestNetworkGuruTest {
         when(network.getBroadcastUri()).thenReturn(new 
URI("vsp://aaaaaa-aavvv/10.1.1.1"));
 
         final DataCenterVO dataCenter = mock(DataCenterVO.class);
-        when(dcdao.findById(NETWORK_ID)).thenReturn(dataCenter);
+        when(_dataCenterDao.findById(NETWORK_ID)).thenReturn(dataCenter);
         final AccountVO networksAccount = mock(AccountVO.class);
         when(networksAccount.getUuid()).thenReturn("aaaa-abbbb");
         
when(networksAccount.getType()).thenReturn(Account.ACCOUNT_TYPE_NORMAL);
-        when(accountDao.findById(NETWORK_ID)).thenReturn(networksAccount);
+        when(_accountDao.findById(NETWORK_ID)).thenReturn(networksAccount);
         final DomainVO networksDomain = mock(DomainVO.class);
         when(networksDomain.getUuid()).thenReturn("aaaaa-bbbbb");
-        when(domainDao.findById(NETWORK_ID)).thenReturn(networksDomain);
+        when(_domainDao.findById(NETWORK_ID)).thenReturn(networksDomain);
 
         final NicVO nicvo = mock(NicVO.class);
         when(nicvo.getId()).thenReturn(NETWORK_ID);
         when(nicvo.getMacAddress()).thenReturn("aa-aa-aa-aa-aa-aa");
         when(nicvo.getUuid()).thenReturn("aaaa-fffff");
-        when(nicDao.findById(NETWORK_ID)).thenReturn(nicvo);
+        when(_nicDao.findById(NETWORK_ID)).thenReturn(nicvo);
 
         final VirtualMachine vm = mock(VirtualMachine.class);
         when(vm.getId()).thenReturn(NETWORK_ID);
@@ -306,24 +308,24 @@ public class NuageVspGuestNetworkGuruTest {
 
         final NetworkOfferingVO ntwkoffering = mock(NetworkOfferingVO.class);
         when(ntwkoffering.getId()).thenReturn(NETWORK_ID);
-        when(ntwkOfferDao.findById(NETWORK_ID)).thenReturn(ntwkoffering);
+        
when(_networkOfferingDao.findById(NETWORK_ID)).thenReturn(ntwkoffering);
 
         final HostVO host = mock(HostVO.class);
         when(host.getId()).thenReturn(NETWORK_ID);
         final NuageVspDeviceVO nuageVspDevice = mock(NuageVspDeviceVO.class);
         when(nuageVspDevice.getHostId()).thenReturn(NETWORK_ID);
-        
when(nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[] {nuageVspDevice}));
-        when(hostDao.findById(NETWORK_ID)).thenReturn(host);
+        
when(_nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[]{nuageVspDevice}));
+        when(_hostDao.findById(NETWORK_ID)).thenReturn(host);
 
-        when(networkDao.acquireInLockTable(NETWORK_ID, 
1200)).thenReturn(network);
-        when(ipAddressDao.findByVmIdAndNetworkId(NETWORK_ID, 
NETWORK_ID)).thenReturn(null);
-        when(domainDao.findById(NETWORK_ID)).thenReturn(mock(DomainVO.class));
+        when(_networkDao.acquireInLockTable(NETWORK_ID, 
1200)).thenReturn(network);
+        when(_ipAddressDao.findByVmIdAndNetworkId(NETWORK_ID, 
NETWORK_ID)).thenReturn(null);
+        when(_domainDao.findById(NETWORK_ID)).thenReturn(mock(DomainVO.class));
 
         final Answer answer = mock(Answer.class);
         when(answer.getResult()).thenReturn(true);
-        when(agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
+        when(_agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
 
-        guru.reserve(nicProfile, network, vmProfile, 
mock(DeployDestination.class), mock(ReservationContext.class));
+        _nuageVspGuestNetworkGuru.reserve(nicProfile, network, vmProfile, 
mock(DeployDestination.class), mock(ReservationContext.class));
     }
 
     @Test
@@ -352,7 +354,7 @@ public class NuageVspGuestNetworkGuruTest {
         when(offering.getTags()).thenReturn("aaaa");
         when(offering.getEgressDefaultPolicy()).thenReturn(true);
 
-        when(networkModel.findPhysicalNetworkId(NETWORK_ID, "aaa", 
TrafficType.Guest)).thenReturn(NETWORK_ID);
+        when(_networkModel.findPhysicalNetworkId(NETWORK_ID, "aaa", 
TrafficType.Guest)).thenReturn(NETWORK_ID);
 
         final ReservationContext reserveContext = 
mock(ReservationContext.class);
         final Domain domain = mock(Domain.class);
@@ -362,29 +364,29 @@ public class NuageVspGuestNetworkGuruTest {
         when(account.getAccountId()).thenReturn(NETWORK_ID);
         when(reserveContext.getAccount()).thenReturn(account);
         final DomainVO domainVo = mock(DomainVO.class);
-        when(domainDao.findById(NETWORK_ID)).thenReturn(domainVo);
+        when(_domainDao.findById(NETWORK_ID)).thenReturn(domainVo);
         final AccountVO accountVo = mock(AccountVO.class);
-        when(accountDao.findById(NETWORK_ID)).thenReturn(accountVo);
+        when(_accountDao.findById(NETWORK_ID)).thenReturn(accountVo);
 
         final HostVO host = mock(HostVO.class);
         when(host.getId()).thenReturn(NETWORK_ID);
         final NuageVspDeviceVO nuageVspDevice = mock(NuageVspDeviceVO.class);
         when(nuageVspDevice.getHostId()).thenReturn(NETWORK_ID);
-        
when(nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[] {nuageVspDevice}));
-        when(hostDao.findById(NETWORK_ID)).thenReturn(host);
-        when(networkDao.acquireInLockTable(NETWORK_ID, 
1200)).thenReturn(network);
-        when(nuageVspManager.getDnsDetails(network)).thenReturn(new 
ArrayList<String>());
-        when(nuageVspManager.getGatewaySystemIds()).thenReturn(new 
ArrayList<String>());
+        
when(_nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[]{nuageVspDevice}));
+        when(_hostDao.findById(NETWORK_ID)).thenReturn(host);
+        when(_networkDao.acquireInLockTable(NETWORK_ID, 
1200)).thenReturn(network);
+        when(_nuageVspManager.getDnsDetails(network)).thenReturn(new 
ArrayList<String>());
+        when(_nuageVspManager.getGatewaySystemIds()).thenReturn(new 
ArrayList<String>());
 
         final Answer answer = mock(Answer.class);
         when(answer.getResult()).thenReturn(true);
-        when(agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
+        when(_agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
 
         final DataCenter dc = mock(DataCenter.class);
         when(dc.getId()).thenReturn(NETWORK_ID);
         final DeployDestination deployDest = mock(DeployDestination.class);
         when(deployDest.getDataCenter()).thenReturn(dc);
-        guru.implement(network, offering, deployDest, reserveContext);
+        _nuageVspGuestNetworkGuru.implement(network, offering, deployDest, 
reserveContext);
     }
 
     @Test
@@ -396,22 +398,22 @@ public class NuageVspGuestNetworkGuruTest {
         when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
         when(network.getVpcId()).thenReturn(null);
         when(network.getDomainId()).thenReturn(NETWORK_ID);
-        when(networkDao.acquireInLockTable(NETWORK_ID, 
1200)).thenReturn(network);
+        when(_networkDao.acquireInLockTable(NETWORK_ID, 
1200)).thenReturn(network);
 
         final NetworkOfferingVO offering = mock(NetworkOfferingVO.class);
         when(offering.getId()).thenReturn(NETWORK_ID);
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
-        when(ntwkOfferDao.findById(NETWORK_ID)).thenReturn(offering);
+        when(_networkOfferingDao.findById(NETWORK_ID)).thenReturn(offering);
 
         final DomainVO domain = mock(DomainVO.class);
         when(domain.getUuid()).thenReturn("aaaaaa");
-        when(domainDao.findById(NETWORK_ID)).thenReturn(domain);
+        when(_domainDao.findById(NETWORK_ID)).thenReturn(domain);
 
         final NicVO nic = mock(NicVO.class);
         when(nic.getId()).thenReturn(NETWORK_ID);
         when(nic.getIPv4Address()).thenReturn("10.10.10.10");
         when(nic.getMacAddress()).thenReturn("c8:60:00:56:e5:58");
-        when(nicDao.findById(NETWORK_ID)).thenReturn(nic);
+        when(_nicDao.findById(NETWORK_ID)).thenReturn(nic);
 
         final NicProfile nicProfile = mock(NicProfile.class);
         when(nicProfile.getId()).thenReturn(NETWORK_ID);
@@ -431,14 +433,14 @@ public class NuageVspGuestNetworkGuruTest {
         when(host.getId()).thenReturn(NETWORK_ID);
         final NuageVspDeviceVO nuageVspDevice = mock(NuageVspDeviceVO.class);
         when(nuageVspDevice.getHostId()).thenReturn(NETWORK_ID);
-        
when(nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[] {nuageVspDevice}));
-        when(hostDao.findById(NETWORK_ID)).thenReturn(host);
+        
when(_nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[]{nuageVspDevice}));
+        when(_hostDao.findById(NETWORK_ID)).thenReturn(host);
 
         final Answer answer = mock(Answer.class);
         when(answer.getResult()).thenReturn(true);
-        when(agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
+        when(_agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
 
-        guru.deallocate(network, nicProfile, vmProfile);
+        _nuageVspGuestNetworkGuru.deallocate(network, nicProfile, vmProfile);
     }
 
     @Test
@@ -451,31 +453,31 @@ public class NuageVspGuestNetworkGuruTest {
         when(network.getNetworkOfferingId()).thenReturn(NETWORK_ID);
         when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
         when(network.getVpcId()).thenReturn(null);
-        when(networkDao.acquireInLockTable(NETWORK_ID, 
1200)).thenReturn(network);
+        when(_networkDao.acquireInLockTable(NETWORK_ID, 
1200)).thenReturn(network);
 
         final NetworkOfferingVO offering = mock(NetworkOfferingVO.class);
         when(offering.getId()).thenReturn(NETWORK_ID);
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
-        when(ntwkOfferDao.findById(NETWORK_ID)).thenReturn(offering);
+        when(_networkOfferingDao.findById(NETWORK_ID)).thenReturn(offering);
 
         final DomainVO domain = mock(DomainVO.class);
         when(domain.getUuid()).thenReturn("aaaaaa");
-        when(domainDao.findById(NETWORK_ID)).thenReturn(domain);
+        when(_domainDao.findById(NETWORK_ID)).thenReturn(domain);
 
         final HostVO host = mock(HostVO.class);
         when(host.getId()).thenReturn(NETWORK_ID);
         final NuageVspDeviceVO nuageVspDevice = mock(NuageVspDeviceVO.class);
         when(nuageVspDevice.getHostId()).thenReturn(NETWORK_ID);
-        
when(nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[] {nuageVspDevice}));
-        when(hostDao.findById(NETWORK_ID)).thenReturn(host);
-        when(nuageVspManager.getDnsDetails(network)).thenReturn(new 
ArrayList<String>());
-        when(nuageVspManager.getGatewaySystemIds()).thenReturn(new 
ArrayList<String>());
+        
when(_nuageVspDao.listByPhysicalNetwork(NETWORK_ID)).thenReturn(Arrays.asList(new
 NuageVspDeviceVO[]{nuageVspDevice}));
+        when(_hostDao.findById(NETWORK_ID)).thenReturn(host);
+        when(_nuageVspManager.getDnsDetails(network)).thenReturn(new 
ArrayList<String>());
+        when(_nuageVspManager.getGatewaySystemIds()).thenReturn(new 
ArrayList<String>());
 
         final Answer answer = mock(Answer.class);
         when(answer.getResult()).thenReturn(true);
-        when(agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
+        when(_agentManager.easySend(eq(NETWORK_ID), 
(Command)any())).thenReturn(answer);
 
-        assertTrue(guru.trash(network, offering));
+        assertTrue(_nuageVspGuestNetworkGuru.trash(network, offering));
     }
 
 }

Reply via email to