You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2019/05/14 08:58:35 UTC
[cloudstack] branch master updated: RIP Nuage Cloudstack Plugin
(#3146)
This is an automated email from the ASF dual-hosted git repository.
dahn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/master by this push:
new e11f7ee RIP Nuage Cloudstack Plugin (#3146)
e11f7ee is described below
commit e11f7ee1bad4f5a91b9cb82fdabb34231c04c102
Author: Frank Maximus <fr...@nuagenetworks.net>
AuthorDate: Tue May 14 10:58:24 2019 +0200
RIP Nuage Cloudstack Plugin (#3146)
may it rest in peaces
---
api/src/main/java/com/cloud/event/EventTypes.java | 5 -
api/src/main/java/com/cloud/network/Network.java | 2 -
api/src/main/java/com/cloud/network/Networks.java | 4 +-
client/pom.xml | 7 +-
.../db/create-default-role-api-mappings.sql | 3 -
.../META-INF/db/schema-41120to41200-cleanup.sql | 5 +
.../kvm/resource/LibvirtComputingResource.java | 10 -
.../hypervisor/kvm/resource/LibvirtVMDef.java | 24 -
.../hypervisor/kvm/resource/OvsVifDriver.java | 4 -
.../hypervisor/kvm/resource/LibvirtVMDefTest.java | 19 -
.../LibvirtReplugNicCommandWrapperTest.java | 22 +-
.../hypervisor/vmware/resource/VmwareResource.java | 27 -
.../xenserver/resource/CitrixResourceBase.java | 10 +-
plugins/network-elements/nuage-vsp/pom.xml | 46 -
.../main/java/com/cloud/agent/api/CmdBuilder.java | 24 -
.../com/cloud/agent/api/PingNuageVspCommand.java | 57 -
.../com/cloud/agent/api/StartupVspCommand.java | 34 -
.../agent/api/element/ApplyAclRuleVspCommand.java | 96 -
.../api/element/ApplyStaticNatVspCommand.java | 80 -
.../api/element/ExtraDhcpOptionsVspCommand.java | 86 -
.../agent/api/element/ImplementVspCommand.java | 104 -
.../agent/api/element/ShutDownVpcVspCommand.java | 107 -
.../agent/api/element/ShutDownVspCommand.java | 84 -
.../agent/api/guru/DeallocateVmVspCommand.java | 90 -
.../agent/api/guru/ImplementNetworkVspCommand.java | 94 -
.../api/guru/ReserveVmInterfaceVspCommand.java | 107 -
.../agent/api/guru/TrashNetworkVspCommand.java | 71 -
.../agent/api/guru/UpdateDhcpOptionVspCommand.java | 87 -
.../agent/api/manager/CleanUpDomainCommand.java | 72 -
.../agent/api/manager/EntityExistsCommand.java | 85 -
.../agent/api/manager/GetApiDefaultsAnswer.java | 70 -
.../agent/api/manager/GetApiDefaultsCommand.java | 38 -
.../api/manager/ImplementNetworkVspAnswer.java | 53 -
.../api/manager/ListVspDomainTemplatesAnswer.java | 44 -
.../api/manager/ListVspDomainTemplatesCommand.java | 47 -
.../api/manager/SupportedApiVersionCommand.java | 70 -
.../api/manager/UpdateNuageVspDeviceCommand.java | 70 -
.../com/cloud/agent/api/sync/SyncDomainAnswer.java | 64 -
.../cloud/agent/api/sync/SyncDomainCommand.java | 84 -
.../agent/api/sync/SyncNuageVspCmsIdAnswer.java | 88 -
.../agent/api/sync/SyncNuageVspCmsIdCommand.java | 75 -
.../cloud/api/commands/AddNuageVspDeviceCmd.java | 182 --
.../AssociateNuageVspDomainTemplateCmd.java | 114 -
.../api/commands/DeleteNuageVspDeviceCmd.java | 110 -
.../DisableNuageUnderlayVlanIpRangeCmd.java | 110 -
.../EnableNuageUnderlayVlanIpRangeCmd.java | 110 -
.../commands/ListNuageUnderlayVlanIpRangesCmd.java | 80 -
.../cloud/api/commands/ListNuageVspDevicesCmd.java | 111 -
.../commands/ListNuageVspDomainTemplatesCmd.java | 120 -
.../ListNuageVspGlobalDomainTemplateCmd.java | 81 -
.../api/commands/UpdateNuageVspDeviceCmd.java | 182 --
.../java/com/cloud/api/commands/VspConstants.java | 38 -
.../api/response/NuageVlanIpRangeResponse.java | 38 -
.../cloud/api/response/NuageVspDeviceResponse.java | 111 -
.../response/NuageVspDomainTemplateResponse.java | 45 -
.../api/response/NuageVspResourceResponse.java | 40 -
.../java/com/cloud/network/NuageVspDeviceVO.java | 97 -
.../java/com/cloud/network/dao/NuageVspDao.java | 44 -
.../com/cloud/network/dao/NuageVspDaoImpl.java | 60 -
.../com/cloud/network/element/NuageVspElement.java | 788 ------
.../network/guru/NuageVspGuestNetworkGuru.java | 874 -------
.../cloud/network/manager/AbstractListener.java | 91 -
.../com/cloud/network/manager/NuageVspManager.java | 173 --
.../cloud/network/manager/NuageVspManagerImpl.java | 1408 -----------
.../network/resource/NuageVspRequestWrapper.java | 78 -
.../cloud/network/resource/NuageVspResource.java | 310 ---
.../resource/NuageVspResourceConfiguration.java | 360 ---
.../cloud/network/resource/VspStatisticsMBean.java | 66 -
.../network/resource/VspStatisticsMBeanImpl.java | 66 -
.../wrapper/NuageVspApiSupportCommandWrapper.java | 41 -
.../NuageVspApplyAclRulesCommandWrapper.java | 42 -
.../NuageVspApplyStaticNatCommandWrapper.java | 42 -
.../wrapper/NuageVspCheckHealthCommandWrapper.java | 43 -
.../NuageVspCleanupDomainCommandWrapper.java | 41 -
.../resource/wrapper/NuageVspCommandWrapper.java | 57 -
...uageVspDeallocateVmInterfaceCommandWrapper.java | 42 -
.../NuageVspEntityExistsCommandWrapper.java | 59 -
.../NuageVspExtraDhcpOptionsCommandWrapper.java | 42 -
.../NuageVspGetApiDefaultsCommandWrapper.java | 43 -
...NuageVspGuruImplementNetworkCommandWrapper.java | 50 -
.../NuageVspGuruTrashNetworkCommandWrapper.java | 42 -
.../NuageVspImplementNetworkCommandWrapper.java | 43 -
.../NuageVspListDomainTemplatesCommandWrapper.java | 51 -
.../wrapper/NuageVspMaintainCommandWrapper.java | 35 -
.../wrapper/NuageVspReadyCommandWrapper.java | 35 -
.../NuageVspReserveVmInterfaceCommandWrapper.java | 42 -
.../NuageVspShutdownNetworkCommandWrapper.java | 42 -
.../wrapper/NuageVspShutdownVpcCommandWrapper.java | 42 -
.../wrapper/NuageVspSyncCmsIdCommandWrapper.java | 62 -
.../wrapper/NuageVspSyncDomainCommandWrapper.java | 41 -
.../NuageVspUpdateDhcpOptionsCommandWrapper.java | 42 -
.../UpdateNuageVspDeviceCommandWrapper.java | 46 -
.../java/com/cloud/util/NuageVspEntityBuilder.java | 463 ----
.../src/main/java/com/cloud/util/NuageVspUtil.java | 58 -
.../META-INF/cloudstack/vsp/module.properties | 21 -
.../META-INF/cloudstack/vsp/spring-vsp-context.xml | 41 -
.../src/test/java/com/cloud/NuageTest.java | 219 --
.../java/com/cloud/agent/api/CommandsTest.java | 175 --
.../cloud/network/element/NuageVspElementTest.java | 382 ---
.../network/guru/NuageVspGuestNetworkGuruTest.java | 511 ----
.../cloud/network/manager/NuageVspManagerTest.java | 171 --
.../network/resource/NuageVspResourceTest.java | 241 --
.../com/cloud/util/NuageVspEntityBuilderTest.java | 435 ----
.../test/java/com/cloud/util/NuageVspUtilTest.java | 43 -
plugins/pom.xml | 1 -
.../main/java/com/cloud/api/ApiResponseHelper.java | 2 +-
.../com/cloud/network/guru/DirectNetworkGuru.java | 1 -
.../java/com/cloud/network/vpc/VpcManagerImpl.java | 3 +-
.../java/com/cloud/network/NetworkModelTest.java | 56 -
.../cloud/network/guru/DirectNetworkGuruTest.java | 1 -
test/integration/plugins/nuagevsp/__init__.py | 16 -
.../plugins/nuagevsp/libVSD/__init__.py | 22 -
test/integration/plugins/nuagevsp/libVSD/client.py | 135 -
.../integration/plugins/nuagevsp/libVSD/helpers.py | 602 -----
test/integration/plugins/nuagevsp/nuageTestCase.py | 1546 ------------
test/integration/plugins/nuagevsp/nuage_lib.py | 98 -
.../plugins/nuagevsp/nuage_test_data.py | 561 -----
.../plugins/nuagevsp/nuage_vsp_statistics.py | 202 --
.../plugins/nuagevsp/test_nuage_configdrive.py | 1213 ---------
.../plugins/nuagevsp/test_nuage_extra_dhcp.py | 2027 ---------------
.../plugins/nuagevsp/test_nuage_internal_dns.py | 779 ------
.../nuagevsp/test_nuage_network_migration.py | 2002 ---------------
...test_nuage_non_public_sharednetwork_ip_range.py | 654 -----
.../plugins/nuagevsp/test_nuage_password_reset.py | 364 ---
.../test_nuage_public_sharednetwork_ip_range.py | 823 -------
.../test_nuage_public_sharednetwork_userdata.py | 943 -------
.../nuagevsp/test_nuage_publicsharednetwork.py | 2575 -------------------
.../nuagevsp/test_nuage_sharednetwork_deployVM.py | 2573 -------------------
.../test_nuage_sharednetwork_vpc_vm_monitor.py | 704 ------
.../plugins/nuagevsp/test_nuage_source_nat.py | 1461 -----------
.../plugins/nuagevsp/test_nuage_static_nat.py | 2270 -----------------
.../plugins/nuagevsp/test_nuage_vpc_internal_lb.py | 2590 --------------------
.../plugins/nuagevsp/test_nuage_vpc_network.py | 147 --
.../integration/plugins/nuagevsp/test_nuage_vsp.py | 245 --
.../nuagevsp/test_nuage_vsp_domain_template.py | 835 -------
.../nuagevsp/test_nuage_vsp_mngd_subnets.py | 777 ------
tools/marvin/marvin/deployDataCenter.py | 17 +-
tools/marvin/marvin/lib/base.py | 55 -
tools/marvin/setup.py | 3 -
ui/l10n/en.js | 6 -
ui/scripts/configuration.js | 25 +-
ui/scripts/docs.js | 29 -
ui/scripts/network.js | 189 +-
ui/scripts/system.js | 485 +---
.../hypervisor/vmware/mo/HypervisorHostHelper.java | 11 +-
145 files changed, 48 insertions(+), 38841 deletions(-)
diff --git a/api/src/main/java/com/cloud/event/EventTypes.java b/api/src/main/java/com/cloud/event/EventTypes.java
index f0e6ab6..a30518a 100644
--- a/api/src/main/java/com/cloud/event/EventTypes.java
+++ b/api/src/main/java/com/cloud/event/EventTypes.java
@@ -480,9 +480,6 @@ public class EventTypes {
public static final String EVENT_EXTERNAL_OVS_CONTROLLER_DELETE = "PHYSICAL.OVSCONTROLLER.DELETE";
// external network mapping events
- public static final String EVENT_EXTERNAL_VSP_VSD_ADD = "PHYSICAL.NUAGE.VSD.ADD";
- public static final String EVENT_EXTERNAL_VSP_VSD_UPDATE = "PHYSICAL.NUAGE.VSD.UPDATE";
- public static final String EVENT_EXTERNAL_VSP_VSD_DELETE = "PHYSICAL.NUAGE.VSD.DELETE";
// AutoScale
public static final String EVENT_COUNTER_CREATE = "COUNTER.CREATE";
public static final String EVENT_COUNTER_DELETE = "COUNTER.DELETE";
@@ -924,8 +921,6 @@ public class EventTypes {
entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_CONFIGURE, "NvpController");
// external network mapping events
- entityEventDetails.put(EVENT_EXTERNAL_VSP_VSD_ADD, "NuageVsp");
- entityEventDetails.put(EVENT_EXTERNAL_VSP_VSD_DELETE, "NuageVsp");
// AutoScale
entityEventDetails.put(EVENT_COUNTER_CREATE, AutoScaleCounter.class);
diff --git a/api/src/main/java/com/cloud/network/Network.java b/api/src/main/java/com/cloud/network/Network.java
index d983081..2aa241d 100644
--- a/api/src/main/java/com/cloud/network/Network.java
+++ b/api/src/main/java/com/cloud/network/Network.java
@@ -144,8 +144,6 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
// add new Ovs provider
public static final Provider Ovs = new Provider("Ovs", false);
public static final Provider Opendaylight = new Provider("Opendaylight", false);
- // add Nuage Vsp Providers
- public static final Provider NuageVsp = new Provider("NuageVsp", false);
public static final Provider BrocadeVcs = new Provider("BrocadeVcs", false);
// add GloboDns provider
public static final Provider GloboDns = new Provider("GloboDns", true);
diff --git a/api/src/main/java/com/cloud/network/Networks.java b/api/src/main/java/com/cloud/network/Networks.java
index 06f4236..559a369 100644
--- a/api/src/main/java/com/cloud/network/Networks.java
+++ b/api/src/main/java/com/cloud/network/Networks.java
@@ -125,8 +125,8 @@ public class Networks {
}
}
},
- UnDecided(null, null), OpenDaylight("opendaylight", String.class),
- Vsp("vsp", String.class),;
+ UnDecided(null, null),
+ OpenDaylight("opendaylight", String.class);
private final String scheme;
private final Class<?> type;
diff --git a/client/pom.xml b/client/pom.xml
index 06113bf..5c58635 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -215,11 +215,6 @@
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
- <artifactId>cloud-plugin-network-vsp</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-hypervisor-xenserver</artifactId>
<version>${project.version}</version>
</dependency>
@@ -802,7 +797,7 @@
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
- <!-- Copy the systemvm in the package phase as it is generated by console-proxy in the package
+ <!-- Copy the systemvm in the package phase as it is generated by console-proxy in the package
phase. -->
<execution>
<id>copy-systemvm</id>
diff --git a/engine/schema/src/main/resources/META-INF/db/create-default-role-api-mappings.sql b/engine/schema/src/main/resources/META-INF/db/create-default-role-api-mappings.sql
index 57601fb..d814b0f 100644
--- a/engine/schema/src/main/resources/META-INF/db/create-default-role-api-mappings.sql
+++ b/engine/schema/src/main/resources/META-INF/db/create-default-role-api-mappings.sql
@@ -166,7 +166,6 @@ INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`,
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getVMPassword', 'ALLOW', 143) ON DUPLICATE KEY UPDATE rule=rule;
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'getVirtualMachineUserData', 'ALLOW', 144) ON DUPLICATE KEY UPDATE rule=rule;
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'importLdapUsers', 'ALLOW', 145) ON DUPLICATE KEY UPDATE rule=rule;
-INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'issueNuageVspResourceRequest', 'ALLOW', 146) ON DUPLICATE KEY UPDATE rule=rule;
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'ldapCreateAccount', 'ALLOW', 147) ON DUPLICATE KEY UPDATE rule=rule;
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'linkDomainToLdap', 'ALLOW', 148) ON DUPLICATE KEY UPDATE rule=rule;
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'listAccounts', 'ALLOW', 149) ON DUPLICATE KEY UPDATE rule=rule;
@@ -479,7 +478,6 @@ INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`,
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getUploadParamsForVolume', 'ALLOW', 138) ON DUPLICATE KEY UPDATE rule=rule;
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getVMPassword', 'ALLOW', 139) ON DUPLICATE KEY UPDATE rule=rule;
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'getVirtualMachineUserData', 'ALLOW', 140) ON DUPLICATE KEY UPDATE rule=rule;
-INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'issueNuageVspResourceRequest', 'ALLOW', 141) ON DUPLICATE KEY UPDATE rule=rule;
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAccounts', 'ALLOW', 142) ON DUPLICATE KEY UPDATE rule=rule;
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAffinityGroupTypes', 'ALLOW', 143) ON DUPLICATE KEY UPDATE rule=rule;
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 3, 'listAffinityGroups', 'ALLOW', 144) ON DUPLICATE KEY UPDATE rule=rule;
@@ -759,7 +757,6 @@ INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`,
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'getUploadParamsForVolume', 'ALLOW', 116) ON DUPLICATE KEY UPDATE rule=rule;
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'getVMPassword', 'ALLOW', 117) ON DUPLICATE KEY UPDATE rule=rule;
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'getVirtualMachineUserData', 'ALLOW', 118) ON DUPLICATE KEY UPDATE rule=rule;
-INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'issueNuageVspResourceRequest', 'ALLOW', 119) ON DUPLICATE KEY UPDATE rule=rule;
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listAccounts', 'ALLOW', 120) ON DUPLICATE KEY UPDATE rule=rule;
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listAffinityGroupTypes', 'ALLOW', 121) ON DUPLICATE KEY UPDATE rule=rule;
INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'listAffinityGroups', 'ALLOW', 122) ON DUPLICATE KEY UPDATE rule=rule;
diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41120to41200-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/schema-41120to41200-cleanup.sql
index 82cbfad..465c65c 100644
--- a/engine/schema/src/main/resources/META-INF/db/schema-41120to41200-cleanup.sql
+++ b/engine/schema/src/main/resources/META-INF/db/schema-41120to41200-cleanup.sql
@@ -25,3 +25,8 @@ DROP TABLE IF EXISTS `cloud`.`iam_group_policy_map`;
DROP TABLE IF EXISTS `cloud`.`iam_group`;
DROP TABLE IF EXISTS `cloud`.`iam_policy_permission`;
DROP TABLE IF EXISTS `cloud`.`iam_policy`;
+
+-- Cleanup Nuage VSP
+DELETE FROM `cloud`.`host` WHERE id in (SELECT vsp.host_id FROM `cloud`.`external_nuage_vsp_devices` vsp);
+DROP TABLE IF EXISTS `cloud`.`external_nuage_vsp_devices`;
+delete from `cloud`.`role_permissions` where rule = 'issueNuageVspResourceRequest';
diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 1cdc1f0..ae6a6a2 100644
--- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -2491,16 +2491,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
}
private void createVif(final LibvirtVMDef vm, final NicTO nic, final String nicAdapter, Map<String, String> extraConfig) throws InternalErrorException, LibvirtException {
-
- if (nic.getType().equals(TrafficType.Guest) && nic.getBroadcastType().equals(BroadcastDomainType.Vsp)) {
- String vrIp = nic.getBroadcastUri().getPath().substring(1);
- vm.getMetaData().getMetadataNode(LibvirtVMDef.NuageExtensionDef.class).addNuageExtension(nic.getMac(), vrIp);
-
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("NIC with MAC " + nic.getMac() + " and BroadcastDomainType " + nic.getBroadcastType() + " in network(" + nic.getGateway() + "/" + nic.getNetmask()
- + ") is " + nic.getType() + " traffic type. So, vsp-vr-ip " + vrIp + " is set in the metadata");
- }
- }
if (vm.getDevices() == null) {
s_logger.error("LibvirtVMDef object get devices with null result");
throw new InternalErrorException("LibvirtVMDef object get devices with null result");
diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
index 4f7732b..1b37783 100644
--- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
+++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
@@ -26,8 +26,6 @@ import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
-import com.google.common.collect.Maps;
-
public class LibvirtVMDef {
private static final Logger s_logger = Logger.getLogger(LibvirtVMDef.class);
@@ -1665,28 +1663,6 @@ public class LibvirtVMDef {
}
}
- public static class NuageExtensionDef {
- private Map<String, String> addresses = Maps.newHashMap();
-
- public void addNuageExtension(String macAddress, String vrIp) {
- addresses.put(macAddress, vrIp);
- }
-
- @Override
- public String toString() {
- StringBuilder fsBuilder = new StringBuilder();
- fsBuilder.append("<nuage-extension xmlns='nuagenetworks.net/nuage/cna'>\n");
- for (Map.Entry<String, String> address : addresses.entrySet()) {
- fsBuilder.append(" <interface mac='")
- .append(address.getKey())
- .append("' vsp-vr-ip='")
- .append(address.getValue())
- .append("'></interface>\n");
- }
- return fsBuilder.append("</nuage-extension>\n").toString();
- }
- }
-
public static class RngDef {
enum RngModel {
VIRTIO("virtio");
diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java
index ea4fd4a..db3ee4d 100644
--- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java
+++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java
@@ -183,10 +183,6 @@ public class OvsVifDriver extends VifDriverBase {
String brName = "OVSTunnel" + vnetId;
s_logger.debug("nic " + nic + " needs to be connected to LogicalSwitch " + brName);
intf.defBridgeNet(brName, null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), networkRateKBps);
- } else if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vsp) {
- intf.setVirtualPortInterfaceId(nic.getUuid());
- String brName = (trafficLabel != null && !trafficLabel.isEmpty()) ? _pifs.get(trafficLabel) : _pifs.get("private");
- intf.defBridgeNet(brName, null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), networkRateKBps);
} else {
intf.defBridgeNet(_bridges.get("guest"), null, nic.getMac(), getGuestNicModel(guestOsType, nicAdapter), networkRateKBps);
}
diff --git a/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
index 28f5389..d0ba4dd 100644
--- a/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
+++ b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
@@ -292,23 +292,4 @@ public class LibvirtVMDefTest extends TestCase {
"</controller>\n";
assertEquals(str, expected);
}
-
- @Test
- public void testMetadataDef() {
- LibvirtVMDef.MetadataDef metadataDef = new LibvirtVMDef.MetadataDef();
-
- metadataDef.getMetadataNode(LibvirtVMDef.NuageExtensionDef.class).addNuageExtension("mac1", "ip1");
- metadataDef.getMetadataNode(LibvirtVMDef.NuageExtensionDef.class).addNuageExtension("mac2", "ip2");
-
- String xmlDef = metadataDef.toString();
- String expectedXml = "<metadata>\n" +
- "<nuage-extension xmlns='nuagenetworks.net/nuage/cna'>\n" +
- " <interface mac='mac2' vsp-vr-ip='ip2'></interface>\n" +
- " <interface mac='mac1' vsp-vr-ip='ip1'></interface>\n" +
- "</nuage-extension>\n" +
- "</metadata>\n";
-
- assertEquals(xmlDef, expectedXml);
- }
-
}
diff --git a/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtReplugNicCommandWrapperTest.java b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtReplugNicCommandWrapperTest.java
index c8b9e5c..9d47bfc 100644
--- a/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtReplugNicCommandWrapperTest.java
+++ b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtReplugNicCommandWrapperTest.java
@@ -56,6 +56,7 @@ import com.cloud.vm.VirtualMachine;
@RunWith(PowerMockRunner.class)
@PrepareForTest(value = {Script.class, MemStat.class})
public class LibvirtReplugNicCommandWrapperTest {
+
private static final String part_1 =
"<domain type='kvm' id='143'>\n"
+ " <name>i-85-285-VM</name>\n"
@@ -180,6 +181,7 @@ public class LibvirtReplugNicCommandWrapperTest {
+ "</domain>\n";
private static final String fullfile = part_1 + part_2 + part_3;
+ public static final String GUEST_BR = "guestbr0";
private LibvirtComputingResource res;
private final Domain _domain = mock(Domain.class);
@@ -213,7 +215,7 @@ public class LibvirtReplugNicCommandWrapperTest {
BDDMockito.given(Script.findScript(anyString(), anyString())).willReturn("dummypath/tofile.sh");
Map<String, String> pifs = new HashMap<>();
- pifs.put("alubr0", "alubr0");
+ pifs.put(GUEST_BR, "eth0");
Map<String, Object> params = new HashMap<>();
params.put("libvirt.computing.resource", res);
@@ -227,7 +229,7 @@ public class LibvirtReplugNicCommandWrapperTest {
doReturn(helper).when(res).getLibvirtUtilitiesHelper();
doReturn(bridgeVifDriver).when(res).getVifDriver(eq(Networks.TrafficType.Guest), anyString());
- doReturn(ovsVifDriver).when(res).getVifDriver(Networks.TrafficType.Guest, "alubr0");
+ doReturn(ovsVifDriver).when(res).getVifDriver(Networks.TrafficType.Guest, GUEST_BR);
doReturn(bridgeVifDriver).when(res).getVifDriver(not(eq(Networks.TrafficType.Guest)));
doReturn(Arrays.asList(bridgeVifDriver, ovsVifDriver)).when(res).getAllVifDrivers();
@@ -237,7 +239,6 @@ public class LibvirtReplugNicCommandWrapperTest {
@Test
public void testReplugNic() throws LibvirtException {
-
final String expectedDetachXml =
"<interface type='bridge'>\n"
+ "<source bridge='breth2-234'/>\n"
@@ -248,23 +249,29 @@ public class LibvirtReplugNicCommandWrapperTest {
+ "</interface>\n";
final String expectedAttachXml =
"<interface type='bridge'>\n"
- + "<source bridge='alubr0'/>\n"
+ + "<source bridge='eth0'/>\n"
+ "<target dev='vnet10'/>\n"
+ "<mac address='02:00:7c:98:00:02'/>\n"
+ "<model type='virtio'/>\n"
+ "<virtualport type='openvswitch'>\n"
+ "</virtualport>\n"
+ + "<vlan trunk='no'>\n"
+ + "<tag id='100'/>\n"
+ + "</vlan>"
+ "<link state='down'/>\n"
+ "<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>\n"
+ "</interface>\n";
final String expectedUpdateXml =
"<interface type='bridge'>\n"
- + "<source bridge='alubr0'/>\n"
+ + "<source bridge='eth0'/>\n"
+ "<target dev='vnet10'/>\n"
+ "<mac address='02:00:7c:98:00:02'/>\n"
+ "<model type='virtio'/>\n"
+ "<virtualport type='openvswitch'>\n"
+ "</virtualport>\n"
+ + "<vlan trunk='no'>\n"
+ + "<tag id='100'/>\n"
+ + "</vlan>"
+ "<link state='up'/>\n"
+ "<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>\n"
+ "</interface>\n";
@@ -272,9 +279,10 @@ public class LibvirtReplugNicCommandWrapperTest {
final LibvirtReplugNicCommandWrapper wrapper = new LibvirtReplugNicCommandWrapper();
final NicTO nic = new NicTO();
nic.setType(Networks.TrafficType.Guest);
- nic.setName("alubr0");
- nic.setBroadcastType(Networks.BroadcastDomainType.Vsp);
+ nic.setName(GUEST_BR);
+ nic.setBroadcastType(Networks.BroadcastDomainType.Vlan);
nic.setMac("02:00:7c:98:00:02");
+ nic.setBroadcastUri(Networks.BroadcastDomainType.Vlan.toUri(100));
final ReplugNicCommand command = new ReplugNicCommand(nic, "i-85-285-VM", VirtualMachine.Type.User);
final Answer result = wrapper.execute(command, res);
diff --git a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 37d27c8..22b878c 100644
--- a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -1171,7 +1171,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.ADD);
vmConfigSpec.getDeviceChange().add(deviceConfigSpec);
- setNuageVspVrIpInExtraConfig(vmConfigSpec.getExtraConfig(), nicTo, dvSwitchUuid);
if (!vmMo.configureVm(vmConfigSpec)) {
throw new Exception("Failed to configure devices when running PlugNicCommand");
}
@@ -1252,7 +1251,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.EDIT);
vmConfigSpec.getDeviceChange().add(deviceConfigSpec);
- setNuageVspVrIpInExtraConfig(vmConfigSpec.getExtraConfig(), nicTo, dvSwitchUuid);
if (!vmMo.configureVm(vmConfigSpec)) {
throw new Exception("Failed to configure devices when running ReplugNicCommand");
}
@@ -2632,36 +2630,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
newVal.setKey("nvp.iface-id." + nicNum);
newVal.setValue(nicTo.getUuid());
extraOptions.add(newVal);
- setNuageVspVrIpInExtraConfig(extraOptions, nicTo, nicUuidToDvSwitchUuid.get(nicTo.getUuid()));
}
nicNum++;
}
}
- private static void setNuageVspVrIpInExtraConfig(List<OptionValue> extraOptions, NicTO nicTo, String dvSwitchUuid) {
- if (nicTo.getBroadcastType() != BroadcastDomainType.Vsp) {
- return;
- }
-
- OptionValue newVal;
- if (nicTo.getType().equals(TrafficType.Guest) && dvSwitchUuid != null && nicTo.getGateway() != null && nicTo.getNetmask() != null) {
- String vrIp = nicTo.getBroadcastUri().getPath().substring(1);
- newVal = new OptionValue();
- newVal.setKey("vsp.vr-ip." + nicTo.getMac());
- newVal.setValue(vrIp);
- extraOptions.add(newVal);
- newVal = new OptionValue();
- newVal.setKey("vsp.dvswitch." + nicTo.getMac());
- newVal.setValue(dvSwitchUuid);
- extraOptions.add(newVal);
-
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("NIC with MAC " + nicTo.getMac() + " and BroadcastDomainType " + nicTo.getBroadcastType() + " in network(" + nicTo.getGateway() + "/"
- + nicTo.getNetmask() + ") is " + nicTo.getType() + " traffic type. So, vsp-vr-ip is set in the extraconfig");
- }
- }
- }
-
private static void configCustomExtraOption(List<OptionValue> extraOptions, VirtualMachineTO vmSpec) {
// we no longer to validation anymore
for (Map.Entry<String, String> entry : vmSpec.getDetails().entrySet()) {
diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index e1066b7..ff7b0a3 100644
--- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -1225,14 +1225,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
// group VIF's & tunnel ports as part of tier
// when bridge is setup for distributed routing
vifr.otherConfig.put("cloudstack-network-id", nic.getNetworkUuid());
-
- // Nuage Vsp needs Virtual Router IP to be passed in the otherconfig
- // get the virtual router IP information from broadcast uri
- final URI broadcastUri = nic.getBroadcastUri();
- if (broadcastUri != null && broadcastUri.getScheme().equalsIgnoreCase(Networks.BroadcastDomainType.Vsp.scheme())) {
- final String path = broadcastUri.getPath();
- vifr.otherConfig.put("vsp-vr-ip", path.substring(1));
- }
vifr.network = getNetwork(conn, nic);
if (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) {
@@ -2776,7 +2768,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
assert BroadcastDomainType.getSchemeValue(uri) == BroadcastDomainType.Vlan;
final long vlan = Long.parseLong(BroadcastDomainType.getValue(uri));
return enableVlanNetwork(conn, vlan, network);
- } else if (type == BroadcastDomainType.Native || type == BroadcastDomainType.LinkLocal || type == BroadcastDomainType.Vsp) {
+ } else if (type == BroadcastDomainType.Native || type == BroadcastDomainType.LinkLocal) {
return network.getNetwork();
} else if (uri != null && type == BroadcastDomainType.Vswitch) {
final String header = uri.toString().substring(Networks.BroadcastDomainType.Vswitch.scheme().length() + "://".length());
diff --git a/plugins/network-elements/nuage-vsp/pom.xml b/plugins/network-elements/nuage-vsp/pom.xml
deleted file mode 100644
index 08deda9..0000000
--- a/plugins/network-elements/nuage-vsp/pom.xml
+++ /dev/null
@@ -1,46 +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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <artifactId>cloud-plugin-network-vsp</artifactId>
- <name>Apache CloudStack Plugin - Nuage VSP</name>
- <parent>
- <groupId>org.apache.cloudstack</groupId>
- <artifactId>cloudstack-plugins</artifactId>
- <version>4.13.0.0-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
- <repositories>
- <repository>
- <id>nuage-vsp</id>
- <url>http://cs.mv.nuagenetworks.net/releases/</url>
- </repository>
- </repositories>
- <properties>
- <nuage.vsp.client.version>1.0.8</nuage.vsp.client.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>net.nuagenetworks.vsp</groupId>
- <artifactId>nuage-vsp-acs-client</artifactId>
- <version>${nuage.vsp.client.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/CmdBuilder.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/CmdBuilder.java
deleted file mode 100644
index 514afb6..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/CmdBuilder.java
+++ /dev/null
@@ -1,24 +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 com.cloud.agent.api;
-
-public interface CmdBuilder<T> {
- T build();
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/PingNuageVspCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/PingNuageVspCommand.java
deleted file mode 100644
index c710ad5..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/PingNuageVspCommand.java
+++ /dev/null
@@ -1,57 +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 com.cloud.agent.api;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import com.cloud.host.Host;
-
-public class PingNuageVspCommand extends PingCommand {
-
- private final boolean shouldAudit;
-
- public PingNuageVspCommand(Host.Type type, long id, boolean shouldAudit) {
- super(type, id);
- this.shouldAudit = shouldAudit;
- }
-
- public boolean shouldAudit() {
- return shouldAudit;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof PingNuageVspCommand)) return false;
-
- PingNuageVspCommand that = (PingNuageVspCommand) o;
-
- return super.equals(that)
- && shouldAudit == that.shouldAudit;
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(shouldAudit)
- .toHashCode();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/StartupVspCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/StartupVspCommand.java
deleted file mode 100644
index 2e289fb..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/StartupVspCommand.java
+++ /dev/null
@@ -1,34 +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 com.cloud.agent.api;
-
-import com.cloud.host.Host;
-
-/**
- * The super class implementations for equals and hashCode are acceptable because this class does not track any state
- * in addition to the super class.
- */
-public class StartupVspCommand extends StartupCommand {
-
- public StartupVspCommand() {
- super(Host.Type.L2Networking);
- }
-
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ApplyAclRuleVspCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ApplyAclRuleVspCommand.java
deleted file mode 100644
index 4691355..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ApplyAclRuleVspCommand.java
+++ /dev/null
@@ -1,96 +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 com.cloud.agent.api.element;
-
-import java.util.List;
-import java.util.Objects;
-
-import net.nuage.vsp.acs.client.api.model.VspAclRule;
-import net.nuage.vsp.acs.client.api.model.VspNetwork;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import com.cloud.agent.api.Command;
-
-public class ApplyAclRuleVspCommand extends Command {
-
- private final VspAclRule.ACLType _aclType;
- private final VspNetwork _network;
- private final List<VspAclRule> _aclRules;
- private final boolean _networkReset;
-
- public ApplyAclRuleVspCommand(VspAclRule.ACLType aclType, VspNetwork network, List<VspAclRule> aclRules, boolean networkReset) {
- super();
- this._aclType = aclType;
- this._network = network;
- this._aclRules = aclRules;
- this._networkReset = networkReset;
- }
-
- public VspAclRule.ACLType getAclType() {
- return _aclType;
- }
-
- public VspNetwork getNetwork() {
- return _network;
- }
-
- public List<VspAclRule> getAclRules() {
- return _aclRules;
- }
-
- public boolean isNetworkReset() {
- return _networkReset;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof ApplyAclRuleVspCommand)) {
- return false;
- }
-
- ApplyAclRuleVspCommand that = (ApplyAclRuleVspCommand) o;
-
- return super.equals(that)
- && _networkReset == that._networkReset
- && Objects.equals(_aclType, that._aclType)
- && Objects.equals(_network, that._network)
- && Objects.equals(_aclRules, that._aclRules);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_aclType)
- .append(_network)
- .append(_networkReset)
- .toHashCode();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ApplyStaticNatVspCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ApplyStaticNatVspCommand.java
deleted file mode 100644
index b017dea..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ApplyStaticNatVspCommand.java
+++ /dev/null
@@ -1,80 +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 com.cloud.agent.api.element;
-
-import java.util.List;
-import java.util.Objects;
-
-import net.nuage.vsp.acs.client.api.model.VspNetwork;
-import net.nuage.vsp.acs.client.api.model.VspStaticNat;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import com.cloud.agent.api.Command;
-
-public class ApplyStaticNatVspCommand extends Command {
-
- private final VspNetwork _network;
- private final List<VspStaticNat> _staticNatDetails;
-
- public ApplyStaticNatVspCommand(VspNetwork network, List<VspStaticNat> staticNatDetails) {
- super();
- this._network = network;
- this._staticNatDetails = staticNatDetails;
- }
-
- public VspNetwork getNetwork() {
- return _network;
- }
-
- public List<VspStaticNat> getStaticNatDetails() {
- return _staticNatDetails;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof ApplyStaticNatVspCommand)) {
- return false;
- }
-
- ApplyStaticNatVspCommand that = (ApplyStaticNatVspCommand) o;
-
- return super.equals(that)
- && Objects.equals(_network, that._network)
- && Objects.equals(_staticNatDetails, that._staticNatDetails);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_network)
- .toHashCode();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ExtraDhcpOptionsVspCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ExtraDhcpOptionsVspCommand.java
deleted file mode 100644
index 45f2601..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ExtraDhcpOptionsVspCommand.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 com.cloud.agent.api.element;
-
-import net.nuage.vsp.acs.client.api.model.VspNetwork;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import java.util.Map;
-import java.util.Objects;
-
-import com.cloud.agent.api.Command;
-
-public class ExtraDhcpOptionsVspCommand extends Command {
- private final VspNetwork network;
- private final String nicUuid;
- private final Map<Integer, String> dhcpOptions;
-
- public ExtraDhcpOptionsVspCommand (VspNetwork network, String nicUuid, Map<Integer, String> dhcpOptions) {
- super();
- this.network = network;
- this.nicUuid = nicUuid;
- this.dhcpOptions = dhcpOptions;
- }
-
- public VspNetwork getNetwork() {
- return network;
- }
-
- public String getNicUuid() {
- return nicUuid;
- }
-
- public Map<Integer, String> getDhcpOptions() {
- return dhcpOptions;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof ExtraDhcpOptionsVspCommand)) {
- return false;
- }
-
- ExtraDhcpOptionsVspCommand that = (ExtraDhcpOptionsVspCommand) o;
-
- return super.equals(that)
- && Objects.equals(network, that.network)
- && Objects.equals(nicUuid, that.nicUuid)
- && Objects.equals(dhcpOptions, that.dhcpOptions);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(nicUuid)
- .append(network)
- .append(dhcpOptions)
- .toHashCode();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ImplementVspCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ImplementVspCommand.java
deleted file mode 100644
index 37ec2bf..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ImplementVspCommand.java
+++ /dev/null
@@ -1,104 +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 com.cloud.agent.api.element;
-
-import java.util.List;
-import java.util.Objects;
-
-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.VspNetwork;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import com.cloud.agent.api.Command;
-
-public class ImplementVspCommand extends Command {
-
- private final VspNetwork _network;
- private final List<VspAclRule> _ingressFirewallRules;
- private final List<VspAclRule> _egressFirewallRules;
- private final List<String> _floatingIpUuids;
- private final VspDhcpDomainOption _dhcpOption;
-
- public ImplementVspCommand(VspNetwork network, List<VspAclRule> ingressFirewallRules,
- List<VspAclRule> egressFirewallRules, List<String> floatingIpUuids, VspDhcpDomainOption dhcpOption) {
- super();
- this._network = network;
- this._ingressFirewallRules = ingressFirewallRules;
- this._egressFirewallRules = egressFirewallRules;
- this._floatingIpUuids = floatingIpUuids;
- this._dhcpOption = dhcpOption;
- }
-
- public VspNetwork getNetwork() {
- return _network;
- }
-
- public List<VspAclRule> getIngressFirewallRules() {
- return _ingressFirewallRules;
- }
-
- public List<VspAclRule> getEgressFirewallRules() {
- return _egressFirewallRules;
- }
-
- public List<String> getFloatingIpUuids() {
- return _floatingIpUuids;
- }
-
- public VspDhcpDomainOption getDhcpOption() {
- return _dhcpOption;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof ImplementVspCommand)) {
- return false;
- }
-
- ImplementVspCommand that = (ImplementVspCommand) o;
-
- return super.equals(that)
- && Objects.equals(_network, that._network)
- && Objects.equals(_dhcpOption, that._dhcpOption)
- && Objects.equals(_floatingIpUuids, that._floatingIpUuids)
- && Objects.equals(_ingressFirewallRules, that._ingressFirewallRules)
- && Objects.equals(_egressFirewallRules, that._egressFirewallRules);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_network)
- .append(_dhcpOption)
- .toHashCode();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ShutDownVpcVspCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ShutDownVpcVspCommand.java
deleted file mode 100644
index 6c98238..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ShutDownVpcVspCommand.java
+++ /dev/null
@@ -1,107 +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 com.cloud.agent.api.element;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import com.cloud.agent.api.Command;
-import com.cloud.network.manager.NuageVspManager;
-
-import net.nuage.vsp.acs.client.api.model.NetworkRelatedVsdIds;
-
-public class ShutDownVpcVspCommand extends Command {
-
- private final String _domainUuid;
- private final String _vpcUuid;
- private final String _domainTemplateName;
- private final List<String> _domainRouterUuids;
- private final NetworkRelatedVsdIds _relatedVsdIds;
-
- public ShutDownVpcVspCommand(String domainUuid, String vpcUuid, String domainTemplateName, List<String> domainRouterUuids, Map<String, String> details) {
- super();
- this._domainUuid = domainUuid;
- this._vpcUuid = vpcUuid;
- this._domainTemplateName = domainTemplateName;
- this._domainRouterUuids = domainRouterUuids;
- this._relatedVsdIds = new NetworkRelatedVsdIds.Builder()
- .vsdDomainId(details.get(NuageVspManager.NETWORK_METADATA_VSD_DOMAIN_ID))
- .vsdZoneId(details.get(NuageVspManager.NETWORK_METADATA_VSD_ZONE_ID))
- .withVsdManaged(details.get(NuageVspManager.NETWORK_METADATA_VSD_MANAGED) != null && details.get(NuageVspManager.NETWORK_METADATA_VSD_MANAGED).equals("true"))
- .build();
- }
-
- public String getDomainUuid() {
- return _domainUuid;
- }
-
- public String getVpcUuid() {
- return _vpcUuid;
- }
-
- public String getDomainTemplateName() {
- return _domainTemplateName;
- }
-
- public List<String> getDomainRouterUuids() {
- return _domainRouterUuids;
- }
-
- public NetworkRelatedVsdIds getRelatedVsdIds() {
- return _relatedVsdIds;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof ShutDownVpcVspCommand)) {
- return false;
- }
- if (!super.equals(o)) return false;
-
- ShutDownVpcVspCommand that = (ShutDownVpcVspCommand) o;
-
- return super.equals(that)
- && Objects.equals(_domainUuid, that._domainUuid)
- && Objects.equals(_vpcUuid, that._vpcUuid)
- && Objects.equals(_domainTemplateName, that._domainTemplateName)
- && Objects.equals(_domainRouterUuids, that._domainRouterUuids);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_domainUuid)
- .append(_vpcUuid)
- .append(_domainTemplateName)
- .toHashCode();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ShutDownVspCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ShutDownVspCommand.java
deleted file mode 100644
index 8406764..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/element/ShutDownVspCommand.java
+++ /dev/null
@@ -1,84 +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 com.cloud.agent.api.element;
-
-import java.util.Objects;
-
-import net.nuage.vsp.acs.client.api.model.VspDhcpDomainOption;
-import net.nuage.vsp.acs.client.api.model.VspNetwork;
-
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-import com.cloud.agent.api.Command;
-
-public class ShutDownVspCommand extends Command {
-
- private final VspNetwork _network;
- private final VspDhcpDomainOption _dhcpOptions;
-
- public ShutDownVspCommand(VspNetwork network, VspDhcpDomainOption dhcpOptions) {
- super();
- this._network = network;
- this._dhcpOptions = dhcpOptions;
- }
-
- public VspNetwork getNetwork() {
- return _network;
- }
-
- public VspDhcpDomainOption getDhcpOptions() {
- return _dhcpOptions;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof ShutDownVspCommand)) {
- return false;
- }
-
- ShutDownVspCommand that = (ShutDownVspCommand) o;
-
- return super.equals(that)
- && Objects.equals(_dhcpOptions, that._dhcpOptions)
- && Objects.equals(_network, that._network);
- }
-
-
-
- @Override
- public int hashCode() {
- return Objects.hash(_network, _dhcpOptions);
- }
-
- public String toDetailString() {
- return new ToStringBuilder(this)
- .append("network", _network)
- .append("dhcpOptions", _dhcpOptions)
- .toString();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/guru/DeallocateVmVspCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/guru/DeallocateVmVspCommand.java
deleted file mode 100644
index 327c0b5..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/guru/DeallocateVmVspCommand.java
+++ /dev/null
@@ -1,90 +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 com.cloud.agent.api.guru;
-
-import java.util.Objects;
-
-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.VspVm;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import com.cloud.agent.api.Command;
-
-
-public class DeallocateVmVspCommand extends Command {
-
- private final VspNetwork _network;
- private final VspVm _vm;
- private final VspNic _nic;
-
- public DeallocateVmVspCommand(VspNetwork network, VspVm vm, VspNic nic) {
- super();
- this._network = network;
- this._vm = vm;
- this._nic = nic;
- }
-
- public VspNetwork getNetwork() {
- return this._network;
- }
-
- public VspVm getVm() {
- return this._vm;
- }
-
- public VspNic getNic() {
- return this._nic;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof DeallocateVmVspCommand)) {
- return false;
- }
-
- DeallocateVmVspCommand that = (DeallocateVmVspCommand) o;
-
- return super.equals(that)
- && Objects.equals(_network, that._network)
- && Objects.equals(_nic, that._nic)
- && Objects.equals(_vm, that._vm);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_network)
- .append(_vm)
- .append(_nic)
- .toHashCode();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/guru/ImplementNetworkVspCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/guru/ImplementNetworkVspCommand.java
deleted file mode 100644
index 2f2d5fd..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/guru/ImplementNetworkVspCommand.java
+++ /dev/null
@@ -1,94 +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 com.cloud.agent.api.guru;
-
-import java.util.Objects;
-
-import net.nuage.vsp.acs.client.api.model.VspDhcpDomainOption;
-import net.nuage.vsp.acs.client.api.model.VspNetwork;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-import com.cloud.agent.api.Command;
-
-public class ImplementNetworkVspCommand extends Command {
-
- private final VspNetwork _network;
- private final VspDhcpDomainOption _dhcpOption;
- private final boolean _isVsdManaged;
-
- public ImplementNetworkVspCommand(VspNetwork network, VspDhcpDomainOption dhcpOption, boolean isVsdManaged) {
- super();
- this._network = network;
- this._dhcpOption = dhcpOption;
- this._isVsdManaged = isVsdManaged;
- }
-
- public VspNetwork getNetwork() {
- return _network;
- }
-
- public VspDhcpDomainOption getDhcpOption() {
- return _dhcpOption;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof ImplementNetworkVspCommand)) {
- return false;
- }
-
- ImplementNetworkVspCommand that = (ImplementNetworkVspCommand) o;
-
- return super.equals(that)
- && Objects.equals(_dhcpOption, that._dhcpOption)
- && Objects.equals(_network, that._network);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_network)
- .append(_dhcpOption)
- .toHashCode();
- }
-
- public String toDetailString() {
- return new ToStringBuilder(this)
- .append("network", _network)
- .append("dhcpOption", _dhcpOption)
- .toString();
- }
-
- public boolean isVsdManaged() {
- return _isVsdManaged;
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/guru/ReserveVmInterfaceVspCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/guru/ReserveVmInterfaceVspCommand.java
deleted file mode 100644
index 910d4ac..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/guru/ReserveVmInterfaceVspCommand.java
+++ /dev/null
@@ -1,107 +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 com.cloud.agent.api.guru;
-
-import java.util.Objects;
-
-import net.nuage.vsp.acs.client.api.model.VspDhcpVMOption;
-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 org.apache.commons.lang.builder.HashCodeBuilder;
-
-import com.cloud.agent.api.Command;
-
-public class ReserveVmInterfaceVspCommand extends Command {
-
- private final VspNetwork _network;
- private final VspVm _vm;
- private final VspNic _nic;
- private final VspStaticNat _staticNat;
- private final VspDhcpVMOption _dhcpOption;
-
- public ReserveVmInterfaceVspCommand(VspNetwork network, VspVm vm, VspNic nic, VspStaticNat staticNat, VspDhcpVMOption dhcpOption) {
- super();
- this._network = network;
- this._vm = vm;
- this._nic = nic;
- this._staticNat = staticNat;
- this._dhcpOption = dhcpOption;
- }
-
- public VspNetwork getNetwork() {
- return _network;
- }
-
- public VspVm getVm() {
- return _vm;
- }
-
- public VspNic getNic() {
- return _nic;
- }
-
- public VspStaticNat getStaticNat() {
- return _staticNat;
- }
-
- public VspDhcpVMOption getDhcpOption() {
- return _dhcpOption;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof ReserveVmInterfaceVspCommand)) {
- return false;
- }
-
- ReserveVmInterfaceVspCommand that = (ReserveVmInterfaceVspCommand) o;
-
- return super.equals(that)
- && Objects.equals(_network, that._network)
- && Objects.equals(_nic, that._nic)
- && Objects.equals(_dhcpOption, that._dhcpOption)
- && Objects.equals(_staticNat, that._staticNat)
- && Objects.equals(_vm, that._vm);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_network)
- .append(_vm)
- .append(_nic)
- .append(_staticNat)
- .append(_dhcpOption)
- .toHashCode();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/guru/TrashNetworkVspCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/guru/TrashNetworkVspCommand.java
deleted file mode 100644
index 873b5c2..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/guru/TrashNetworkVspCommand.java
+++ /dev/null
@@ -1,71 +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 com.cloud.agent.api.guru;
-
-import java.util.Objects;
-
-import net.nuage.vsp.acs.client.api.model.VspNetwork;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import com.cloud.agent.api.Command;
-
-public class TrashNetworkVspCommand extends Command {
-
- private final VspNetwork _network;
-
- public TrashNetworkVspCommand(VspNetwork network) {
- super();
- this._network = network;
- }
-
- public VspNetwork getNetwork() {
- return _network;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof TrashNetworkVspCommand)) {
- return false;
- }
-
- TrashNetworkVspCommand that = (TrashNetworkVspCommand) o;
-
- return super.equals(that)
- && Objects.equals(_network, that._network);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_network)
- .toHashCode();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/guru/UpdateDhcpOptionVspCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/guru/UpdateDhcpOptionVspCommand.java
deleted file mode 100644
index c5ae11a..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/guru/UpdateDhcpOptionVspCommand.java
+++ /dev/null
@@ -1,87 +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 com.cloud.agent.api.guru;
-
-import java.util.List;
-import java.util.Objects;
-
-import net.nuage.vsp.acs.client.api.model.VspDhcpVMOption;
-import net.nuage.vsp.acs.client.api.model.VspNetwork;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-import com.cloud.agent.api.Command;
-
-public class UpdateDhcpOptionVspCommand extends Command {
-
- private final List<VspDhcpVMOption> _dhcpOptions;
- private final VspNetwork _network;
-
- public UpdateDhcpOptionVspCommand(List<VspDhcpVMOption> dhcpOptions, VspNetwork network) {
- this._dhcpOptions = dhcpOptions;
- this._network = network;
- }
-
- public List<VspDhcpVMOption> getDhcpOptions() {
- return _dhcpOptions;
- }
-
- public VspNetwork getNetwork() {
- return _network;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof UpdateDhcpOptionVspCommand)) {
- return false;
- }
-
- UpdateDhcpOptionVspCommand that = (UpdateDhcpOptionVspCommand) o;
-
- return super.equals(that)
- && Objects.equals(_network, that._network)
- && Objects.equals(_dhcpOptions, that._dhcpOptions);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_network)
- .toHashCode();
- }
-
- public String toDetailString() {
- return new ToStringBuilder(this)
- .append("network", _network)
- .append("dhcpOptions", _dhcpOptions)
- .toString();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/CleanUpDomainCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/CleanUpDomainCommand.java
deleted file mode 100644
index 2229b61..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/CleanUpDomainCommand.java
+++ /dev/null
@@ -1,72 +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 com.cloud.agent.api.manager;
-
-import com.cloud.agent.api.Command;
-
-import com.google.common.base.Preconditions;
-import net.nuage.vsp.acs.client.api.model.VspDomainCleanUp;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import java.util.Objects;
-
-public class CleanUpDomainCommand extends Command {
-
- private final VspDomainCleanUp _domainCleanUp;
-
- public CleanUpDomainCommand(VspDomainCleanUp domainCleanUp) {
- super();
- Preconditions.checkNotNull(domainCleanUp);
- this._domainCleanUp = domainCleanUp;
- }
-
- public VspDomainCleanUp getDomainCleanUp() {
- return _domainCleanUp;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof CleanUpDomainCommand)) {
- return false;
- }
-
- CleanUpDomainCommand that = (CleanUpDomainCommand) o;
-
- return super.equals(that)
- && Objects.equals(_domainCleanUp, that._domainCleanUp);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_domainCleanUp)
- .toHashCode();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/EntityExistsCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/EntityExistsCommand.java
deleted file mode 100644
index 8e8fd81..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/EntityExistsCommand.java
+++ /dev/null
@@ -1,85 +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 com.cloud.agent.api.manager;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import java.util.Objects;
-
-import com.cloud.agent.api.Command;
-
-public class EntityExistsCommand<T> extends Command {
-
- private transient Class<T> _type;
- private final String _className;
- private final String _uuid;
-
- public EntityExistsCommand(Class<T> type, String uuid) {
- super();
- this._type = type;
- this._className = type.getName();
- this._uuid = uuid;
- }
-
- public Class<T> getType() {
- if (_type == null) {
- try {
- _type = (Class<T>)Class.forName(_className);
- } catch (ClassNotFoundException e) {
- }
- }
- return _type;
- }
-
- public String getUuid() {
- return _uuid;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof EntityExistsCommand)) {
- return false;
- }
-
- EntityExistsCommand that = (EntityExistsCommand) o;
-
- return super.equals(that)
- && Objects.equals(getType(), that.getType())
- && Objects.equals(_uuid, that._uuid);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(getType())
- .append(_uuid)
- .toHashCode();
- }
-}
\ No newline at end of file
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/GetApiDefaultsAnswer.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/GetApiDefaultsAnswer.java
deleted file mode 100644
index e52b0e3..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/GetApiDefaultsAnswer.java
+++ /dev/null
@@ -1,70 +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 com.cloud.agent.api.manager;
-
-import java.util.Objects;
-
-import net.nuage.vsp.acs.client.api.model.VspApiDefaults;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import com.cloud.agent.api.Answer;
-
-public class GetApiDefaultsAnswer extends Answer {
-
- private VspApiDefaults _apiDefaults;
-
- public GetApiDefaultsAnswer(GetApiDefaultsCommand cmd, VspApiDefaults defaults) {
- super(cmd);
- this._apiDefaults = defaults;
- }
-
- public GetApiDefaultsAnswer(GetApiDefaultsCommand cmd, Exception e) {
- super(cmd, e);
- }
-
- public VspApiDefaults getApiDefaults() {
- return _apiDefaults;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof GetApiDefaultsAnswer)) {
- return false;
- }
-
- GetApiDefaultsAnswer that = (GetApiDefaultsAnswer) o;
-
- return super.equals(that)
- && Objects.equals(_apiDefaults, that._apiDefaults);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_apiDefaults)
- .toHashCode();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/GetApiDefaultsCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/GetApiDefaultsCommand.java
deleted file mode 100644
index 3fca16a..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/GetApiDefaultsCommand.java
+++ /dev/null
@@ -1,38 +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 com.cloud.agent.api.manager;
-
-import com.cloud.agent.api.Command;
-
-/**
- * The super class implementations for equals and hashCode are acceptable because this class does not track any state
- * in addition to the super class.
- */
-public class GetApiDefaultsCommand extends Command {
-
- public GetApiDefaultsCommand() {
- super();
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-}
\ No newline at end of file
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/ImplementNetworkVspAnswer.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/ImplementNetworkVspAnswer.java
deleted file mode 100644
index 8cfb715..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/ImplementNetworkVspAnswer.java
+++ /dev/null
@@ -1,53 +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 com.cloud.agent.api.manager;
-
-import net.nuage.vsp.acs.client.api.model.NetworkRelatedVsdIds;
-import net.nuage.vsp.acs.client.api.model.VspNetwork;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.guru.ImplementNetworkVspCommand;
-
-/**
- * Created by sgoeminn on 3/24/17.
- */
-public class ImplementNetworkVspAnswer extends Answer {
- private NetworkRelatedVsdIds networkRelatedVsdIds;
-
- private VspNetwork vspNetwork;
-
- public ImplementNetworkVspAnswer(ImplementNetworkVspCommand command, VspNetwork vspNetwork, NetworkRelatedVsdIds networkRelatedVsdIds) {
- super(command);
- this.vspNetwork = vspNetwork;
- this.networkRelatedVsdIds = networkRelatedVsdIds;
- }
-
- public ImplementNetworkVspAnswer(ImplementNetworkVspCommand command, Exception e) {
- super(command, e);
- }
-
- public NetworkRelatedVsdIds getNetworkRelatedVsdIds() {
- return networkRelatedVsdIds;
- }
-
- public VspNetwork getVspNetwork() {
- return vspNetwork;
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/ListVspDomainTemplatesAnswer.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/ListVspDomainTemplatesAnswer.java
deleted file mode 100644
index ec13d67..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/ListVspDomainTemplatesAnswer.java
+++ /dev/null
@@ -1,44 +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 com.cloud.agent.api.manager;
-
-import com.cloud.agent.api.Answer;
-import net.nuage.vsp.acs.client.api.model.VspDomainTemplate;
-
-import java.util.List;
-
-
-public class ListVspDomainTemplatesAnswer extends Answer {
- private List<VspDomainTemplate> domainTemplates;
-
- public ListVspDomainTemplatesAnswer(ListVspDomainTemplatesCommand command, List<VspDomainTemplate> domainTemplates) {
- super(command);
-
- this.domainTemplates = domainTemplates;
- }
-
- public ListVspDomainTemplatesAnswer(ListVspDomainTemplatesCommand command, Exception e) {
- super(command, e);
- }
-
- public List<VspDomainTemplate> getDomainTemplates() {
- return domainTemplates;
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/ListVspDomainTemplatesCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/ListVspDomainTemplatesCommand.java
deleted file mode 100644
index e174004..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/ListVspDomainTemplatesCommand.java
+++ /dev/null
@@ -1,47 +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 com.cloud.agent.api.manager;
-
-import com.cloud.agent.api.Command;
-import net.nuage.vsp.acs.client.api.model.VspDomain;
-
-
-public class ListVspDomainTemplatesCommand extends Command {
- private final VspDomain _domain;
- private final String _name;
-
- public ListVspDomainTemplatesCommand(VspDomain domain, String name) {
- this._domain = domain;
- this._name = name;
- }
-
- public VspDomain getDomain() {
- return _domain;
- }
-
- public String getName() {
- return _name;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/SupportedApiVersionCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/SupportedApiVersionCommand.java
deleted file mode 100644
index 6c57e85..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/SupportedApiVersionCommand.java
+++ /dev/null
@@ -1,70 +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 com.cloud.agent.api.manager;
-
-import java.util.Objects;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import com.cloud.agent.api.Command;
-
-public class SupportedApiVersionCommand extends Command {
-
- private final String _apiVersion;
-
- public SupportedApiVersionCommand(String apiVersion) {
- super();
- this._apiVersion = apiVersion;
- }
-
- public String getApiVersion() {
- return _apiVersion;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof SupportedApiVersionCommand)) {
- return false;
- }
-
- SupportedApiVersionCommand that = (SupportedApiVersionCommand) o;
-
- return super.equals(that)
- && Objects.equals(_apiVersion, that._apiVersion);
-
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_apiVersion)
- .toHashCode();
- }
-}
\ No newline at end of file
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/UpdateNuageVspDeviceCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/UpdateNuageVspDeviceCommand.java
deleted file mode 100644
index d94ff70..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/manager/UpdateNuageVspDeviceCommand.java
+++ /dev/null
@@ -1,70 +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 com.cloud.agent.api.manager;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import java.util.Objects;
-
-import com.cloud.agent.api.Command;
-import com.cloud.network.resource.NuageVspResourceConfiguration;
-
-public class UpdateNuageVspDeviceCommand extends Command {
-
- private final NuageVspResourceConfiguration configuration;
-
- public UpdateNuageVspDeviceCommand(NuageVspResourceConfiguration configuration) {
- super();
- this.configuration = configuration;
- }
-
- public NuageVspResourceConfiguration getConfiguration() {
- return configuration;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof UpdateNuageVspDeviceCommand)) {
- return false;
- }
-
- UpdateNuageVspDeviceCommand that = (UpdateNuageVspDeviceCommand) o;
-
- return super.equals(that)
- && Objects.equals(configuration, that.configuration);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(configuration)
- .toHashCode();
- }
-}
\ No newline at end of file
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/sync/SyncDomainAnswer.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/sync/SyncDomainAnswer.java
deleted file mode 100644
index 26d8ad4..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/sync/SyncDomainAnswer.java
+++ /dev/null
@@ -1,64 +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 com.cloud.agent.api.sync;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import com.cloud.agent.api.Answer;
-
-public class SyncDomainAnswer extends Answer {
-
- private final boolean _success;
-
- public SyncDomainAnswer(boolean success) {
- super();
- this._success = success;
- }
-
- public boolean getSuccess() {
- return _success;
- }
-
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof SyncDomainAnswer)) {
- return false;
- }
-
- SyncDomainAnswer that = (SyncDomainAnswer) o;
-
- return super.equals(that)
- && _success == that._success;
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_success)
- .toHashCode();
-
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/sync/SyncDomainCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/sync/SyncDomainCommand.java
deleted file mode 100644
index 024eaae..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/sync/SyncDomainCommand.java
+++ /dev/null
@@ -1,84 +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 com.cloud.agent.api.sync;
-
-import java.util.Objects;
-
-import net.nuage.vsp.acs.client.api.model.VspDomain;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import com.cloud.agent.api.Command;
-
-public class SyncDomainCommand extends Command {
-
- public enum Type { ADD, REMOVE }
- private final VspDomain _domain;
- private final Type _action;
-
- public SyncDomainCommand(VspDomain domain, Type action) {
- super();
- this._domain = domain;
- this._action = action;
- }
-
- public VspDomain getDomain() {
- return _domain;
- }
-
- public Type getAction() {
- return _action;
- }
-
- public boolean isToAdd() {
- return Type.ADD.equals(_action);
- }
-
- public boolean isToRemove() {
- return Type.REMOVE.equals(_action);
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof SyncDomainCommand)) return false;
- if (!super.equals(o)) return false;
-
- SyncDomainCommand that = (SyncDomainCommand) o;
-
- return super.equals(that)
- && Objects.equals(_action, that._action)
- && Objects.equals(_domain, that._domain);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_domain)
- .append(_action)
- .toHashCode();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/sync/SyncNuageVspCmsIdAnswer.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/sync/SyncNuageVspCmsIdAnswer.java
deleted file mode 100644
index 98730fe..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/sync/SyncNuageVspCmsIdAnswer.java
+++ /dev/null
@@ -1,88 +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 com.cloud.agent.api.sync;
-
-import java.util.Objects;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-
-public class SyncNuageVspCmsIdAnswer extends Answer {
-
- private final boolean _success;
- private final String _nuageVspCmsId;
- private final SyncNuageVspCmsIdCommand.SyncType _syncType;
-
- public SyncNuageVspCmsIdAnswer(boolean success, String nuageVspCmsId, SyncNuageVspCmsIdCommand.SyncType syncType) {
- super();
- this._success = success;
- this._nuageVspCmsId = nuageVspCmsId;
- this._syncType = syncType;
- }
-
- public SyncNuageVspCmsIdAnswer(Command command, Exception e, SyncNuageVspCmsIdCommand.SyncType syncType) {
- super(command, e);
- this._nuageVspCmsId = null;
- this._success = false;
- this._syncType = syncType;
- }
-
- public boolean getSuccess() {
- return _success;
- }
-
- public String getNuageVspCmsId() {
- return _nuageVspCmsId;
- }
-
- public SyncNuageVspCmsIdCommand.SyncType getSyncType() {
- return _syncType;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof SyncNuageVspCmsIdAnswer)) {
- return false;
- }
-
- SyncNuageVspCmsIdAnswer that = (SyncNuageVspCmsIdAnswer) o;
-
- return super.equals(that)
- && _success == that._success
- && Objects.equals(_syncType, that._syncType)
- && Objects.equals(_nuageVspCmsId, that._nuageVspCmsId);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_syncType)
- .append(_nuageVspCmsId)
- .append(_success)
- .toHashCode();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/sync/SyncNuageVspCmsIdCommand.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/sync/SyncNuageVspCmsIdCommand.java
deleted file mode 100644
index 40a0a45..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/agent/api/sync/SyncNuageVspCmsIdCommand.java
+++ /dev/null
@@ -1,75 +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 com.cloud.agent.api.sync;
-
-import java.util.Objects;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-import com.cloud.agent.api.Command;
-
-public class SyncNuageVspCmsIdCommand extends Command {
-
- public static enum SyncType { AUDIT, AUDIT_ONLY, REGISTER, UNREGISTER }
-
- private final SyncType _syncType;
- private final String _nuageVspCmsId;
-
- public SyncNuageVspCmsIdCommand(SyncType syncType, String nuageVspCmsId) {
- super();
- this._syncType = syncType;
- this._nuageVspCmsId = nuageVspCmsId;
- }
-
- public SyncType getSyncType() {
- return _syncType;
- }
-
- public String getNuageVspCmsId() {
- return _nuageVspCmsId;
- }
-
- @Override
- public boolean executeInSequence() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof SyncNuageVspCmsIdCommand)) return false;
- if (!super.equals(o)) return false;
-
- SyncNuageVspCmsIdCommand that = (SyncNuageVspCmsIdCommand) o;
-
- return super.equals(that)
- && Objects.equals(_syncType, that._syncType)
- && Objects.equals(_nuageVspCmsId, that._nuageVspCmsId);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_syncType)
- .append(_nuageVspCmsId)
- .toHashCode();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/AddNuageVspDeviceCmd.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/AddNuageVspDeviceCmd.java
deleted file mode 100644
index 62a15ea..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/AddNuageVspDeviceCmd.java
+++ /dev/null
@@ -1,182 +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 com.cloud.api.commands;
-
-import com.cloud.api.response.NuageVspDeviceResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.NuageVspDeviceVO;
-import com.cloud.network.manager.NuageVspManager;
-import com.cloud.utils.exception.CloudRuntimeException;
-import org.apache.cloudstack.acl.RoleType;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
-import org.apache.cloudstack.context.CallContext;
-
-import javax.inject.Inject;
-
-@APICommand(name = AddNuageVspDeviceCmd.APINAME, description = "Adds a Nuage VSP device", responseObject = NuageVspDeviceResponse.class,
- requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
- since = "4.5",
- authorized = {RoleType.Admin})
-public class AddNuageVspDeviceCmd extends BaseAsyncCmd {
- public static final String APINAME = "addNuageVspDevice";
-
- @Inject
- NuageVspManager _nuageVspManager;
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = BaseCmd.CommandType.UUID, entityType = PhysicalNetworkResponse.class,
- required = true, description = "the ID of the physical network in to which Nuage VSP is added")
- private Long physicalNetworkId;
-
- @Parameter(name = VspConstants.NUAGE_VSP_API_PORT, type = CommandType.INTEGER, required = true, description = "the port to communicate to Nuage VSD")
- private int port;
-
- @Parameter(name = ApiConstants.HOST_NAME, type = CommandType.STRING, required = true, description = "the hostname of the Nuage VSD")
- private String hostName;
-
- @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "the user name of the CMS user in Nuage VSD")
- private String userName;
-
- @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, required = true, description = "the password of CMS user in Nuage VSD")
- private String password;
-
- @Parameter(name = VspConstants.NUAGE_VSP_API_VERSION, type = CommandType.STRING, description = "the version of the API to use to communicate to Nuage VSD")
- private String apiVersion;
-
- @Parameter(name = VspConstants.NUAGE_VSP_API_RETRY_COUNT, type = CommandType.INTEGER, description = "the number of retries on failure to communicate to Nuage VSD")
- private Integer apiRetryCount;
-
- @Parameter(name = VspConstants.NUAGE_VSP_API_RETRY_INTERVAL, type = CommandType.LONG, description = "the time to wait after failure before retrying to communicate to Nuage VSD")
- private Long apiRetryInterval;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- public int getPort() {
- return port;
- }
-
- public void setPort(int port) {
- this.port = port;
- }
-
- public String getHostName() {
- return hostName;
- }
-
- public void setHostName(String hostName) {
- this.hostName = hostName;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public String getPassword() {
- return password;
- }
-
- public String getApiVersion() {
- return apiVersion;
- }
-
- public void setApiVersion(String apiVersion) {
- this.apiVersion = apiVersion;
- }
-
- public Integer getApiRetryCount() {
- return apiRetryCount;
- }
-
- public void setApiRetryCount(int apiRetryCount) {
- this.apiRetryCount = apiRetryCount;
- }
-
- public Long getApiRetryInterval() {
- return apiRetryInterval;
- }
-
- public void setApiRetryInterval(long apiRetryInterval) {
- this.apiRetryInterval = apiRetryInterval;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
- try {
- NuageVspDeviceVO nuageVspDeviceVO = _nuageVspManager.addNuageVspDevice(this);
- if (nuageVspDeviceVO != null) {
- NuageVspDeviceResponse response = _nuageVspManager.createNuageVspDeviceResponse(nuageVspDeviceVO);
- response.setObjectName("nuagevspdevice");
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Nuage VSP device due to internal error.");
- }
- } catch (InvalidParameterValueException invalidParamExcp) {
- throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
- } catch (CloudRuntimeException runtimeExcp) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
- }
- }
-
- @Override
- public String getCommandName() {
- return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
- }
-
- @Override
- public long getEntityOwnerId() {
- return CallContext.current().getCallingAccount().getId();
- }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_EXTERNAL_VSP_VSD_ADD;
- }
-
- @Override
- public String getEventDescription() {
- return "Adding a Nuage VSD";
- }
-}
\ No newline at end of file
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/AssociateNuageVspDomainTemplateCmd.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/AssociateNuageVspDomainTemplateCmd.java
deleted file mode 100644
index 9b36aaf..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/AssociateNuageVspDomainTemplateCmd.java
+++ /dev/null
@@ -1,114 +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 com.cloud.api.commands;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.acl.RoleType;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
-import org.apache.cloudstack.api.response.SuccessResponse;
-import org.apache.cloudstack.api.response.VpcResponse;
-import org.apache.cloudstack.api.response.ZoneResponse;
-import org.apache.cloudstack.context.CallContext;
-
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.manager.NuageVspManager;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-@APICommand(name = AssociateNuageVspDomainTemplateCmd.APINAME, responseObject = SuccessResponse.class,
- description = "associate a vpc with a domain template", authorized = {RoleType.Admin, RoleType.DomainAdmin, RoleType.User},
- since = "4.11.0")
-public class AssociateNuageVspDomainTemplateCmd extends BaseCmd {
- static final String APINAME = "associateNuageVspDomainTemplate";
-
- @Inject
- NuageVspManager _nuageVspManager;
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name = ApiConstants.VPC_ID, type = CommandType.UUID, entityType = VpcResponse.class, required = true, description = "VPC ID")
- private Long vpcId;
-
-
- @Parameter(name = VspConstants.NUAGE_VSP_API_DOMAIN_TEMPLATE, type = CommandType.STRING, required = true, description = "the name of the domain template")
- private String domainTemplate;
-
- @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, description = "the physical network ID")
- private Long physicalNetworkId;
-
- @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the zone ID")
- private Long zoneId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getVpcId() {
- return vpcId;
- }
-
- public String getDomainTemplate() { return domainTemplate; }
-
- public Long getZoneId() { return zoneId; }
-
- public Long getPhysicalNetworkId() { return physicalNetworkId; }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
- try {
- _nuageVspManager.associateNuageVspDomainTemplate(this);
- SuccessResponse response = new SuccessResponse(getCommandName());
- response.setResponseName(getCommandName());
- response.setSuccess(true);
- this.setResponseObject(response);
- } catch (InvalidParameterValueException invalidParamExcp) {
- throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
- } catch (CloudRuntimeException runtimeExcp) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
- }
- }
-
- @Override
- public String getCommandName() {
- return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
- }
-
- @Override
- public long getEntityOwnerId() {
- return CallContext.current().getCallingAccount().getId();
- }
-
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/DeleteNuageVspDeviceCmd.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/DeleteNuageVspDeviceCmd.java
deleted file mode 100644
index 05a17d6..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/DeleteNuageVspDeviceCmd.java
+++ /dev/null
@@ -1,110 +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 com.cloud.api.commands;
-
-import com.cloud.api.response.NuageVspDeviceResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.manager.NuageVspManager;
-import com.cloud.utils.exception.CloudRuntimeException;
-import org.apache.cloudstack.acl.RoleType;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.SuccessResponse;
-import org.apache.cloudstack.context.CallContext;
-
-import javax.inject.Inject;
-
-@APICommand(name = DeleteNuageVspDeviceCmd.APINAME, description = "delete a nuage vsp device", responseObject = SuccessResponse.class,
- requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
- since = "4.5",
- authorized = {RoleType.Admin})
-public class DeleteNuageVspDeviceCmd extends BaseAsyncCmd {
- public static final String APINAME = "deleteNuageVspDevice";
-
- @Inject
- NuageVspManager _nuageVspManager;
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name = VspConstants.NUAGE_VSP_DEVICE_ID, type = CommandType.UUID, entityType = NuageVspDeviceResponse.class, required = true, description = "Nuage device ID")
- private Long nuageVspDeviceId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getNuageVspDeviceId() {
- return nuageVspDeviceId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
- try {
- boolean result = _nuageVspManager.deleteNuageVspDevice(this);
- if (result) {
- SuccessResponse response = new SuccessResponse(getCommandName());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Nuage device.");
- }
- } catch (InvalidParameterValueException invalidParamExcp) {
- throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
- } catch (CloudRuntimeException runtimeExcp) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
- }
- }
-
- @Override
- public String getCommandName() {
- return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
- }
-
- @Override
- public long getEntityOwnerId() {
- return CallContext.current().getCallingAccount().getId();
- }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_EXTERNAL_VSP_VSD_DELETE;
- }
-
- @Override
- public String getEventDescription() {
- return "Deleting Nuage VSD";
- }
-
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/DisableNuageUnderlayVlanIpRangeCmd.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/DisableNuageUnderlayVlanIpRangeCmd.java
deleted file mode 100644
index bcc804c..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/DisableNuageUnderlayVlanIpRangeCmd.java
+++ /dev/null
@@ -1,110 +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 com.cloud.api.commands;
-
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.manager.NuageVspManager;
-import com.cloud.utils.exception.CloudRuntimeException;
-import org.apache.cloudstack.acl.RoleType;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.SuccessResponse;
-import org.apache.cloudstack.api.response.VlanIpRangeResponse;
-import org.apache.cloudstack.context.CallContext;
-
-import javax.inject.Inject;
-
-@APICommand(name = DisableNuageUnderlayVlanIpRangeCmd.APINAME, description = "disable Nuage underlay on vlan ip range", responseObject = SuccessResponse.class,
- requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
- since = "4.10",
- authorized = {RoleType.Admin})
-public class DisableNuageUnderlayVlanIpRangeCmd extends BaseAsyncCmd {
- public static final String APINAME = "disableNuageUnderlayVlanIpRange";
-
- @Inject
- NuageVspManager _nuageVspManager;
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VlanIpRangeResponse.class, required = true, description = "VLAN IP Range ID")
- private long vlanIpRangeId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public long getVlanIpRangeId() {
- return vlanIpRangeId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
- try {
- boolean result = _nuageVspManager.updateNuageUnderlayVlanIpRange(vlanIpRangeId, false);
- if (result) {
- SuccessResponse response = new SuccessResponse(getCommandName());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable underlay, VLAN IP range is already pushed to the Nuage VSP device.");
- }
- } catch (InvalidParameterValueException invalidParamExcp) {
- throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
- } catch (CloudRuntimeException runtimeExcp) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
- }
- }
-
- @Override
- public String getCommandName() {
- return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
- }
-
- @Override
- public long getEntityOwnerId() {
- return CallContext.current().getCallingAccount().getId();
- }
-
- @Override
- public String getEventType() {
- return "VLAN.DISABLE.NUAGE.UNDERLAY";
- }
-
- @Override
- public String getEventDescription() {
- return "Disable VLAN IP range Nuage underlay";
- }
-
-}
\ No newline at end of file
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/EnableNuageUnderlayVlanIpRangeCmd.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/EnableNuageUnderlayVlanIpRangeCmd.java
deleted file mode 100644
index b1eb9d7..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/EnableNuageUnderlayVlanIpRangeCmd.java
+++ /dev/null
@@ -1,110 +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 com.cloud.api.commands;
-
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.manager.NuageVspManager;
-import com.cloud.utils.exception.CloudRuntimeException;
-import org.apache.cloudstack.acl.RoleType;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.SuccessResponse;
-import org.apache.cloudstack.api.response.VlanIpRangeResponse;
-import org.apache.cloudstack.context.CallContext;
-
-import javax.inject.Inject;
-
-@APICommand(name = EnableNuageUnderlayVlanIpRangeCmd.APINAME, description = "enable Nuage underlay on vlan ip range", responseObject = SuccessResponse.class,
- requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
- since = "4.10",
- authorized = {RoleType.Admin})
-public class EnableNuageUnderlayVlanIpRangeCmd extends BaseAsyncCmd {
- public static final String APINAME = "enableNuageUnderlayVlanIpRange";
-
- @Inject
- NuageVspManager _nuageVspManager;
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VlanIpRangeResponse.class, required = true, description = "VLAN IP Range ID")
- private long vlanIpRangeId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public long getVlanIpRangeId() {
- return vlanIpRangeId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
- try {
- boolean result = _nuageVspManager.updateNuageUnderlayVlanIpRange(vlanIpRangeId, true);
- if (result) {
- SuccessResponse response = new SuccessResponse(getCommandName());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable underlay, VLAN IP range is already pushed to the Nuage VSP device.");
- }
- } catch (InvalidParameterValueException invalidParamExcp) {
- throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
- } catch (CloudRuntimeException runtimeExcp) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
- }
- }
-
- @Override
- public String getCommandName() {
- return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
- }
-
- @Override
- public long getEntityOwnerId() {
- return CallContext.current().getCallingAccount().getId();
- }
-
- @Override
- public String getEventType() {
- return "VLAN.ENABLE.NUAGE.UNDERLAY";
- }
-
- @Override
- public String getEventDescription() {
- return "Enable VLAN IP range Nuage underlay";
- }
-
-}
\ No newline at end of file
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/ListNuageUnderlayVlanIpRangesCmd.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/ListNuageUnderlayVlanIpRangesCmd.java
deleted file mode 100644
index 38bc788..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/ListNuageUnderlayVlanIpRangesCmd.java
+++ /dev/null
@@ -1,80 +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 com.cloud.api.commands;
-
-import com.cloud.api.response.NuageVlanIpRangeResponse;
-import com.cloud.dc.Vlan;
-import com.cloud.network.manager.NuageVspManager;
-import com.cloud.utils.Pair;
-import org.apache.cloudstack.acl.RoleType;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
-import org.apache.cloudstack.api.response.ListResponse;
-
-import javax.inject.Inject;
-import java.util.List;
-
-@APICommand(name = "listNuageUnderlayVlanIpRanges", description = "enable Nuage underlay on vlan ip range", responseObject = NuageVlanIpRangeResponse.class,
- requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
- since = "4.10",
- authorized = {RoleType.Admin})
-public class ListNuageUnderlayVlanIpRangesCmd extends ListVlanIpRangesCmd {
- public static final String APINAME = "listNuageUnderlayVlanIpRanges";
-
- @Inject
- NuageVspManager _nuageVspManager;
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name = VspConstants.NUAGE_VSP_API_UNDERLAY, type = CommandType.BOOLEAN, description = "true to list only underlay enabled, false if not, empty for all")
- private Boolean underlay;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Boolean getUnderlay() {
- return underlay;
- }
-
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute() {
- Pair<List<? extends Vlan>, Integer> vlans = _mgr.searchForVlans(this);
- ListResponse<NuageVlanIpRangeResponse> response = new ListResponse<NuageVlanIpRangeResponse>();
- List<NuageVlanIpRangeResponse> vlanIpRanges = _nuageVspManager.filterNuageVlanIpRanges(vlans.first(), underlay);
- response.setResponses(vlanIpRanges);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- }
-
- @Override
- public String getCommandName() {
- return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/ListNuageVspDevicesCmd.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/ListNuageVspDevicesCmd.java
deleted file mode 100644
index d9f80e7..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/ListNuageVspDevicesCmd.java
+++ /dev/null
@@ -1,111 +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 com.cloud.api.commands;
-
-import com.cloud.api.response.NuageVspDeviceResponse;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.NuageVspDeviceVO;
-import com.cloud.network.manager.NuageVspManager;
-import com.cloud.utils.exception.CloudRuntimeException;
-import org.apache.cloudstack.acl.RoleType;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.ListResponse;
-import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
-
-import javax.inject.Inject;
-import java.util.ArrayList;
-import java.util.List;
-
-@APICommand(name = ListNuageVspDevicesCmd.APINAME, description = "Lists Nuage VSP devices", responseObject = NuageVspDeviceResponse.class,
- requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
- since = "4.5",
- authorized = {RoleType.Admin})
-public class ListNuageVspDevicesCmd extends BaseListCmd {
- public static final String APINAME = "listNuageVspDevices";
-
- @Inject
- NuageVspManager _nuageVspManager;
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, description = "the Physical Network ID")
- private Long physicalNetworkId;
-
- @Parameter(name = VspConstants.NUAGE_VSP_DEVICE_ID, type = CommandType.UUID, entityType = NuageVspDeviceResponse.class, description = "the Nuage VSP device ID")
- private Long nuageVspDeviceId;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getNuageVspDeviceId() {
- return nuageVspDeviceId;
- }
-
- public Long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
- try {
- List<NuageVspDeviceVO> nuageDevices = _nuageVspManager.listNuageVspDevices(this);
- ListResponse<NuageVspDeviceResponse> response = new ListResponse<NuageVspDeviceResponse>();
- List<NuageVspDeviceResponse> nuageDevicesResponse = new ArrayList<NuageVspDeviceResponse>();
-
- if (nuageDevices != null && !nuageDevices.isEmpty()) {
- for (NuageVspDeviceVO nuageDeviceVO : nuageDevices) {
- NuageVspDeviceResponse nuageDeviceResponse = _nuageVspManager.createNuageVspDeviceResponse(nuageDeviceVO);
- nuageDevicesResponse.add(nuageDeviceResponse);
- }
- }
-
- response.setResponses(nuageDevicesResponse);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } catch (InvalidParameterValueException invalidParamExcp) {
- throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
- } catch (CloudRuntimeException runtimeExcp) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
- }
- }
-
- @Override
- public String getCommandName() {
- return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
- }
-
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/ListNuageVspDomainTemplatesCmd.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/ListNuageVspDomainTemplatesCmd.java
deleted file mode 100644
index 8b00057..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/ListNuageVspDomainTemplatesCmd.java
+++ /dev/null
@@ -1,120 +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 com.cloud.api.commands;
-
-import com.cloud.api.response.NuageVspDomainTemplateResponse;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.manager.NuageVspManager;
-import com.cloud.utils.exception.CloudRuntimeException;
-import org.apache.cloudstack.acl.RoleType;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.BaseResponse;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.DomainResponse;
-import org.apache.cloudstack.api.response.ListResponse;
-import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
-import org.apache.cloudstack.api.response.ZoneResponse;
-
-import javax.inject.Inject;
-import java.util.List;
-
-@APICommand(name = ListNuageVspDomainTemplatesCmd.APINAME, responseObject = BaseResponse.class, description = "Lists Nuage VSP domain templates", since = "4.11.0", responseHasSensitiveInfo = false, authorized = {RoleType.Admin, RoleType.DomainAdmin, RoleType.User})
-public class ListNuageVspDomainTemplatesCmd extends BaseCmd {
- static final String APINAME = "listNuageVspDomainTemplates";
-
- @Inject
- private NuageVspManager _nuageVspManager;
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class,
- description = "the domain ID")
- private Long domainId;
-
- @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class,
- description = "the physical network ID")
- private Long physicalNetworkId;
-
- @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class,
- description = "the zone ID")
- private Long zoneId;
-
- @Parameter(name = ApiConstants.KEYWORD, type = CommandType.STRING,
- description = "filters the domain templates which contain the keyword")
- private String keyword;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public String getKeyword() {
- return keyword;
- }
-
- public Long getDomainId() {
- return domainId;
- }
-
- public Long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- public Long getZoneId() { return zoneId; }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
- try {
- List<NuageVspDomainTemplateResponse> responses = _nuageVspManager.listNuageVspDomainTemplates(this);
- ListResponse<NuageVspDomainTemplateResponse> response = new ListResponse<>();
- response.setResponses(responses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } catch (InvalidParameterValueException invalidParamExcp) {
- throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
- } catch (CloudRuntimeException e) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
- }
- }
-
- @Override
- public String getCommandName() {
- return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
- }
-
- @Override public long getEntityOwnerId() {
- return 0; //not owned by anyone
- }
-
-}
-
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/ListNuageVspGlobalDomainTemplateCmd.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/ListNuageVspGlobalDomainTemplateCmd.java
deleted file mode 100644
index 9024170..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/ListNuageVspGlobalDomainTemplateCmd.java
+++ /dev/null
@@ -1,81 +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 com.cloud.api.commands;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.acl.RoleType;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.BaseResponse;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.ListResponse;
-
-import com.cloud.api.response.NuageVspDomainTemplateResponse;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.NetworkRuleConflictException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.manager.NuageVspManager;
-import com.cloud.user.Account;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-@APICommand(name = ListNuageVspGlobalDomainTemplateCmd.APINAME, responseObject = BaseResponse.class,
- description = "Lists Nuage VSP domain templates", authorized = {RoleType.Admin, RoleType.DomainAdmin, RoleType.User},
- since = "4.11.0")
-public class ListNuageVspGlobalDomainTemplateCmd extends BaseCmd {
- static final String APINAME = "listNuageVspGlobalDomainTemplate";
-
- @Inject
- private NuageVspManager _nuageVspManager;
-
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
- try {
- List<NuageVspDomainTemplateResponse> responses = new LinkedList<>();
- NuageVspDomainTemplateResponse answer = new NuageVspDomainTemplateResponse(_nuageVspManager.NuageVspVpcDomainTemplateName.value(),_nuageVspManager.NuageVspVpcDomainTemplateName.value());
- responses.add(answer);
-
- ListResponse<NuageVspDomainTemplateResponse> response = new ListResponse<>();
- response.setResponses(responses);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } catch (InvalidParameterValueException invalidParamExcp) {
- throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
- } catch (CloudRuntimeException e) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
- }
- }
-
- @Override
- public String getCommandName() {
- return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
- }
-
- @Override public long getEntityOwnerId() {
- return Account.ACCOUNT_ID_SYSTEM;
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/UpdateNuageVspDeviceCmd.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/UpdateNuageVspDeviceCmd.java
deleted file mode 100755
index 4197bd6..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/UpdateNuageVspDeviceCmd.java
+++ /dev/null
@@ -1,182 +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 com.cloud.api.commands;
-
-import com.cloud.api.response.NuageVspDeviceResponse;
-import com.cloud.event.EventTypes;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.NuageVspDeviceVO;
-import com.cloud.network.manager.NuageVspManager;
-import com.cloud.utils.exception.CloudRuntimeException;
-import org.apache.cloudstack.acl.RoleType;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
-import org.apache.cloudstack.context.CallContext;
-
-import javax.inject.Inject;
-
-@APICommand(name = UpdateNuageVspDeviceCmd.APINAME, description = "Update a Nuage VSP device", responseObject = NuageVspDeviceResponse.class,
- requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
- since = "4.6",
- authorized = {RoleType.Admin})
-public class UpdateNuageVspDeviceCmd extends BaseAsyncCmd {
- public static final String APINAME = "updateNuageVspDevice";
-
- @Inject
- NuageVspManager _nuageVspManager;
-
- /////////////////////////////////////////////////////
- //////////////// API parameters /////////////////////
- /////////////////////////////////////////////////////
-
- @Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = BaseCmd.CommandType.UUID, entityType = PhysicalNetworkResponse.class,
- required = true, description = "the ID of the physical network in to which Nuage VSP is added")
- private Long physicalNetworkId;
-
- @Parameter(name = VspConstants.NUAGE_VSP_API_PORT, type = CommandType.INTEGER, description = "the port to communicate to Nuage VSD")
- private Integer port;
-
- @Parameter(name = ApiConstants.HOST_NAME, type = CommandType.STRING, description = "the hostname of the Nuage VSD")
- private String hostName;
-
- @Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, description = "the user name of the CMS user in Nuage VSD")
- private String userName;
-
- @Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, description = "the password of CMS user in Nuage VSD")
- private String password;
-
- @Parameter(name = VspConstants.NUAGE_VSP_API_VERSION, type = CommandType.STRING, description = "the version of the API to use to communicate to Nuage VSD")
- private String apiVersion;
-
- @Parameter(name = VspConstants.NUAGE_VSP_API_RETRY_COUNT, type = CommandType.INTEGER, description = "the number of retries on failure to communicate to Nuage VSD")
- private Integer apiRetryCount;
-
- @Parameter(name = VspConstants.NUAGE_VSP_API_RETRY_INTERVAL, type = CommandType.LONG, description = "the time to wait after failure before retrying to communicate to Nuage VSD")
- private Long apiRetryInterval;
-
- /////////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- public Integer getPort() {
- return port;
- }
-
- public void setPort(Integer port) {
- this.port = port;
- }
-
- public String getHostName() {
- return hostName;
- }
-
- public void setHostName(String hostName) {
- this.hostName = hostName;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public String getPassword() {
- return password;
- }
-
- public String getApiVersion() {
- return apiVersion;
- }
-
- public void setApiVersion(String apiVersion) {
- this.apiVersion = apiVersion;
- }
-
- public Integer getApiRetryCount() {
- return apiRetryCount;
- }
-
- public void setApiRetryCount(Integer apiRetryCount) {
- this.apiRetryCount = apiRetryCount;
- }
-
- public Long getApiRetryInterval() {
- return apiRetryInterval;
- }
-
- public void setApiRetryInterval(Long apiRetryInterval) {
- this.apiRetryInterval = apiRetryInterval;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
-
- @Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
- try {
- NuageVspDeviceVO nuageVspDeviceVO = _nuageVspManager.updateNuageVspDevice(this);
- if (nuageVspDeviceVO != null) {
- NuageVspDeviceResponse response = _nuageVspManager.createNuageVspDeviceResponse(nuageVspDeviceVO);
- response.setObjectName("nuagevspdevice");
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Nuage VSP device due to internal error.");
- }
- } catch (InvalidParameterValueException invalidParamExcp) {
- throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage());
- } catch (CloudRuntimeException runtimeExcp) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage());
- }
- }
-
- @Override
- public String getCommandName() {
- return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
- }
-
- @Override
- public long getEntityOwnerId() {
- return CallContext.current().getCallingAccount().getId();
- }
-
- @Override
- public String getEventType() {
- return EventTypes.EVENT_EXTERNAL_VSP_VSD_UPDATE;
- }
-
- @Override
- public String getEventDescription() {
- return "Updating a Nuage VSD";
- }
-}
\ No newline at end of file
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/VspConstants.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/VspConstants.java
deleted file mode 100644
index 5b226af..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/commands/VspConstants.java
+++ /dev/null
@@ -1,38 +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 com.cloud.api.commands;
-
-public class VspConstants {
- public static final String NUAGE_VSP_DEVICE_ID = "vspdeviceid";
- public static final String NUAGE_VSP_DEVICE_NAME = "nuagedevicename";
- public static final String NUAGE_VSP_API_PORT = "port";
- public static final String NUAGE_VSP_API_VERSION = "apiversion";
- public static final String NUAGE_VSP_API_RETRY_COUNT = "retrycount";
- public static final String NUAGE_VSP_API_RETRY_INTERVAL = "retryinterval";
- public static final String NUAGE_VSP_API_METHOD = "method";
- public static final String NUAGE_VSP_API_RESOURCE = "resource";
- public static final String NUAGE_VSP_API_RESOURCE_ID = "resourceid";
- public static final String NUAGE_VSP_API_CHILD_RESOURCE = "childresource";
- public static final String NUAGE_VSP_API_RESOURCE_FILTER = "resourcefilter";
- public static final String NUAGE_VSP_API_RESOURCE_INFO = "resourceinfo";
- public static final String NUAGE_VSP_CMS_ID = "cmsid";
- public static final String NUAGE_VSP_API_UNDERLAY = "underlay";
- public static final String NUAGE_VSP_API_DOMAIN_TEMPLATE = "domaintemplate";
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/response/NuageVlanIpRangeResponse.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/response/NuageVlanIpRangeResponse.java
deleted file mode 100644
index cc3204d..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/response/NuageVlanIpRangeResponse.java
+++ /dev/null
@@ -1,38 +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 com.cloud.api.response;
-
-import com.cloud.api.commands.VspConstants;
-import com.cloud.dc.Vlan;
-import com.cloud.serializer.Param;
-import com.google.gson.annotations.SerializedName;
-import org.apache.cloudstack.api.EntityReference;
-import org.apache.cloudstack.api.response.VlanIpRangeResponse;
-
-@EntityReference(value = Vlan.class)
-public class NuageVlanIpRangeResponse extends VlanIpRangeResponse {
- @SerializedName(VspConstants.NUAGE_VSP_API_UNDERLAY)
- @Param(description = "true if Nuage underlay enabled, false if not")
- private boolean underlay;
-
- public void setUnderlay(boolean underlay) {
- this.underlay = underlay;
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/response/NuageVspDeviceResponse.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/response/NuageVspDeviceResponse.java
deleted file mode 100644
index 346e288..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/response/NuageVspDeviceResponse.java
+++ /dev/null
@@ -1,111 +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 com.cloud.api.response;
-
-import com.cloud.api.commands.VspConstants;
-import com.cloud.network.NuageVspDeviceVO;
-import com.cloud.serializer.Param;
-import com.google.gson.annotations.SerializedName;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseResponse;
-import org.apache.cloudstack.api.EntityReference;
-
-@EntityReference(value = NuageVspDeviceVO.class)
-public class NuageVspDeviceResponse extends BaseResponse {
- @SerializedName(VspConstants.NUAGE_VSP_DEVICE_ID)
- @Param(description = "the device id of the Nuage VSD")
- private String id;
-
- @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
- @Param(description = "the ID of the physical network to which this Nuage VSP belongs to")
- private String physicalNetworkId;
-
- @SerializedName(ApiConstants.PROVIDER)
- @Param(description = "the service provider name corresponding to this Nuage VSP device")
- private String providerName;
-
- @SerializedName(VspConstants.NUAGE_VSP_DEVICE_NAME)
- @Param(description = "the name of the Nuage VSP device")
- private String deviceName;
-
- @SerializedName(VspConstants.NUAGE_VSP_API_PORT)
- @Param(description = "the port to communicate to Nuage VSD")
- private int port;
-
- @SerializedName(ApiConstants.HOST_NAME)
- @Param(description = "the hostname of the Nuage VSD")
- private String hostName;
-
- @SerializedName(VspConstants.NUAGE_VSP_API_VERSION)
- @Param(description = "the version of the API to use to communicate to Nuage VSD")
- private String apiVersion;
-
- @SerializedName(VspConstants.NUAGE_VSP_API_RETRY_COUNT)
- @Param(description = "the number of retries on failure to communicate to Nuage VSD")
- private int apiRetryCount;
-
- @SerializedName(VspConstants.NUAGE_VSP_API_RETRY_INTERVAL)
- @Param(description = "the time to wait after failure before retrying to communicate to Nuage VSD")
- private long apiRetryInterval;
-
- @SerializedName(VspConstants.NUAGE_VSP_CMS_ID)
- @Param(description = "the CMS ID generated by the Nuage VSD")
- private String cmsId;
-
- public void setId(String vspDetailsId) {
- this.id = vspDetailsId;
- }
-
- public void setPhysicalNetworkId(String physicalNetworkId) {
- this.physicalNetworkId = physicalNetworkId;
- }
-
- public void setProviderName(String providerName) {
- this.providerName = providerName;
- }
-
- public void setDeviceName(String deviceName) {
- this.deviceName = deviceName;
- }
-
- public void setPort(int port) {
- this.port = port;
- }
-
- public void setHostName(String hostName) {
- this.hostName = hostName;
- }
-
- public void setApiVersion(String apiVersion) {
- this.apiVersion = apiVersion;
- }
-
- public void setApiRetryCount(int apiRetryCount) {
- this.apiRetryCount = apiRetryCount;
- }
-
- public void setApiRetryInterval(long apiRetryInterval) {
- this.apiRetryInterval = apiRetryInterval;
- }
-
- public void setCmsId(String cmsId) {
- this.cmsId = cmsId;
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/response/NuageVspDomainTemplateResponse.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/response/NuageVspDomainTemplateResponse.java
deleted file mode 100644
index ce36e8e..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/response/NuageVspDomainTemplateResponse.java
+++ /dev/null
@@ -1,45 +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 com.cloud.api.response;
-
-import com.cloud.serializer.Param;
-import org.apache.cloudstack.api.BaseResponse;
-
-public class NuageVspDomainTemplateResponse extends BaseResponse {
- @Param(description = "the name of the domain template")
- private String name;
-
- @Param(description = "the description of the domain template")
- private String description;
-
- public NuageVspDomainTemplateResponse(String name, String description) {
- this.name = name;
- this.description = description;
- this.setObjectName("domaintemplates");
- }
-
- public String getName() {
- return name;
- }
-
- public String getDescription() {
- return description;
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/response/NuageVspResourceResponse.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/response/NuageVspResourceResponse.java
deleted file mode 100644
index 7002413..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/api/response/NuageVspResourceResponse.java
+++ /dev/null
@@ -1,40 +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 com.cloud.api.response;
-
-import com.cloud.api.commands.VspConstants;
-import com.cloud.serializer.Param;
-import com.google.gson.annotations.SerializedName;
-import org.apache.cloudstack.api.BaseResponse;
-
-public class NuageVspResourceResponse extends BaseResponse {
- @SerializedName(VspConstants.NUAGE_VSP_API_RESOURCE_INFO)
- @Param(description = "the details of the Nuage VSP resource")
- private String resourceInfo;
-
- public String getResourceInfo() {
- return resourceInfo;
- }
-
- public void setResourceInfo(String resourceInfo) {
- this.resourceInfo = resourceInfo;
- }
-
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/NuageVspDeviceVO.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/NuageVspDeviceVO.java
deleted file mode 100644
index ad5a7eb..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/NuageVspDeviceVO.java
+++ /dev/null
@@ -1,97 +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 com.cloud.network;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import java.util.UUID;
-
-@Entity
-@Table(name = "external_nuage_vsp_devices")
-public class NuageVspDeviceVO implements InternalIdentity {
-
- private static final long serialVersionUID = 1L;
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- private long id;
-
- @Column(name = "uuid")
- private String uuid;
-
- @Column(name = "host_id")
- private long hostId;
-
- @Column(name = "physical_network_id")
- private long physicalNetworkId;
-
- @Column(name = "provider_name")
- private String providerName;
-
- @Column(name = "device_name")
- private String deviceName;
-
- public NuageVspDeviceVO() {
- this.uuid = UUID.randomUUID().toString();
- }
-
- public NuageVspDeviceVO(long hostId, long physicalNetworkId,
- String providerName, String deviceName){
- super();
- this.hostId = hostId;
- this.physicalNetworkId = physicalNetworkId;
- this.providerName = providerName;
- this.deviceName = deviceName;
- this.uuid = UUID.randomUUID().toString();
- }
-
- @Override
- public long getId() {
- return id;
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public long getHostId() {
- return hostId;
- }
-
- public long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- public String getProviderName() {
- return providerName;
- }
-
- public String getDeviceName() {
- return deviceName;
- }
-
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/dao/NuageVspDao.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/dao/NuageVspDao.java
deleted file mode 100644
index aa795eb..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/dao/NuageVspDao.java
+++ /dev/null
@@ -1,44 +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 com.cloud.network.dao;
-
-import com.cloud.network.NuageVspDeviceVO;
-import com.cloud.utils.db.GenericDao;
-
-import java.util.List;
-
-public interface NuageVspDao extends GenericDao<NuageVspDeviceVO, Long> {
- /**
- * List all the Nuage Vsp devices added in to this physical network
- *
- * @param physicalNetworkId physical Network Id
- * @return list of NuageVspDeviceVO for this physical network.
- */
- List<NuageVspDeviceVO> listByPhysicalNetwork(long physicalNetworkId);
-
- /**
- * List all the Nuage Vsp devices by a specific host
- *
- * @param hostId host Id
- * @return list of NuageVspDeviceVO for this host.
- */
- List<NuageVspDeviceVO> listByHost(long hostId);
-
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/dao/NuageVspDaoImpl.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/dao/NuageVspDaoImpl.java
deleted file mode 100644
index d308fe1..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/dao/NuageVspDaoImpl.java
+++ /dev/null
@@ -1,60 +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 com.cloud.network.dao;
-
-import com.cloud.network.NuageVspDeviceVO;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-@Component
-public class NuageVspDaoImpl extends GenericDaoBase<NuageVspDeviceVO, Long>
- implements NuageVspDao {
-
- private final SearchBuilder<NuageVspDeviceVO> physicalNetworkIdSearch;
- private final SearchBuilder<NuageVspDeviceVO> hostIdSearch;
-
- public NuageVspDaoImpl() {
- physicalNetworkIdSearch = createSearchBuilder();
- physicalNetworkIdSearch.and("physicalNetworkId", physicalNetworkIdSearch.entity().getPhysicalNetworkId(), SearchCriteria.Op.EQ);
- physicalNetworkIdSearch.done();
-
- hostIdSearch = createSearchBuilder();
- hostIdSearch.and("hostId", hostIdSearch.entity().getHostId(), SearchCriteria.Op.EQ);
- hostIdSearch.done();
- }
-
- @Override
- public List<NuageVspDeviceVO> listByPhysicalNetwork(long physicalNetworkId) {
- SearchCriteria<NuageVspDeviceVO> sc = physicalNetworkIdSearch.create();
- sc.setParameters("physicalNetworkId", physicalNetworkId);
- return search(sc, null);
- }
-
- @Override
- public List<NuageVspDeviceVO> listByHost(long hostId) {
- SearchCriteria<NuageVspDeviceVO> sc = hostIdSearch.create();
- sc.setParameters("hostId", hostId);
- return search(sc, null);
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/element/NuageVspElement.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/element/NuageVspElement.java
deleted file mode 100644
index b92e827..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/element/NuageVspElement.java
+++ /dev/null
@@ -1,788 +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 com.cloud.network.element;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Nullable;
-import javax.inject.Inject;
-import javax.naming.ConfigurationException;
-
-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.VspNetwork;
-import net.nuage.vsp.acs.client.api.model.VspStaticNat;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.log4j.Logger;
-
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Sets;
-
-import org.apache.cloudstack.api.InternalIdentity;
-import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
-import org.apache.cloudstack.network.ExternalNetworkDeviceManager;
-import org.apache.cloudstack.resourcedetail.VpcDetailVO;
-import org.apache.cloudstack.resourcedetail.dao.VpcDetailsDao;
-
-import com.cloud.agent.AgentManager;
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.StartupCommand;
-import com.cloud.agent.api.StartupVspCommand;
-import com.cloud.agent.api.element.ApplyAclRuleVspCommand;
-import com.cloud.agent.api.element.ApplyStaticNatVspCommand;
-import com.cloud.agent.api.element.ExtraDhcpOptionsVspCommand;
-import com.cloud.agent.api.element.ImplementVspCommand;
-import com.cloud.agent.api.element.ShutDownVpcVspCommand;
-import com.cloud.agent.api.element.ShutDownVspCommand;
-import com.cloud.dc.Vlan;
-import com.cloud.dc.VlanVO;
-import com.cloud.dc.dao.VlanDao;
-import com.cloud.dc.dao.VlanDetailsDao;
-import com.cloud.deploy.DeployDestination;
-import com.cloud.domain.Domain;
-import com.cloud.domain.dao.DomainDao;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.exception.UnsupportedServiceException;
-import com.cloud.host.Host;
-import com.cloud.host.HostVO;
-import com.cloud.network.Network;
-import com.cloud.network.Network.Capability;
-import com.cloud.network.Network.Provider;
-import com.cloud.network.Network.Service;
-import com.cloud.network.NetworkMigrationManager;
-import com.cloud.network.NetworkModel;
-import com.cloud.network.Networks;
-import com.cloud.network.PhysicalNetworkServiceProvider;
-import com.cloud.network.PublicIpAddress;
-import com.cloud.network.dao.FirewallRulesCidrsDao;
-import com.cloud.network.dao.FirewallRulesDao;
-import com.cloud.network.dao.IPAddressDao;
-import com.cloud.network.dao.IPAddressVO;
-import com.cloud.network.dao.NetworkDao;
-import com.cloud.network.dao.NetworkServiceMapDao;
-import com.cloud.network.dao.PhysicalNetworkDao;
-import com.cloud.network.dao.PhysicalNetworkVO;
-import com.cloud.network.manager.NuageVspManager;
-import com.cloud.network.manager.NuageVspManagerImpl;
-import com.cloud.network.rules.FirewallRule;
-import com.cloud.network.rules.FirewallRule.FirewallRuleType;
-import com.cloud.network.rules.FirewallRuleVO;
-import com.cloud.network.rules.StaticNat;
-import com.cloud.network.vpc.NetworkACLItem;
-import com.cloud.network.vpc.NetworkACLItemDao;
-import com.cloud.network.vpc.NetworkACLItemVO;
-import com.cloud.network.vpc.PrivateGateway;
-import com.cloud.network.vpc.StaticRouteProfile;
-import com.cloud.network.vpc.Vpc;
-import com.cloud.network.vpc.VpcOfferingServiceMapVO;
-import com.cloud.network.vpc.dao.VpcOfferingServiceMapDao;
-import com.cloud.offering.NetworkOffering;
-import com.cloud.offerings.NetworkOfferingVO;
-import com.cloud.offerings.dao.NetworkOfferingDao;
-import com.cloud.resource.ResourceManager;
-import com.cloud.resource.ResourceStateAdapter;
-import com.cloud.resource.ServerResource;
-import com.cloud.resource.UnableDeleteHostException;
-import com.cloud.server.ResourceTag;
-import com.cloud.tags.dao.ResourceTagDao;
-import com.cloud.util.NuageVspEntityBuilder;
-import com.cloud.util.NuageVspUtil;
-import com.cloud.utils.Pair;
-import com.cloud.utils.component.AdapterBase;
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.net.NetUtils;
-import com.cloud.vm.DomainRouterVO;
-import com.cloud.vm.NicProfile;
-import com.cloud.vm.NicVO;
-import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VirtualMachineProfile;
-import com.cloud.vm.dao.DomainRouterDao;
-import com.cloud.vm.dao.NicDao;
-
-public class NuageVspElement extends AdapterBase implements ConnectivityProvider, IpDeployer, SourceNatServiceProvider, StaticNatServiceProvider, FirewallServiceProvider,
- DhcpServiceProvider, ResourceStateAdapter, VpcProvider, NetworkACLServiceProvider {
-
- private static final Logger s_logger = Logger.getLogger(NuageVspElement.class);
-
- private static final Map<Service, Map<Capability, String>> capabilities = setCapabilities();
-
- private static final Set<Service> REQUIRED_SERVICES = ImmutableSet.of(
- Service.Connectivity,
- Service.Dhcp
- );
- private static final Set<Service> NUAGE_ONLY_SERVICES = ImmutableSet.of(
- Service.SourceNat,
- Service.StaticNat,
- Service.Gateway
- );
- private static final Set<Service> UNSUPPORTED_SERVICES = ImmutableSet.of(
- Service.Vpn,
- Service.Dns,
- Service.PortForwarding,
- Service.SecurityGroup
- );
- private static final Set<Pair<Service, Service>> ANY_REQUIRED_SERVICES = ImmutableSet.of(
- new Pair<>(Service.SourceNat, Service.StaticNat)
- );
-
-
- public static final ExternalNetworkDeviceManager.NetworkDevice NuageVspDevice = new ExternalNetworkDeviceManager.NetworkDevice("NuageVsp", Provider.NuageVsp.getName());
-
- @Inject
- ResourceManager _resourceMgr;
- @Inject
- NetworkModel _networkModel;
- @Inject
- NetworkServiceMapDao _ntwkSrvcDao;
- @Inject
- NetworkDao _networkDao;
- @Inject
- DomainDao _domainDao;
- @Inject
- IPAddressDao _ipAddressDao;
- @Inject
- VlanDao _vlanDao;
- @Inject
- VlanDetailsDao _vlanDetailsDao;
- @Inject
- NicDao _nicDao;
- @Inject
- VpcOfferingServiceMapDao _vpcOfferingSrvcDao;
- @Inject
- AgentManager _agentMgr;
- @Inject
- NetworkOfferingDao _ntwkOfferingDao;
- @Inject
- ConfigurationDao _configDao;
- @Inject
- NuageVspManager _nuageVspManager;
- @Inject
- FirewallRulesDao _firewallRulesDao;
- @Inject
- FirewallRulesCidrsDao _firewallRulesCidrsDao;
- @Inject
- PhysicalNetworkDao _physicalNetworkDao;
- @Inject
- NetworkACLItemDao _networkACLItemDao;
- @Inject
- NuageVspEntityBuilder _nuageVspEntityBuilder;
- @Inject
- VpcDetailsDao _vpcDetailsDao;
- @Inject
- DomainRouterDao _routerDao;
- @Inject
- ResourceTagDao _resourceTagDao;
-
- @Override
- public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> service) throws ResourceUnavailableException {
- return false;
- }
-
- @Override
- public Map<Service, Map<Capability, String>> getCapabilities() {
- return capabilities;
- }
-
- private static Map<Service, Map<Capability, String>> setCapabilities() {
- return ImmutableMap.<Service, Map<Capability, String>>builder()
- .put(Service.Connectivity, ImmutableMap.of(
- Capability.NoVlan, "",
- Capability.PublicAccess, ""
- ))
- .put(Service.Gateway, ImmutableMap.<Capability, String>of())
- .put(Service.SourceNat, ImmutableMap.of(
- Capability.SupportedSourceNatTypes, "perzone",
- Capability.RedundantRouter, "false"
- ))
- .put(Service.StaticNat, ImmutableMap.<Capability, String>of())
- .put(Service.SecurityGroup, ImmutableMap.<Capability, String>of())
- .put(Service.Firewall, ImmutableMap.of(
- Capability.TrafficStatistics, "per public ip",
- Capability.SupportedProtocols, "tcp,udp,icmp",
- Capability.SupportedEgressProtocols, "tcp,udp,icmp, all",
- Capability.SupportedTrafficDirection, "ingress, egress",
- Capability.MultipleIps, "true"
- ))
- .put(Service.Dhcp, ImmutableMap.of(
- Capability.DhcpAccrossMultipleSubnets, "true",
- Capability.ExtraDhcpOptions, "true"
- ))
- .put(Service.NetworkACL, ImmutableMap.of(
- Capability.SupportedProtocols, "tcp,udp,icmp"
- ))
- .build();
- }
-
- @Override
- public Provider getProvider() {
- return Provider.NuageVsp;
- }
-
- @Override
- public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
- super.configure(name, params);
- _resourceMgr.registerResourceStateAdapter(name, this);
- return true;
- }
-
- @Override
- public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
- ResourceUnavailableException, InsufficientCapacityException {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Entering NuageElement implement function for network " + network.getDisplayText() + " (state " + network.getState() + ")");
- }
-
- if (network.getVpcId() != null) {
- return applyACLRulesForVpc(network, offering);
- }
-
- if (!canHandle(network, offering, Service.Connectivity)) {
- return false;
- }
-
- if (network.getBroadcastUri() == null) {
- s_logger.error("Nic has no broadcast Uri with the virtual router IP");
- return false;
- }
-
- _nuageVspManager.updateBroadcastUri(network);
- network = _networkDao.findById(network.getId());
- VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(network);
- List<VspAclRule> ingressFirewallRules = getFirewallRulesToApply(network, FirewallRule.TrafficType.Ingress);
- List<VspAclRule> egressFirewallRules = getFirewallRulesToApply(network, FirewallRule.TrafficType.Egress);
-
- List<IPAddressVO> ips = _ipAddressDao.listStaticNatPublicIps(network.getId());
- List<String> floatingIpUuids = new ArrayList<String>();
- for (IPAddressVO ip : ips) {
- floatingIpUuids.add(ip.getUuid());
- }
- VspDhcpDomainOption vspDhcpOptions = _nuageVspEntityBuilder.buildNetworkDhcpOption(network, offering);
- HostVO nuageVspHost = _nuageVspManager.getNuageVspHost(network.getPhysicalNetworkId());
- ImplementVspCommand cmd = new ImplementVspCommand(vspNetwork, ingressFirewallRules, egressFirewallRules, floatingIpUuids, vspDhcpOptions);
- send(cmd, network);
-
- return true;
- }
-
- private void send(Command cmd, Network network)
- throws ResourceUnavailableException {
- send(cmd, network.getPhysicalNetworkId(), Network.class, network);
- }
-
- private void send(Command cmd, Vpc vpc)
- throws ResourceUnavailableException {
- send(cmd, getPhysicalNetworkId(vpc.getZoneId()), Vpc.class, vpc);
- }
-
-
- private <R extends InternalIdentity> void send(Command cmd, long physicalNetworkId, Class<R> resourceClass,
- R resource)
- throws ResourceUnavailableException {
- HostVO nuageVspHost = _nuageVspManager.getNuageVspHost(physicalNetworkId);
- Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd);
- if (isFailure(answer)) {
- s_logger.error(cmd.getClass().getName() + " for " + resourceClass.getName() + " " + resource.getId() + " failed on Nuage VSD " + nuageVspHost.getDetail("hostname"));
- if (hasFailureDetails(answer)) {
- throw new ResourceUnavailableException(answer.getDetails(), resourceClass, resource.getId());
- }
- }
- }
-
- private boolean hasFailureDetails(Answer answer) {
- return (null != answer) && (null != answer.getDetails());
- }
-
- private boolean isFailure(Answer answer) {
- return answer == null || !answer.getResult();
- }
-
- private boolean applyACLRulesForVpc(Network network, NetworkOffering offering) throws ResourceUnavailableException {
- List<NetworkACLItemVO> rules = _networkACLItemDao.listByACL(network.getNetworkACLId());
- if (_networkModel.areServicesSupportedByNetworkOffering(offering.getId(), Network.Service.NetworkACL)) {
- applyACLRules(network, rules, true, false);
- }
- return true;
- }
-
- private List<VspAclRule> getFirewallRulesToApply(final Network network, FirewallRule.TrafficType trafficType) {
- List<FirewallRuleVO> firewallRulesToApply = _firewallRulesDao.listByNetworkPurposeTrafficType(network.getId(), FirewallRule.Purpose.Firewall, trafficType);
- List<VspAclRule> vspAclRulesToApply = Lists.newArrayListWithExpectedSize(firewallRulesToApply.size());
-
- for (FirewallRuleVO rule : firewallRulesToApply) {
- rule.setSourceCidrList(_firewallRulesCidrsDao.getSourceCidrs(rule.getId()));
- VspAclRule vspAclRule = _nuageVspEntityBuilder.buildVspAclRule(rule, network);
- vspAclRulesToApply.add(vspAclRule);
- }
- return vspAclRulesToApply;
- }
-
- @Override
- public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
- ResourceUnavailableException, InsufficientCapacityException {
- if (!canHandle(network, Service.Connectivity)) {
- return false;
- }
-
- if (network.getBroadcastUri() == null) {
- s_logger.error("Nic has no broadcast Uri with the virtual router IP");
- return false;
- }
-
- return true;
- }
-
- @Override
- public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
- if (!canHandle(network, Service.Connectivity)) {
- return false;
- }
-
- if (network.getBroadcastUri() == null) {
- s_logger.error("Nic has no broadcast Uri with the virtual router IP");
- return false;
- }
-
- return true;
- }
-
- @Override
- public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
- if (!canHandle(network, Service.Connectivity)) {
- return false;
- }
- if (cleanup && isDnsSupportedByVR(network)) {
- // The network is restarted, possibly the domain name is changed, update the dhcpOptions as soon as possible
- NetworkOfferingVO networkOfferingVO = _ntwkOfferingDao.findById(network.getNetworkOfferingId());
- VspDhcpDomainOption vspDhcpOptions = _nuageVspEntityBuilder.buildNetworkDhcpOption(network, networkOfferingVO);
- VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(network);
-
- ShutDownVspCommand cmd = new ShutDownVspCommand(vspNetwork, vspDhcpOptions);
- send(cmd, network);
- }
- return true;
- }
-
- @Override
- public boolean isReady(PhysicalNetworkServiceProvider provider) {
- return true;
- }
-
- @Override
- public boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
- return true;
- }
-
- @Override
- public boolean canEnableIndividualServices() {
- return true;
- }
-
- @Override
- public boolean destroy(Network network, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
- return canHandle(network, Service.Connectivity);
- }
-
- @Override
- public boolean verifyServicesCombination(Set<Service> services) {
- Preconditions.checkNotNull(services);
- final Sets.SetView<Service> missingServices = Sets.difference(REQUIRED_SERVICES, services);
- final Sets.SetView<Service> unsupportedServices = Sets.intersection(UNSUPPORTED_SERVICES, services);
- final Sets.SetView<Service> wantedServices = Sets.intersection(NUAGE_ONLY_SERVICES, new HashSet<>());
-
- if (!missingServices.isEmpty()) {
- throw new UnsupportedServiceException("Provider " + Provider.NuageVsp + " requires services: " + missingServices);
- }
-
- if (!unsupportedServices.isEmpty()) {
- // NuageVsp doesn't implement any of these services.
- // So if these services are requested, we can't handle it.
- s_logger.debug("Unable to support services combination. The services " + unsupportedServices + " are not supported by Nuage VSP.");
- return false;
- }
-
- if (!wantedServices.isEmpty()) {
- throw new UnsupportedServiceException("Provider " + Provider.NuageVsp + " does not support services to be implemented by another provider: " + wantedServices);
- }
-
- return true;
- }
-
- protected boolean canHandle(Network network, Service service) {
- NetworkOffering networkOffering = _ntwkOfferingDao.findById(network.getNetworkOfferingId());
- return canHandle(network, networkOffering, service);
- }
-
- protected boolean canHandle(Network network, NetworkOffering networkOffering, Service service) {
- if (network.getBroadcastDomainType() != Networks.BroadcastDomainType.Vsp) {
- return false;
- }
-
- if (!_networkModel.isProviderForNetwork(getProvider(), network.getId())) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("NuageVsp is not a provider for network " + network.getDisplayText());
- }
- return false;
- }
-
- if (service != null) {
- if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), service, getProvider())) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("NuageVsp can't provide the " + service.getName() + " service on network " + network.getDisplayText());
- }
- return false;
- }
- }
-
- if (service != Service.Connectivity
- && !_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), Service.Connectivity, getProvider())) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("NuageVsp can't handle networks which use a network offering without NuageVsp as Connectivity provider");
- }
- return false;
- }
-
- if (service != Service.SourceNat
- && networkOffering.getGuestType() == Network.GuestType.Isolated
- && !_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), Service.SourceNat, getProvider())) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("NuageVsp can't handle networks which use a network offering without NuageVsp as SourceNat provider");
- }
- return false;
- }
-
- if (networkOffering.isSpecifyVlan()) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("NuageVsp doesn't support VLAN values for networks");
- }
- return false;
- }
-
- if (network.getVpcId() != null && !networkOffering.isPersistent()) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("NuageVsp can't handle VPC tiers which use a network offering which are not persistent");
- }
- return false;
- }
-
- return true;
- }
-
- @Override
- public boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
- InsufficientCapacityException, ResourceUnavailableException {
- return true;
- }
-
- @Override
- public boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
- throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
- return true;
- }
-
- private boolean isDnsSupportedByVR(Network network) {
- return (_networkModel.areServicesSupportedInNetwork(network.getId(), Service.Dns) &&
- ( _networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.Dns, Provider.VirtualRouter) ||
- _networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.Dns, Provider.VPCVirtualRouter)));
- }
-
- @Override
- public boolean removeDhcpSupportForSubnet(Network network) throws ResourceUnavailableException {
- return true;
- }
-
- @Override
- public boolean setExtraDhcpOptions(Network network, long nicId, Map<Integer, String> dhcpOptions) {
- if (network.isRollingRestart()) {
- return true;
- }
-
- VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(network);
- HostVO nuageVspHost = _nuageVspManager.getNuageVspHost(network.getPhysicalNetworkId());
- NicVO nic = _nicDao.findById(nicId);
-
- ExtraDhcpOptionsVspCommand extraDhcpOptionsVspCommand = new ExtraDhcpOptionsVspCommand(vspNetwork, nic.getUuid(), dhcpOptions);
- Answer answer = _agentMgr.easySend(nuageVspHost.getId(), extraDhcpOptionsVspCommand);
- if (isFailure(answer)) {
- s_logger.error("[setExtraDhcpOptions] setting extra DHCP options for nic " + nic.getUuid() + " failed.");
- return false;
- }
-
- return true;
- }
-
- @Override
- public boolean applyStaticNats(Network config, List<? extends StaticNat> rules) throws ResourceUnavailableException {
- List<VspStaticNat> vspStaticNatDetails = new ArrayList<VspStaticNat>();
- for (StaticNat staticNat : rules) {
- IPAddressVO sourceNatIp = _ipAddressDao.findById(staticNat.getSourceIpAddressId());
- VlanVO sourceNatVlan = _vlanDao.findById(sourceNatIp.getVlanId());
- checkVlanUnderlayCompatibility(sourceNatVlan);
-
- if (!staticNat.isForRevoke()) {
- final List<FirewallRuleVO> firewallRules = _firewallRulesDao.listByIpAndNotRevoked(staticNat.getSourceIpAddressId());
- for (FirewallRuleVO firewallRule : firewallRules) {
- _nuageVspEntityBuilder.buildVspAclRule(firewallRule, config, sourceNatIp);
- }
- }
-
- NicVO nicVO = _nicDao.findByIp4AddressAndNetworkId(staticNat.getDestIpAddress(), staticNat.getNetworkId());
- VspStaticNat vspStaticNat = _nuageVspEntityBuilder.buildVspStaticNat(staticNat.isForRevoke(), sourceNatIp, sourceNatVlan, nicVO);
- vspStaticNatDetails.add(vspStaticNat);
-
-
- }
-
- VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(config);
- ApplyStaticNatVspCommand cmd = new ApplyStaticNatVspCommand(vspNetwork, vspStaticNatDetails);
- send(cmd,
- config);
-
- return true;
- }
-
- private void checkVlanUnderlayCompatibility(VlanVO newVlan) throws ResourceUnavailableException {
- List<VlanVO> vlans = _vlanDao.listByZone(newVlan.getDataCenterId());
- if (CollectionUtils.isNotEmpty(vlans)) {
- boolean newVlanUnderlay = NuageVspUtil.isUnderlayEnabledForVlan(_vlanDetailsDao, newVlan);
- final String newCidr = NetUtils.getCidrFromGatewayAndNetmask(newVlan.getVlanGateway(), newVlan.getVlanNetmask());
-
- for (VlanVO vlan : vlans) {
- if (vlan.getId() == newVlan.getId()) continue;
-
- final String existingCidr = NetUtils.getCidrFromGatewayAndNetmask(vlan.getVlanGateway(), vlan.getVlanNetmask());
-
- NetUtils.SupersetOrSubset supersetOrSubset = NetUtils.isNetowrkASubsetOrSupersetOfNetworkB(newCidr, existingCidr);
- if (supersetOrSubset == NetUtils.SupersetOrSubset.sameSubnet) {
- boolean vlanUnderlay = NuageVspUtil.isUnderlayEnabledForVlan(_vlanDetailsDao, vlan);
- if (newVlanUnderlay != vlanUnderlay) {
- throw new ResourceUnavailableException("Mixed values for the underlay flag for IP ranges in the same subnet is not supported", Vlan.class, newVlan.getId());
- }
- break;
- }
- }
- }
- }
-
- @Override
- public IpDeployer getIpDeployer(Network network) {
- return this;
- }
-
- @Override
- public boolean applyFWRules(Network network, List<? extends FirewallRule> rules) throws ResourceUnavailableException {
- if (rules == null || rules.isEmpty()) {
- return true;
- }
-
- if (rules.size() == 1 && rules.iterator().next().getType().equals(FirewallRuleType.System)) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Default ACL added by CS as system is ignored for network " + network.getName() + " with rule " + rules);
- }
- return true;
- }
-
- s_logger.info("Applying " + rules.size() + " Firewall Rules for network " + network.getName());
- return applyACLRules(network, rules, false, false);
- }
-
- protected boolean applyACLRules(final Network network, List<? extends InternalIdentity> rules, boolean isNetworkAcl, boolean networkReset)
- throws ResourceUnavailableException {
- VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(network);
- List<VspAclRule> vspAclRules = Lists.transform(rules, new Function<InternalIdentity, VspAclRule>() {
- @Nullable
- @Override
- public VspAclRule apply(@Nullable InternalIdentity input) {
- if (input instanceof FirewallRule) {
- return _nuageVspEntityBuilder.buildVspAclRule((FirewallRule) input, network);
- }
- return _nuageVspEntityBuilder.buildVspAclRule((NetworkACLItem) input);
- }
- });
-
- VspAclRule.ACLType vspAclType = isNetworkAcl ? VspAclRule.ACLType.NetworkACL : VspAclRule.ACLType.Firewall;
- ApplyAclRuleVspCommand cmd = new ApplyAclRuleVspCommand(vspAclType, vspNetwork, vspAclRules, networkReset);
- send(cmd,
- network);
- return true;
- }
-
- @Override
- public boolean applyNetworkACLs(Network config, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException {
- if (rules == null || rules.isEmpty()) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("No rules to apply. So, delete all the existing ACL in VSP from Subnet with uuid " + config.getUuid());
- }
- } else {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("New rules has to applied. So, delete all the existing ACL in VSP from Subnet with uuid " + config.getUuid());
- }
- }
- if (rules != null) {
- s_logger.info("Applying " + rules.size() + " Network ACLs for network " + config.getName());
- applyACLRules(config, rules, true, rules.isEmpty());
- }
- return true;
- }
-
- @Override
- public boolean implementVpc(Vpc vpc, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
- List<VpcOfferingServiceMapVO> vpcOfferingServices = _vpcOfferingSrvcDao.listByVpcOffId(vpc.getVpcOfferingId());
- Multimap<Service, Provider> supportedVpcServices = NuageVspManagerImpl.SUPPORTED_NUAGE_VSP_VPC_SERVICE_MAP;
- for (VpcOfferingServiceMapVO vpcOfferingService : vpcOfferingServices) {
- Network.Service service = Network.Service.getService(vpcOfferingService.getService());
- if (!supportedVpcServices.containsKey(service)) {
- s_logger.warn(String.format("NuageVsp doesn't support service %s for VPCs", service.getName()));
- return false;
- }
-
- Network.Provider provider = Network.Provider.getProvider(vpcOfferingService.getProvider());
- if (!supportedVpcServices.containsEntry(service, provider)) {
- s_logger.warn(String.format("NuageVsp doesn't support provider %s for service %s for VPCs", provider.getName(), service.getName()));
- return false;
- }
- }
-
- String globalDomainTemplate = _nuageVspManager.NuageVspVpcDomainTemplateName.value();
- if (StringUtils.isNotBlank(globalDomainTemplate) && !_nuageVspManager.checkIfDomainTemplateExist(vpc.getDomainId(),globalDomainTemplate,vpc.getZoneId(),null)) {
- s_logger.warn("The global pre configured domain template does not exist on the VSD.");
- throw new CloudRuntimeException("The global pre configured domain template does not exist on the VSD.");
- }
-
- return true;
- }
-
- @Override
- public boolean shutdownVpc(Vpc vpc, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
- if (vpc.getState().equals(Vpc.State.Inactive)) {
- List<DomainRouterVO> routers = _routerDao.listByVpcId(vpc.getId());
- if (CollectionUtils.isEmpty(routers)) {
- routers = _routerDao.listIncludingRemovedByVpcId(vpc.getId());
- }
-
- List<String> domainRouterUuids = Lists.transform(routers, new Function<DomainRouterVO, String>() {
- @Nullable
- @Override
- public String apply(@Nullable DomainRouterVO input) {
- return input != null ? input.getUuid() : null;
- }
- });
-
- Domain vpcDomain = _domainDao.findById(vpc.getDomainId());
-
- String preConfiguredDomainTemplateName;
- VpcDetailVO domainTemplateNameDetail = _vpcDetailsDao.findDetail(vpc.getId(), NuageVspManager.nuageDomainTemplateDetailName);
- if (domainTemplateNameDetail != null) {
- preConfiguredDomainTemplateName = domainTemplateNameDetail.getValue();
- } else {
- preConfiguredDomainTemplateName = _configDao.getValue(NuageVspManager.NuageVspVpcDomainTemplateName.key());
- }
-
- Map<String, String> vpcDetails = _vpcDetailsDao.listDetailsKeyPairs(vpc.getId(), false);
-
- cleanUpVpcCaching(vpc.getId());
- //related to migration caching
- List<? extends ResourceTag> vpcResourceDetails = _resourceTagDao.listByResourceUuid(vpc.getUuid());
- if (vpcResourceDetails != null) {
- vpcResourceDetails.stream()
- .filter(item -> item.getKey().equals(NetworkMigrationManager.MIGRATION))
- .findFirst()
- .map(ResourceTag::getResourceId)
- .ifPresent(this::cleanUpVpcCaching);
- }
-
- ShutDownVpcVspCommand cmd = new ShutDownVpcVspCommand(vpcDomain.getUuid(), vpc.getUuid(), preConfiguredDomainTemplateName, domainRouterUuids, vpcDetails);
- send(cmd, vpc);
- }
- return true;
- }
-
- private void cleanUpVpcCaching(long vpcId) {
- _vpcDetailsDao.removeDetail(vpcId, NuageVspManager.NETWORK_METADATA_VSD_DOMAIN_ID);
- _vpcDetailsDao.removeDetail(vpcId, NuageVspManager.NETWORK_METADATA_VSD_ZONE_ID);
- }
-
- private Long getPhysicalNetworkId(Long zoneId) {
- Long guestPhysicalNetworkId = 0L;
- List<PhysicalNetworkVO> physicalNetworkList = _physicalNetworkDao.listByZone(zoneId);
- for (PhysicalNetworkVO phyNtwk : physicalNetworkList) {
- if (phyNtwk.getIsolationMethods().contains("VSP")) {
- guestPhysicalNetworkId = phyNtwk.getId();
- break;
- }
- }
- return guestPhysicalNetworkId;
- }
-
- @Override
- public boolean createPrivateGateway(PrivateGateway gateway) throws ConcurrentOperationException, ResourceUnavailableException {
- return false;
- }
-
- @Override
- public boolean deletePrivateGateway(PrivateGateway privateGateway) throws ConcurrentOperationException, ResourceUnavailableException {
- return false;
- }
-
- @Override
- public boolean applyStaticRoutes(Vpc vpc, List<StaticRouteProfile> routes) throws ResourceUnavailableException {
- return true;
- }
-
- @Override
- public boolean applyACLItemsToPrivateGw(PrivateGateway gateway, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException {
- return false;
- }
-
- @Override
- public HostVO createHostVOForConnectedAgent(HostVO host, StartupCommand[] cmd) {
- return null;
- }
-
- @Override
- public HostVO createHostVOForDirectConnectAgent(HostVO host, StartupCommand[] startup, ServerResource resource, Map<String, String> details, List<String> hostTags) {
- if (!(startup[0] instanceof StartupVspCommand)) {
- return null;
- }
- host.setType(Host.Type.L2Networking);
- return host;
- }
-
- @Override
- public DeleteHostAnswer deleteHost(HostVO host, boolean isForced, boolean isForceDeleteStorage) throws UnableDeleteHostException {
- if (!(host.getType() == Host.Type.L2Networking)) {
- return null;
- }
- return new DeleteHostAnswer(true);
- }
-}
\ No newline at end of file
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/guru/NuageVspGuestNetworkGuru.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
deleted file mode 100644
index 00b1283..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
+++ /dev/null
@@ -1,874 +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 com.cloud.network.guru;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Inject;
-
-import net.nuage.vsp.acs.client.api.model.NetworkRelatedVsdIds;
-import net.nuage.vsp.acs.client.api.model.VspDhcpDomainOption;
-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.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 org.apache.log4j.Logger;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.LinkedListMultimap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
-import org.apache.cloudstack.resourcedetail.VpcDetailVO;
-import org.apache.cloudstack.resourcedetail.dao.VpcDetailsDao;
-
-import com.cloud.agent.AgentManager;
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.guru.DeallocateVmVspCommand;
-import com.cloud.agent.api.guru.ImplementNetworkVspCommand;
-import com.cloud.agent.api.guru.ReserveVmInterfaceVspCommand;
-import com.cloud.agent.api.guru.TrashNetworkVspCommand;
-import com.cloud.agent.api.guru.UpdateDhcpOptionVspCommand;
-import com.cloud.agent.api.manager.ImplementNetworkVspAnswer;
-import com.cloud.configuration.ConfigurationManager;
-import com.cloud.dc.DataCenter;
-import com.cloud.dc.DataCenter.NetworkType;
-import com.cloud.dc.DataCenterDetailVO;
-import com.cloud.dc.VlanVO;
-import com.cloud.dc.dao.DataCenterDetailsDao;
-import com.cloud.dc.dao.VlanDetailsDao;
-import com.cloud.deploy.DeployDestination;
-import com.cloud.deploy.DeploymentPlan;
-import com.cloud.domain.dao.DomainDao;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientAddressCapacityException;
-import com.cloud.exception.InsufficientVirtualNetworkCapacityException;
-import com.cloud.exception.UnsupportedServiceException;
-import com.cloud.host.HostVO;
-import com.cloud.network.Network;
-import com.cloud.network.Network.GuestType;
-import com.cloud.network.Network.State;
-import com.cloud.network.NetworkProfile;
-import com.cloud.network.Networks;
-import com.cloud.network.PhysicalNetwork;
-import com.cloud.network.PhysicalNetwork.IsolationMethod;
-import com.cloud.network.dao.IPAddressVO;
-import com.cloud.network.dao.NetworkDetailsDao;
-import com.cloud.network.dao.NetworkVO;
-import com.cloud.network.dao.PhysicalNetworkVO;
-import com.cloud.network.manager.NuageVspManager;
-import com.cloud.network.router.VirtualRouter;
-import com.cloud.offering.NetworkOffering;
-import com.cloud.offerings.dao.NetworkOfferingDao;
-import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
-import com.cloud.user.Account;
-import com.cloud.user.AccountVO;
-import com.cloud.user.dao.AccountDao;
-import com.cloud.util.NuageVspEntityBuilder;
-import com.cloud.util.NuageVspUtil;
-import com.cloud.utils.StringUtils;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.net.Ip;
-import com.cloud.vm.DomainRouterVO;
-import com.cloud.vm.Nic;
-import com.cloud.vm.NicProfile;
-import com.cloud.vm.NicVO;
-import com.cloud.vm.ReservationContext;
-import com.cloud.vm.VMInstanceVO;
-import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.VirtualMachineProfile;
-import com.cloud.vm.dao.DomainRouterDao;
-import com.cloud.vm.dao.VMInstanceDao;
-
-public class NuageVspGuestNetworkGuru extends GuestNetworkGuru implements NetworkGuruAdditionalFunctions {
- public static final Logger s_logger = Logger.getLogger(NuageVspGuestNetworkGuru.class);
-
- @Inject
- NetworkOfferingServiceMapDao _ntwkOfferingSrvcDao;
- @Inject
- NetworkOfferingDao _ntwkOfferingDao;
- @Inject
- DomainDao _domainDao;
- @Inject
- AccountDao _accountDao;
- @Inject
- VMInstanceDao _vmInstanceDao;
- @Inject
- AgentManager _agentMgr;
- @Inject
- NuageVspManager _nuageVspManager;
- @Inject
- ConfigurationManager _configMgr;
- @Inject
- NuageVspEntityBuilder _nuageVspEntityBuilder;
- @Inject
- NetworkDetailsDao _networkDetailsDao;
- @Inject
- VpcDetailsDao _vpcDetailsDao;
- @Inject
- NetworkOrchestrationService _networkOrchestrationService;
- @Inject
- DataCenterDetailsDao _dcDetailsDao;
- @Inject
- VlanDetailsDao _vlanDetailsDao;
- @Inject
- private DomainRouterDao _routerDao;
-
- public NuageVspGuestNetworkGuru() {
- super();
- _isolationMethods = new IsolationMethod[] {new IsolationMethod("VSP")};
- }
-
- @Override
- public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
- PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId());
- DataCenter dc = _dcDao.findById(plan.getDataCenterId());
- if (!canHandle(offering, dc.getNetworkType(), physnet)) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Refusing to design network using network offering " + offering.getId() + (physnet != null ? " on physical network " + physnet.getId() : ""));
- }
- return null;
- }
-
- NetworkVO networkObject = (NetworkVO)super.design(offering, plan, userSpecified, owner);
- if (networkObject == null) {
- return null;
- }
-
- networkObject.setBroadcastDomainType(Networks.BroadcastDomainType.Vsp);
-
- if (userSpecified instanceof NetworkVO && userSpecified.getExternalId() != null) {
- if (owner.getType() < Account.ACCOUNT_TYPE_ADMIN) {
- throw new IllegalArgumentException("vsdManaged networks are only useable by admins.");
- }
-
- if (!isUniqueReference(plan.getDataCenterId(), userSpecified.getExternalId())) {
- s_logger.debug("Refusing to design network. VsdManaged network object already present in zone.");
- return null;
- }
- }
-
- return networkObject;
- }
-
- private boolean isUniqueReference(long dataCenterId, String vsdSubnetId) {
- DataCenterDetailVO detail = _dcDetailsDao.findDetail(dataCenterId, vsdSubnetId);
- return detail == null;
- }
-
- private boolean isVsdManagedVpc(long vpcId) {
- //Check if it's a vpc and if the vpc is already vsdManaged OR if it has 0 tiers
- Map<String, String> vpcDetails = _vpcDetailsDao.listDetailsKeyPairs(vpcId, false);
- return vpcDetails.get(NuageVspManager.NETWORK_METADATA_VSD_MANAGED) != null && vpcDetails.get(NuageVspManager.NETWORK_METADATA_VSD_MANAGED).equals("true");
- }
-
- /** In case an externalId is specified, we get called here, and store the id the same way as cached data */
- @Override
- public void finalizeNetworkDesign(long networkId, String vlanIdAsUUID) {
- NetworkVO designedNetwork = _networkDao.findById(networkId);
- String externalId = designedNetwork.getExternalId();
- boolean isVpc = designedNetwork.getVpcId() != null;
-
- if (isVpc && _networkDao.listByVpc(designedNetwork.getVpcId()).size() > 1) {
- boolean isVsdManagedVpc = isVsdManagedVpc(designedNetwork.getVpcId());
- if (isVsdManagedVpc && externalId == null) {
- throw new CloudRuntimeException("Refusing to design network. Network is vsdManaged but is part of a non vsd managed vpc.");
- } else if (!isVsdManagedVpc && externalId != null) {
- throw new CloudRuntimeException("Refusing to design network. Network is not vsdManaged but is part of a vsd managed vpc.");
- }
- }
-
- if (externalId == null) {
- return;
- }
-
- VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(designedNetwork, externalId);
- HostVO nuageVspHost = _nuageVspManager.getNuageVspHost(designedNetwork.getPhysicalNetworkId());
-
- ImplementNetworkVspCommand cmd = new ImplementNetworkVspCommand(vspNetwork, null, true);
- Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd);
- if (answer == null || !answer.getResult()) {
- s_logger.error("ImplementNetworkVspCommand for network " + vspNetwork.getUuid() + " failed on Nuage VSD " + nuageVspHost.getDetail("hostname"));
- if ((null != answer) && (null != answer.getDetails())) {
- s_logger.error(answer.getDetails());
- }
- throw new CloudRuntimeException("ImplementNetworkVspCommand for network " + vspNetwork.getUuid() + " failed on Nuage VSD " + nuageVspHost.getDetail("hostname"));
- }
-
- //check if the network does not violate the uuid cidr
- ImplementNetworkVspAnswer implementAnswer = (ImplementNetworkVspAnswer) answer;
- VspNetwork updatedVspNetwork = implementAnswer.getVspNetwork();
- NetworkVO forUpdate = _networkDao.createForUpdate(networkId);
-
- if (isVpc && (!designedNetwork.getCidr().equals(updatedVspNetwork.getCidr()) || !designedNetwork.getGateway().equals(updatedVspNetwork.getGateway()))) {
- throw new CloudRuntimeException("Tier network does not match the VsdManaged subnet cidr or gateway.");
- } else {
- forUpdate.setCidr(updatedVspNetwork.getCidr());
- forUpdate.setGateway(updatedVspNetwork.getGateway());
- }
-
- saveNetworkAndVpcDetails(vspNetwork, implementAnswer.getNetworkRelatedVsdIds(), designedNetwork.getVpcId());
- saveNetworkDetail(networkId, NuageVspManager.NETWORK_METADATA_VSD_SUBNET_ID, externalId);
- saveNetworkDetail(networkId, NuageVspManager.NETWORK_METADATA_VSD_MANAGED, "true");
-
- forUpdate.setState(State.Allocated);
- _networkDao.update(networkId, forUpdate);
- }
-
- @Override
- public Map<String, ? extends Object> listAdditionalNicParams(String nicUuid) {
- return null;
- }
-
- @Override
- public Network implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapacityException {
- long networkId = network.getId();
- network = _networkDao.acquireInLockTable(network.getId(), 1200);
- if (network == null) {
- throw new ConcurrentOperationException("Unable to acquire lock on network " + networkId);
- }
-
- /* Check if an acl template is used in combination with a pre-configured DT. -> show an error if there is
- Rollback of the network fails in core CS -> networkOrchestrator. */
- if(network.getVpcId() != null) {
- VpcDetailVO detail = _vpcDetailsDao.findDetail(network.getVpcId(), NuageVspManager.nuageDomainTemplateDetailName);
- if (detail != null && network.getNetworkACLId() != null) {
- s_logger.error("Pre-configured DT are used in combination with ACL lists. Which is not supported.");
- throw new IllegalArgumentException("CloudStack ACLs are not supported with Nuage Pre-configured Domain Template");
- }
-
- if(detail != null && !_nuageVspManager.checkIfDomainTemplateExist(network.getDomainId(),detail.getValue(),network.getDataCenterId(),null)){
- s_logger.error("The provided domain template does not exist on the VSD.");
- throw new IllegalArgumentException("The provided domain template does not exist on the VSD anymore.");
- }
- }
-
- NetworkVO implemented = null;
- try {
- if (offering.getGuestType() == GuestType.Isolated && network.getState() != State.Implementing) {
- throw new IllegalStateException("Network " + networkId + " is not in expected state Implementing, but is in state " + network.getState());
- }
-
- //Get the Account details and find the type
- AccountVO networksAccount = _accountDao.findById(network.getAccountId());
- if (networksAccount.getType() == Account.ACCOUNT_TYPE_PROJECT) {
- String errorMessage = "Networks created by account " + networksAccount.getAccountName() + " of type Project (" + Account.ACCOUNT_TYPE_PROJECT + ") " +
- "are not yet supported by NuageVsp provider";
- s_logger.error(errorMessage);
- throw new InsufficientVirtualNetworkCapacityException(errorMessage, Account.class, network.getAccountId());
- }
-
- //We don't support a shared network with UserData and multiple IP ranges at the same time.
- checkMultipleSubnetsCombinedWithUseData(network);
-
- long dcId = dest.getDataCenter().getId();
- //Get physical network id
- Long physicalNetworkId = network.getPhysicalNetworkId();
- //Physical network id can be null in Guest Network in Basic zone, so locate the physical network
- if (physicalNetworkId == null) {
- physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, offering.getTags(), offering.getTrafficType());
- }
-
- implemented = new NetworkVO(network.getId(), network, network.getNetworkOfferingId(), network.getGuruName(), network.getDomainId(), network.getAccountId(),
- network.getRelated(), network.getName(), network.getDisplayText(), network.getNetworkDomain(), network.getGuestType(), network.getDataCenterId(),
- physicalNetworkId, network.getAclType(), network.getSpecifyIpRanges(), network.getVpcId(), offering.isRedundantRouter(), network.getExternalId());
- implemented.setUuid(network.getUuid());
- implemented.setState(State.Allocated);
- if (network.getGateway() != null) {
- implemented.setGateway(network.getGateway());
- }
- if (network.getCidr() != null) {
- implemented.setCidr(network.getCidr());
- }
-
- implemented.setBroadcastUri(_nuageVspManager.calculateBroadcastUri(implemented));
- implemented.setBroadcastDomainType(Networks.BroadcastDomainType.Vsp);
- VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(implemented);
-
- if (vspNetwork.isShared()) {
- Boolean previousUnderlay= null;
- for (VlanVO vlan : _vlanDao.listVlansByNetworkId(networkId)) {
- boolean underlay = NuageVspUtil.isUnderlayEnabledForVlan(_vlanDetailsDao, vlan);
- if (previousUnderlay == null || underlay == previousUnderlay) {
- previousUnderlay = underlay;
- } else {
- throw new CloudRuntimeException("Mixed values for the underlay flag for IP ranges in the same subnet is not supported");
- }
- }
- if (previousUnderlay != null) {
- vspNetwork = new VspNetwork.Builder().fromObject(vspNetwork)
- .vlanUnderlay(previousUnderlay)
- .build();
- }
- }
-
- boolean implementSucceeded = implement(network.getVpcId(), physicalNetworkId, vspNetwork, implemented, _nuageVspEntityBuilder.buildNetworkDhcpOption(network, offering));
-
- if (!implementSucceeded) {
- return null;
- }
-
- if (StringUtils.isNotBlank(vspNetwork.getDomainTemplateName())) {
- if (network.getVpcId() != null) {
- saveVpcDetail(network.getVpcId(), NuageVspManager.nuageDomainTemplateDetailName, vspNetwork.getDomainTemplateName());
- } else {
- saveNetworkDetail(implemented.getId(), NuageVspManager.nuageDomainTemplateDetailName, vspNetwork.getDomainTemplateName());
- }
- }
-
- String tenantId = context.getDomain().getName() + "-" + context.getAccount().getAccountId();
- s_logger.info("Implemented OK, network " + implemented.getUuid() + " in tenant " + tenantId + " linked to " + implemented.getBroadcastUri());
- } finally {
- _networkDao.releaseFromLockTable(network.getId());
- }
- return implemented;
- }
-
- private boolean implement(Long vpcId, long physicalNetworkId, VspNetwork vspNetwork, NetworkVO implemented, VspDhcpDomainOption vspDhcpDomainOption) {
- HostVO nuageVspHost = _nuageVspManager.getNuageVspHost(physicalNetworkId);
- final boolean isVsdManaged = vspNetwork.getNetworkRelatedVsdIds()
- .getVsdSubnetId()
- .isPresent();
- if (isVsdManaged) {
- //Implement cmd was already send in design step.
- _dcDetailsDao.persist(implemented.getDataCenterId(), vspNetwork.getNetworkRelatedVsdIds().getVsdSubnetId().orElseThrow(() -> new CloudRuntimeException("Managed but no subnetId. How can this happen?")), implemented.getUuid());
- return true;
- }
-
- ImplementNetworkVspCommand cmd = new ImplementNetworkVspCommand(vspNetwork, vspDhcpDomainOption, false);
- Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd);
- if (answer == null || !answer.getResult()) {
- s_logger.error("ImplementNetworkVspCommand for network " + vspNetwork.getUuid() + " failed on Nuage VSD " + nuageVspHost.getDetail("hostname"));
- if ((null != answer) && (null != answer.getDetails())) {
- s_logger.error(answer.getDetails());
- }
- return false;
- }
-
- ImplementNetworkVspAnswer implementAnswer = (ImplementNetworkVspAnswer) answer;
- saveNetworkAndVpcDetails(vspNetwork, implementAnswer.getNetworkRelatedVsdIds(), vpcId);
- return true;
- }
-
- private void saveNetworkAndVpcDetails(VspNetwork vspNetwork, NetworkRelatedVsdIds networkRelatedVsdIds, Long vpcId) {
- if (!vspNetwork.isShared() && !vspNetwork.getNetworkRelatedVsdIds().equals(networkRelatedVsdIds)) {
- Map<String, String> networkDetails = constructNetworkDetails(networkRelatedVsdIds, vspNetwork.isVpc());
-
- long networkId = vspNetwork.getId();
-
- for (Map.Entry<String, String> networkDetail : networkDetails.entrySet()) {
- saveNetworkDetail(vspNetwork.getId(), networkDetail.getKey(), networkDetail.getValue());
- }
-
- if(vspNetwork.isVpc()) {
- Map<String, String> vpcDetails = constructVpcDetails(networkRelatedVsdIds);
-
- for (Map.Entry<String, String> vpcDetail : vpcDetails.entrySet()) {
- saveVpcDetail(vpcId, vpcDetail.getKey(), vpcDetail.getValue());
- }
- }
- }
- }
-
- private void saveVpcDetail(Long vpcId, String key, String value) {
- _vpcDetailsDao.addDetail(vpcId, key, value, false);
- }
-
- private void saveNetworkDetail(long networkId, String key, String value) {
- _networkDetailsDao.addDetail(networkId, key, value, false);
- }
-
- private static Map<String, String> constructNetworkDetails(NetworkRelatedVsdIds networkRelatedVsdIds, boolean isVpc) {
- Map<String, String> networkDetails = Maps.newHashMap();
-
- if (!isVpc) {
- networkRelatedVsdIds.getVsdDomainId().ifPresent(v -> networkDetails.put(NuageVspManager.NETWORK_METADATA_VSD_DOMAIN_ID, v));
- networkRelatedVsdIds.getVsdZoneId().ifPresent(v -> networkDetails.put(NuageVspManager.NETWORK_METADATA_VSD_ZONE_ID, v));
- }
- networkRelatedVsdIds.getVsdSubnetId().ifPresent(v -> networkDetails.put(NuageVspManager.NETWORK_METADATA_VSD_SUBNET_ID, v));
-
- return networkDetails;
- }
-
- private static Map<String, String> constructVpcDetails(NetworkRelatedVsdIds networkRelatedVsdIds) {
- Map<String, String> vpcDetails = Maps.newHashMap();
-
- networkRelatedVsdIds.getVsdDomainId().ifPresent(v -> vpcDetails.put(NuageVspManager.NETWORK_METADATA_VSD_DOMAIN_ID, v));
- networkRelatedVsdIds.getVsdZoneId().ifPresent(v -> vpcDetails.put(NuageVspManager.NETWORK_METADATA_VSD_ZONE_ID, v));
- if (networkRelatedVsdIds.isVsdManaged()) {
- vpcDetails.put(NuageVspManager.NETWORK_METADATA_VSD_MANAGED, "true");
- }
-
- return vpcDetails;
- }
-
-
- @Override
- public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException {
- if (vm.getType() != VirtualMachine.Type.DomainRouter && _nuageVspEntityBuilder.usesVirtualRouter(network.getNetworkOfferingId())) {
- VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(network);
- if (nic != null && nic.getRequestedIPv4() != null && nic.getRequestedIPv4().equals(vspNetwork.getVirtualRouterIp())) {
- DataCenter dc = _dcDao.findById(network.getDataCenterId());
- s_logger.error("Unable to acquire requested Guest IP address " + nic.getRequestedIPv4() + " because it is reserved for the VR in network " + network);
- throw new InsufficientVirtualNetworkCapacityException("Unable to acquire requested Guest IP address " + nic.getRequestedIPv4() + " because it is reserved " +
- "for the VR in network " + network, DataCenter.class,dc.getId());
- }
- }
-
- return super.allocate(network, nic, vm);
- }
-
- @Override
- public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
- throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException {
- boolean lockedNetwork = lockNetworkForUserVm(network, vm);
- if (lockedNetwork && s_logger.isDebugEnabled()) {
- s_logger.debug("Locked network " + network.getId() + " for creation of user VM " + vm.getInstanceName());
- }
-
- try {
- //We don't support a shared network with UserData and multiple IP ranges at the same time.
- checkMultipleSubnetsCombinedWithUseData(network);
-
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Handling reserve() call back to with Create a new VM or add an interface to existing VM in network " + network.getName());
- }
-
- DataCenter dc = _dcDao.findById(network.getDataCenterId());
- AccountVO neworkAccountDetails = _accountDao.findById(network.getAccountId());
- if (neworkAccountDetails.getType() == Account.ACCOUNT_TYPE_PROJECT) {
- throw new InsufficientVirtualNetworkCapacityException("CS project support is not yet implemented in NuageVsp", DataCenter.class, dc.getId());
- }
-
- if (Strings.isNullOrEmpty(network.getBroadcastUri().getPath()) || !network.getBroadcastUri().getPath().startsWith("/")) {
- throw new IllegalStateException("The broadcast URI path " + network.getBroadcastUri() + " is empty or in an incorrect format.");
- }
-
- HostVO nuageVspHost = _nuageVspManager.getNuageVspHost(network.getPhysicalNetworkId());
- VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(vm.getVirtualMachine().getDomainId(), network);
-
- boolean vrAddedToNuage = vm.getType() == VirtualMachine.Type.DomainRouter && vspNetwork.getVirtualRouterIp()
- .equals("null");
- if (vrAddedToNuage) {
- //In case a VR is added due to upgrade network offering - recalculate the broadcast uri before using it.
- _nuageVspManager.updateBroadcastUri(network);
- network = _networkDao.findById(network.getId());
- vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(vm.getVirtualMachine().getDomainId(), network, null);
- }
-
- if (vspNetwork.isShared()) {
- vspNetwork = _nuageVspEntityBuilder.updateVspNetworkByPublicIp(vspNetwork, network, nic.getIPv4Address());
-
- if (VirtualMachine.Type.DomainRouter.equals(vm.getType()) && !nic.getIPv4Address().equals(vspNetwork.getVirtualRouterIp())) {
- if(s_logger.isDebugEnabled()) {
- s_logger.debug("VR got spawned with a different IP, releasing the previously allocated public IP " + nic.getIPv4Address());
- }
- IPAddressVO oldIpAddress = _ipAddressDao.findByIpAndSourceNetworkId(network.getId(), nic.getIPv4Address());
- _ipAddressDao.unassignIpAddress(oldIpAddress.getId());
- _ipAddressDao.mark(network.getDataCenterId(), new Ip(vspNetwork.getVirtualRouterIp()));
- } else if (VirtualMachine.Type.User.equals(vm.getType()) && nic.getIPv4Address().equals(vspNetwork.getVirtualRouterIp())) {
- s_logger.error("Deploying a user VM with the same IP as the VR is not allowed.");
- throw new InsufficientVirtualNetworkCapacityException("Deploying a user VM with the same IP " + nic.getIPv4Address() + " as the VR is not allowed.",
- Network.class, network.getId());
- }
-
- // Make sure the shared network is present
- NetworkOffering offering = _ntwkOfferingDao.findById(network.getNetworkOfferingId());
- if (!implement(network.getVpcId(), network.getPhysicalNetworkId(), vspNetwork, null, _nuageVspEntityBuilder.buildNetworkDhcpOption(network, offering))) {
- s_logger.error("Failed to implement shared network " + network.getUuid() + " under domain " + context.getDomain().getUuid());
- throw new InsufficientVirtualNetworkCapacityException("Failed to implement shared network " + network.getUuid() + " under domain " +
- context.getDomain().getUuid(), Network.class, network.getId());
- }
- }
-
- // Set flags for dhcp options
- boolean networkHasDns = networkHasDns(network);
-
- Map<Long, Boolean> networkHasDnsCache = Maps.newHashMap();
- networkHasDnsCache.put(network.getId(), networkHasDns);
-
- // Determine if dhcp options of the other nics in the network need to be updated
- if (vm.getType() == VirtualMachine.Type.DomainRouter && network.getState() != State.Implementing) {
- updateDhcpOptionsForExistingVms(network, nuageVspHost, vspNetwork, networkHasDns, networkHasDnsCache);
- //update the extra DHCP options
-
- }
- // Update broadcast Uri to enable VR ip update
- if (!network.getBroadcastUri().getPath().substring(1).equals(vspNetwork.getVirtualRouterIp())) {
- NetworkVO networkToUpdate = _networkDao.findById(network.getId());
- String broadcastUriStr = networkToUpdate.getUuid() + "/" + vspNetwork.getVirtualRouterIp();
- networkToUpdate.setBroadcastUri(Networks.BroadcastDomainType.Vsp.toUri(broadcastUriStr));
- _networkDao.update(network.getId(), networkToUpdate);
- if (network instanceof NetworkVO) {
- ((NetworkVO) network).setBroadcastUri(networkToUpdate.getBroadcastUri());
- }
- }
-
- nic.setBroadcastUri(network.getBroadcastUri());
- nic.setIsolationUri(network.getBroadcastUri());
-
- VspVm vspVm = _nuageVspEntityBuilder.buildVspVm(vm.getVirtualMachine(), network);
-
- if (vm.isRollingRestart()) {
- ((NetworkVO)network).setRollingRestart(true);
- } else {
- //NicProfile does not contain the NIC UUID. We need this information to set it in the VMInterface and VPort
- //that we create in VSP
- NicVO nicFromDb = _nicDao.findById(nic.getId());
- IPAddressVO staticNatIp = _ipAddressDao.findByVmIdAndNetworkId(network.getId(), vm.getId());
- VspNic vspNic = _nuageVspEntityBuilder.buildVspNic(nicFromDb.getUuid(), nic);
- VspStaticNat vspStaticNat = null;
- if (staticNatIp != null) {
- VlanVO staticNatVlan = _vlanDao.findById(staticNatIp.getVlanId());
- vspStaticNat = _nuageVspEntityBuilder.buildVspStaticNat(null, staticNatIp, staticNatVlan, vspNic);
- }
-
- boolean defaultHasDns = getDefaultHasDns(networkHasDnsCache, nicFromDb);
- VspDhcpVMOption dhcpOption = _nuageVspEntityBuilder.buildVmDhcpOption(nicFromDb, defaultHasDns, networkHasDns);
- ReserveVmInterfaceVspCommand cmd = new ReserveVmInterfaceVspCommand(vspNetwork, vspVm, vspNic, vspStaticNat, dhcpOption);
- Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd);
-
- if (answer == null || !answer.getResult()) {
- s_logger.error("ReserveVmInterfaceNuageVspCommand failed for NIC " + nic.getId() + " attached to VM " + vm.getId() + " in network " + network.getId());
- if ((null != answer) && (null != answer.getDetails())) {
- s_logger.error(answer.getDetails());
- }
- throw new InsufficientVirtualNetworkCapacityException("Failed to reserve VM in Nuage VSP.", Network.class, network.getId());
- }
- }
-
- if (vspVm.getDomainRouter() == Boolean.TRUE) {
- nic.setIPv4Address(vspVm.getDomainRouterIp());
- }
-
- } finally {
- if (network != null && lockedNetwork) {
- _networkDao.releaseFromLockTable(network.getId());
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Unlocked network " + network.getId() + " for creation of user VM " + vm.getInstanceName());
- }
- }
- }
- }
-
- private void updateExtraDhcpOptionsForExistingVm(Network network, Nic nic) {
- _networkOrchestrationService.configureExtraDhcpOptions(network, nic.getId());
- }
-
- private void updateDhcpOptionsForExistingVms(Network network, HostVO nuageVspHost, VspNetwork vspNetwork, boolean networkHasDns, Map<Long, Boolean> networkHasDnsCache)
- throws InsufficientVirtualNetworkCapacityException {
- // Update dhcp options if a VR is added when we are not initiating the network
- if(s_logger.isDebugEnabled()) {
- s_logger.debug(String.format("DomainRouter is added to an existing network: %s in state: %s", network.getName(), network.getState()));
- }
-
- List<NicVO> userNics = _nicDao.listByNetworkId(network.getId());
- LinkedListMultimap<Long, VspDhcpVMOption> dhcpOptionsPerDomain = LinkedListMultimap.create();
-
- for (Iterator<NicVO> iterator = userNics.iterator(); iterator.hasNext(); ) {
- NicVO userNic = iterator.next();
- if (userNic.getVmType() == VirtualMachine.Type.DomainRouter || userNic.getState() != Nic.State.Reserved) {
- iterator.remove();
- continue;
- }
-
- VMInstanceVO userVm = _vmInstanceDao.findById(userNic.getInstanceId());
- boolean defaultHasDns = getDefaultHasDns(networkHasDnsCache, userNic);
- VspDhcpVMOption dhcpOption = _nuageVspEntityBuilder.buildVmDhcpOption(userNic, defaultHasDns, networkHasDns);
- dhcpOptionsPerDomain.put(userVm.getDomainId(), dhcpOption);
- }
-
- for (Long domainId : dhcpOptionsPerDomain.keySet()) {
- VspDomain vspDomain = _nuageVspEntityBuilder.buildVspDomain(_domainDao.findById(domainId));
- VspNetwork vspNetworkForDomain = new VspNetwork.Builder().fromObject(vspNetwork).domain(vspDomain).build();
- List<VspDhcpVMOption> dhcpOptions = dhcpOptionsPerDomain.get(domainId);
- UpdateDhcpOptionVspCommand cmd = new UpdateDhcpOptionVspCommand(dhcpOptions, vspNetworkForDomain);
- Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd);
-
- if (answer == null || !answer.getResult()) {
- s_logger.error("UpdateDhcpOptionVspCommand failed at \"reserve\" for network " + vspNetwork.getName() + " under domain " + vspNetwork.getVspDomain().getName());
- if ((null != answer) && (null != answer.getDetails())) {
- s_logger.error(answer.getDetails());
- }
- throw new InsufficientVirtualNetworkCapacityException("Failed to reserve VM in Nuage VSP.", Network.class, network.getId());
- }
- }
-
- for (NicVO userNic : userNics) {
- updateExtraDhcpOptionsForExistingVm(network, userNic);
- }
- }
-
-
- private boolean isServiceProvidedByVR(Network network, Network.Service service ) {
- return (_networkModel.areServicesSupportedInNetwork(network.getId(), service) &&
- ( _networkModel.isProviderSupportServiceInNetwork(network.getId(), service, Network.Provider.VirtualRouter) ||
- _networkModel.isProviderSupportServiceInNetwork(network.getId(), service, Network.Provider.VPCVirtualRouter)));
- }
-
- private void checkMultipleSubnetsCombinedWithUseData(Network network) {
- if (isServiceProvidedByVR(network, Network.Service.UserData)) {
- List<VlanVO> vlanVOs = _vlanDao.listVlansByNetworkId(network.getId());
- if (vlanVOs.stream()
- .map(VlanVO::getVlanGateway)
- .distinct()
- .count() > 1) {
- s_logger.error("NuageVsp provider does not support multiple subnets in combination with user data. Network: " + network + ", vlans: " + vlanVOs);
- throw new UnsupportedServiceException("NuageVsp provider does not support multiple subnets in combination with user data.");
- }
- }
- }
-
- @Override
- protected boolean canHandle(NetworkOffering offering, final NetworkType networkType, final PhysicalNetwork physicalNetwork) {
- if (networkType == NetworkType.Advanced
- && isMyTrafficType(offering.getTrafficType())
- && isMyIsolationMethod(physicalNetwork)
- && (offering.getGuestType() == GuestType.Isolated || offering.getGuestType() == GuestType.Shared)
- && hasRequiredServices(offering)) {
- if (_configMgr.isOfferingForVpc(offering) && !offering.isPersistent()) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("NuageVsp can't handle VPC tiers which use a network offering which are not persistent");
- }
- return false;
- } else if (offering.getGuestType() == GuestType.Shared) {
- List<String> supportedSharedNetworkServices = Lists.newArrayList(Network.Service.Connectivity.getName(), Network.Service.Dhcp.getName(), Network.Service.UserData.getName());
- List<String> offeringServices = _ntwkOfferingSrvcDao.listServicesForNetworkOffering(offering.getId());
- if (!supportedSharedNetworkServices.containsAll(offeringServices)) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("We only support " + Iterables.toString(supportedSharedNetworkServices) + " services for shared networks");
- }
- return false;
- }
- }
- return true;
- } else {
- if (s_logger.isTraceEnabled()) {
- s_logger.trace("We only take care of networks in zone of type " + NetworkType.Advanced + " without VLAN");
- }
- return false;
- }
- }
-
- private boolean hasRequiredServices(NetworkOffering networkOffering) {
- final Map<Network.Service, Set<Network.Provider>> serviceProviderMap = _networkModel.getNetworkOfferingServiceProvidersMap(networkOffering.getId());
-
- if (!serviceProviderMap.get(Network.Service.Connectivity).contains(Network.Provider.NuageVsp)) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("NuageVsp can't handle networks which use a network offering without NuageVsp as Connectivity provider");
- }
- return false;
- }
-
- if (networkOffering.getGuestType() == GuestType.Isolated
- && !serviceProviderMap.get(Network.Service.SourceNat).contains(Network.Provider.NuageVsp)) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("NuageVsp can't handle networks which use a network offering without NuageVsp as SourceNat provider");
- }
- return false;
- }
- return true;
- }
-
- @Override
- @DB
- public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
- boolean lockedNetwork = lockNetworkForUserVm(network, vm);
- if (lockedNetwork && s_logger.isDebugEnabled()) {
- s_logger.debug("Locked network " + network.getId() + " for deallocation of user VM " + vm.getInstanceName());
- }
-
- try {
- final VirtualMachine virtualMachine = vm.getVirtualMachine();
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Handling deallocate() call back, which is called when a VM is destroyed or interface is removed, " + "to delete VM Interface with IP "
- + nic.getIPv4Address() + " from a VM " + vm.getInstanceName() + " with state " + virtualMachine
- .getState());
- }
-
- NicVO nicFromDb = _nicDao.findById(nic.getId());
-
- VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(virtualMachine
- .getDomainId(), network);
- VspVm vspVm = _nuageVspEntityBuilder.buildVspVm(virtualMachine, network);
- VspNic vspNic = _nuageVspEntityBuilder.buildVspNic(nicFromDb.getUuid(), nic);
- HostVO nuageVspHost = _nuageVspManager.getNuageVspHost(network.getPhysicalNetworkId());
-
- DeallocateVmVspCommand cmd = new DeallocateVmVspCommand(vspNetwork, vspVm, vspNic);
- Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd);
- if (answer == null || !answer.getResult()) {
- s_logger.error("DeallocateVmNuageVspCommand for VM " + vm.getUuid() + " failed on Nuage VSD " + nuageVspHost.getDetail("hostname"));
- if ((null != answer) && (null != answer.getDetails())) {
- s_logger.error(answer.getDetails());
- }
- }
-
- // In case of shared network, when a User VM is spawned with the same IP as the VR, and it gets cleaned up, make sure we do not release the public IP
- // because it is still allocated for the VR.
- if (vspNetwork.isShared() && VirtualMachine.Type.User.equals(vm.getType()) && nic.getIPv4Address().equals(vspNetwork.getVirtualRouterIp())) {
- nic.deallocate();
- } else {
- super.deallocate(network, nic, vm);
- }
-
- if (virtualMachine.getType() == VirtualMachine.Type.DomainRouter) {
- final List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), VirtualRouter.Role.VIRTUAL_ROUTER);
- final DomainRouterVO otherRouter = routers.stream()
- .filter(r -> r.getId() != vm.getId())
- .findFirst()
- .orElse(null);
-
- if (otherRouter != null) {
- nicFromDb = _nicDao.findByNtwkIdAndInstanceId(network.getId(), otherRouter.getId());
- vspVm = _nuageVspEntityBuilder.buildVspVm(otherRouter, network);
- vspNic = _nuageVspEntityBuilder.buildVspNic(nicFromDb);
-
- VspDhcpVMOption dhcpOption = _nuageVspEntityBuilder.buildVmDhcpOption(nicFromDb, false, false);
- ReserveVmInterfaceVspCommand reserveCmd = new ReserveVmInterfaceVspCommand(vspNetwork, vspVm, vspNic, null, dhcpOption);
-
- answer = _agentMgr.easySend(nuageVspHost.getId(), reserveCmd);
- if (answer == null || !answer.getResult()) {
- s_logger.error("DeallocateVmNuageVspCommand for VM " + vm.getUuid() + " failed on Nuage VSD " + nuageVspHost.getDetail("hostname"));
- if ((null != answer) && (null != answer.getDetails())) {
- s_logger.error(answer.getDetails());
- }
- }
- }
-
- }
- } finally {
- if (network != null && lockedNetwork) {
- _networkDao.releaseFromLockTable(network.getId());
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Unlocked network " + network.getId() + " for deallocation of user VM " + vm.getInstanceName());
- }
- }
- }
- }
-
- private boolean lockNetworkForUserVm(Network network, VirtualMachineProfile vm) {
- if (!vm.getVirtualMachine().getType().isUsedBySystem()) {
- long networkId = network.getId();
- network = _networkDao.acquireInLockTable(network.getId(), 1200);
- if (network == null) {
- throw new ConcurrentOperationException("Unable to acquire lock on network " + networkId);
- }
- return true;
- }
- return false;
- }
-
- @Override
- public void shutdown(NetworkProfile profile, NetworkOffering offering) {
- super.shutdown(profile, offering);
- }
-
- @Override
- public boolean trash(Network network, NetworkOffering offering) {
- long networkId = network.getId();
- network = _networkDao.acquireInLockTable(networkId, 1200);
- if (network == null) {
- throw new ConcurrentOperationException("Unable to acquire lock on network " + networkId);
- }
-
- try {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Handling trash() call back to delete the network " + network.getName() + " with uuid " + network.getUuid() + " from VSP");
- }
-
- VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(network);
-
- boolean networkMigrationCopy = network.getRelated() != network.getId();
-
- if (networkMigrationCopy) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Network " + network.getName() + " is a copy of a migrated network. Cleaning up network details of related network.");
- }
- cleanUpNetworkCaching(network.getRelated());
- }
- cleanUpNetworkCaching(network.getId());
-
- //Clean up VSD managed subnet caching
- if (vspNetwork.getNetworkRelatedVsdIds().isVsdManaged()) {
- final long dataCenterId = network.getDataCenterId();
- vspNetwork.getNetworkRelatedVsdIds().getVsdSubnetId().ifPresent(subnetId -> {
- _dcDetailsDao.removeDetail(dataCenterId, subnetId);
- });
- }
-
- HostVO nuageVspHost = _nuageVspManager.getNuageVspHost(network.getPhysicalNetworkId());
- TrashNetworkVspCommand cmd = new TrashNetworkVspCommand(vspNetwork);
- Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd);
- if (answer == null || !answer.getResult()) {
- s_logger.error("TrashNetworkNuageVspCommand for network " + network.getUuid() + " failed");
- if ((null != answer) && (null != answer.getDetails())) {
- s_logger.error(answer.getDetails());
- }
- return false;
- }
- } finally {
- _networkDao.releaseFromLockTable(network.getId());
- }
- return super.trash(network, offering);
- }
-
- private void cleanUpNetworkCaching(long id) {
- _networkDetailsDao.removeDetail(id, NuageVspManager.NETWORK_METADATA_VSD_DOMAIN_ID);
- _networkDetailsDao.removeDetail(id, NuageVspManager.NETWORK_METADATA_VSD_ZONE_ID);
- _networkDetailsDao.removeDetail(id, NuageVspManager.NETWORK_METADATA_VSD_SUBNET_ID);
- _networkDetailsDao.removeDetail(id, NuageVspManager.NETWORK_METADATA_VSD_MANAGED);
- }
-
- private boolean networkHasDns(Network network) {
-
- if (network != null) {
- List<String> dnsProviders = _ntwkOfferingSrvcDao.listProvidersForServiceForNetworkOffering(network.getNetworkOfferingId(), Network.Service.Dns);
- return dnsProviders.contains(Network.Provider.VirtualRouter.getName())
- || dnsProviders.contains(Network.Provider.VPCVirtualRouter.getName());
-
- }
-
- return false;
- }
-
- private boolean getDefaultHasDns(Map<Long, Boolean> cache, Nic nic) {
- Long networkId = nic.isDefaultNic()
- ? Long.valueOf(nic.getNetworkId())
- : getDefaultNetwork(nic.getInstanceId());
-
- Boolean hasDns = cache.computeIfAbsent(networkId, k -> networkHasDns(_networkDao.findById(networkId)));
- return hasDns;
- }
-
- private Long getDefaultNetwork(long vmId) {
- NicVO defaultNic = _nicDao.findDefaultNicForVM(vmId);
- if (defaultNic != null) return defaultNic.getNetworkId();
- return null;
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/manager/AbstractListener.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/manager/AbstractListener.java
deleted file mode 100644
index 648e0f7..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/manager/AbstractListener.java
+++ /dev/null
@@ -1,91 +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 com.cloud.network.manager;
-
-import com.cloud.agent.Listener;
-import com.cloud.agent.api.AgentControlAnswer;
-import com.cloud.agent.api.AgentControlCommand;
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.StartupCommand;
-import com.cloud.exception.ConnectionException;
-import com.cloud.host.Host;
-import com.cloud.host.Status;
-
-/**
- * Created by maximusf on 7/19/17.
- */
-abstract class AbstractListener implements Listener {
-
- @Override
- public boolean processAnswers(long agentId, long seq, Answer[] answers) {
- return true;
- }
-
- @Override
- public boolean processCommands(long agentId, long seq, Command[] commands) {
- return true;
- }
-
- @Override
- public AgentControlAnswer processControlCommand(long agentId, AgentControlCommand cmd) {
- return null;
- }
-
- @Override
- public void processHostAdded(long hostId) {
-
- }
-
- @Override
- public void processConnect(Host host, StartupCommand cmd, boolean forRebalance) throws ConnectionException {
-
- }
-
- @Override
- public boolean processDisconnect(long agentId, Status state) {
- return true;
- }
-
- @Override
- public void processHostAboutToBeRemoved(long hostId) {
-
- }
-
- @Override
- public void processHostRemoved(long hostId, long clusterId) {
-
- }
-
- @Override
- public boolean isRecurring() {
- return false;
- }
-
- @Override
- public int getTimeout() {
- return 0;
- }
-
- @Override
- public boolean processTimeout(long agentId, long seq) {
- return true;
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/manager/NuageVspManager.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/manager/NuageVspManager.java
deleted file mode 100644
index 1fe9b40..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/manager/NuageVspManager.java
+++ /dev/null
@@ -1,173 +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 com.cloud.network.manager;
-
-import java.net.URI;
-import java.util.List;
-
-import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.ConfigKey.Scope;
-
-import com.cloud.agent.api.manager.EntityExistsCommand;
-import com.cloud.api.commands.AddNuageVspDeviceCmd;
-import com.cloud.api.commands.AssociateNuageVspDomainTemplateCmd;
-import com.cloud.api.commands.DeleteNuageVspDeviceCmd;
-import com.cloud.api.commands.ListNuageVspDevicesCmd;
-import com.cloud.api.commands.ListNuageVspDomainTemplatesCmd;
-import com.cloud.api.commands.UpdateNuageVspDeviceCmd;
-import com.cloud.api.response.NuageVlanIpRangeResponse;
-import com.cloud.api.response.NuageVspDeviceResponse;
-import com.cloud.dc.Vlan;
-import com.cloud.api.response.NuageVspDomainTemplateResponse;
-import com.cloud.exception.InsufficientVirtualNetworkCapacityException;
-import com.cloud.host.HostVO;
-import com.cloud.network.Network;
-import com.cloud.network.NuageVspDeviceVO;
-import com.cloud.utils.component.PluggableService;
-
-
-
-public interface NuageVspManager extends PluggableService {
-
- String nuageVPCOfferingName = "Nuage VSP VPC Offering";
-
- String nuageVPCOfferingDisplayText = "Nuage VSP VPC Offering";
-
- String nuageDomainTemplateDetailName = "domainTemplateName";
-
- String nuageUnderlayVlanIpRangeDetailKey = "nuage.underlay";
-
- ConfigKey<Boolean> NuageVspConfigDns = new ConfigKey<Boolean>(Boolean.class, "nuagevsp.configure.dns", "Advanced", "true",
- "Defines if NuageVsp plugin needs to configure DNS setting for a VM or not. True will configure the DNS and false will not configure the DNS settings", true,
- Scope.Global, null);
-
- ConfigKey<Boolean> NuageVspDnsExternal = new ConfigKey<Boolean>(
- Boolean.class,
- "nuagevsp.dns.external",
- "Advanced",
- "true",
- "Defines if NuageVsp plugin needs to configure either internal or external DNS server configured during Zone provisioning. "
- + "Value true uses the external DNS and value false uses the internal DNS to configure in the VM. But, this flag depends on "
- + "nuagevsp.configure.dns. Only if nuagevsp.configure.dns is set to true, DNS server will be configured in the VM. "
- + "If nuagevsp.configure.dns is false, DNS server will not be configured in the VM. Default value for this flag is true",
- true, Scope.Global, null);
-
- ConfigKey<String> NuageVspConfigGateway = new ConfigKey<String>(String.class, "nuagevsp.configure.gateway.systemid", "Advanced", "",
- "Defines the systemID of the gateway configured in VSP", true, Scope.Global, null);
-
- ConfigKey<String> NuageVspSharedNetworkDomainTemplateName = new ConfigKey<String>(String.class, "nuagevsp.sharedntwk.domaintemplate.name",
- "Advanced", "", "Defines if NuageVsp plugin needs to use pre created Domain Template configured in VSP for shared networks", true, Scope.Global, null);
-
- ConfigKey<String> NuageVspVpcDomainTemplateName = new ConfigKey<String>(String.class, "nuagevsp.vpc.domaintemplate.name",
- "Advanced", "", "Defines if NuageVsp plugin needs to use pre created Domain Template configured in VSP for VPCs", true, Scope.Global, null);
-
- ConfigKey<String> NuageVspIsolatedNetworkDomainTemplateName = new ConfigKey<String>(String.class, "nuagevsp.isolatedntwk.domaintemplate.name",
- "Advanced", "", "Defines if NuageVsp plugin needs to use pre created Domain Template configured in VSP for isolated networks", true, Scope.Global, null);
-
- String NETWORK_METADATA_VSD_DOMAIN_ID = "vsdDomainId";
-
- String NETWORK_METADATA_VSD_ZONE_ID = "vsdZoneId";
-
- String NETWORK_METADATA_VSD_SUBNET_ID = "vsdSubnetId";
-
- String NETWORK_METADATA_VSD_MANAGED = "isVsdManaged";
-
- String CMSID_CONFIG_KEY = "nuagevsp.cms.id";
-
- String NUAGE_VSP_ISOLATION = "VSP";
-
- NuageVspDeviceVO addNuageVspDevice(AddNuageVspDeviceCmd cmd);
-
- NuageVspDeviceVO updateNuageVspDevice(UpdateNuageVspDeviceCmd cmd);
-
- NuageVspDeviceResponse createNuageVspDeviceResponse(NuageVspDeviceVO nuageVspDeviceVO);
-
- boolean deleteNuageVspDevice(DeleteNuageVspDeviceCmd cmd);
-
- List<NuageVspDeviceVO> listNuageVspDevices(ListNuageVspDevicesCmd cmd);
-
- List<String> getDnsDetails(long dataCenterId);
-
- List<String> getGatewaySystemIds();
-
- HostVO getNuageVspHost(long physicalNetworkId);
-
- boolean updateNuageUnderlayVlanIpRange(long vlanIpRangeId, boolean enabled);
-
- List<NuageVlanIpRangeResponse> filterNuageVlanIpRanges(List<? extends Vlan> vlanIpRanges, Boolean underlay);
-
- List<NuageVspDomainTemplateResponse> listNuageVspDomainTemplates(ListNuageVspDomainTemplatesCmd cmd);
-
- List<NuageVspDomainTemplateResponse> listNuageVspDomainTemplates(long domainId, String keyword, Long zoneId, Long physicalNetworkId);
-
- /**
- * Associates a Nuage Vsp domain template with a
- * @param cmd Associate cmd which contains all the data
- */
- void associateNuageVspDomainTemplate(AssociateNuageVspDomainTemplateCmd cmd);
-
- /**
- * Queries the VSD to check if the entity provided in the entityCmd exists on the VSD
- * @param cmd entityCommand which contains the ACS class of the entity and the UUID
- * @param hostId the hostId of the VSD
- * @return true if an entity exists with the UUI on the VSD, otherwise false.
- */
- boolean entityExist(EntityExistsCommand cmd, Long hostId);
-
- /**
- * Sets the preconfigured domain template for a given network
- * @param network the network for which we want to set the domain template
- * @param domainTemplateName the domain template name we want to use
- */
- void setPreConfiguredDomainTemplateName(Network network, String domainTemplateName);
-
- /**
- * Returns the current pre configured domain template for a given network
- * @param network the network for which we want the domain template name
- * @return the domain template name
- */
- String getPreConfiguredDomainTemplateName(Network network);
-
- /**
- * Checks if a given domain template exists or not on the VSD.
- * @param domainId Id of the domain to search in.
- * @param domainTemplate The name of the domain template for which we need to query the VSD.
- * @param zoneId zoneId OR PhysicalNetworkId needs to be provided.
- * @param physicalNetworkId zoneId OR PhysicalNetworkId needs to be provided.
- * @return true if the domain template exists on the VSD else false if it does not exist on the VSD
- */
- boolean checkIfDomainTemplateExist(Long domainId, String domainTemplate, Long zoneId, Long physicalNetworkId);
-
- /**
- * calculates the new broadcast uri of a network and persists it in the database
- * @param network the network for which you want to calculate the broadcast uri
- * @throws InsufficientVirtualNetworkCapacityException in case there is no free ip that can be used as the VR ip.
- */
- void updateBroadcastUri(Network network) throws InsufficientVirtualNetworkCapacityException;
-
- /**
- * Calculates the broadcast uri based on the network and the offering of the given network
- * @param network the network for which you want to calculate the broadcast uri
- * @return the calculated broadcast uri
- * @throws InsufficientVirtualNetworkCapacityException in case there is no free ip that can be used as the VR ip.
- */
- URI calculateBroadcastUri(Network network) throws InsufficientVirtualNetworkCapacityException;
-
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/manager/NuageVspManagerImpl.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/manager/NuageVspManagerImpl.java
deleted file mode 100644
index d5f9acb..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/manager/NuageVspManagerImpl.java
+++ /dev/null
@@ -1,1408 +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 com.cloud.network.manager;
-
-import static com.cloud.agent.api.sync.SyncNuageVspCmsIdCommand.SyncType;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.UUID;
-import java.util.stream.Collectors;
-
-import javax.annotation.Nonnull;
-import javax.inject.Inject;
-import javax.naming.ConfigurationException;
-
-import net.nuage.vsp.acs.client.api.NuageVspPluginClientLoader;
-import net.nuage.vsp.acs.client.api.model.VspApiDefaults;
-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.VspDomainTemplate;
-import net.nuage.vsp.acs.client.api.model.VspHost;
-import net.nuage.vsp.acs.client.common.NuageVspApiVersion;
-import net.nuage.vsp.acs.client.common.NuageVspConstants;
-import net.nuage.vsp.acs.client.common.model.Pair;
-import net.nuage.vsp.acs.client.exception.NuageVspException;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.log4j.Logger;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Strings;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Multimap;
-
-import org.apache.cloudstack.api.ResponseGenerator;
-import org.apache.cloudstack.context.CallContext;
-import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.Configurable;
-import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
-import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
-import org.apache.cloudstack.framework.messagebus.MessageBus;
-import org.apache.cloudstack.network.ExternalNetworkDeviceManager;
-import org.apache.cloudstack.resourcedetail.VpcDetailVO;
-import org.apache.cloudstack.resourcedetail.dao.VpcDetailsDao;
-
-import com.cloud.agent.AgentManager;
-import com.cloud.agent.Listener;
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.PingNuageVspCommand;
-import com.cloud.agent.api.manager.CleanUpDomainCommand;
-import com.cloud.agent.api.manager.EntityExistsCommand;
-import com.cloud.agent.api.manager.GetApiDefaultsAnswer;
-import com.cloud.agent.api.manager.GetApiDefaultsCommand;
-import com.cloud.agent.api.manager.ListVspDomainTemplatesAnswer;
-import com.cloud.agent.api.manager.ListVspDomainTemplatesCommand;
-import com.cloud.agent.api.manager.SupportedApiVersionCommand;
-import com.cloud.agent.api.manager.UpdateNuageVspDeviceCommand;
-import com.cloud.agent.api.sync.SyncDomainCommand;
-import com.cloud.agent.api.sync.SyncNuageVspCmsIdAnswer;
-import com.cloud.agent.api.sync.SyncNuageVspCmsIdCommand;
-import com.cloud.api.ApiDBUtils;
-import com.cloud.api.commands.AddNuageVspDeviceCmd;
-import com.cloud.api.commands.AssociateNuageVspDomainTemplateCmd;
-import com.cloud.api.commands.DeleteNuageVspDeviceCmd;
-import com.cloud.api.commands.DisableNuageUnderlayVlanIpRangeCmd;
-import com.cloud.api.commands.EnableNuageUnderlayVlanIpRangeCmd;
-import com.cloud.api.commands.ListNuageUnderlayVlanIpRangesCmd;
-import com.cloud.api.commands.ListNuageVspDevicesCmd;
-import com.cloud.api.commands.ListNuageVspDomainTemplatesCmd;
-import com.cloud.api.commands.ListNuageVspGlobalDomainTemplateCmd;
-import com.cloud.api.commands.UpdateNuageVspDeviceCmd;
-import com.cloud.api.response.NuageVlanIpRangeResponse;
-import com.cloud.api.response.NuageVspDeviceResponse;
-import com.cloud.api.response.NuageVspDomainTemplateResponse;
-import com.cloud.dc.DataCenterVO;
-import com.cloud.dc.Vlan;
-import com.cloud.dc.VlanDetailsVO;
-import com.cloud.dc.VlanVO;
-import com.cloud.dc.dao.DataCenterDao;
-import com.cloud.dc.dao.VlanDao;
-import com.cloud.dc.dao.VlanDetailsDao;
-import com.cloud.domain.Domain;
-import com.cloud.domain.DomainVO;
-import com.cloud.domain.dao.DomainDao;
-import com.cloud.exception.InsufficientVirtualNetworkCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.host.DetailVO;
-import com.cloud.host.Host;
-import com.cloud.host.HostVO;
-import com.cloud.host.Status;
-import com.cloud.host.dao.HostDao;
-import com.cloud.host.dao.HostDetailsDao;
-import com.cloud.network.Network;
-import com.cloud.network.NetworkModel;
-import com.cloud.network.Networks;
-import com.cloud.network.NuageVspDeviceVO;
-import com.cloud.network.PhysicalNetwork;
-import com.cloud.network.PhysicalNetworkServiceProvider;
-import com.cloud.network.dao.NetworkDao;
-import com.cloud.network.dao.NetworkDetailVO;
-import com.cloud.network.dao.NetworkDetailsDao;
-import com.cloud.network.dao.NetworkVO;
-import com.cloud.network.dao.NuageVspDao;
-import com.cloud.network.dao.PhysicalNetworkDao;
-import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
-import com.cloud.network.dao.PhysicalNetworkServiceProviderVO;
-import com.cloud.network.dao.PhysicalNetworkVO;
-import com.cloud.network.resource.NuageVspResource;
-import com.cloud.network.resource.NuageVspResourceConfiguration;
-import com.cloud.network.vpc.VpcOffering;
-import com.cloud.network.vpc.VpcOfferingServiceMapVO;
-import com.cloud.network.vpc.VpcOfferingVO;
-import com.cloud.network.vpc.VpcVO;
-import com.cloud.network.vpc.dao.VpcDao;
-import com.cloud.network.vpc.dao.VpcOfferingDao;
-import com.cloud.network.vpc.dao.VpcOfferingServiceMapDao;
-import com.cloud.offerings.dao.NetworkOfferingDao;
-import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
-import com.cloud.resource.ResourceManager;
-import com.cloud.resource.ResourceState;
-import com.cloud.user.DomainManager;
-import com.cloud.util.NuageVspEntityBuilder;
-import com.cloud.util.NuageVspUtil;
-import com.cloud.utils.component.ManagerBase;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.Transaction;
-import com.cloud.utils.db.TransactionCallback;
-import com.cloud.utils.db.TransactionCallbackNoReturn;
-import com.cloud.utils.db.TransactionStatus;
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.fsm.StateListener;
-import com.cloud.utils.fsm.StateMachine2;
-import com.cloud.utils.net.NetUtils;
-import com.cloud.vm.VMInstanceVO;
-import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.dao.NicDao;
-import com.cloud.vm.dao.VMInstanceDao;
-
-public class NuageVspManagerImpl extends ManagerBase implements NuageVspManager, Configurable, StateListener<Status, Status.Event, Host> {
-
- private static final Logger s_logger = Logger.getLogger(NuageVspManagerImpl.class);
-
- public static final Multimap<Network.Service, Network.Provider> DEFAULT_NUAGE_VSP_VPC_SERVICE_MAP;
- public static final Multimap<Network.Service, Network.Provider> SUPPORTED_NUAGE_VSP_VPC_SERVICE_MAP;
- private static final ConfigKey[] NUAGE_VSP_CONFIG_KEYS = new ConfigKey<?>[] { NuageVspConfigDns, NuageVspDnsExternal, NuageVspConfigGateway,
- NuageVspSharedNetworkDomainTemplateName, NuageVspVpcDomainTemplateName, NuageVspIsolatedNetworkDomainTemplateName };
-
-
- @Inject
- ResourceManager _resourceMgr;
- @Inject
- HostDetailsDao _hostDetailsDao;
- @Inject
- HostDao _hostDao;
- @Inject
- PhysicalNetworkDao _physicalNetworkDao;
- @Inject
- PhysicalNetworkServiceProviderDao _physicalNetworkServiceProviderDao;
- @Inject
- NetworkDao _networkDao;
- @Inject
- NetworkDetailsDao _networkDetailsDao;
- @Inject
- VpcOfferingDao _vpcOffDao;
- @Inject
- VpcOfferingServiceMapDao _vpcOffSvcMapDao;
- @Inject
- VpcDao _vpcDao;
- @Inject
- private VpcDetailsDao _vpcDetailsDao;
- @Inject
- NuageVspDao _nuageVspDao;
- @Inject
- DataCenterDao _dataCenterDao;
- @Inject
- ConfigurationDao _configDao;
- @Inject
- AgentManager _agentMgr;
- @Inject
- private DomainDao _domainDao;
- @Inject
- NetworkOfferingDao _networkOfferingDao;
- @Inject
- NetworkOfferingServiceMapDao _networkOfferingServiceMapDao;
- @Inject
- NuageVspEntityBuilder _nuageVspEntityBuilder;
- @Inject
- VlanDao _vlanDao;
- @Inject
- VlanDetailsDao _vlanDetailsDao;
- @Inject
- ResponseGenerator _responseGenerator;
- @Inject
- MessageBus _messageBus;
- @Inject
- VMInstanceDao _vmInstanceDao;
- @Inject
- NicDao _nicDao;
- @Inject
- NetworkModel _networkModel;
-
- static {
- Set<Network.Provider> nuageVspProviders = ImmutableSet.of(Network.Provider.NuageVsp);
- Set<Network.Provider> vrProviders = ImmutableSet.of(Network.Provider.VPCVirtualRouter);
- Set<Network.Provider> defaultLbProviders = ImmutableSet.of(Network.Provider.InternalLbVm);
- Set<Network.Provider> supportedLbProviders = ImmutableSet.of(Network.Provider.InternalLbVm);
- Set<Network.Provider> supportedUserDataProviders = ImmutableSet.of(Network.Provider.VPCVirtualRouter, Network.Provider.ConfigDrive);
-
- DEFAULT_NUAGE_VSP_VPC_SERVICE_MAP = ImmutableMultimap.<Network.Service, Network.Provider>builder()
- .putAll(Network.Service.Connectivity, nuageVspProviders)
- .putAll(Network.Service.Gateway, nuageVspProviders)
- .putAll(Network.Service.Dhcp, nuageVspProviders)
- .putAll(Network.Service.StaticNat, nuageVspProviders)
- .putAll(Network.Service.SourceNat, nuageVspProviders)
- .putAll(Network.Service.NetworkACL, nuageVspProviders)
- .putAll(Network.Service.UserData, vrProviders)
- .putAll(Network.Service.Lb, defaultLbProviders)
- .putAll(Network.Service.Dns, vrProviders)
- .build();
-
- Multimap<Network.Service, Network.Provider> builder = HashMultimap.create(DEFAULT_NUAGE_VSP_VPC_SERVICE_MAP);
- builder.putAll(Network.Service.UserData, supportedUserDataProviders);
- builder.putAll(Network.Service.Lb, supportedLbProviders);
-
- SUPPORTED_NUAGE_VSP_VPC_SERVICE_MAP = ImmutableMultimap.copyOf(builder);
- }
-
- private Listener _nuageVspResourceListener;
-
- @Override
- public List<Class<?>> getCommands() {
- return Lists.<Class<?>>newArrayList(
- AddNuageVspDeviceCmd.class,
- DeleteNuageVspDeviceCmd.class,
- UpdateNuageVspDeviceCmd.class,
- ListNuageVspDevicesCmd.class,
-
- DisableNuageUnderlayVlanIpRangeCmd.class,
- EnableNuageUnderlayVlanIpRangeCmd.class,
- ListNuageUnderlayVlanIpRangesCmd.class,
-
- ListNuageVspDomainTemplatesCmd.class,
- ListNuageVspGlobalDomainTemplateCmd.class,
- AssociateNuageVspDomainTemplateCmd.class
- );
- }
-
- @Override
- public NuageVspDeviceVO addNuageVspDevice(AddNuageVspDeviceCmd cmd) {
- final NuageVspResource resource = new NuageVspResource();
- final String deviceName = Network.Provider.NuageVsp.getName();
- ExternalNetworkDeviceManager.NetworkDevice networkDevice = ExternalNetworkDeviceManager.NetworkDevice.getNetworkDevice(deviceName);
- final Long physicalNetworkId = cmd.getPhysicalNetworkId();
- PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
- if (physicalNetwork == null) {
- throw new InvalidParameterValueException("Could not find phyical network with ID: " + physicalNetworkId);
- }
- long zoneId = physicalNetwork.getDataCenterId();
-
- final PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao.findByServiceProvider(physicalNetwork.getId(),
- networkDevice.getNetworkServiceProvder());
- if (ntwkSvcProvider == null) {
- throw new CloudRuntimeException("Network Service Provider: " + networkDevice.getNetworkServiceProvder() + " is not enabled in the physical network: "
- + physicalNetworkId + "to add this device");
- } else if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) {
- throw new CloudRuntimeException("Network Service Provider: " + ntwkSvcProvider.getProviderName() + " is in shutdown state in the physical network: "
- + physicalNetworkId + "to add this device");
- }
-
- if (_nuageVspDao.listByPhysicalNetwork(physicalNetworkId).size() != 0) {
- throw new CloudRuntimeException("A NuageVsp device is already configured on this physical network");
- }
-
- // While the default VSD port is 8443, clustering via HAProxy will go over port 443 (CLOUD-58)
- int port = cmd.getPort() > 0 ? cmd.getPort() : 443;
-
- try {
- String apiVersion = null;
-
- String cmsUserPasswordBase64 = NuageVspUtil.encodePassword(cmd.getPassword());
-
- NuageVspResourceConfiguration resourceConfiguration = new NuageVspResourceConfiguration()
- .guid(UUID.randomUUID().toString())
- .zoneId(String.valueOf(physicalNetwork.getDataCenterId()))
- .hostName(cmd.getHostName())
- .cmsUser(cmd.getUserName())
- .cmsUserPassword(cmsUserPasswordBase64)
- .port(String.valueOf(port))
- .apiVersion(NuageVspApiVersion.CURRENT.toString())
- .retryCount(NuageVspConstants.DEFAULT_API_RETRY_COUNT.toString())
- .retryInterval(NuageVspConstants.DEFAULT_API_RETRY_INTERVAL.toString())
- .apiRelativePath("/nuage");
-
- VspHost vspHost = resourceConfiguration.buildVspHost();
- NuageVspPluginClientLoader clientLoader = NuageVspPluginClientLoader.getClientLoader(vspHost);
- VspApiDefaults apiDefaults = clientLoader.getNuageVspManagerClient().getApiDefaults();
-
-
- if (StringUtils.isNotBlank(cmd.getApiVersion())){
- apiVersion = cmd.getApiVersion();
- if (!clientLoader.getNuageVspManagerClient().isSupportedApiVersion(apiVersion)){
- throw new CloudRuntimeException("Unsupported API version : " + cmd.getApiVersion());
- }
- } else {
- List<NuageVspApiVersion> supportedVsdVersions = clientLoader.getNuageVspManagerClient().getSupportedVersionList();
- supportedVsdVersions.retainAll(Arrays.asList(NuageVspApiVersion.SUPPORTED_VERSIONS));
-
- if(supportedVsdVersions.isEmpty()) {
- throw new CloudRuntimeException("No supported API version found!");
- }
-
- supportedVsdVersions.sort(Comparator.reverseOrder());
- apiVersion = supportedVsdVersions.get(0).toString();
- }
-
-
- String retryCount = String.valueOf(MoreObjects.firstNonNull(cmd.getApiRetryCount(), apiDefaults.getRetryCount()));
- String retryInterval = String.valueOf(MoreObjects.firstNonNull(cmd.getApiRetryInterval(), apiDefaults.getRetryInterval()));
-
- resourceConfiguration
- .apiVersion(apiVersion)
- .apiRelativePath("/nuage/api/" + apiVersion)
- .retryCount(retryCount)
- .retryInterval(retryInterval);
- Map<String, String> hostDetails = resourceConfiguration.build();
- resource.configure("Nuage VSD - " + cmd.getHostName(), Maps.<String, Object>newHashMap(hostDetails));
-
-
- Host host = _resourceMgr.addHost(zoneId, resource, Host.Type.L2Networking, hostDetails);
- if (host == null) {
- throw new CloudRuntimeException("Failed to add Nuage Vsp Device due to internal error.");
- }
-
- NuageVspDeviceVO nuageVspDevice = new NuageVspDeviceVO(host.getId(), physicalNetworkId, ntwkSvcProvider.getProviderName(), deviceName);
- _nuageVspDao.persist(nuageVspDevice);
-
- DetailVO detail = new DetailVO(host.getId(), "nuagevspdeviceid", String.valueOf(nuageVspDevice.getId()));
- _hostDetailsDao.persist(detail);
-
- NuageVspDeviceVO matchingNuageVspDevice = findMatchingNuageVspDevice(nuageVspDevice);
- String cmsId;
- if (matchingNuageVspDevice != null) {
- cmsId = findNuageVspCmsIdForDeviceOrHost(matchingNuageVspDevice.getId(), matchingNuageVspDevice.getHostId());
- } else {
- SyncNuageVspCmsIdCommand syncCmd = new SyncNuageVspCmsIdCommand(SyncType.REGISTER, null);
- SyncNuageVspCmsIdAnswer answer = (SyncNuageVspCmsIdAnswer) _agentMgr.easySend(nuageVspDevice.getHostId(), syncCmd);
- if (answer != null && answer.getSuccess()) {
- cmsId = answer.getNuageVspCmsId();
- } else {
- throw new CloudRuntimeException("Failed to register CMS ID");
- }
- }
-
- host = findNuageVspHost(nuageVspDevice.getHostId());
- registerNewNuageVspDevice(host.getId(), cmsId);
-
- resourceConfiguration.nuageVspCmsId(cmsId);
- resource.configure(cmd.getHostName(), Maps.<String, Object>newHashMap(resourceConfiguration.build()));
-
- if (matchingNuageVspDevice == null) {
- auditDomainsOnVsp((HostVO) host, true);
- }
-
- return nuageVspDevice;
- } catch (ConfigurationException e) {
- s_logger.error("Failed to configure Nuage VSD resource " + cmd.getHostName(), e);
- throw new CloudRuntimeException("Failed to configure Nuage VSD resource " + cmd.getHostName(), e);
- } catch (NuageVspException ee) {
- s_logger.error("Failed to add Nuage VSP device " + cmd.getHostName(), ee);
- throw new CloudRuntimeException("Failed to add Nuage VSP device " + cmd.getHostName(), ee);
- }
- }
-
- @Override
- public NuageVspDeviceVO updateNuageVspDevice(UpdateNuageVspDeviceCmd command) {
- NuageVspResource resource = new NuageVspResource();
- final String deviceName = Network.Provider.NuageVsp.getName();
- ExternalNetworkDeviceManager.NetworkDevice networkDevice = ExternalNetworkDeviceManager.NetworkDevice.getNetworkDevice(deviceName);
- final Long physicalNetworkId = command.getPhysicalNetworkId();
- PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
- if (physicalNetwork == null) {
- throw new InvalidParameterValueException("Could not find phyical network with ID: " + physicalNetworkId);
- }
-
- final PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao.findByServiceProvider(physicalNetwork.getId(),
- networkDevice.getNetworkServiceProvder());
- if (ntwkSvcProvider == null) {
- throw new CloudRuntimeException("Network Service Provider: " + networkDevice.getNetworkServiceProvder() + " is not enabled in the physical network: "
- + physicalNetworkId + "to add this device");
- }
- if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) {
- throw new CloudRuntimeException("Network Service Provider: " + ntwkSvcProvider.getProviderName() + " is in shutdown state in the physical network: "
- + physicalNetworkId + "to add this device");
- }
-
- HostVO nuageVspHost = null;
- NuageVspDeviceVO nuageVspDevice = null;
- List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listByPhysicalNetwork(physicalNetworkId);
- if (nuageVspDevices == null || nuageVspDevices.isEmpty()) {
- throw new CloudRuntimeException("Nuage VSD is not configured on physical network " + physicalNetworkId);
- } else {
- nuageVspDevice = nuageVspDevices.iterator().next();
- nuageVspHost = _hostDao.findById(nuageVspDevice.getHostId());
- _hostDao.loadDetails(nuageVspHost);
- }
-
- boolean resourceConfigurationChanged = false;
- NuageVspResourceConfiguration resourceConfiguration = NuageVspResourceConfiguration.fromConfiguration(nuageVspHost.getDetails());
- if (!Strings.isNullOrEmpty(command.getHostName()) &&
- !command.getHostName().equals(resourceConfiguration.hostName())) {
- resourceConfiguration.hostName(command.getHostName());
- resourceConfigurationChanged = true;
- }
-
- if (!Strings.isNullOrEmpty(command.getUserName()) &&
- !command.getUserName().equals(resourceConfiguration.cmsUser())) {
- resourceConfiguration.cmsUser(command.getUserName());
- resourceConfigurationChanged = true;
- }
-
- if (!Strings.isNullOrEmpty(command.getPassword())) {
- String encodedNewPassword = NuageVspUtil.encodePassword(command.getPassword());
- if (!encodedNewPassword.equals(resourceConfiguration.cmsUserPassword())) {
- resourceConfiguration.cmsUserPassword(encodedNewPassword);
- resourceConfigurationChanged = true;
- }
- }
-
- if (command.getPort() != null &&
- command.getPort() != Integer.parseInt(resourceConfiguration.port())) {
- resourceConfiguration.port(String.valueOf(command.getPort()));
- resourceConfigurationChanged = true;
- }
-
- String apiVersion = MoreObjects.firstNonNull(command.getApiVersion(), resourceConfiguration.apiVersion());
- NuageVspApiVersion apiVersionObj = NuageVspApiVersion.fromString(apiVersion);
- NuageVspApiVersion apiVersionCurrent = null;
- try {
- apiVersionCurrent = resourceConfiguration.getApiVersion();
- } catch (ConfigurationException e){
- throw new CloudRuntimeException("Current version is not configured correctly");
- }
-
-
- if(command.getApiVersion() != null){
- if(apiVersionObj.compareTo(apiVersionCurrent) < 0) {
- throw new CloudRuntimeException("Downgrading is not supported");
- }
-
- GetApiDefaultsCommand apiDefaultsCmd = new GetApiDefaultsCommand();
- GetApiDefaultsAnswer apiDefaultsAnswer = (GetApiDefaultsAnswer) _agentMgr.easySend(nuageVspHost.getId(), apiDefaultsCmd);
-
- SupportedApiVersionCommand supportedApiVersionCmd = new SupportedApiVersionCommand(apiVersion);
- Answer supportedApiVersionAnswer = _agentMgr.easySend(nuageVspHost.getId(), supportedApiVersionCmd);
-
- if (!supportedApiVersionAnswer.getResult()) {
- throw new CloudRuntimeException("Incorrect API version: Nuage plugin only supports " + apiDefaultsAnswer.getApiDefaults().getVersion());
- }
-
- String apiRelativePath = "/nuage/api/" + apiVersion;
- if (!apiRelativePath.equals(resourceConfiguration.apiRelativePath())) {
- resourceConfiguration.apiVersion(apiVersion);
- resourceConfiguration.apiRelativePath(apiRelativePath);
- resourceConfigurationChanged = true;
- }
-
- }
-
- if (command.getApiRetryCount() != null && resourceConfiguration.retryCount() != null) {
- final int retryCount = Integer.parseInt(resourceConfiguration.retryCount());
- if (command.getApiRetryCount() != retryCount) {
- resourceConfiguration.retryCount(String.valueOf(command.getApiRetryCount()));
- resourceConfigurationChanged = true;
- }
- }
-
- if (command.getApiRetryInterval() != null && resourceConfiguration.retryInterval() != null) {
- final int apiRetryInterval = Integer.parseInt(resourceConfiguration.retryInterval());
- if (command.getApiRetryInterval() != apiRetryInterval) {
- resourceConfiguration.retryInterval(String.valueOf(command.getApiRetryInterval()));
- resourceConfigurationChanged = true;
- }
- }
-
- if (!resourceConfigurationChanged) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("No change in the NuageVsp device parameters. None of the NuageVsp device parameters are modified");
- }
- return nuageVspDevice;
- }
-
- Map<String, String> config = resourceConfiguration.build();
- try {
- resource.validate(config);
-
- UpdateNuageVspDeviceCommand cmd = new UpdateNuageVspDeviceCommand(resourceConfiguration);
- Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd);
- if (answer == null || !answer.getResult()) {
- s_logger.error("UpdateNuageVspDeviceCommand failed");
- if ((null != answer) && (null != answer.getDetails())) {
- throw new CloudRuntimeException(answer.getDetails());
- }
- }
-
- _hostDetailsDao.persist(nuageVspDevice.getHostId(), config);
- } catch (ConfigurationException e) {
- throw new CloudRuntimeException("Failed to update Nuage VSP device " + nuageVspDevice.getId() + " with parameters " + resourceConfiguration, e);
- }
- return nuageVspDevice;
- }
-
- @Override
- public NuageVspDeviceResponse createNuageVspDeviceResponse(NuageVspDeviceVO nuageVspDeviceVO) {
- HostVO nuageVspHost = _hostDao.findById(nuageVspDeviceVO.getHostId());
- _hostDao.loadDetails(nuageVspHost);
-
- NuageVspResourceConfiguration resourceConfiguration = NuageVspResourceConfiguration.fromConfiguration(nuageVspHost.getDetails());
- NuageVspDeviceResponse response = new NuageVspDeviceResponse();
- response.setDeviceName(nuageVspDeviceVO.getDeviceName());
- PhysicalNetwork pnw = ApiDBUtils.findPhysicalNetworkById(nuageVspDeviceVO.getPhysicalNetworkId());
- if (pnw != null) {
- response.setPhysicalNetworkId(pnw.getUuid());
- }
- response.setId(nuageVspDeviceVO.getUuid());
- response.setProviderName(nuageVspDeviceVO.getProviderName());
- response.setHostName(resourceConfiguration.hostName());
- response.setPort(Integer.parseInt(resourceConfiguration.port()));
- String apiRelativePath = resourceConfiguration.apiRelativePath();
- response.setApiVersion(apiRelativePath.substring(apiRelativePath.lastIndexOf('/') + 1));
- response.setApiRetryCount(Integer.parseInt(resourceConfiguration.retryCount()));
- response.setApiRetryInterval(Long.parseLong(resourceConfiguration.retryInterval()));
- response.setCmsId(resourceConfiguration.nuageVspCmsId());
- response.setObjectName("nuagevspdevice");
- return response;
- }
-
- @Override
- public boolean deleteNuageVspDevice(DeleteNuageVspDeviceCmd cmd) {
- Long nuageDeviceId = cmd.getNuageVspDeviceId();
- NuageVspDeviceVO nuageVspDevice = _nuageVspDao.findById(nuageDeviceId);
- if (nuageVspDevice == null) {
- throw new InvalidParameterValueException("Could not find a Nuage Vsp device with id " + nuageDeviceId);
- }
-
- // Find the physical network we work for
- Long physicalNetworkId = nuageVspDevice.getPhysicalNetworkId();
- PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
- if (physicalNetwork != null) {
- // Lets see if there are networks that use us
- // Find the nuage networks on this physical network
- List<NetworkVO> networkList = _networkDao.listByPhysicalNetwork(physicalNetworkId);
-
- // Networks with broadcast type lswitch are ours
- for (NetworkVO network : networkList) {
- if (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Vsp) {
- if ((network.getState() != Network.State.Shutdown) && (network.getState() != Network.State.Destroy)) {
- throw new CloudRuntimeException("This Nuage Vsp device can not be deleted as there are one or more logical networks provisioned by Cloudstack.");
- }
- }
- }
- }
-
- NuageVspDeviceVO matchingNuageVspDevice = findMatchingNuageVspDevice(nuageVspDevice);
-
- String nuageVspCmsId = findNuageVspCmsIdForDeviceOrHost(nuageVspDevice.getId(), nuageVspDevice.getHostId());
- if (matchingNuageVspDevice == null) {
- HostVO host = findNuageVspHost(nuageVspDevice.getHostId());
- if (!auditDomainsOnVsp(host, false)) {
- return false;
- }
-
- SyncNuageVspCmsIdCommand syncCmd = new SyncNuageVspCmsIdCommand(SyncType.UNREGISTER, nuageVspCmsId);
- SyncNuageVspCmsIdAnswer answer = (SyncNuageVspCmsIdAnswer) _agentMgr.easySend(nuageVspDevice.getHostId(), syncCmd);
- if (answer == null || !answer.getSuccess()) {
- return false;
- }
- }
-
- removeLegacyNuageVspDeviceCmsId(nuageVspDevice.getId());
-
- HostVO nuageHost = _hostDao.findById(nuageVspDevice.getHostId());
- Long hostId = nuageHost.getId();
-
- nuageHost.setResourceState(ResourceState.Maintenance);
- _hostDao.update(hostId, nuageHost);
- _resourceMgr.deleteHost(hostId, false, false);
-
- _nuageVspDao.remove(nuageDeviceId);
- return true;
- }
-
- private NuageVspDeviceVO findMatchingNuageVspDevice(NuageVspDeviceVO nuageVspDevice) {
- DetailVO nuageVspDeviceHost = _hostDetailsDao.findDetail(nuageVspDevice.getHostId(), "hostname");
- String nuageVspDeviceHostName = (nuageVspDeviceHost != null) ? nuageVspDeviceHost.getValue(): null;
-
- List<NuageVspDeviceVO> otherNuageVspDevices = _nuageVspDao.listAll();
- for (NuageVspDeviceVO otherNuageVspDevice : otherNuageVspDevices) {
- if (otherNuageVspDevice.getId() == nuageVspDevice.getId()) continue;
-
- DetailVO otherNuageVspDeviceHostName = _hostDetailsDao.findDetail(otherNuageVspDevice.getHostId(), "hostname");
- if (otherNuageVspDeviceHostName != null && nuageVspDeviceHostName.equals(otherNuageVspDeviceHostName.getValue())) {
- return otherNuageVspDevice;
- }
- }
- return null;
- }
-
- @Override
- public List<NuageVspDeviceVO> listNuageVspDevices(ListNuageVspDevicesCmd cmd) {
- Long physicalNetworkId = cmd.getPhysicalNetworkId();
- Long nuageVspDeviceId = cmd.getNuageVspDeviceId();
- List<NuageVspDeviceVO> responseList = new ArrayList<NuageVspDeviceVO>();
-
- if (physicalNetworkId == null && nuageVspDeviceId == null) {
- throw new InvalidParameterValueException("Either physical network Id or Nuage device Id must be specified");
- }
-
- if (nuageVspDeviceId != null) {
- NuageVspDeviceVO nuageVspDevice = _nuageVspDao.findById(nuageVspDeviceId);
- if (nuageVspDevice == null) {
- throw new InvalidParameterValueException("Could not find Nuage Vsp device with id: " + nuageVspDeviceId);
- }
- responseList.add(nuageVspDevice);
- } else {
- PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
- if (physicalNetwork == null) {
- throw new InvalidParameterValueException("Could not find a physical network with id: " + physicalNetworkId);
- }
- responseList = _nuageVspDao.listByPhysicalNetwork(physicalNetworkId);
- }
-
- return responseList;
- }
-
- private void registerNewNuageVspDevice(long hostId, String cmsId) {
- DetailVO detail = new DetailVO(hostId, "nuagevspcmsid", cmsId);
- _hostDetailsDao.persist(detail);
- }
-
- @Deprecated
- private void removeLegacyNuageVspDeviceCmsId(long deviceId) {
- ConfigurationVO cmsIdConfig = _configDao.findByName(CMSID_CONFIG_KEY);
- if (cmsIdConfig != null) {
- if (!cmsIdConfig.getValue().contains(";") && cmsIdConfig.getValue().startsWith(deviceId + ":")) {
- _configDao.update(CMSID_CONFIG_KEY, "Advanced", "");
- } else {
- String newValue = cmsIdConfig.getValue().replace(String.format("(^|;)%d:[0-9a-f\\-]+;?", deviceId), ";");
- _configDao.update(CMSID_CONFIG_KEY, "Advanced", newValue);
- }
- }
- }
-
- public boolean executeSyncCmsId(NuageVspDeviceVO nuageVspDevice, SyncType syncType) {
- NuageVspDeviceVO matchingNuageVspDevice = findMatchingNuageVspDevice(nuageVspDevice);
- if (syncType == SyncType.REGISTER && matchingNuageVspDevice != null) {
- String cmsId = findNuageVspCmsIdForDeviceOrHost(matchingNuageVspDevice.getId(), matchingNuageVspDevice.getHostId());
- registerNewNuageVspDevice(nuageVspDevice.getHostId(), cmsId);
- return true;
- }
-
- String cmsId = findNuageVspCmsIdForDeviceOrHost(nuageVspDevice.getId(), nuageVspDevice.getHostId());
-
- SyncNuageVspCmsIdCommand syncCmd = new SyncNuageVspCmsIdCommand(syncType, cmsId);
- SyncNuageVspCmsIdAnswer answer = (SyncNuageVspCmsIdAnswer) _agentMgr.easySend(nuageVspDevice.getHostId(), syncCmd);
- if (answer != null) {
- if (answer.getSuccess()) {
- if (syncType == SyncType.REGISTER || answer.getSyncType() == SyncType.REGISTER) {
- registerNewNuageVspDevice(nuageVspDevice.getHostId(), answer.getNuageVspCmsId());
- } else if (syncType == SyncType.UNREGISTER) {
- removeLegacyNuageVspDeviceCmsId(nuageVspDevice.getId());
- }
- } else if (syncType == SyncType.AUDIT || syncType == SyncType.AUDIT_ONLY) {
- s_logger.fatal("Nuage VSP Device with ID " + nuageVspDevice.getId() + " is configured with an unknown CMS ID!");
- }
- }
-
- return answer != null && answer.getSuccess();
- }
-
- void auditHost(long hostId) {
- Host host = _hostDao.findById(hostId);
- auditHost((HostVO)host);
- }
-
- void auditHost(HostVO host) {
- if (host == null) return;
-
- _hostDao.loadDetails(host);
-
- boolean validateDomains = true;
- List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listByHost(host.getId());
- if (!CollectionUtils.isEmpty(nuageVspDevices)) {
- for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) {
- String nuageVspCmsId = findNuageVspCmsIdForDeviceOrHost(nuageVspDevice.getId(), nuageVspDevice.getHostId());
- SyncNuageVspCmsIdCommand syncCmd = new SyncNuageVspCmsIdCommand(SyncType.AUDIT, nuageVspCmsId);
- SyncNuageVspCmsIdAnswer answer = (SyncNuageVspCmsIdAnswer) _agentMgr.easySend(nuageVspDevice.getHostId(), syncCmd);
-
- if (answer != null && !answer.getSuccess()) {
- s_logger.error("Nuage VSP Device with ID " + nuageVspDevice.getId() + " is configured with an unknown CMS ID!");
- validateDomains = false;
- } else if (answer != null && answer.getSyncType() == SyncType.REGISTER) {
- registerNewNuageVspDevice(nuageVspDevice.getHostId(), answer.getNuageVspCmsId());
- }
- }
- }
-
- if (validateDomains) {
- auditDomainsOnVsp(host, true);
- }
- }
-
- private boolean auditDomainsOnVsp(HostVO host, boolean add) {
- List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listByHost(host.getId());
- if (CollectionUtils.isEmpty(nuageVspDevices)) {
- return true;
- }
-
- final SyncDomainCommand.Type action = add ? SyncDomainCommand.Type.ADD : SyncDomainCommand.Type.REMOVE;
-
- _hostDao.loadDetails(host);
- List<DomainVO> allDomains = _domainDao.listAll();
- for (DomainVO domain : allDomains) {
- if (action == SyncDomainCommand.Type.REMOVE) {
- VspDomainCleanUp vspDomainCleanUp = _nuageVspEntityBuilder.buildVspDomainCleanUp(domain);
- CleanUpDomainCommand cmd = new CleanUpDomainCommand(vspDomainCleanUp);
- Answer answer = _agentMgr.easySend(host.getId(), cmd);
- if (!answer.getResult()) {
- return false;
- }
- }
-
- VspDomain vspDomain = _nuageVspEntityBuilder.buildVspDomain(domain);
- SyncDomainCommand cmd = new SyncDomainCommand(vspDomain, action);
- Answer answer = _agentMgr.easySend(host.getId(), cmd);
- if (!answer.getResult()) {
- return false;
- }
- }
- return true;
- }
-
- private String findNuageVspCmsIdForDeviceOrHost(long deviceId, long hostId) {
- String cmsId = findNuageVspCmsIdForHostDevice(hostId);
- if(cmsId == null) {
- cmsId = findNuageVspCmsIdForDevice(deviceId);
-
- if (cmsId != null) {
- // Upgrade
- registerNewNuageVspDevice(hostId, cmsId);
- removeLegacyNuageVspDeviceCmsId(deviceId);
- }
- }
-
- return cmsId;
- }
-
- private String findNuageVspCmsIdForHostDevice(long hostId) {
- final DetailVO cmsIdDetailVO = _hostDetailsDao.findDetail(hostId, "nuagevspcmsid");
- if (cmsIdDetailVO != null) {
- return cmsIdDetailVO.getValue();
- }
- return null;
- }
-
- @Deprecated
- private String findNuageVspCmsIdForDevice(long deviceId) {
- ConfigurationVO cmsIdConfig = _configDao.findByName(CMSID_CONFIG_KEY);
- if(cmsIdConfig != null) {
- String configValue = cmsIdConfig.getValue();
- if (!Strings.isNullOrEmpty(configValue)) {
- String[] configuredNuageVspDevices = configValue.split(";");
- for (String configuredNuageVspDevice : configuredNuageVspDevices) {
- if (configuredNuageVspDevice.startsWith(deviceId + ":")) {
- String[] split = configuredNuageVspDevice.split(":");
- if (split.length != 2 || (split.length > 1 && Strings.isNullOrEmpty(split[1]))) {
- throw new IllegalArgumentException("The configured CMS ID for Nuage VSP device " + deviceId + " is in an incorrect format");
- }
- return split[1];
- }
- }
- }
- }
- return null;
- }
-
- public List<String> getDnsDetails(long dataCenterId) {
- Boolean configureDns = Boolean.valueOf(_configDao.getValue(NuageVspManager.NuageVspConfigDns.key()));
- if (!configureDns) {
- return Lists.newArrayList();
- }
-
- Boolean configureExternalDns = Boolean.valueOf(_configDao.getValue(NuageVspManager.NuageVspDnsExternal.key()));
- DataCenterVO dc = _dataCenterDao.findById(dataCenterId);
- List<String> dnsServers = new ArrayList<String>();
- if (configureExternalDns) {
- if (!Strings.isNullOrEmpty(dc.getDns1())) {
- dnsServers.add(dc.getDns1());
- }
- if (!Strings.isNullOrEmpty(dc.getDns2())) {
- dnsServers.add(dc.getDns2());
- }
- } else {
- if (!Strings.isNullOrEmpty(dc.getInternalDns1())) {
- dnsServers.add(dc.getInternalDns1());
- }
- if (!Strings.isNullOrEmpty(dc.getInternalDns2())) {
- dnsServers.add(dc.getInternalDns2());
- }
- }
- return dnsServers;
- }
-
- public List<String> getGatewaySystemIds() {
- String gatewaySystemIds = String.valueOf(_configDao.getValue(NuageVspManager.NuageVspConfigGateway.key()));
- if (!Strings.isNullOrEmpty(gatewaySystemIds)) {
- return Lists.newArrayList(gatewaySystemIds.split(","));
- }
- return Lists.newArrayList();
- }
-
-
- @Override
- public List<NuageVspDomainTemplateResponse> listNuageVspDomainTemplates(ListNuageVspDomainTemplatesCmd cmd){
- long domainId;
-
- if (cmd.getDomainId() != null) {
- domainId = cmd.getDomainId();
- } else {
- domainId = CallContext.current().getCallingAccount().getDomainId();
- }
-
- return listNuageVspDomainTemplates(domainId, cmd.getKeyword(), cmd.getZoneId(), cmd.getPhysicalNetworkId());
- }
-
- @Override
- public List<NuageVspDomainTemplateResponse> listNuageVspDomainTemplates(long domainId, String keyword, Long zoneId, Long passedPhysicalNetworkId) {
- Optional<Long> physicalNetworkId;
- Domain domain = _domainDao.findById(domainId);
- VspDomain vspDomain = _nuageVspEntityBuilder.buildVspDomain(domain);
-
- if (passedPhysicalNetworkId != null) {
- physicalNetworkId = Optional.of(passedPhysicalNetworkId);
- } else if (zoneId != null) {
- physicalNetworkId = Optional.ofNullable(getPhysicalNetworkBasedOnZone(zoneId));
- } else {
- throw new InvalidParameterValueException("No zoneid or physicalnetworkid specified.");
- }
-
- if (!physicalNetworkId.isPresent()) {
- return new LinkedList<>();
- }
-
- Long hostId = getNuageVspHostId(physicalNetworkId.get());
- if (hostId == null) {
- return new LinkedList<>();
- }
-
- ListVspDomainTemplatesCommand agentCmd = new ListVspDomainTemplatesCommand(vspDomain, keyword);
- ListVspDomainTemplatesAnswer answer = (ListVspDomainTemplatesAnswer) _agentMgr.easySend(hostId, agentCmd);
- List<VspDomainTemplate> domainTemplates = answer.getDomainTemplates();
-
- return domainTemplates.stream()
- .map(NuageVspManagerImpl::createDomainTemplateResponse)
- .collect(Collectors.toList());
- }
-
- private static NuageVspDomainTemplateResponse createDomainTemplateResponse(VspDomainTemplate dt) {
- return new NuageVspDomainTemplateResponse(dt.getName(), dt.getDescription());
- }
-
- /**
- * Returns the PhysicalNetworkId based on a zoneId
- * @param zoneId != null, the zone id for which we need to retrieve the PhysicalNetworkId
- * @return the physical network id if it's found otherwise null
- */
- private Long getPhysicalNetworkBasedOnZone(Long zoneId){
-
- Long physicalNetworkId = null;
- List<PhysicalNetworkVO> physicalNetworkVOs = _physicalNetworkDao.listByZoneAndTrafficType(zoneId, Networks.TrafficType.Guest);
- for (PhysicalNetworkVO physicalNetwok : physicalNetworkVOs) {
- if (physicalNetwok.getIsolationMethods().contains(NUAGE_VSP_ISOLATION)) {
- physicalNetworkId = physicalNetwok.getId();
- break;
- }
- }
- return physicalNetworkId;
- }
-
- @Override
- public void associateNuageVspDomainTemplate(AssociateNuageVspDomainTemplateCmd cmd){
- VpcVO vpc = _vpcDao.findById(cmd.getVpcId());
- Long physicalNetworkId;
- if (cmd.getPhysicalNetworkId() != null) {
- physicalNetworkId = cmd.getPhysicalNetworkId();
- } else if (cmd.getZoneId() != null) {
- physicalNetworkId = getPhysicalNetworkBasedOnZone(cmd.getZoneId());
- } else {
- throw new InvalidParameterValueException("No zoneid or physicalnetworkid specified.");
- }
-
- EntityExistsCommand entityCmd = new EntityExistsCommand(VpcVO.class, vpc.getUuid());
- boolean exists = entityExist(entityCmd, physicalNetworkId);
- if (exists) {
- throw new CloudRuntimeException("Failed to associate domain template, VPC is already pushed to the Nuage VSP device.");
- }
-
- if (!checkIfDomainTemplateExist(vpc.getDomainId(), cmd.getDomainTemplate(), cmd.getZoneId(), cmd.getPhysicalNetworkId())) {
- throw new InvalidParameterValueException("Could not find a Domain Template with name: " + cmd.getDomainTemplate());
- }
- setPreConfiguredDomainTemplateName(cmd.getVpcId(), cmd.getDomainTemplate());
- }
-
- @Override
- public boolean checkIfDomainTemplateExist(Long domainId, String domainTemplate, Long zoneId, Long physicalNetworkId){
- List<NuageVspDomainTemplateResponse> domainTemplateList = listNuageVspDomainTemplates(domainId, domainTemplate, zoneId, physicalNetworkId);
- if (domainTemplateList != null) {
- for (NuageVspDomainTemplateResponse val : domainTemplateList) {
- if (val.getName().equals(domainTemplate)) {
- return true;
- }
- }
- }
- return false;
- }
-
- @Override
- public void updateBroadcastUri(Network network) throws InsufficientVirtualNetworkCapacityException {
- NetworkVO updatedNetwork = _networkDao.createForUpdate(network.getId());
- URI broadcastUri = calculateBroadcastUri(network);
- if (!broadcastUri.equals(network.getBroadcastUri())) {
- updatedNetwork.setBroadcastUri(broadcastUri);
- _networkDao.update(network.getId(), updatedNetwork);
- }
- }
-
- @Override
- public URI calculateBroadcastUri(Network network) throws InsufficientVirtualNetworkCapacityException {
- String vrIp = calculateVirtualRouterIp(network);
- return Networks.BroadcastDomainType.Vsp.toUri(network.getUuid() + "/" + vrIp);
- }
-
- private boolean usesVirtualRouter(long networkOfferingId) {
- return _networkOfferingServiceMapDao.isProviderForNetworkOffering(networkOfferingId, Network.Provider.VirtualRouter) ||
- _networkOfferingServiceMapDao.isProviderForNetworkOffering(networkOfferingId, Network.Provider.VPCVirtualRouter);
- }
-
- private String calculateVirtualRouterIp(Network network)
- throws InsufficientVirtualNetworkCapacityException {
- if (!usesVirtualRouter(network.getNetworkOfferingId())) {
- return null;
- }
-
- List<Pair<String, String>> ipAddressRanges =
- network.getGuestType() == Network.GuestType.Shared ? getSharedIpAddressRanges(network.getId()) : getIpAddressRanges(network);
-
- //check if a vr might be present already or not? CLOUD-1216 - before we always picked .2
- List<VMInstanceVO> vrs =_vmInstanceDao.listNonRemovedVmsByTypeAndNetwork(network.getId(), VirtualMachine.Type.DomainRouter);
-
- for (VMInstanceVO vr : vrs) {
- return _nicDao.listByVmIdAndNicIdAndNtwkId(vr.getId(), null, network.getId()).get(0).getIPv4Address();
- }
-
- ensureIpCapacity(network, ipAddressRanges);
-
- if(network.getGuestType() == Network.GuestType.Shared) {
- return ipAddressRanges.stream()
- .sorted(Comparator.comparingLong(p -> NetUtils.ip2Long(p.getLeft())))
- .findFirst()
- .map(Pair::getLeft)
- .orElseThrow(() -> new IllegalArgumentException("Shared network without ip ranges? How can this happen?"));
- }
-
- Network networkToCheck;
- if (isMigratingNetwork(network)) {
- networkToCheck = _networkDao.findById(network.getRelated());
- } else {
- networkToCheck = network;
- }
-
- Long freeIp = _networkModel.getAvailableIps(networkToCheck, null)
- .stream()
- .findFirst()
- .orElseThrow(() -> new InsufficientVirtualNetworkCapacityException("There is no free ip available for the VirtualRouter.",
- Network.class,
- network.getId()));
-
- return NetUtils.long2Ip(freeIp);
- }
-
- private List<Pair<String, String>> getSharedIpAddressRanges(long networkId) {
- List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(networkId);
- List<Pair<String, String>> ipAddressRanges = Lists.newArrayList();
- for (VlanVO vlan : vlans) {
- Pair<String, String> ipAddressRange = NuageVspUtil.getIpAddressRange(vlan);
- if (ipAddressRange != null) {
- ipAddressRanges.add(ipAddressRange);
- }
- }
- 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);
- Set<Long> allIPsInCidr = NetUtils.getAllIpsFromCidr(subnet, cidrSize, new HashSet<Long>());
- if (allIPsInCidr == null || !(allIPsInCidr instanceof TreeSet)) {
- throw new IllegalStateException("The IPs in CIDR for subnet " + subnet + " where null or returned in a non-ordered set.");
- }
-
- Iterator<Long> ipIterator = allIPsInCidr.iterator();
- long ip = ipIterator.next();
- 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)));
- }
-
- return ipAddressRanges;
- }
-
- private void ensureIpCapacity(Network network, List<Pair<String, String>> ipAddressRanges) throws InsufficientVirtualNetworkCapacityException {
- long ipCount = ipAddressRanges.stream()
- .mapToLong(this::getIpCount)
- .sum();
-
- 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 (ipCount < 3) {
- throw new InsufficientVirtualNetworkCapacityException("VSP allocates an IP for VirtualRouter." + " So, subnet should have atleast minimum 3 hosts", Network.class,
- network.getId());
- }
- }
-
- private boolean isMigratingNetwork(Network network) {
- return network.getRelated() != network.getId();
- }
-
- private long getIpCount(Pair<String, String> ipAddressRange) {
- return NetUtils.ip2Long(ipAddressRange.getRight()) - NetUtils.ip2Long(ipAddressRange.getLeft()) + 1;
- }
-
- @Override
- public boolean entityExist(EntityExistsCommand cmd, Long physicalNetworkId){
- Long hostId = getNuageVspHostId(physicalNetworkId);
- if (hostId == null) {
- throw new CloudRuntimeException("There is no Nuage VSP device configured on physical network " + physicalNetworkId);
- }
-
- Answer answer = _agentMgr.easySend(hostId, cmd);
- if (answer != null) {
- return answer.getResult();
- }
- throw new CloudRuntimeException("No answer received from the client");
- }
-
- /**
- * Sets the preconfigured domain template of a vpc to the given value.
- * @param vpcId
- * @param domainTemplateName
- */
- private void setPreConfiguredDomainTemplateName(long vpcId, String domainTemplateName) {
- //remove the previous nuageDomainTemplate if it is present.
- if (_vpcDetailsDao.findDetail(vpcId, NuageVspManager.nuageDomainTemplateDetailName) != null) {
- _vpcDetailsDao.removeDetail(vpcId, NuageVspManager.nuageDomainTemplateDetailName);
- }
- VpcDetailVO vpcDetail = new VpcDetailVO(vpcId, NuageVspManager.nuageDomainTemplateDetailName, domainTemplateName, false);
- _vpcDetailsDao.persist(vpcDetail);
- }
-
- @Override
- public void setPreConfiguredDomainTemplateName(Network network, String domainTemplateName) {
-
- if (network.getVpcId() != null) {
- setPreConfiguredDomainTemplateName(network.getVpcId(), domainTemplateName);
- } else {
- NetworkDetailVO networkDetail = new NetworkDetailVO(network.getId(), NuageVspManager.nuageDomainTemplateDetailName, domainTemplateName, false);
- _networkDetailsDao.persist(networkDetail);
- }
- }
-
- @Override
- public String getPreConfiguredDomainTemplateName(Network network) {
-
- if (network.getVpcId() != null) {
- VpcDetailVO domainTemplateNetworkDetail = _vpcDetailsDao.findDetail(network.getVpcId(), NuageVspManager.nuageDomainTemplateDetailName);
- if (domainTemplateNetworkDetail != null) {
- return domainTemplateNetworkDetail.getValue();
- }
-
- return NuageVspVpcDomainTemplateName.value();
- } else {
- NetworkDetailVO domainTemplateNetworkDetail = _networkDetailsDao.findDetail(network.getId(), NuageVspManager.nuageDomainTemplateDetailName);
- if (domainTemplateNetworkDetail != null) {
- return domainTemplateNetworkDetail.getValue();
- }
-
- if (network.getGuestType() == Network.GuestType.Shared) {
- return NuageVspSharedNetworkDomainTemplateName.value();
- }
-
- return NuageVspIsolatedNetworkDomainTemplateName.value();
- }
- }
-
- @Override
- public HostVO getNuageVspHost(long physicalNetworkId) {
- HostVO nuageVspHost;
- List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listByPhysicalNetwork(physicalNetworkId);
- if (CollectionUtils.isEmpty(nuageVspDevices)) {
- // Perhaps another physical network is passed from within the same zone, find the VSP physical network in that case
- PhysicalNetwork physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
- List<PhysicalNetworkVO> physicalNetworksInZone = _physicalNetworkDao.listByZone(physicalNetwork.getDataCenterId());
- for (PhysicalNetworkVO physicalNetworkInZone : physicalNetworksInZone) {
- if (physicalNetworkInZone.getIsolationMethods().contains(NUAGE_VSP_ISOLATION)) {
- nuageVspDevices = _nuageVspDao.listByPhysicalNetwork(physicalNetworkInZone.getId());
- break;
- }
- }
- }
-
- if (CollectionUtils.isNotEmpty(nuageVspDevices)) {
- NuageVspDeviceVO config = nuageVspDevices.iterator().next();
- nuageVspHost = _hostDao.findById(config.getHostId());
- _hostDao.loadDetails(nuageVspHost);
- } else {
- throw new CloudRuntimeException("There is no Nuage VSP device configured on physical network " + physicalNetworkId);
- }
- return nuageVspHost;
- }
-
- @Override
- public boolean updateNuageUnderlayVlanIpRange(long vlanIpRangeId, boolean enabled) {
- VlanVO staticNatVlan = _vlanDao.findById(vlanIpRangeId);
- HostVO nuageVspHost = getNuageVspHost(staticNatVlan.getPhysicalNetworkId());
- EntityExistsCommand<Vlan> cmd = new EntityExistsCommand<Vlan>(Vlan.class, staticNatVlan.getUuid());
- Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmd);
- if (answer != null && !answer.getResult()) {
- _vlanDetailsDao.addDetail(staticNatVlan.getId(), NuageVspManager.nuageUnderlayVlanIpRangeDetailKey, String.valueOf(enabled), false);
- return true;
- }
-
- return false;
- }
-
- @Override
- public List<NuageVlanIpRangeResponse> filterNuageVlanIpRanges(List<? extends Vlan> vlanIpRanges, Boolean underlay) {
- List<NuageVlanIpRangeResponse> nuageVlanIpRanges = Lists.newArrayList();
- for (Vlan vlanIpRange : vlanIpRanges) {
- NuageVlanIpRangeResponse nuageVlanIpRange = (NuageVlanIpRangeResponse) _responseGenerator.createVlanIpRangeResponse(NuageVlanIpRangeResponse.class, vlanIpRange);
-
- VlanDetailsVO nuageUnderlayDetail = _vlanDetailsDao.findDetail(vlanIpRange.getId(), NuageVspManager.nuageUnderlayVlanIpRangeDetailKey);
- boolean underlayEnabled = nuageUnderlayDetail != null && nuageUnderlayDetail.getValue().equalsIgnoreCase(String.valueOf(true));
- nuageVlanIpRange.setUnderlay(underlayEnabled);
- if (underlay == null || underlayEnabled == underlay) {
- nuageVlanIpRanges.add(nuageVlanIpRange);
- }
- nuageVlanIpRange.setObjectName("nuagevlaniprange");
- }
- return nuageVlanIpRanges;
- }
-
- @Override
- public boolean preStateTransitionEvent(Status oldState, Status.Event event, Status newState, Host host, boolean status, Object opaque) {
- return true;
- }
-
- @Override
- public boolean postStateTransitionEvent(StateMachine2.Transition<Status, Status.Event> transition, Host vo, boolean status, Object opaque) {
- // Whenever a Nuage VSP Host comes up, check if all CS domains are present and check if the CMS ID is valid
- if (transition.getToState() == Status.Up && vo instanceof HostVO) {
- auditHost((HostVO) vo);
- }
- return true;
- }
-
- @Override
- public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
- initMessageBusListeners();
- initNuageVspResourceListeners();
- initNuageVspVpcOffering();
- Status.getStateMachine().registerListener(this);
- return true;
- }
-
- @DB
- private void initMessageBusListeners() {
- // Create corresponding enterprise and profile in VSP when creating a CS Domain
- _messageBus.subscribe(DomainManager.MESSAGE_ADD_DOMAIN_EVENT, (senderAddress, subject, args) -> {
- Long domainId = (Long) args;
- Domain domain = _domainDao.findById(domainId);
-
- try {
- _domainDao.acquireInLockTable(domain.getId());
-
- List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listAll();
- for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) {
- VspDomain vspDomain = _nuageVspEntityBuilder.buildVspDomain(domain);
- SyncDomainCommand cmd = new SyncDomainCommand(vspDomain, SyncDomainCommand.Type.ADD);
- _agentMgr.easySend(nuageVspDevice.getHostId(), cmd);
- }
- } finally {
- _domainDao.releaseFromLockTable(domain.getId());
- }
- });
-
- // Clean up corresponding resources in VSP when deleting a CS Domain
- _messageBus.subscribe(DomainManager.MESSAGE_PRE_REMOVE_DOMAIN_EVENT, (senderAddress, subject, args) -> {
- DomainVO domain = (DomainVO) args;
- List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listAll();
- for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) {
- VspDomainCleanUp vspDomainCleanUp = _nuageVspEntityBuilder.buildVspDomainCleanUp(domain);
- CleanUpDomainCommand cmd = new CleanUpDomainCommand(vspDomainCleanUp);
- _agentMgr.easySend(nuageVspDevice.getHostId(), cmd);
- }
- });
-
- // Delete corresponding enterprise and profile in VSP when deleting a CS Domain
- _messageBus.subscribe(DomainManager.MESSAGE_REMOVE_DOMAIN_EVENT, (senderAddress, subject, args) -> {
- DomainVO domain = (DomainVO) args;
- List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listAll();
- for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) {
- VspDomain vspDomain = _nuageVspEntityBuilder.buildVspDomain(domain);
- SyncDomainCommand syncCmd = new SyncDomainCommand(vspDomain, SyncDomainCommand.Type.REMOVE);
- _agentMgr.easySend(nuageVspDevice.getHostId(), syncCmd);
- }
- });
- }
-
- private class NuageVspResourceListener extends AbstractListener {
- @Override
- public boolean processCommands(long agentId, long seq, Command[] commands) {
- if (commands != null && commands.length == 1) {
- Command command = commands[0];
- if (command instanceof PingNuageVspCommand) {
- PingNuageVspCommand pingNuageVspCommand = (PingNuageVspCommand)command;
- if (pingNuageVspCommand.shouldAudit()) {
- auditHost(pingNuageVspCommand.getHostId());
- }
- }
- }
- return true;
- }
- }
-
- @DB
- private void initNuageVspResourceListeners() {
- _agentMgr.registerForHostEvents(new NuageVspResourceListener(), false, true, false);
- }
-
- private Long getNuageVspHostId(long physicalNetworkId) {
- List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listByPhysicalNetwork(physicalNetworkId);
- if (nuageVspDevices != null && (!nuageVspDevices.isEmpty())) {
- NuageVspDeviceVO config = nuageVspDevices.iterator().next();
- return config.getHostId();
- }
-
- return null;
- }
-
- @DB
- private void initNuageVspVpcOffering() {
- //configure default Nuage VSP vpc offering
- Transaction.execute(new TransactionCallbackNoReturn() {
- @Override
- public void doInTransactionWithoutResult(TransactionStatus status) {
- VpcOffering offering = _vpcOffDao.findByUniqueName(nuageVPCOfferingName);
- if (offering == null) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Creating default Nuage VPC offering " + nuageVPCOfferingName);
- }
-
- createVpcOffering(nuageVPCOfferingName, nuageVPCOfferingDisplayText, DEFAULT_NUAGE_VSP_VPC_SERVICE_MAP, true, VpcOffering.State.Enabled, null);
- } else {
- updateVpcOffering(offering, DEFAULT_NUAGE_VSP_VPC_SERVICE_MAP);
- }
- }
- });
- }
-
- @DB
- protected VpcOffering createVpcOffering(final String name, final String displayText, final Multimap<Network.Service, Network.Provider> svcProviderMap, final boolean isDefault,
- final VpcOffering.State state, final Long serviceOfferingId) {
- return Transaction.execute((TransactionCallback<VpcOffering>)status -> createVpcOfferingInTransaction(name, displayText, svcProviderMap, isDefault, state, serviceOfferingId));
- }
-
- private VpcOffering createVpcOfferingInTransaction(String name, String displayText, Multimap<Network.Service, Network.Provider> svcProviderMap, boolean isDefault,
- VpcOffering.State state, Long serviceOfferingId) {
- // create vpc offering object
- VpcOfferingVO offering = new VpcOfferingVO(name, displayText, isDefault, serviceOfferingId, false, false);
-
- if (state != null) {
- offering.setState(state);
- }
- if (s_logger.isDebugEnabled()) {
- s_logger.debug(String.format("Adding vpc offering %s", offering));
- }
- offering = _vpcOffDao.persist(offering);
- // populate services and providers
- if (svcProviderMap != null) {
- for (Map.Entry<Network.Service, Network.Provider> entry : svcProviderMap.entries()) {
- Network.Service service = entry.getKey();
- Network.Provider provider = entry.getValue();
-
- VpcOfferingServiceMapVO offService = new VpcOfferingServiceMapVO(offering.getId(), service, provider);
- _vpcOffSvcMapDao.persist(offService);
- if (s_logger.isTraceEnabled()) {
- s_logger.trace(String.format("Added service for the vpc offering: %s with provider %s", offService, provider.getName()));
- }
- }
- }
-
- return offering;
- }
-
- @DB
- protected void updateVpcOffering(final VpcOffering offering, final Multimap<Network.Service, Network.Provider> svcProviderMap) {
- Transaction.execute((TransactionCallback<VpcOffering>)status -> updateVpcOfferingInTransaction(offering, svcProviderMap));
- }
-
- @Nonnull
- private VpcOffering updateVpcOfferingInTransaction(VpcOffering offering, Multimap<Network.Service, Network.Provider> svcProviderMap) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug(String.format("Updating vpc offering %s", offering));
- }
-
- List<VpcOfferingServiceMapVO> currentVpcOfferingServices = _vpcOffSvcMapDao.listByVpcOffId(offering.getId());
- Multimap<Network.Service, Network.Provider> currentSvcProviderMap = HashMultimap.create();
- for (VpcOfferingServiceMapVO vpcOfferingService : currentVpcOfferingServices) {
- Network.Service service = Network.Service.getService(vpcOfferingService.getService());
- Network.Provider provider = Network.Provider.getProvider(vpcOfferingService.getProvider());
- currentSvcProviderMap.put(service, provider);
- }
-
- for (Map.Entry<Network.Service, Network.Provider> entry : svcProviderMap.entries()) {
- Network.Service service = entry.getKey();
- Network.Provider provider = entry.getValue();
-
- if (!currentSvcProviderMap.containsEntry(service, provider)) {
- VpcOfferingServiceMapVO offService = new VpcOfferingServiceMapVO(offering.getId(), service, provider);
- _vpcOffSvcMapDao.persist(offService);
- if (s_logger.isDebugEnabled()) {
- s_logger.debug(String.format("Added service for the vpc offering: %s", offService));
- }
- }
-
- }
-
- return offering;
- }
-
- private HostVO findNuageVspHost(long hostId) {
- HostVO host = _hostDao.findById(hostId);
- _hostDao.loadDetails(host);
- return host;
- }
-
- @Override
- public String getConfigComponentName() {
- return NuageVspManager.class.getSimpleName();
- }
-
- @Override
- public ConfigKey<?>[] getConfigKeys() {
- return Arrays.copyOf(NUAGE_VSP_CONFIG_KEYS, NUAGE_VSP_CONFIG_KEYS.length);
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/NuageVspRequestWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/NuageVspRequestWrapper.java
deleted file mode 100644
index 2a0e0bf..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/NuageVspRequestWrapper.java
+++ /dev/null
@@ -1,78 +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 com.cloud.network.resource;
-
-import java.util.Hashtable;
-import java.util.Set;
-
-import org.reflections.Reflections;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.resource.CommandWrapper;
-import com.cloud.resource.RequestWrapper;
-import com.cloud.resource.ServerResource;
-
-public class NuageVspRequestWrapper extends RequestWrapper {
-
- private static NuageVspRequestWrapper instance;
-
- @SuppressWarnings("rawtypes")
- private final static Set<Class<? extends CommandWrapper>> baseSet;
-
- static {
- Reflections baseWrappers = new Reflections("com.cloud.network.vsp.resource.wrapper");
- baseSet = baseWrappers.getSubTypesOf(CommandWrapper.class);
- instance = new NuageVspRequestWrapper();
- }
-
- private NuageVspRequestWrapper() {
- init();
- }
-
- @SuppressWarnings("rawtypes")
- private void init() {
- // NuageVspResource commands
- final Hashtable<Class<? extends Command>, CommandWrapper> vspCommands = processAnnotations(baseSet);
-
- resources.put(NuageVspResource.class, vspCommands);
- }
-
- public static NuageVspRequestWrapper getInstance() {
- return instance;
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public Answer execute(final Command command, final ServerResource serverResource) {
- final Class<? extends ServerResource> resourceClass = serverResource.getClass();
-
- final Hashtable<Class<? extends Command>, CommandWrapper> resourceCommands = retrieveResource(command, resourceClass);
-
- CommandWrapper<Command, Answer, ServerResource> commandWrapper = retrieveCommands(command.getClass(), resourceCommands);
-
- while (commandWrapper == null) {
- //Could not find the command in the given resource, will traverse the family tree.
- commandWrapper = retryWhenAllFails(command, resourceClass, resourceCommands);
- }
-
- return commandWrapper.execute(command, serverResource);
- }
-}
\ No newline at end of file
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/NuageVspResource.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/NuageVspResource.java
deleted file mode 100644
index 74b9c1d..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/NuageVspResource.java
+++ /dev/null
@@ -1,310 +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 com.cloud.network.resource;
-
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.stream.Collectors;
-import javax.naming.ConfigurationException;
-
-import org.apache.log4j.Logger;
-import com.google.common.base.Strings;
-
-import net.nuage.vsp.acs.client.api.NuageVspAclClient;
-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.NuageVspPluginClientLoader;
-import net.nuage.vsp.acs.client.api.model.VspHost;
-import net.nuage.vsp.acs.client.common.RequestType;
-import net.nuage.vsp.acs.client.common.model.NuageVspEntity;
-import net.nuage.vsp.acs.client.exception.NuageVspException;
-
-import com.cloud.agent.IAgentControl;
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.PingCommand;
-import com.cloud.agent.api.PingNuageVspCommand;
-import com.cloud.agent.api.StartupCommand;
-import com.cloud.agent.api.StartupVspCommand;
-import com.cloud.host.Host;
-import com.cloud.resource.ServerResource;
-import com.cloud.utils.component.ManagerBase;
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.mgmt.JmxUtil;
-
-public class NuageVspResource extends ManagerBase implements ServerResource, VspStatisticsMBean {
- private static final Logger s_logger = Logger.getLogger(NuageVspResource.class);
-
- private String _guid;
- private String _zoneId;
- private String _hostName;
- private boolean _shouldAudit = true;
-
- private VspHost _vspHost;
-
- private static final String NUAGE_VSP_PLUGIN_ERROR_MESSAGE = "Nuage Vsp plugin client is not installed";
- protected NuageVspPluginClientLoader _clientLoader;
-
- public VspHost validate(Map<String, ?> params) throws ConfigurationException {
- return validate(NuageVspResourceConfiguration.fromConfiguration(params));
- }
-
- public VspHost validate(NuageVspResourceConfiguration configuration) throws ConfigurationException {
- configuration.validate();
-
- VspHost newVspHost = configuration.buildVspHost();
-
-
- if (!newVspHost.getApiVersion().isSupported()) {
- s_logger.warn(String.format("[UPGRADE] API version %s of Nuage Vsp Device %s should be updated.", newVspHost.getApiVersion(), configuration.hostName()));
- }
-
- _guid = configuration.guid();
- _zoneId = configuration.zoneId();
- _hostName = configuration.hostName();
- _name = configuration.name();
-
- try {
- final NuageVspPluginClientLoader clientLoader = getClientLoader(newVspHost);
- clientLoader.getNuageVspApiClient().login();
-
- _vspHost = newVspHost;
- _clientLoader = clientLoader;
- } catch (NuageVspException e) {
- s_logger.error(e.getMessage(), e);
- throw new CloudRuntimeException(e.getMessage(), e);
- }
-
- return _vspHost;
- }
-
- @Override
- public long getVSDStatistics() {
- return _clientLoader.getNuageVspStatistics().getVsdCount();
- }
-
-
- @Override
- public long getVsdStatisticsByEntityType(String entity) {
- try {
- NuageVspEntity nuageVspEntity = NuageVspEntity.valueOf(entity);
- return _clientLoader.getNuageVspStatistics().getVsdCount(nuageVspEntity);
- } catch (IllegalArgumentException e) {
- return -1;
- }
- }
-
- @Override
- public long getVsdStatisticsByRequestType(String requestType) {
- try {
- RequestType requestTypeValue = RequestType.valueOf(requestType);
- return _clientLoader.getNuageVspStatistics().getVsdCount(requestTypeValue);
- } catch (IllegalArgumentException e) {
- return -1;
- }
-
- }
-
- @Override
- public long getVsdStatisticsByEntityAndRequestType(String entity, String requestType) {
- try {
- RequestType requestTypeValue = RequestType.valueOf(requestType);
- NuageVspEntity nuageVspEntity = NuageVspEntity.valueOf(entity);
- return _clientLoader.getNuageVspStatistics().getVsdCount(nuageVspEntity, requestTypeValue);
- } catch (IllegalArgumentException e) {
- return -1;
- }
- }
-
- private static Map<String, AtomicLong> convertHashMap(Map<RequestType, AtomicLong> map) {
- return map.entrySet()
- .stream()
- .collect(Collectors.toMap(
- e -> e.getKey().toString(),
- Map.Entry::getValue)
- );
- }
-
- @Override
- public Map<String, Map<String, AtomicLong>> getVsdStatisticsReport() {
- return _clientLoader.getNuageVspStatistics()
- .getVsdCountReport()
- .entrySet().stream()
- .collect(Collectors.toMap(
- e -> e.getKey().toString(),
- e -> convertHashMap(e.getValue())
- ));
- }
-
- @Override
- public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
- if(super.configure(name, params)) {
- validate(params);
- }
- return true;
- }
-
- protected void login() throws ConfigurationException, NuageVspException {
- getNuageVspApiClient().login();
- }
-
- protected NuageVspPluginClientLoader getClientLoader(VspHost vspHost) {
- return NuageVspPluginClientLoader.getClientLoader(vspHost);
- }
-
- @Override
- public boolean start() {
- try {
- JmxUtil.registerMBean("NuageVspResource", _name, new VspStatisticsMBeanImpl(this));
- } catch (Exception e) {
- s_logger.warn("Unable to initialize statistics Mbean", e);
- }
-
- return true;
-
- }
-
- @Override
- public boolean stop() {
-
- try {
- JmxUtil.unregisterMBean("NuageVspResource", _name);
- } catch (Exception e) {
- s_logger.warn("Unable to stop NuageVspResource", e);
- }
-
- return true;
- }
-
- @Override
- public Host.Type getType() {
- return Host.Type.L2Networking;
- }
-
- @Override
- public StartupCommand[] initialize() {
- StartupVspCommand sc = new StartupVspCommand();
- sc.setGuid(_guid);
- sc.setName(_name);
- sc.setDataCenter(_zoneId);
- sc.setPod("");
- sc.setPrivateIpAddress("");
- sc.setStorageIpAddress("");
- sc.setVersion(NuageVspResource.class.getPackage().getImplementationVersion());
- return new StartupCommand[] {sc};
- }
-
- @Override
- public PingCommand getCurrentStatus(long id) {
- if (Strings.isNullOrEmpty(_vspHost.getRestRelativePath())) {
- s_logger.error("Refusing to ping Nuage VSD because the resource configuration is missing the relative path information");
- _shouldAudit = true;
- return null;
- }
-
- if (Strings.isNullOrEmpty(_vspHost.getCmsUserLogin()) || Strings.isNullOrEmpty(_vspHost.getCmsUserPassword())) {
- s_logger.error("Refusing to ping Nuage VSD because the resource configuration is missing the CMS user information");
- _shouldAudit = true;
- return null;
- }
-
- try {
- login();
- } catch (NuageVspException | ConfigurationException e) {
- s_logger.error("Failed to ping to Nuage VSD on " + _name + " as user " +_vspHost.getCmsUserLogin(), e);
- _shouldAudit = true;
- return null;
- }
- PingNuageVspCommand pingNuageVspCommand = new PingNuageVspCommand(Host.Type.L2Networking, id, _shouldAudit);
- _shouldAudit = false;
- return pingNuageVspCommand;
- }
-
- public boolean getStatus() {
- try {
- login();
- return true;
- } catch (NuageVspException | ConfigurationException e) {
- s_logger.error("Failed to ping to Nuage VSD on " + _name + " as user " +_vspHost.getCmsUserLogin(), e);
- return false;
- }
- }
-
- @Override
- public Answer executeRequest(final Command cmd) {
- final NuageVspRequestWrapper wrapper = NuageVspRequestWrapper.getInstance();
- try {
- return wrapper.execute(cmd, this);
- } catch (final Exception e) {
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Received unsupported command " + cmd.toString(), e);
- }
- return Answer.createUnsupportedCommandAnswer(cmd);
- }
- }
-
- @Override
- public void disconnected() {
- }
-
- @Override
- public IAgentControl getAgentControl() {
- return null;
- }
-
- @Override
- public void setAgentControl(IAgentControl agentControl) {
- }
-
- protected void assertNuageVspClientsLoaded() throws ConfigurationException {
- if (_clientLoader == null) {
- throw new ConfigurationException(NUAGE_VSP_PLUGIN_ERROR_MESSAGE);
- }
- }
-
- public NuageVspApiClient getNuageVspApiClient() throws ConfigurationException {
- assertNuageVspClientsLoaded();
- return _clientLoader.getNuageVspApiClient();
-
- }
-
- public NuageVspGuruClient getNuageVspGuruClient() throws ConfigurationException {
- assertNuageVspClientsLoaded();
- return _clientLoader.getNuageVspGuruClient();
- }
-
- public NuageVspAclClient getNuageVspAclClient() throws ConfigurationException {
- assertNuageVspClientsLoaded();
- return _clientLoader.getNuageVspAclClient();
- }
-
- public NuageVspElementClient getNuageVspElementClient() throws ConfigurationException {
- assertNuageVspClientsLoaded();
- return _clientLoader.getNuageVspElementClient();
- }
-
- public NuageVspManagerClient getNuageVspManagerClient() throws ConfigurationException {
- assertNuageVspClientsLoaded();
- return _clientLoader.getNuageVspManagerClient();
- }
-
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/NuageVspResourceConfiguration.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/NuageVspResourceConfiguration.java
deleted file mode 100644
index 71d7390..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/NuageVspResourceConfiguration.java
+++ /dev/null
@@ -1,360 +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 com.cloud.network.resource;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-
-import javax.naming.ConfigurationException;
-
-import net.nuage.vsp.acs.client.api.model.NuageVspUser;
-import net.nuage.vsp.acs.client.api.model.VspHost;
-import net.nuage.vsp.acs.client.common.NuageVspApiVersion;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-import com.google.common.base.Preconditions;
-
-import com.cloud.util.NuageVspUtil;
-
-public class NuageVspResourceConfiguration {
- private static final String NAME = "name";
- private static final String GUID = "guid";
- private static final String ZONE_ID = "zoneid";
- private static final String HOST_NAME = "hostname";
- private static final String CMS_USER = "cmsuser";
- private static final String CMS_USER_PASSWORD = "cmsuserpass";
- private static final String PORT = "port";
- private static final String API_VERSION = "apiversion";
- private static final String API_RELATIVE_PATH = "apirelativepath";
- private static final String RETRY_COUNT = "retrycount";
- private static final String RETRY_INTERVAL = "retryinterval";
- private static final String NUAGE_VSP_CMS_ID = "nuagevspcmsid";
-
- private static final String CMS_USER_ENTEPRISE_NAME = "CSP";
-
- private String _name;
- private String _guid;
- private String _zoneId;
- private String _hostName;
- private String _cmsUser;
- private String _cmsUserPassword;
- private String _port;
- private String _apiVersion;
- private String _apiRelativePath;
- private String _retryCount;
- private String _retryInterval;
- private String _nuageVspCmsId;
-
- public String name() {
- return _name;
- }
-
- public String guid() {
- return this._guid;
- }
-
- public NuageVspResourceConfiguration guid(String guid) {
- this._guid = guid;
- return this;
- }
-
- public String zoneId() {
- return this._zoneId;
- }
-
- public NuageVspResourceConfiguration zoneId(String zoneId) {
- this._zoneId = zoneId;
- return this;
- }
-
- public String hostName() {
- return this._hostName;
- }
-
- public NuageVspResourceConfiguration hostName(String hostName) {
- this._hostName = hostName;
- this._name = "Nuage VSD - " + _hostName;
- return this;
- }
-
- public String cmsUser() {
- return this._cmsUser;
- }
-
- public NuageVspResourceConfiguration cmsUser(String cmsUser) {
- this._cmsUser = cmsUser;
- return this;
- }
-
- public String cmsUserPassword() {
- return this._cmsUserPassword;
- }
-
- public NuageVspResourceConfiguration cmsUserPassword(String cmsUserPassword) {
- this._cmsUserPassword = cmsUserPassword;
- return this;
- }
-
- public String port() {
- return this._port;
- }
-
- public NuageVspResourceConfiguration port(String port) {
- this._port = port;
- return this;
- }
-
- public String apiVersion() {
- return this._apiVersion;
- }
-
- public NuageVspResourceConfiguration apiVersion(String apiVersion) {
- this._apiVersion = apiVersion;
- return this;
- }
-
- public String apiRelativePath() {
- return this._apiRelativePath;
- }
-
- public NuageVspResourceConfiguration apiRelativePath(String apiRelativePath) {
- this._apiRelativePath = apiRelativePath;
- return this;
- }
-
- public String retryCount() {
- return this._retryCount;
- }
-
- public NuageVspResourceConfiguration retryCount(String retryCount) {
- this._retryCount = retryCount;
- return this;
- }
-
- public String retryInterval() {
- return this._retryInterval;
- }
-
- public NuageVspResourceConfiguration retryInterval(String retryInterval) {
- this._retryInterval = retryInterval;
- return this;
- }
-
- public String nuageVspCmsId() {
- return this._nuageVspCmsId;
- }
-
- public NuageVspResourceConfiguration nuageVspCmsId(String nuageVspCmsId) {
- this._nuageVspCmsId = nuageVspCmsId;
- return this;
- }
-
- public String getRootPath(){
- return "https://" + _hostName + ":" + _port + "/nuage";
- }
-
- public String getApiPath() {
- return "https://" + _hostName + ":" + _port + "/nuage/api/" + _apiVersion;
- }
-
- public NuageVspApiVersion getApiVersion() throws ConfigurationException {
- try {
- if(_apiVersion != null) {
- return NuageVspApiVersion.fromString(_apiVersion);
- }
- return null;
- } catch (IllegalArgumentException e) {
- throw new ConfigurationException("Incorrect API version");
- }
- }
-
- public Map<String, String> build() {
- Map<String, String> map = new HashMap<>();
- putIfPresent(map, GUID, _guid);
- putIfPresent(map, ZONE_ID, _zoneId);
- putIfPresent(map, HOST_NAME, _hostName);
- putIfPresent(map, CMS_USER, _cmsUser);
- putIfPresent(map, CMS_USER_PASSWORD, _cmsUserPassword);
- putIfPresent(map, PORT, _port);
- putIfPresent(map, API_VERSION, _apiVersion);
- putIfPresent(map, API_RELATIVE_PATH, _apiRelativePath);
- putIfPresent(map, RETRY_COUNT, _retryCount);
- putIfPresent(map, RETRY_INTERVAL, _retryInterval);
- putIfPresent(map, NUAGE_VSP_CMS_ID, _nuageVspCmsId);
- return map;
- }
-
- private void putIfPresent(Map<String, String> map, String key, String value) {
- Preconditions.checkNotNull(map);
- Preconditions.checkNotNull(key);
-
- if (value != null) {
- map.put(key, value);
- }
- }
-
- public static NuageVspResourceConfiguration fromConfiguration(Map<String, ?> configuration) {
- return new NuageVspResourceConfiguration()
- .guid((String)configuration.get(GUID))
- .zoneId((String)configuration.get(ZONE_ID))
- .hostName((String)configuration.get(HOST_NAME))
- .cmsUser((String)configuration.get(CMS_USER))
- .cmsUserPassword((String)configuration.get(CMS_USER_PASSWORD))
- .port((String)configuration.get(PORT))
- .apiVersion((String)configuration.get(API_VERSION))
- .apiRelativePath((String)configuration.get(API_RELATIVE_PATH))
- .retryCount((String)configuration.get(RETRY_COUNT))
- .retryInterval((String)configuration.get(RETRY_INTERVAL))
- .nuageVspCmsId((String)configuration.get(NUAGE_VSP_CMS_ID));
- }
-
- private void verifyNotNull(String name, String value) throws ConfigurationException {
- if (value == null) {
- throw new ConfigurationException("Unable to find " + name);
- }
- }
-
- private void verifyNotEmpty(String name, String value) throws ConfigurationException {
- if (StringUtils.isEmpty(value)) {
- throw new ConfigurationException("Unable to find " + name);
- }
- }
-
- private int verifyInRange(String name, String value, int min, int max) throws ConfigurationException {
- verifyNotEmpty(name, value);
-
- int parsedValue;
- try {
- parsedValue = Integer.parseInt(value);
- } catch (NumberFormatException ex) {
- throw new ConfigurationException(name + " has to be between " + min + " and " + max);
- }
- if ((parsedValue < min) || (parsedValue > max)) {
- throw new ConfigurationException(name + " has to be between " + min + " and " + max);
- }
- return parsedValue;
- }
-
- public void validate() throws ConfigurationException {
- verifyNotNull("name", _name);
- verifyNotNull("guid", _guid);
- verifyNotNull("zone", _zoneId);
- verifyNotNull("hostname", _hostName);
- verifyNotNull("CMS username", _cmsUser);
- verifyNotNull("CMS password", _cmsUserPassword);
- verifyNotEmpty("API version", _apiVersion);
-
- try {
- NuageVspApiVersion.fromString(_apiVersion);
- } catch(IllegalArgumentException e) {
- throw new ConfigurationException("Incorrect API version");
- }
-
- verifyNotEmpty("number of retries", _retryCount);
- verifyNotEmpty("retry interval", _retryInterval);
- }
-
- public int parseRetryCount() throws ConfigurationException {
- return verifyInRange("Number of retries", _retryCount, 1, 10);
- }
-
- public int parseRetryInterval() throws ConfigurationException {
- return verifyInRange("Retry interval", _retryInterval, 1, 10000);
- }
-
- public VspHost buildVspHost() throws ConfigurationException {
- return new VspHost.Builder()
- .cmsUser(new NuageVspUser(CMS_USER_ENTEPRISE_NAME, _cmsUser, NuageVspUtil.decodePassword(_cmsUserPassword)))
- .apiVersion(getApiVersion())
- .restRelativePath(getApiPath())
- .rootPath(getRootPath())
- .nuageVspCmsId(_nuageVspCmsId)
- .noofRetry(parseRetryCount())
- .retryInterval(parseRetryInterval())
- .build();
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!(o instanceof NuageVspResourceConfiguration)) {
- return false;
- }
-
- NuageVspResourceConfiguration that = (NuageVspResourceConfiguration) o;
-
- return super.equals(that)
- && Objects.equals(_name, that._name)
- && Objects.equals(_guid, that._guid)
- && Objects.equals(_zoneId, that._zoneId)
- && Objects.equals(_hostName, that._hostName)
- && Objects.equals(_cmsUser, that._cmsUser)
- && Objects.equals(_cmsUserPassword, that._cmsUserPassword)
- && Objects.equals(_port, that._port)
- && Objects.equals(_apiVersion, that._apiVersion)
- && Objects.equals(_apiRelativePath, that._apiRelativePath)
- && Objects.equals(_retryCount, that._retryCount)
- && Objects.equals(_retryInterval, that._retryInterval)
- && Objects.equals(_nuageVspCmsId, that._nuageVspCmsId);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(_name)
- .append(_guid)
- .append(_zoneId)
- .append(_hostName)
- .append(_cmsUser)
- .append(_cmsUserPassword)
- .append(_port)
- .append(_apiVersion)
- .append(_apiRelativePath)
- .append(_retryCount)
- .append(_retryInterval)
- .append(_nuageVspCmsId)
- .toHashCode();
- }
-
- @Override public String toString() {
- return new ToStringBuilder(this)
- .append("_name", _name)
- .append("_guid", _guid)
- .append("_zoneId", _zoneId)
- .append("_hostName", _hostName)
- .append("_cmsUser", _cmsUser)
- .append("_cmsUserPassword", _cmsUserPassword)
- .append("_port", _port)
- .append("_apiVersion", _apiVersion)
- .append("_apiRelativePath", _apiRelativePath)
- .append("_retryCount", _retryCount)
- .append("_retryInterval", _retryInterval)
- .append("_nuageVspCmsId", _nuageVspCmsId)
- .toString();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/VspStatisticsMBean.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/VspStatisticsMBean.java
deleted file mode 100644
index 55072ec..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/VspStatisticsMBean.java
+++ /dev/null
@@ -1,66 +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 com.cloud.network.resource;
-
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
-
-import com.cloud.utils.mgmt.ManagementBean;
-
-/**
- * Created by sgoeminn on 1/24/17.
- */
-public interface VspStatisticsMBean extends ManagementBean {
-
- /**
- * Returns the global count of all the VSD calls since start up
- * @return
- */
- long getVSDStatistics();
-
- /**
- * Returns the count of all the vsd calls where the entityType is equal to the entity
- * @param entity
- * @return
- */
- long getVsdStatisticsByEntityType(String entity);
-
- /**
- * Returns the count of all the vsd calls where the requestType is equal to the requestType
- * @param requestType
- * @return
- */
- long getVsdStatisticsByRequestType(String requestType);
-
- /**
- * Returns the count of all the vsd calls where the EntityType is equal to the entity
- * and the RequestType is equal to the requestType string.
- * @param entity
- * @param requestType
- * @return
- */
- long getVsdStatisticsByEntityAndRequestType(String entity, String requestType);
-
- /**
- * Returns the count of all VSD calls with EntityType entity and RequestType type
- * @return
- */
- Map<String, Map<String, AtomicLong>> getVsdStatisticsReport();
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/VspStatisticsMBeanImpl.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/VspStatisticsMBeanImpl.java
deleted file mode 100644
index 7e3de56..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/VspStatisticsMBeanImpl.java
+++ /dev/null
@@ -1,66 +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 com.cloud.network.resource;
-
-import javax.management.StandardMBean;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * Created by sgoeminn on 1/24/17.
- */
-public class VspStatisticsMBeanImpl extends StandardMBean implements VspStatisticsMBean{
- private VspStatisticsMBean _delegate;
-
- public VspStatisticsMBeanImpl(VspStatisticsMBean nuageVspResource) {
- super(VspStatisticsMBean.class, false);
- _delegate = nuageVspResource;
- }
-
- @Override
- public long getVSDStatistics() {
- return _delegate.getVSDStatistics();
- }
-
- @Override
- public long getVsdStatisticsByEntityType(String entity) {
- return _delegate.getVsdStatisticsByEntityType(entity);
- }
-
- @Override
- public long getVsdStatisticsByRequestType(String requestType) {
- return _delegate.getVsdStatisticsByRequestType(requestType);
- }
-
- @Override
- public long getVsdStatisticsByEntityAndRequestType(String entity, String requestType) {
- return _delegate.getVsdStatisticsByEntityAndRequestType(entity, requestType);
- }
-
- @Override
- public Map<String, Map<String, AtomicLong>> getVsdStatisticsReport() {
- return _delegate.getVsdStatisticsReport();
- }
-
- @Override
- public String getName() {
- return _delegate.getName();
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspApiSupportCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspApiSupportCommandWrapper.java
deleted file mode 100644
index 1e84e20..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspApiSupportCommandWrapper.java
+++ /dev/null
@@ -1,41 +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 com.cloud.network.vsp.resource.wrapper;
-
-import javax.naming.ConfigurationException;
-
-import net.nuage.vsp.acs.client.exception.NuageVspException;
-
-import com.cloud.agent.api.manager.SupportedApiVersionCommand;
-import com.cloud.network.resource.NuageVspResource;
-import com.cloud.resource.ResourceWrapper;
-
-@ResourceWrapper(handles = SupportedApiVersionCommand.class)
-public final class NuageVspApiSupportCommandWrapper extends NuageVspCommandWrapper<SupportedApiVersionCommand> {
-
- @Override public boolean executeNuageVspCommand(SupportedApiVersionCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
- return nuageVspResource.getNuageVspManagerClient().isSupportedApiVersion(cmd.getApiVersion());
- }
-
- @Override public StringBuilder fillDetail(StringBuilder stringBuilder, SupportedApiVersionCommand cmd) {
- return stringBuilder.append("Check if API version ").append(cmd.getApiVersion()).append(" is supported");
- }
-
-}
\ No newline at end of file
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspApplyAclRulesCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspApplyAclRulesCommandWrapper.java
deleted file mode 100644
index 42499c4..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspApplyAclRulesCommandWrapper.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 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspApplyStaticNatCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspApplyStaticNatCommandWrapper.java
deleted file mode 100644
index 81fbdef..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspApplyStaticNatCommandWrapper.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 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspCheckHealthCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspCheckHealthCommandWrapper.java
deleted file mode 100644
index d66fc1b..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspCheckHealthCommandWrapper.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 com.cloud.network.vsp.resource.wrapper;
-
-import javax.naming.ConfigurationException;
-
-import net.nuage.vsp.acs.client.exception.NuageVspException;
-
-import com.cloud.agent.api.CheckHealthCommand;
-import com.cloud.network.resource.NuageVspResource;
-import com.cloud.resource.ResourceWrapper;
-
-@ResourceWrapper(handles = CheckHealthCommand.class)
-public class NuageVspCheckHealthCommandWrapper extends NuageVspCommandWrapper<CheckHealthCommand> {
-
- @Override
- public boolean executeNuageVspCommand(CheckHealthCommand cmd, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
- return nuageVspResource.getStatus();
- }
-
- @Override
- public StringBuilder fillDetail(StringBuilder stringBuilder, CheckHealthCommand cmd) {
- return stringBuilder.append("Check Health");
- }
-
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspCleanupDomainCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspCleanupDomainCommandWrapper.java
deleted file mode 100644
index 273a719..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspCleanupDomainCommandWrapper.java
+++ /dev/null
@@ -1,41 +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 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspCommandWrapper.java
deleted file mode 100644
index 3e3c4a1..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspCommandWrapper.java
+++ /dev/null
@@ -1,57 +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 com.cloud.network.vsp.resource.wrapper;
-
-import javax.naming.ConfigurationException;
-
-import net.nuage.vsp.acs.client.exception.NuageVspException;
-
-import net.nuage.vsp.acs.client.exception.NuageVspUnsupportedRequestException;
-import org.apache.log4j.Logger;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.UnsupportedAnswer;
-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 (NuageVspUnsupportedRequestException e) {
- s_logger.error("Failure during " + command + " on " + nuageVspResource.getName(), e);
- return new UnsupportedAnswer(command, e.getMessage()); //New Exception so there is no stacktrace showed in the UI when changing ACL lists.
- } catch (Exception 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspDeallocateVmInterfaceCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspDeallocateVmInterfaceCommandWrapper.java
deleted file mode 100644
index 2125653..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspDeallocateVmInterfaceCommandWrapper.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 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspEntityExistsCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspEntityExistsCommandWrapper.java
deleted file mode 100644
index 6e737b8..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspEntityExistsCommandWrapper.java
+++ /dev/null
@@ -1,59 +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 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.network.vpc.VpcVO;
-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;
- }
- else if(VpcVO.class.isAssignableFrom(clazz)){
- entityType = NuageVspEntity.ZONE;
- }
-
- 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspExtraDhcpOptionsCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspExtraDhcpOptionsCommandWrapper.java
deleted file mode 100644
index 7bd7e7c..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspExtraDhcpOptionsCommandWrapper.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 com.cloud.network.vsp.resource.wrapper;
-
-import net.nuage.vsp.acs.client.exception.NuageVspException;
-
-import javax.naming.ConfigurationException;
-
-import com.cloud.agent.api.element.ExtraDhcpOptionsVspCommand;
-import com.cloud.network.resource.NuageVspResource;
-import com.cloud.resource.ResourceWrapper;
-
-@ResourceWrapper(handles=ExtraDhcpOptionsVspCommand.class)
-public class NuageVspExtraDhcpOptionsCommandWrapper extends NuageVspCommandWrapper<ExtraDhcpOptionsVspCommand> {
- @Override
- public boolean executeNuageVspCommand(ExtraDhcpOptionsVspCommand command, NuageVspResource nuageVspResource) throws ConfigurationException, NuageVspException {
- nuageVspResource.getNuageVspElementClient().setDhcpOptionsNic(command.getNetwork(), command.getNicUuid(), command.getDhcpOptions());
- return true;
- }
-
- @Override
- public StringBuilder fillDetail(StringBuilder stringBuilder, ExtraDhcpOptionsVspCommand command) {
- return stringBuilder;
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspGetApiDefaultsCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspGetApiDefaultsCommandWrapper.java
deleted file mode 100644
index ac96895..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspGetApiDefaultsCommandWrapper.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 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspGuruImplementNetworkCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspGuruImplementNetworkCommandWrapper.java
deleted file mode 100644
index 4d2ef63..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspGuruImplementNetworkCommandWrapper.java
+++ /dev/null
@@ -1,50 +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 com.cloud.network.vsp.resource.wrapper;
-
-import net.nuage.vsp.acs.client.api.NuageVspGuruClient;
-import net.nuage.vsp.acs.client.api.model.NetworkRelatedVsdIds;
-import net.nuage.vsp.acs.client.api.model.VspNetwork;
-
-import com.cloud.agent.api.guru.ImplementNetworkVspCommand;
-import com.cloud.agent.api.manager.ImplementNetworkVspAnswer;
-import com.cloud.network.resource.NuageVspResource;
-import com.cloud.resource.CommandWrapper;
-import com.cloud.resource.ResourceWrapper;
-
-@ResourceWrapper(handles = ImplementNetworkVspCommand.class)
-public final class NuageVspGuruImplementNetworkCommandWrapper extends CommandWrapper<ImplementNetworkVspCommand, ImplementNetworkVspAnswer, NuageVspResource> {
-
- @Override
- public ImplementNetworkVspAnswer execute(ImplementNetworkVspCommand command, NuageVspResource serverResource) {
- try {
- NuageVspGuruClient client = serverResource.getNuageVspGuruClient();
- if (command.isVsdManaged()) {
- VspNetwork vspNetwork = client.addPermissionL3Network(command.getNetwork());
- return new ImplementNetworkVspAnswer(command, vspNetwork, vspNetwork.getNetworkRelatedVsdIds());
- } else {
- NetworkRelatedVsdIds networkRelatedVsdIds = client.implement(command.getNetwork(), command.getDhcpOption());
- return new ImplementNetworkVspAnswer(command, command.getNetwork(), networkRelatedVsdIds);
- }
- } catch (Exception e) {
- return new ImplementNetworkVspAnswer(command, e);
- }
- }
-}
\ No newline at end of file
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspGuruTrashNetworkCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspGuruTrashNetworkCommandWrapper.java
deleted file mode 100644
index 1f12f94..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspGuruTrashNetworkCommandWrapper.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 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspImplementNetworkCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspImplementNetworkCommandWrapper.java
deleted file mode 100644
index d0732da..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspImplementNetworkCommandWrapper.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 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspListDomainTemplatesCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspListDomainTemplatesCommandWrapper.java
deleted file mode 100644
index 668034e..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspListDomainTemplatesCommandWrapper.java
+++ /dev/null
@@ -1,51 +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 com.cloud.network.vsp.resource.wrapper;
-
-import com.cloud.agent.api.manager.ListVspDomainTemplatesAnswer;
-import com.cloud.agent.api.manager.ListVspDomainTemplatesCommand;
-import com.cloud.network.resource.NuageVspResource;
-import com.cloud.resource.CommandWrapper;
-import com.cloud.resource.ResourceWrapper;
-import net.nuage.vsp.acs.client.api.NuageVspManagerClient;
-import net.nuage.vsp.acs.client.api.model.VspDomainTemplate;
-import net.nuage.vsp.acs.client.exception.NuageVspException;
-
-import javax.naming.ConfigurationException;
-import java.util.List;
-
-
-@ResourceWrapper(handles = ListVspDomainTemplatesCommand.class)
-public class NuageVspListDomainTemplatesCommandWrapper extends CommandWrapper<ListVspDomainTemplatesCommand, ListVspDomainTemplatesAnswer, NuageVspResource> {
-
- @Override
- public ListVspDomainTemplatesAnswer execute(ListVspDomainTemplatesCommand command, NuageVspResource serverResource) {
- NuageVspManagerClient client = null;
- try {
- client = serverResource.getNuageVspManagerClient();
- List<VspDomainTemplate> domainTemplates = client.getDomainTemplates(command.getDomain(), command.getName());
-
- return new ListVspDomainTemplatesAnswer(command, domainTemplates);
- } catch (ConfigurationException | NuageVspException e) {
- return new ListVspDomainTemplatesAnswer(command, e);
- }
-
- }
-}
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspMaintainCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspMaintainCommandWrapper.java
deleted file mode 100644
index b0e6db7..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspMaintainCommandWrapper.java
+++ /dev/null
@@ -1,35 +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 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspReadyCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspReadyCommandWrapper.java
deleted file mode 100644
index ca95b46..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspReadyCommandWrapper.java
+++ /dev/null
@@ -1,35 +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 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspReserveVmInterfaceCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspReserveVmInterfaceCommandWrapper.java
deleted file mode 100644
index fdf1ab2..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspReserveVmInterfaceCommandWrapper.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 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspShutdownNetworkCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspShutdownNetworkCommandWrapper.java
deleted file mode 100644
index 1852eb6..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspShutdownNetworkCommandWrapper.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 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspShutdownVpcCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspShutdownVpcCommandWrapper.java
deleted file mode 100644
index a3910cf..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspShutdownVpcCommandWrapper.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 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(), cmd.getRelatedVsdIds());
- return true;
- }
-
- @Override public StringBuilder fillDetail(StringBuilder stringBuilder, ShutDownVpcVspCommand cmd) {
- return stringBuilder.append("Shutdown VPC " + cmd.getVpcUuid());
- }
-
-}
\ No newline at end of file
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspSyncCmsIdCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspSyncCmsIdCommandWrapper.java
deleted file mode 100644
index c101344..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspSyncCmsIdCommandWrapper.java
+++ /dev/null
@@ -1,62 +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 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspSyncDomainCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspSyncDomainCommandWrapper.java
deleted file mode 100644
index b32e0b1..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspSyncDomainCommandWrapper.java
+++ /dev/null
@@ -1,41 +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 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspUpdateDhcpOptionsCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspUpdateDhcpOptionsCommandWrapper.java
deleted file mode 100644
index 56bde5c..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/NuageVspUpdateDhcpOptionsCommandWrapper.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 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
diff --git a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/UpdateNuageVspDeviceCommandWrapper.java b/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/UpdateNuageVspDeviceCommandWrapper.java
deleted file mode 100644
index c895391..0000000
--- a/plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/vsp/resource/wrapper/UpdateNuageVspDeviceCommandWrapper.java
+++ /dev/null
@@ -1,46 +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 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");
- }
-
-}
... 30428 lines suppressed ...