cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [08/13] git commit: updated refs/heads/master to 0e057ad
Date Wed, 07 Dec 2016 18:36:47 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspApplyAclRulesCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspApplyAclRulesCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspApplyAclRulesCommandWrapper.java
new file mode 100644
index 0000000..42499c4
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspApplyAclRulesCommandWrapper.java
@@ -0,0 +1,42 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.element.ApplyAclRuleVspCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  ApplyAclRuleVspCommand.class)
+public final class NuageVspApplyAclRulesCommandWrapper extends NuageVspCommandWrapper<ApplyAclRuleVspCommand> {
+
+    @Override public boolean executeNuageVspCommand(ApplyAclRuleVspCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
+        nuageVspResource.getNuageVspElementClient().applyAclRules(cmd.getAclType(), cmd.getNetwork(), cmd.getAclRules(), cmd.isNetworkReset());
+        return true;
+    }
+
+    @Override public StringBuilder fillDetail(StringBuilder stringBuilder, ApplyAclRuleVspCommand cmd) {
+        return stringBuilder.append("Applied ACL Rule to network mapping " + cmd.getNetwork().getUuid());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspApplyStaticNatCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspApplyStaticNatCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspApplyStaticNatCommandWrapper.java
new file mode 100644
index 0000000..81fbdef
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspApplyStaticNatCommandWrapper.java
@@ -0,0 +1,42 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.element.ApplyStaticNatVspCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  ApplyStaticNatVspCommand.class)
+public final class NuageVspApplyStaticNatCommandWrapper extends NuageVspCommandWrapper<ApplyStaticNatVspCommand> {
+
+    @Override public boolean executeNuageVspCommand(ApplyStaticNatVspCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
+        nuageVspResource.getNuageVspElementClient().applyStaticNats(cmd.getNetwork(), cmd.getStaticNatDetails());
+        return true;
+    }
+
+    @Override public StringBuilder fillDetail(StringBuilder stringBuilder, ApplyStaticNatVspCommand cmd) {
+        return stringBuilder.append("Applied Static NAT to network mapping ").append(cmd.getNetwork().getUuid());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspCleanupDomainCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspCleanupDomainCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspCleanupDomainCommandWrapper.java
new file mode 100644
index 0000000..273a719
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspCleanupDomainCommandWrapper.java
@@ -0,0 +1,41 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.manager.CleanUpDomainCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  CleanUpDomainCommand.class)
+public final class NuageVspCleanupDomainCommandWrapper extends NuageVspCommandWrapper<CleanUpDomainCommand> {
+
+    @Override public boolean executeNuageVspCommand(CleanUpDomainCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
+        return nuageVspResource.getNuageVspManagerClient().cleanUpDomain(cmd.getDomainCleanUp());
+    }
+
+    @Override public StringBuilder fillDetail(StringBuilder stringBuilder, CleanUpDomainCommand cmd) {
+        return stringBuilder.append("Clean Domain ").append(cmd.getDomainCleanUp().getUuid());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspCommandWrapper.java
new file mode 100644
index 0000000..ee3f5c5
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspCommandWrapper.java
@@ -0,0 +1,52 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.CommandWrapper;
+
+public abstract class NuageVspCommandWrapper<T extends Command> extends CommandWrapper<T, Answer, NuageVspResource> {
+
+    private static final Logger s_logger = Logger.getLogger(NuageVspResource.class);
+
+    @Override
+    public final Answer execute(final T command, final NuageVspResource nuageVspResource) {
+        try {
+            boolean success = executeNuageVspCommand(command, nuageVspResource);
+            String detail = fillDetail(new StringBuilder(), command).append(" on ").append(nuageVspResource.getName()).toString();
+            return new Answer(command, success, detail);
+        } catch (NuageVspException | ConfigurationException e) {
+            s_logger.error("Failure during " + command + " on " + nuageVspResource.getName(), e);
+            return new Answer(command, e);
+        }
+    }
+
+    public abstract boolean executeNuageVspCommand(final T command, final NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException;
+
+    public abstract StringBuilder fillDetail(final StringBuilder stringBuilder, final T command);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspDeallocateVmInterfaceCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspDeallocateVmInterfaceCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspDeallocateVmInterfaceCommandWrapper.java
new file mode 100644
index 0000000..2125653
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspDeallocateVmInterfaceCommandWrapper.java
@@ -0,0 +1,42 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.guru.DeallocateVmVspCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  DeallocateVmVspCommand.class)
+public final class NuageVspDeallocateVmInterfaceCommandWrapper extends NuageVspCommandWrapper<DeallocateVmVspCommand> {
+
+    @Override public boolean executeNuageVspCommand(DeallocateVmVspCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
+        nuageVspResource.getNuageVspGuruClient().deallocate(cmd.getNetwork(), cmd.getVm(), cmd.getNic());
+        return true;
+    }
+
+    @Override public StringBuilder fillDetail(StringBuilder stringBuilder, DeallocateVmVspCommand cmd) {
+        return stringBuilder.append("Deallocated VM ").append(cmd.getVm().getName());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspEntityExistsCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspEntityExistsCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspEntityExistsCommandWrapper.java
new file mode 100644
index 0000000..ecf0629
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspEntityExistsCommandWrapper.java
@@ -0,0 +1,55 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.common.model.NuageVspEntity;
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.manager.EntityExistsCommand;
+import com.cloud.dc.Vlan;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  EntityExistsCommand.class)
+public final class NuageVspEntityExistsCommandWrapper extends NuageVspCommandWrapper<EntityExistsCommand> {
+
+    @Override public boolean executeNuageVspCommand(EntityExistsCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
+        NuageVspEntity entityType = getNuageVspEntity(cmd.getType());
+
+        return nuageVspResource.getNuageVspApiClient().entityExists(entityType, cmd.getUuid());
+    }
+
+    private NuageVspEntity getNuageVspEntity(Class clazz) {
+        NuageVspEntity entityType = null;
+
+        if (Vlan.class.isAssignableFrom(clazz)) {
+            entityType = NuageVspEntity.SHARED_NETWORK;
+        }
+
+        return entityType;
+    }
+
+    @Override public StringBuilder fillDetail(StringBuilder stringBuilder, EntityExistsCommand cmd) {
+        return stringBuilder.append("Check if entity with UUID " + cmd.getUuid() + " of type " + getNuageVspEntity(cmd.getType()) + " exists");
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspGetApiDefaultsCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspGetApiDefaultsCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspGetApiDefaultsCommandWrapper.java
new file mode 100644
index 0000000..ac96895
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspGetApiDefaultsCommandWrapper.java
@@ -0,0 +1,43 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.manager.GetApiDefaultsAnswer;
+import com.cloud.agent.api.manager.GetApiDefaultsCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.CommandWrapper;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  GetApiDefaultsCommand.class)
+public final class NuageVspGetApiDefaultsCommandWrapper extends CommandWrapper<GetApiDefaultsCommand, GetApiDefaultsAnswer, NuageVspResource> {
+
+    @Override
+    public GetApiDefaultsAnswer execute(final GetApiDefaultsCommand command, final NuageVspResource nuageVspResource) {
+        try {
+            return new GetApiDefaultsAnswer(command, nuageVspResource.getNuageVspManagerClient().getApiDefaults());
+        } catch (NuageVspException|ConfigurationException e) {
+            return new GetApiDefaultsAnswer(command, e);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspGuruImplementNetworkCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspGuruImplementNetworkCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspGuruImplementNetworkCommandWrapper.java
new file mode 100644
index 0000000..1ba77ff
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspGuruImplementNetworkCommandWrapper.java
@@ -0,0 +1,42 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.guru.ImplementNetworkVspCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  ImplementNetworkVspCommand.class)
+public final class NuageVspGuruImplementNetworkCommandWrapper extends NuageVspCommandWrapper<ImplementNetworkVspCommand> {
+
+    @Override public boolean executeNuageVspCommand(ImplementNetworkVspCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
+        nuageVspResource.getNuageVspGuruClient().implement(cmd.getNetwork(), cmd.getDhcpOption());
+        return true;
+    }
+
+    @Override public StringBuilder fillDetail(StringBuilder stringBuilder, ImplementNetworkVspCommand command) {
+        return stringBuilder.append("Created network mapping to ").append(command.getNetwork().getName());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspGuruTrashNetworkCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspGuruTrashNetworkCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspGuruTrashNetworkCommandWrapper.java
new file mode 100644
index 0000000..1f12f94
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspGuruTrashNetworkCommandWrapper.java
@@ -0,0 +1,42 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.guru.TrashNetworkVspCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  TrashNetworkVspCommand.class)
+public final class NuageVspGuruTrashNetworkCommandWrapper extends NuageVspCommandWrapper<TrashNetworkVspCommand> {
+
+    @Override public boolean executeNuageVspCommand(TrashNetworkVspCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
+        nuageVspResource.getNuageVspGuruClient().trash(cmd.getNetwork());
+        return true;
+    }
+
+    @Override public StringBuilder fillDetail(StringBuilder stringBuilder, TrashNetworkVspCommand command) {
+        return stringBuilder;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspImplementNetworkCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspImplementNetworkCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspImplementNetworkCommandWrapper.java
new file mode 100644
index 0000000..d0732da
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspImplementNetworkCommandWrapper.java
@@ -0,0 +1,43 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.element.ImplementVspCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  ImplementVspCommand.class)
+public final class NuageVspImplementNetworkCommandWrapper extends NuageVspCommandWrapper<ImplementVspCommand> {
+
+    @Override public boolean executeNuageVspCommand(ImplementVspCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
+        nuageVspResource.getNuageVspElementClient().implement(cmd.getNetwork(), cmd.getDhcpOption(), cmd.getIngressFirewallRules(),
+                cmd.getEgressFirewallRules(), cmd.getFloatingIpUuids());
+        return true;
+    }
+
+    @Override public StringBuilder fillDetail(StringBuilder stringBuilder, ImplementVspCommand cmd) {
+        return stringBuilder.append("Implemented network ").append(cmd.getNetwork().getUuid());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspMaintainCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspMaintainCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspMaintainCommandWrapper.java
new file mode 100644
index 0000000..b0e6db7
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspMaintainCommandWrapper.java
@@ -0,0 +1,35 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import com.cloud.agent.api.MaintainAnswer;
+import com.cloud.agent.api.MaintainCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.CommandWrapper;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  MaintainCommand.class)
+public final class NuageVspMaintainCommandWrapper extends CommandWrapper<MaintainCommand, MaintainAnswer, NuageVspResource> {
+
+    @Override
+    public MaintainAnswer execute(final MaintainCommand command, final NuageVspResource nuageVspResource) {
+        return new MaintainAnswer(command);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspReadyCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspReadyCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspReadyCommandWrapper.java
new file mode 100644
index 0000000..ca95b46
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspReadyCommandWrapper.java
@@ -0,0 +1,35 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import com.cloud.agent.api.ReadyAnswer;
+import com.cloud.agent.api.ReadyCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.CommandWrapper;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  ReadyCommand.class)
+public final class NuageVspReadyCommandWrapper extends CommandWrapper<ReadyCommand, ReadyAnswer, NuageVspResource> {
+
+    @Override
+    public ReadyAnswer execute(final ReadyCommand command, final NuageVspResource nuageVspResource) {
+        return new ReadyAnswer(command);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspReserveVmInterfaceCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspReserveVmInterfaceCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspReserveVmInterfaceCommandWrapper.java
new file mode 100644
index 0000000..fdf1ab2
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspReserveVmInterfaceCommandWrapper.java
@@ -0,0 +1,42 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.guru.ReserveVmInterfaceVspCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  ReserveVmInterfaceVspCommand.class)
+public final class NuageVspReserveVmInterfaceCommandWrapper extends NuageVspCommandWrapper<ReserveVmInterfaceVspCommand> {
+
+    @Override public boolean executeNuageVspCommand(ReserveVmInterfaceVspCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
+        nuageVspResource.getNuageVspGuruClient().reserve(cmd.getNetwork(), cmd.getVm(), cmd.getNic(), cmd.getStaticNat(), cmd.getDhcpOption());
+        return true;
+    }
+
+    @Override public StringBuilder fillDetail(StringBuilder stringBuilder, ReserveVmInterfaceVspCommand command) {
+        return stringBuilder.append("Created NIC that maps to nicUuid ").append(command.getNic().getUuid());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspShutdownNetworkCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspShutdownNetworkCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspShutdownNetworkCommandWrapper.java
new file mode 100644
index 0000000..1852eb6
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspShutdownNetworkCommandWrapper.java
@@ -0,0 +1,42 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.element.ShutDownVspCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  ShutDownVspCommand.class)
+public final class NuageVspShutdownNetworkCommandWrapper extends NuageVspCommandWrapper<ShutDownVspCommand> {
+
+    @Override public boolean executeNuageVspCommand(ShutDownVspCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
+        nuageVspResource.getNuageVspElementClient().shutdownNetwork(cmd.getNetwork(), cmd.getDhcpOptions());
+        return true;
+    }
+
+    @Override public StringBuilder fillDetail(StringBuilder stringBuilder, ShutDownVspCommand cmd) {
+        return stringBuilder.append("Shutdown Network " + cmd.getNetwork().getUuid());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspShutdownVpcCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspShutdownVpcCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspShutdownVpcCommandWrapper.java
new file mode 100644
index 0000000..d2d9ea7
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspShutdownVpcCommandWrapper.java
@@ -0,0 +1,42 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.element.ShutDownVpcVspCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  ShutDownVpcVspCommand.class)
+public final class NuageVspShutdownVpcCommandWrapper extends NuageVspCommandWrapper<ShutDownVpcVspCommand> {
+
+    @Override public boolean executeNuageVspCommand(ShutDownVpcVspCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
+        nuageVspResource.getNuageVspElementClient().shutdownVpc(cmd.getDomainUuid(), cmd.getVpcUuid(), cmd.getDomainTemplateName(), cmd.getDomainRouterUuids());
+        return true;
+    }
+
+    @Override public StringBuilder fillDetail(StringBuilder stringBuilder, ShutDownVpcVspCommand cmd) {
+        return stringBuilder.append("Shutdown VPC " + cmd.getVpcUuid());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspSyncCmsIdCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspSyncCmsIdCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspSyncCmsIdCommandWrapper.java
new file mode 100644
index 0000000..c101344
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspSyncCmsIdCommandWrapper.java
@@ -0,0 +1,62 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.api.NuageVspManagerClient;
+import net.nuage.vsp.acs.client.common.model.Pair;
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.sync.SyncNuageVspCmsIdAnswer;
+import com.cloud.agent.api.sync.SyncNuageVspCmsIdCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.CommandWrapper;
+import com.cloud.resource.ResourceWrapper;
+import com.cloud.utils.StringUtils;
+
+@ResourceWrapper(handles =  SyncNuageVspCmsIdCommand.class)
+public final class NuageVspSyncCmsIdCommandWrapper extends CommandWrapper<SyncNuageVspCmsIdCommand, SyncNuageVspCmsIdAnswer, NuageVspResource> {
+
+    @Override public SyncNuageVspCmsIdAnswer execute(SyncNuageVspCmsIdCommand cmd, NuageVspResource nuageVspResource) {
+        NuageVspManagerClient client = null;
+        try {
+            client = nuageVspResource.getNuageVspManagerClient();
+
+            Pair<Boolean, String> answer;
+            switch (cmd.getSyncType()) {
+            case REGISTER:
+                String registeredNuageVspCmsId = client.registerNuageVspCmsId();
+                answer = Pair.of(StringUtils.isNotBlank(registeredNuageVspCmsId), registeredNuageVspCmsId);
+                break;
+            case UNREGISTER:
+                boolean success = client.unregisterNuageVspCmsId(cmd.getNuageVspCmsId());
+                answer = Pair.of(success, cmd.getNuageVspCmsId());
+                break;
+            default:
+                answer = client.auditNuageVspCmsId(cmd.getNuageVspCmsId(), cmd.getSyncType() == SyncNuageVspCmsIdCommand.SyncType.AUDIT_ONLY);
+                break;
+            }
+            return new SyncNuageVspCmsIdAnswer(answer.getLeft(), answer.getRight(), cmd.getSyncType());
+        } catch (ConfigurationException|NuageVspException e) {
+            return new SyncNuageVspCmsIdAnswer(cmd, e, cmd.getSyncType());
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspSyncDomainCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspSyncDomainCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspSyncDomainCommandWrapper.java
new file mode 100644
index 0000000..b32e0b1
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspSyncDomainCommandWrapper.java
@@ -0,0 +1,41 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.sync.SyncDomainCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  SyncDomainCommand.class)
+public final class NuageVspSyncDomainCommandWrapper extends NuageVspCommandWrapper<SyncDomainCommand> {
+
+    @Override public boolean executeNuageVspCommand(SyncDomainCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
+        return nuageVspResource.getNuageVspManagerClient().syncDomainWithNuageVsp(cmd.getDomain(), cmd.isToAdd(), cmd.isToRemove());
+    }
+
+    @Override public StringBuilder fillDetail(StringBuilder stringBuilder, SyncDomainCommand cmd) {
+        return stringBuilder.append("Synced Domain ").append(cmd.getDomain().getUuid());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspUpdateDhcpOptionsCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspUpdateDhcpOptionsCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspUpdateDhcpOptionsCommandWrapper.java
new file mode 100644
index 0000000..56bde5c
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/NuageVspUpdateDhcpOptionsCommandWrapper.java
@@ -0,0 +1,42 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.guru.UpdateDhcpOptionVspCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  UpdateDhcpOptionVspCommand.class)
+public final class NuageVspUpdateDhcpOptionsCommandWrapper extends NuageVspCommandWrapper<UpdateDhcpOptionVspCommand> {
+
+    @Override public boolean executeNuageVspCommand(UpdateDhcpOptionVspCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
+        nuageVspResource.getNuageVspGuruClient().applyDhcpOptions(cmd.getDhcpOptions(), cmd.getNetwork());
+        return true;
+    }
+
+    @Override public StringBuilder fillDetail(StringBuilder stringBuilder, UpdateDhcpOptionVspCommand cmd) {
+        return stringBuilder.append("Update DhcpOptions on VM's in network: ").append(cmd.getNetwork().getName());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/UpdateNuageVspDeviceCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/UpdateNuageVspDeviceCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/UpdateNuageVspDeviceCommandWrapper.java
new file mode 100644
index 0000000..c895391
--- /dev/null
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/vsp/resource/wrapper/UpdateNuageVspDeviceCommandWrapper.java
@@ -0,0 +1,46 @@
+//
+// 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.network.vsp.resource.wrapper;
+
+import javax.naming.ConfigurationException;
+
+import net.nuage.vsp.acs.client.exception.NuageVspException;
+
+import com.cloud.agent.api.manager.UpdateNuageVspDeviceCommand;
+import com.cloud.network.resource.NuageVspResource;
+import com.cloud.network.resource.NuageVspResourceConfiguration;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  UpdateNuageVspDeviceCommand.class)
+public final class UpdateNuageVspDeviceCommandWrapper extends NuageVspCommandWrapper<UpdateNuageVspDeviceCommand> {
+
+    @Override public boolean executeNuageVspCommand(UpdateNuageVspDeviceCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
+        final NuageVspResourceConfiguration configuration = cmd.getConfiguration();
+        nuageVspResource.validate(configuration);
+        nuageVspResource.getConfigParams().putAll(configuration.build());
+
+        return true;
+    }
+
+    @Override public StringBuilder fillDetail(StringBuilder stringBuilder, UpdateNuageVspDeviceCommand cmd) {
+        return stringBuilder.append("Updated the NuageVspResource parameters");
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/plugins/network-elements/nuage-vsp/src/com/cloud/util/NuageVspEntityBuilder.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/util/NuageVspEntityBuilder.java b/plugins/network-elements/nuage-vsp/src/com/cloud/util/NuageVspEntityBuilder.java
index b1db4fb..84afa29 100644
--- a/plugins/network-elements/nuage-vsp/src/com/cloud/util/NuageVspEntityBuilder.java
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/util/NuageVspEntityBuilder.java
@@ -19,6 +19,7 @@
 
 package com.cloud.util;
 
+import com.cloud.dc.Vlan;
 import com.cloud.dc.VlanVO;
 import com.cloud.dc.dao.VlanDao;
 import com.cloud.dc.dao.VlanDetailsDao;
@@ -30,7 +31,9 @@ import com.cloud.network.Network;
 import com.cloud.network.NetworkModel;
 import com.cloud.network.dao.IPAddressDao;
 import com.cloud.network.dao.IPAddressVO;
+import com.cloud.network.dao.NetworkDao;
 import com.cloud.network.dao.NetworkDetailsDao;
+import com.cloud.network.dao.NetworkVO;
 import com.cloud.network.manager.NuageVspManager;
 import com.cloud.network.rules.FirewallRule;
 import com.cloud.network.vpc.NetworkACLItem;
@@ -49,12 +52,17 @@ import com.cloud.vm.NicVO;
 import com.cloud.vm.VMInstanceVO;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.dao.VMInstanceDao;
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import net.nuage.vsp.acs.client.api.model.VspAclRule;
 import net.nuage.vsp.acs.client.api.model.VspDhcpDomainOption;
+import net.nuage.vsp.acs.client.api.model.VspAddressRange;
 import net.nuage.vsp.acs.client.api.model.VspDhcpVMOption;
 import net.nuage.vsp.acs.client.api.model.VspDomain;
+import net.nuage.vsp.acs.client.api.model.VspDomainCleanUp;
 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;
@@ -64,10 +72,12 @@ import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 
+import javax.annotation.Nullable;
 import javax.inject.Inject;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
 
@@ -75,6 +85,8 @@ public class NuageVspEntityBuilder {
     private static final Logger s_logger = Logger.getLogger(NuageVspEntityBuilder.class);
 
     @Inject
+    NetworkDao _networkDao;
+    @Inject
     VpcDao _vpcDao;
     @Inject
     DomainDao _domainDao;
@@ -112,7 +124,31 @@ public class NuageVspEntityBuilder {
                 .build();
     }
 
-    public VspNetwork buildVspNetwork(Network network, boolean fillAddressRange) {
+    public VspDomainCleanUp buildVspDomainCleanUp(Domain domain) {
+        VspDomainCleanUp.Builder vspDomainCleanUpBuilder = new VspDomainCleanUp.Builder().uuid(domain.getUuid());
+
+        Map<String, List<String>> sharedNetworkUuids = Maps.newHashMap();
+        List<NetworkVO> allSharedNetworks = _networkDao.listByGuestType(Network.GuestType.Shared);
+        for (NetworkVO sharedNetwork : allSharedNetworks) {
+            if (_networkModel.isNetworkAvailableInDomain(sharedNetwork.getId(), domain.getId())) {
+                NetworkOffering networkOffering = _networkOfferingDao.findById(sharedNetwork.getNetworkOfferingId());
+                String preConfiguredDomainTemplateName = NuageVspUtil.getPreConfiguredDomainTemplateName(_configurationDao, _networkDetailsDao, sharedNetwork, networkOffering);
+                if (!sharedNetworkUuids.containsKey(preConfiguredDomainTemplateName)) {
+                    sharedNetworkUuids.put(preConfiguredDomainTemplateName, Lists.<String>newArrayList());
+                }
+                sharedNetworkUuids.get(preConfiguredDomainTemplateName).add(sharedNetwork.getUuid());
+            }
+        }
+        vspDomainCleanUpBuilder.sharedNetworkUuids(sharedNetworkUuids);
+
+        return vspDomainCleanUpBuilder.build();
+    }
+
+    public VspNetwork buildVspNetwork(Network network) {
+        return buildVspNetwork(network.getDomainId(), network);
+    }
+
+    public VspNetwork buildVspNetwork(long domainId, Network network) {
         VspNetwork.Builder vspNetworkBuilder = new VspNetwork.Builder()
                 .id(network.getId())
                 .uuid(network.getUuid())
@@ -120,7 +156,7 @@ public class NuageVspEntityBuilder {
                 .cidr(network.getCidr())
                 .gateway(network.getGateway());
 
-        DomainVO domain = _domainDao.findById(network.getDomainId());
+        DomainVO domain = _domainDao.findById(domainId);
         VspDomain vspDomain = buildVspDomain(domain);
         vspNetworkBuilder.domain(vspDomain);
 
@@ -130,7 +166,7 @@ public class NuageVspEntityBuilder {
         }
 
         NetworkOfferingVO networkOffering = _networkOfferingDao.findById(network.getNetworkOfferingId());
-        vspNetworkBuilder.egressDefaultPolicy(networkOffering.getEgressDefaultPolicy());
+        vspNetworkBuilder.egressDefaultPolicy(networkOffering.getEgressDefaultPolicy()).publicAccess(networkOffering.getSupportsPublicAccess());
 
         if (network.getVpcId() != null) {
             VpcVO vpc = _vpcDao.findById(network.getVpcId());
@@ -139,7 +175,16 @@ public class NuageVspEntityBuilder {
                     .networkType(VspNetwork.NetworkType.Vpc);
         } else {
             if (networkOffering.getGuestType() == Network.GuestType.Shared) {
-                vspNetworkBuilder.networkType(VspNetwork.NetworkType.Shared);
+                List<VlanVO> vlans = _vlanDao.listVlansByNetworkIdIncludingRemoved(network.getId());
+                List<VspAddressRange> vspAddressRanges = Lists.transform(vlans, new Function<VlanVO, VspAddressRange>() {
+                    @Nullable
+                    @Override
+                    public VspAddressRange apply(VlanVO vlanVO) {
+                        return new VspAddressRange.Builder().gateway(vlanVO.getVlanGateway()).netmask(vlanVO.getVlanNetmask()).build();
+                    }
+                });
+
+                vspNetworkBuilder.networkType(VspNetwork.NetworkType.Shared).addressRanges(vspAddressRanges);
             } else if (_networkOfferingServiceMapDao.areServicesSupportedByNetworkOffering(network.getNetworkOfferingId(), Network.Service.SourceNat)
                     || _networkOfferingServiceMapDao.areServicesSupportedByNetworkOffering(network.getNetworkOfferingId(), Network.Service.StaticNat)) {
                 vspNetworkBuilder.networkType(VspNetwork.NetworkType.L3);
@@ -154,11 +199,10 @@ public class NuageVspEntityBuilder {
         String preConfiguredDomainTemplateName = NuageVspUtil.getPreConfiguredDomainTemplateName(_configurationDao, _networkDetailsDao, network, networkOffering);
         vspNetworkBuilder.domainTemplateName(preConfiguredDomainTemplateName);
 
-        if (fillAddressRange) {
+        if (usesVirtualRouter(networkOffering.getId())) {
             try {
-                List<Pair<String, String>> ipAddressRanges = getIpAddressRanges(networkOffering, network);
-                vspNetworkBuilder.ipAddressRanges(ipAddressRanges);
-
+                List<Pair<String, String>> ipAddressRanges =
+                        networkOffering.getGuestType() == Network.GuestType.Shared ? getSharedIpAddressRanges(network.getId()) : getIpAddressRanges(network);
                 String virtualRouterIp = getVirtualRouterIP(network, ipAddressRanges);
                 vspNetworkBuilder.virtualRouterIp(virtualRouterIp);
             } catch (InsufficientVirtualNetworkCapacityException ex) {
@@ -170,21 +214,44 @@ public class NuageVspEntityBuilder {
         return vspNetworkBuilder.build();
     }
 
-    private List<Pair<String, String>> getIpAddressRanges(NetworkOfferingVO networkOffering, Network network) {
+    public boolean usesVirtualRouter(long networkOfferingId) {
+        return _networkOfferingServiceMapDao.isProviderForNetworkOffering(networkOfferingId, Network.Provider.VirtualRouter) ||
+                _networkOfferingServiceMapDao.isProviderForNetworkOffering(networkOfferingId, Network.Provider.VPCVirtualRouter);
+    }
+
+    public VspNetwork updateVspNetworkByPublicIp(VspNetwork vspNetwork, Network network, String publicIp) {
+        List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(network.getId());
+        final long ip = NetUtils.ip2Long(publicIp);
+        VlanVO matchingVlan = Iterables.find(vlans, new Predicate<VlanVO>() {
+            @Override
+            public boolean apply(@Nullable VlanVO vlan) {
+                Pair<String, String> ipAddressRange = getIpAddressRange(vlan);
+                long startIp = NetUtils.ip2Long(ipAddressRange.getLeft());
+                long endIp = NetUtils.ip2Long(ipAddressRange.getRight());
+                return startIp <= ip && ip <= endIp;
+            }
+        });
+
+        return new VspNetwork.Builder().fromObject(vspNetwork)
+                .gateway(matchingVlan.getVlanGateway())
+                .cidr(NetUtils.getCidrFromGatewayAndNetmask(matchingVlan.getVlanGateway(), matchingVlan.getVlanNetmask()))
+                .build();
+    }
+
+    private List<Pair<String, String>> getSharedIpAddressRanges(long networkId) {
+        List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(networkId);
         List<Pair<String, String>> ipAddressRanges = Lists.newArrayList();
-        if (networkOffering.getGuestType() == Network.GuestType.Shared) {
-            List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(network.getId());
-            ipAddressRanges = Lists.newArrayList();
-            for (VlanVO vlan : vlans) {
-                boolean isIpv4 = StringUtils.isNotBlank(vlan.getIpRange());
-                String[] range = isIpv4 ? vlan.getIpRange().split("-") : vlan.getIp6Range().split("-");
-                if (range.length == 2) {
-                    ipAddressRanges.add(Pair.of(range[0], range[1]));
-                }
+        for (VlanVO vlan : vlans) {
+            Pair<String, String> ipAddressRange = getIpAddressRange(vlan);
+            if (ipAddressRange != null) {
+                ipAddressRanges.add(ipAddressRange);
             }
-            return ipAddressRanges;
         }
+        return ipAddressRanges;
+    }
 
+    private List<Pair<String, String>> getIpAddressRanges(Network network) {
+        List<Pair<String, String>> ipAddressRanges = Lists.newArrayList();
         String subnet = NetUtils.getCidrSubNet(network.getCidr());
         String netmask = NetUtils.getCidrNetmask(network.getCidr());
         long cidrSize = NetUtils.getCidrSize(netmask);
@@ -195,29 +262,53 @@ public class NuageVspEntityBuilder {
 
         Iterator<Long> ipIterator = allIPsInCidr.iterator();
         long ip =  ipIterator.next();
-        if (NetUtils.ip2Long(network.getGateway()) == ip) {
+        long gatewayIp = NetUtils.ip2Long(network.getGateway());
+        String lastIp = NetUtils.getIpRangeEndIpFromCidr(subnet, cidrSize);
+        if (gatewayIp == ip) {
             ip = ipIterator.next();
+            ipAddressRanges.add(Pair.of(NetUtils.long2Ip(ip), lastIp));
+        } else if (!network.getGateway().equals(lastIp)) {
+            ipAddressRanges.add(Pair.of(NetUtils.long2Ip(ip), NetUtils.long2Ip(gatewayIp - 1)));
+            ipAddressRanges.add(Pair.of(NetUtils.long2Ip(gatewayIp + 1), lastIp));
+        } else {
+            ipAddressRanges.add(Pair.of(NetUtils.long2Ip(ip), NetUtils.long2Ip(gatewayIp - 1)));
         }
-        ipAddressRanges.add(Pair.of(NetUtils.long2Ip(ip), NetUtils.getIpRangeEndIpFromCidr(subnet, cidrSize)));
+
         return ipAddressRanges;
     }
 
+    public Pair<String, String> getIpAddressRange(Vlan vlan) {
+        boolean isIpv4 = StringUtils.isNotBlank(vlan.getIpRange());
+        String[] range = isIpv4 ? vlan.getIpRange().split("-") : vlan.getIp6Range().split("-");
+        if (range.length == 2) {
+            return Pair.of(range[0], range[1]);
+        }
+        return null;
+    }
+
     private String getVirtualRouterIP(Network network, List<Pair<String, String>> ipAddressRanges) throws InsufficientVirtualNetworkCapacityException {
+        if (network.getBroadcastUri() != null) {
+            return network.getBroadcastUri().getPath().substring(1);
+        }
+
         Pair<String, String> lowestIpAddressRange = null;
+        long ipCount = 0;
         if (ipAddressRanges.size() == 1) {
             lowestIpAddressRange = Iterables.getOnlyElement(ipAddressRanges);
+            ipCount = NetUtils.ip2Long(lowestIpAddressRange.getRight()) - NetUtils.ip2Long(lowestIpAddressRange.getLeft()) + 1;
         } else {
             for (Pair<String, String> ipAddressRange : ipAddressRanges) {
                 if (lowestIpAddressRange == null || NetUtils.ip2Long(ipAddressRange.getLeft()) < NetUtils.ip2Long(lowestIpAddressRange.getLeft())) {
                     lowestIpAddressRange = ipAddressRange;
                 }
+                ipCount += NetUtils.ip2Long(ipAddressRange.getRight()) - NetUtils.ip2Long(ipAddressRange.getLeft()) + 1;
             }
         }
 
-        if (lowestIpAddressRange == null) {
+        if (ipCount == 0) {
             throw new InsufficientVirtualNetworkCapacityException("VSP allocates an IP for VirtualRouter." + " But no ip address ranges are specified", Network.class,
                     network.getId());
-        } else if (NetUtils.ip2Long(lowestIpAddressRange.getRight()) - NetUtils.ip2Long(lowestIpAddressRange.getLeft()) < 2) {
+        } else if (ipCount < 3) {
             throw new InsufficientVirtualNetworkCapacityException("VSP allocates an IP for VirtualRouter." + " So, subnet should have atleast minimum 3 hosts", Network.class,
                     network.getId());
         }
@@ -269,20 +360,23 @@ public class NuageVspEntityBuilder {
     }
 
     public VspNic buildVspNic(String nicUuid, NicProfile nicProfile) {
-        VspNic.Builder vspNicBuilder = new VspNic.Builder()
-                .uuid(nicUuid)
-                .macAddress(nicProfile.getMacAddress())
-                .useStaticIp(true)
-                .ip(nicProfile.getIPv4Address());
-        return vspNicBuilder.build();
+        return buildVspNic(nicUuid, nicProfile.getMacAddress(), nicProfile.getIPv4Address(), nicProfile.getNetworkId());
     }
 
     public VspNic buildVspNic(NicVO nic) {
+        return buildVspNic(nic.getUuid(), nic.getMacAddress(), nic.getIPv4Address(), nic.getNetworkId());
+    }
+
+    private VspNic buildVspNic(String uuid, String macAddress, String ip, long networkId) {
         VspNic.Builder vspNicBuilder = new VspNic.Builder()
-                .uuid(nic.getUuid())
-                .macAddress(nic.getMacAddress())
+                .uuid(uuid)
+                .macAddress(macAddress)
                 .useStaticIp(true)
-                .ip(nic.getIPv4Address());
+                .ip(ip);
+
+        Network network = _networkDao.findById(networkId);
+        NetworkOffering networkOffering = _networkOfferingDao.findById(network.getNetworkOfferingId());
+
         return vspNicBuilder.build();
     }
 
@@ -403,7 +497,7 @@ public class NuageVspEntityBuilder {
         List<String> dnsProvider = _ntwkOfferingSrvcDao.listProvidersForServiceForNetworkOffering(offering.getId(), Network.Service.Dns);
         boolean isVrDnsProvider = dnsProvider.contains("VirtualRouter") || dnsProvider.contains("VpcVirtualRouter");
         VspDhcpDomainOption.Builder vspDhcpDomainBuilder = new VspDhcpDomainOption.Builder()
-                .dnsServers(_nuageVspManager.getDnsDetails(network))
+                .dnsServers(_nuageVspManager.getDnsDetails(network.getDataCenterId()))
                 .vrIsDnsProvider(isVrDnsProvider);
 
         if (isVrDnsProvider) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/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
deleted file mode 100644
index 72ce290..0000000
--- a/plugins/network-elements/nuage-vsp/src/net/nuage/vsp/acs/NuageVspPluginClientLoader.java
+++ /dev/null
@@ -1,86 +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;
-
-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;
-
-
-public class NuageVspPluginClientLoader {
-
-    private static final Logger s_logger = Logger.getLogger(NuageVspPluginClientLoader.class);
-
-    private NuageVspApiClient _nuageVspApiClient;
-    private NuageVspElementClient _nuageVspElementClient;
-    private NuageVspGuruClient _nuageVspGuruClient;
-    private NuageVspManagerClient _nuageVspManagerClient;
-
-    private NuageVspPluginClientLoader() {
-
-    }
-
-    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 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() {
-        return _nuageVspApiClient;
-    }
-
-    public NuageVspElementClient getNuageVspElementClient() {
-        return _nuageVspElementClient;
-    }
-
-    public NuageVspGuruClient getNuageVspGuruClient() {
-        return _nuageVspGuruClient;
-    }
-
-    public NuageVspManagerClient getNuageVspManagerClient() {
-        return _nuageVspManagerClient;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/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
index 6522d2b..1474265 100644
--- a/plugins/network-elements/nuage-vsp/test/com/cloud/NuageTest.java
+++ b/plugins/network-elements/nuage-vsp/test/com/cloud/NuageTest.java
@@ -29,7 +29,6 @@ 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.junit.Before;
 import org.mockito.Mock;
@@ -56,6 +55,7 @@ import static com.cloud.network.manager.NuageVspManager.NuageVspSharedNetworkDom
 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.anyLong;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.when;
 
@@ -78,7 +78,8 @@ public class NuageTest {
         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.buildVspNetwork(any(Network.class))).thenReturn(buildVspNetwork());
+        when(_nuageVspEntityBuilder.buildVspNetwork(anyLong(), any(Network.class))).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());
@@ -112,7 +113,6 @@ public class NuageTest {
                 .cidr("networkCidr")
                 .gateway("networkGateway")
                 .virtualRouterIp("virtualRouterIp")
-                .ipAddressRanges(new ArrayList<Pair<String, String>>())
                 .build();
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/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 03fe5eb..5877ab0 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
@@ -21,8 +21,13 @@ package com.cloud.agent.api;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
 import java.util.Map;
 
+import net.nuage.vsp.acs.client.api.model.Protocol;
+import net.nuage.vsp.acs.client.api.model.VspAclRule;
+import net.nuage.vsp.acs.client.api.model.VspNetwork;
+
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -44,6 +49,8 @@ import com.cloud.agent.api.sync.SyncDomainCommand;
 import com.cloud.agent.api.sync.SyncNuageVspCmsIdCommand;
 import com.cloud.serializer.GsonHelper;
 
+import static org.hamcrest.core.Is.is;
+
 public class CommandsTest {
     private static final Gson s_gson = GsonHelper.getGson();
 
@@ -94,6 +101,38 @@ public class CommandsTest {
         tester.testEquals();
     }
 
+    @Test
+    public void testApplyAclRuleVspCommandGsonEquals() throws IllegalAccessException, InvocationTargetException, InstantiationException {
+        VspNetwork vspNetwork = new VspNetwork.Builder()
+                .id(1)
+                .uuid("uuid")
+                .name("name")
+                .cidr("192.168.1.0/24")
+                .gateway("192.168.1.1")
+                .build();
+
+        VspAclRule aclRule = new VspAclRule.Builder()
+                .action(VspAclRule.ACLAction.Allow)
+                .uuid("uuid")
+                .trafficType(VspAclRule.ACLTrafficType.Egress)
+                .protocol(Protocol.TCP)
+                .startPort(80)
+                .endPort(80)
+                .priority(1)
+                .state(VspAclRule.ACLState.Active)
+                .build();
+
+        ApplyAclRuleVspCommand before = new ApplyAclRuleVspCommand(VspAclRule.ACLType.NetworkACL, vspNetwork, Arrays.asList(aclRule), false);
+        ApplyAclRuleVspCommand after = serializeAndDeserialize(before);
+
+        Assert.assertThat(after.getAclRules().get(0).getProtocol().hasPort(), is(Protocol.TCP.hasPort()));
+    }
+
+    private <T extends Command> T serializeAndDeserialize(T command) {
+        Command[] forwardedCommands = s_gson.fromJson(s_gson.toJson(new Command[] { command }), Command[].class);
+        return (T) forwardedCommands[0];
+    }
+
     private <T extends Command> void addCommandGsonEqualityGroup(Class<T> clazz) throws IllegalAccessException, InvocationTargetException, InstantiationException{
         addCommandGsonEqualityGroup(fillObject(clazz));
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/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 aad6398..1916271 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
@@ -24,7 +24,6 @@ import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Set;
 
 import org.junit.Before;
@@ -33,6 +32,7 @@ import org.mockito.InjectMocks;
 import org.mockito.Mock;
 
 import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 
 import org.apache.cloudstack.resourcedetail.dao.VpcDetailsDao;
 
@@ -113,6 +113,9 @@ public class NuageVspElementTest extends NuageTest {
     public void setUp() throws Exception {
         super.setUp();
         _nuageVspElement._nuageVspEntityBuilder = _nuageVspEntityBuilder;
+        _nuageVspElement._vpcDetailsDao = _vpcDetailsDao;
+        _nuageVspElement._routerDao = _domainRouterDao;
+
         when(_networkServiceMapDao.canProviderSupportServiceInNetwork(NETWORK_ID, Service.Connectivity, Provider.NuageVsp)).thenReturn(true);
         when(_networkServiceMapDao.canProviderSupportServiceInNetwork(NETWORK_ID, Service.SourceNat, Provider.NuageVsp)).thenReturn(true);
 
@@ -152,6 +155,9 @@ public class NuageVspElementTest extends NuageTest {
         // Only service Connectivity is supported
         assertFalse(_nuageVspElement.canHandle(net, Service.Dhcp));
 
+        // Can't handle network offerings with specify vlan = true
+        when(ntwkoffer.getSpecifyVlan()).thenReturn(true);
+        assertFalse(_nuageVspElement.canHandle(net, Service.Connectivity));
     }
 
     @Test
@@ -163,6 +169,7 @@ public class NuageVspElementTest extends NuageTest {
         when(network.getBroadcastUri()).thenReturn(new URI(""));
         when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
         when(network.getDomainId()).thenReturn(NETWORK_ID);
+        when(network.getDataCenterId()).thenReturn(NETWORK_ID);
         when(_networkModel.isProviderForNetwork(Provider.NuageVsp, NETWORK_ID)).thenReturn(true);
 
         final NetworkOffering offering = mock(NetworkOffering.class);
@@ -192,27 +199,28 @@ public class NuageVspElementTest extends NuageTest {
         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(_nuageVspManager.getDnsDetails(network.getDataCenterId())).thenReturn(new ArrayList<String>());
 
         assertTrue(_nuageVspElement.implement(network, offering, deployDest, context));
     }
 
     @Test
     public void testVerifyServiceCombination() {
-        Set<Service> services = new HashSet<Service>();
-        services.add(Service.Dhcp);
-        services.add(Service.StaticNat);
-        services.add(Service.SourceNat);
-        services.add(Service.Connectivity);
-        services.add(Service.Firewall);
+
+        Set<Service> services = Sets.newHashSet(
+            Service.Dhcp,
+            Service.StaticNat,
+            Service.SourceNat,
+            Service.Connectivity,
+            Service.Firewall);
         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(_nuageVspElement.verifyServicesCombination(services));
+        services = Sets.newHashSet(
+                Service.Dhcp,
+                Service.StaticNat,
+                Service.Connectivity,
+                Service.Firewall);
+        assertTrue(_nuageVspElement.verifyServicesCombination(services));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c91c9c5/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 fdfc4d5..8f334eb 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
@@ -29,8 +29,9 @@ import org.junit.Before;
 import org.junit.Test;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
+import org.mockito.internal.util.collections.Sets;
 
-import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import com.google.common.collect.ImmutableMap;
 
 import com.cloud.NuageTest;
 import com.cloud.agent.AgentManager;
@@ -53,7 +54,6 @@ import com.cloud.host.dao.HostDao;
 import com.cloud.network.Network;
 import com.cloud.network.Network.GuestType;
 import com.cloud.network.Network.Service;
-import com.cloud.network.NetworkModel;
 import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.Networks.Mode;
 import com.cloud.network.Networks.TrafficType;
@@ -100,7 +100,6 @@ public class NuageVspGuestNetworkGuruTest extends NuageTest {
     @Mock private DataCenterDao _dataCenterDao;
     @Mock private NetworkOfferingServiceMapDao _networkOfferingServiceMapDao;
     @Mock private AgentManager _agentManager;
-    @Mock private NetworkModel _networkModel;
     @Mock private AccountDao _accountDao;
     @Mock private DomainDao _domainDao;
     @Mock private NicDao _nicDao;
@@ -108,7 +107,6 @@ public class NuageVspGuestNetworkGuruTest extends NuageTest {
     @Mock private NuageVspDao _nuageVspDao;
     @Mock private HostDao _hostDao;
     @Mock private NetworkDao _networkDao;
-    @Mock private ConfigurationDao _configurationDao;
     @Mock private IPAddressDao _ipAddressDao;
     @Mock private NuageVspManager _nuageVspManager;
     @Mock private ConfigurationManager _configurationManager;
@@ -162,6 +160,11 @@ public class NuageVspGuestNetworkGuruTest extends NuageTest {
         when(_networkOfferingServiceMapDao.canProviderSupportServiceInNetworkOffering(NETWORK_ID, Service.Connectivity, Network.Provider.NuageVsp)).thenReturn(true);
         when(_networkOfferingServiceMapDao.canProviderSupportServiceInNetworkOffering(NETWORK_ID, Service.SourceNat, Network.Provider.NuageVsp)).thenReturn(true);
 
+        when(_networkModel.getNetworkOfferingServiceProvidersMap(NETWORK_ID)).thenReturn(ImmutableMap.of(
+                Service.Connectivity, Sets.newSet(Network.Provider.NuageVsp),
+                Service.SourceNat, Sets.newSet(Network.Provider.NuageVsp)
+        ));
+
         when(offering.getTrafficType()).thenReturn(TrafficType.Guest);
         when(offering.getGuestType()).thenReturn(GuestType.Isolated);
         assertThat(_nuageVspGuestNetworkGuru.canHandle(offering, NetworkType.Advanced, physnet), is(true));
@@ -204,6 +207,11 @@ public class NuageVspGuestNetworkGuruTest extends NuageTest {
         when(_networkOfferingServiceMapDao.canProviderSupportServiceInNetworkOffering(NETWORK_ID, Service.Connectivity, Network.Provider.NuageVsp)).thenReturn(true);
         when(_networkOfferingServiceMapDao.canProviderSupportServiceInNetworkOffering(NETWORK_ID, Service.SourceNat, Network.Provider.NuageVsp)).thenReturn(true);
 
+        when(_networkModel.getNetworkOfferingServiceProvidersMap(NETWORK_ID)).thenReturn(ImmutableMap.of(
+                Service.Connectivity, Sets.newSet(Network.Provider.NuageVsp),
+                Service.SourceNat, Sets.newSet(Network.Provider.NuageVsp)
+        ));
+
         final DeploymentPlan plan = mock(DeploymentPlan.class);
         final Network network = mock(Network.class);
         final Account account = mock(Account.class);
@@ -269,10 +277,12 @@ public class NuageVspGuestNetworkGuruTest extends NuageTest {
         final DataCenterVO dataCenter = mock(DataCenterVO.class);
         when(_dataCenterDao.findById(NETWORK_ID)).thenReturn(dataCenter);
         final AccountVO networksAccount = mock(AccountVO.class);
+        when(networksAccount.getId()).thenReturn(NETWORK_ID);
         when(networksAccount.getUuid()).thenReturn("aaaa-abbbb");
         when(networksAccount.getType()).thenReturn(Account.ACCOUNT_TYPE_NORMAL);
         when(_accountDao.findById(NETWORK_ID)).thenReturn(networksAccount);
         final DomainVO networksDomain = mock(DomainVO.class);
+        when(networksDomain.getId()).thenReturn(NETWORK_ID);
         when(networksDomain.getUuid()).thenReturn("aaaaa-bbbbb");
         when(_domainDao.findById(NETWORK_ID)).thenReturn(networksDomain);
 
@@ -308,7 +318,15 @@ public class NuageVspGuestNetworkGuruTest extends NuageTest {
         when(_ipAddressDao.findByVmIdAndNetworkId(NETWORK_ID, NETWORK_ID)).thenReturn(null);
         when(_domainDao.findById(NETWORK_ID)).thenReturn(mock(DomainVO.class));
 
-        _nuageVspGuestNetworkGuru.reserve(nicProfile, network, vmProfile, mock(DeployDestination.class), mock(ReservationContext.class));
+        final Answer answer = mock(Answer.class);
+        when(answer.getResult()).thenReturn(true);
+        when(_agentManager.easySend(eq(NETWORK_ID), (Command)any())).thenReturn(answer);
+
+        final ReservationContext reservationContext = mock(ReservationContext.class);
+        when(reservationContext.getAccount()).thenReturn(networksAccount);
+        when(reservationContext.getDomain()).thenReturn(networksDomain);
+
+        _nuageVspGuestNetworkGuru.reserve(nicProfile, network, vmProfile, mock(DeployDestination.class), reservationContext);
     }
 
     @Test
@@ -341,9 +359,11 @@ public class NuageVspGuestNetworkGuruTest extends NuageTest {
 
         final ReservationContext reserveContext = mock(ReservationContext.class);
         final Domain domain = mock(Domain.class);
+        when(domain.getId()).thenReturn(NETWORK_ID);
         when(reserveContext.getDomain()).thenReturn(domain);
         when(domain.getName()).thenReturn("aaaaa");
         final Account account = mock(Account.class);
+        when(account.getId()).thenReturn(NETWORK_ID);
         when(account.getAccountId()).thenReturn(NETWORK_ID);
         when(reserveContext.getAccount()).thenReturn(account);
         final DomainVO domainVo = mock(DomainVO.class);
@@ -352,7 +372,7 @@ public class NuageVspGuestNetworkGuruTest extends NuageTest {
         when(_accountDao.findById(NETWORK_ID)).thenReturn(accountVo);
 
         when(_networkDao.acquireInLockTable(NETWORK_ID, 1200)).thenReturn(network);
-        when(_nuageVspManager.getDnsDetails(network)).thenReturn(new ArrayList<String>());
+        when(_nuageVspManager.getDnsDetails(network.getDataCenterId())).thenReturn(new ArrayList<String>());
         when(_nuageVspManager.getGatewaySystemIds()).thenReturn(new ArrayList<String>());
 
         final DataCenter dc = mock(DataCenter.class);
@@ -414,6 +434,7 @@ public class NuageVspGuestNetworkGuruTest extends NuageTest {
         when(network.getDomainId()).thenReturn(NETWORK_ID);
         when(network.getNetworkOfferingId()).thenReturn(NETWORK_ID);
         when(network.getPhysicalNetworkId()).thenReturn(NETWORK_ID);
+        when(network.getDataCenterId()).thenReturn(NETWORK_ID);
         when(network.getVpcId()).thenReturn(null);
         when(_networkDao.acquireInLockTable(NETWORK_ID, 1200)).thenReturn(network);
 
@@ -426,7 +447,13 @@ public class NuageVspGuestNetworkGuruTest extends NuageTest {
         when(domain.getUuid()).thenReturn("aaaaaa");
         when(_domainDao.findById(NETWORK_ID)).thenReturn(domain);
 
-        when(_nuageVspManager.getDnsDetails(network)).thenReturn(new ArrayList<String>());
+        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.getDataCenterId())).thenReturn(new ArrayList<String>());
         when(_nuageVspManager.getGatewaySystemIds()).thenReturn(new ArrayList<String>());
 
         assertTrue(_nuageVspGuestNetworkGuru.trash(network, offering));


Mime
View raw message