You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by re...@apache.org on 2015/11/18 12:11:18 UTC
[4/7] git commit: updated refs/heads/master to 95ae796
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/645f8758/plugins/network-elements/nuage-vsp/src/com/cloud/network/dao/NuageVspDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/dao/NuageVspDaoImpl.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/dao/NuageVspDaoImpl.java
index bc55f43..ec60c49 100644
--- a/plugins/network-elements/nuage-vsp/src/com/cloud/network/dao/NuageVspDaoImpl.java
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/dao/NuageVspDaoImpl.java
@@ -19,15 +19,13 @@
package com.cloud.network.dao;
-import javax.ejb.Local;
-
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 com.cloud.utils.db.GenericDaoBase;
-
+import javax.ejb.Local;
import java.util.List;
@Component
@@ -35,12 +33,17 @@ import java.util.List;
public class NuageVspDaoImpl extends GenericDaoBase<NuageVspDeviceVO, Long>
implements NuageVspDao {
- protected final SearchBuilder<NuageVspDeviceVO> physicalNetworkIdSearch;
+ 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
@@ -49,4 +52,11 @@ public class NuageVspDaoImpl extends GenericDaoBase<NuageVspDeviceVO, Long>
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);
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/645f8758/plugins/network-elements/nuage-vsp/src/com/cloud/network/element/NuageVspElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/element/NuageVspElement.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/element/NuageVspElement.java
index e777268..d9243d4 100644
--- a/plugins/network-elements/nuage-vsp/src/com/cloud/network/element/NuageVspElement.java
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/element/NuageVspElement.java
@@ -19,34 +19,20 @@
package com.cloud.network.element;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.ejb.Local;
-import javax.inject.Inject;
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.api.InternalIdentity;
-import org.apache.cloudstack.network.ExternalNetworkDeviceManager;
-import org.apache.log4j.Logger;
-
import com.cloud.agent.AgentManager;
+import com.cloud.agent.api.Answer;
import com.cloud.agent.api.StartupCommand;
import com.cloud.agent.api.StartupVspCommand;
-import com.cloud.agent.api.element.ApplyAclRuleVspAnswer;
import com.cloud.agent.api.element.ApplyAclRuleVspCommand;
-import com.cloud.agent.api.element.ApplyStaticNatVspAnswer;
import com.cloud.agent.api.element.ApplyStaticNatVspCommand;
+import com.cloud.agent.api.element.ImplementVspCommand;
+import com.cloud.agent.api.element.ShutDownVpcVspCommand;
import com.cloud.dc.VlanVO;
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.dc.dao.VlanDao;
import com.cloud.deploy.DeployDestination;
import com.cloud.domain.Domain;
import com.cloud.domain.dao.DomainDao;
-import com.cloud.exception.CloudException;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceUnavailableException;
@@ -60,17 +46,28 @@ import com.cloud.network.Network.Service;
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.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.NuageVspDao;
+import com.cloud.network.dao.PhysicalNetworkDao;
+import com.cloud.network.dao.PhysicalNetworkVO;
+import com.cloud.network.manager.NuageVspManager;
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.dao.VpcDao;
import com.cloud.offering.NetworkOffering;
@@ -81,17 +78,34 @@ import com.cloud.resource.ResourceManager;
import com.cloud.resource.ResourceStateAdapter;
import com.cloud.resource.ServerResource;
import com.cloud.resource.UnableDeleteHostException;
+import com.cloud.util.NuageVspUtil;
import com.cloud.utils.component.AdapterBase;
+import com.cloud.utils.exception.CloudRuntimeException;
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.NicDao;
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
+import org.apache.cloudstack.api.InternalIdentity;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.network.ExternalNetworkDeviceManager;
+import org.apache.log4j.Logger;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
@Local(value = {NetworkElement.class, ConnectivityProvider.class, IpDeployer.class, SourceNatServiceProvider.class, StaticNatServiceProvider.class, FirewallServiceProvider.class,
- DhcpServiceProvider.class, NetworkACLServiceProvider.class})
+ DhcpServiceProvider.class, VpcProvider.class, NetworkACLServiceProvider.class})
public class NuageVspElement extends AdapterBase implements ConnectivityProvider, IpDeployer, SourceNatServiceProvider, StaticNatServiceProvider, FirewallServiceProvider,
- DhcpServiceProvider, NetworkACLServiceProvider, ResourceStateAdapter {
+ DhcpServiceProvider, ResourceStateAdapter, VpcProvider, NetworkACLServiceProvider {
private static final Logger s_logger = Logger.getLogger(NuageVspElement.class);
@@ -129,6 +143,18 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider
AgentManager _agentMgr;
@Inject
NetworkOfferingDao _ntwkOfferingDao;
+ @Inject
+ ConfigurationDao _configDao;
+ @Inject
+ NuageVspManager _nuageVspManager;
+ @Inject
+ FirewallRulesDao _firewallRulesDao;
+ @Inject
+ FirewallRulesCidrsDao _firewallRulesCidrsDao;
+ @Inject
+ PhysicalNetworkDao _physicalNetworkDao;
+ @Inject
+ NetworkACLItemDao _networkACLItemDao;
@Override
public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> service) throws ResourceUnavailableException {
@@ -149,9 +175,12 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider
// L3 Support : Generic
capabilities.put(Service.Gateway, null);
+ // Security Group
+ capabilities.put(Service.SecurityGroup, null);
+
// L3 Support : SourceNat
Map<Capability, String> sourceNatCapabilities = new HashMap<Capability, String>();
- sourceNatCapabilities.put(Capability.SupportedSourceNatTypes, "peraccount");
+ sourceNatCapabilities.put(Capability.SupportedSourceNatTypes, "perzone");
sourceNatCapabilities.put(Capability.RedundantRouter, "false");
capabilities.put(Service.SourceNat, sourceNatCapabilities);
@@ -194,7 +223,13 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider
@Override
public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException, InsufficientCapacityException {
- s_logger.debug("Entering NuageElement implement function for network " + network.getDisplayText() + " (state " + network.getState() + ")");
+ 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, Service.Connectivity)) {
return false;
@@ -205,9 +240,85 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider
return false;
}
+ boolean egressDefaultPolicy = offering.getEgressDefaultPolicy();
+ Domain networkDomain = _domainDao.findById(network.getDomainId());
+ boolean isFirewallServiceSupported = _networkModel.areServicesSupportedByNetworkOffering(offering.getId(), Service.Firewall);
+ List<String> dnsServers = _nuageVspManager.getDnsDetails(network);
+
+ boolean isL2Network = false, isL3Network = false, isShared = false;
+ String subnetUuid = network.getUuid();
+ if (offering.getGuestType() == Network.GuestType.Shared) {
+ isShared = true;
+ subnetUuid = networkDomain.getUuid();
+ } else if (_ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(offering.getId(), Service.SourceNat)
+ || _ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(offering.getId(), Service.StaticNat)
+ || _ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(offering.getId(), Service.Connectivity)) {
+ isL3Network = true;
+ } else {
+ isL2Network = true;
+ }
+
+ String preConfiguredDomainTemplateName = NuageVspUtil.getPreConfiguredDomainTemplateName(_configDao, network, offering);
+ List<Map<String, Object>> ingressFirewallRules = getFirewallRulesToApply(network.getId(), FirewallRule.TrafficType.Ingress, egressDefaultPolicy);
+ List<Map<String, Object>> egressFirewallRules = getFirewallRulesToApply(network.getId(), FirewallRule.TrafficType.Egress, egressDefaultPolicy);
+
+ List<IPAddressVO> ips = _ipAddressDao.listStaticNatPublicIps(network.getId());
+ List<String> acsFipUuid = new ArrayList<String>();
+ for (IPAddressVO ip : ips) {
+ acsFipUuid.add(ip.getUuid());
+ }
+
+ HostVO nuageVspHost = getNuageVspHost(network.getPhysicalNetworkId());
+ ImplementVspCommand.Builder cmdBuilder = new ImplementVspCommand.Builder()
+ .networkId(network.getId())
+ .networkDomainUuid(networkDomain.getUuid())
+ .networkUuid(network.getUuid())
+ .networkName(network.getName())
+ .vpcOrSubnetUuid(subnetUuid)
+ .isL2Network(isL2Network)
+ .isL3Network(isL3Network)
+ .isVpc(false)
+ .isShared(isShared)
+ .domainTemplateName(preConfiguredDomainTemplateName)
+ .isFirewallServiceSupported(isFirewallServiceSupported)
+ .dnsServers(dnsServers)
+ .ingressFirewallRules(ingressFirewallRules)
+ .egressFirewallRules(egressFirewallRules)
+ .acsFipUuid(acsFipUuid)
+ .egressDefaultPolicy(egressDefaultPolicy);
+ Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmdBuilder.build());
+ if (answer == null || !answer.getResult()) {
+ s_logger.error("ImplementVspCommand for network " + network.getUuid() + " failed on Nuage VSD " + nuageVspHost.getDetail("hostname"));
+ if ((null != answer) && (null != answer.getDetails())) {
+ throw new ResourceUnavailableException(answer.getDetails(), Network.class, network.getId());
+ }
+ }
+
return true;
}
+ 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, null, false);
+ }
+ return true;
+ }
+
+ private List<Map<String, Object>> getFirewallRulesToApply(long networkId, FirewallRule.TrafficType trafficType, final boolean egressDefaultPolicy) {
+ List<FirewallRuleVO> firewallRulesToApply = _firewallRulesDao.listByNetworkPurposeTrafficType(networkId, FirewallRule.Purpose.Firewall, trafficType);
+ for (FirewallRuleVO rule : firewallRulesToApply) {
+ // load cidrs if any
+ rule.setSourceCidrList(_firewallRulesCidrsDao.getSourceCidrs(rule.getId()));
+ }
+ return Lists.transform(firewallRulesToApply, new Function<FirewallRuleVO, Map<String, Object>>() {
+ @Override
+ public Map<String, Object> apply(FirewallRuleVO firewallRuleVO) {
+ return getACLRuleDetails(firewallRuleVO, egressDefaultPolicy);
+ }
+ });
+ }
+
@Override
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException, InsufficientCapacityException {
@@ -258,7 +369,7 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider
@Override
public boolean canEnableIndividualServices() {
- return false;
+ return true;
}
@Override
@@ -303,13 +414,17 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider
}
if (!_networkModel.isProviderForNetwork(getProvider(), network.getId())) {
- s_logger.debug("NuageElement is not a provider for network " + network.getDisplayText());
+ 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())) {
- s_logger.debug("NuageElement can't provide the " + service.getName() + " service on network " + network.getDisplayText());
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("NuageVsp can't provide the " + service.getName() + " service on network " + network.getDisplayText());
+ }
return false;
}
}
@@ -360,6 +475,7 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider
//client to process the request
sourceNatDetail.put("sourceNatIpUuid", sourceNatIp.getUuid());
sourceNatDetail.put("sourceNatIpAddress", sourceNatIp.getAddress().addr());
+ sourceNatDetail.put("nicUuid", nicVO == null ? null : nicVO.getUuid());
sourceNatDetail.put("nicMacAddress", nicVO == null ? null : nicVO.getMacAddress());
sourceNatDetail.put("isRevoke", staticNat.isForRevoke());
sourceNatDetail.put("sourceNatVlanUuid", sourceNatVan.getUuid());
@@ -367,22 +483,21 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider
sourceNatDetail.put("sourceNatVlanNetmask", sourceNatVan.getVlanNetmask());
sourceNatDetails.add(sourceNatDetail);
}
- try {
- try {
- HostVO nuageVspHost = getNuageVspHost(config.getPhysicalNetworkId());
- ApplyStaticNatVspCommand cmd = new ApplyStaticNatVspCommand(networkDomain.getUuid(), vpcOrSubnetUuid, isL3Network, sourceNatDetails);
- ApplyStaticNatVspAnswer answer = (ApplyStaticNatVspAnswer)_agentMgr.easySend(nuageVspHost.getId(), cmd);
- if (answer == null || !answer.getResult()) {
- s_logger.error("ApplyStaticNatNuageVspCommand for network " + config.getUuid() + " failed");
- if ((null != answer) && (null != answer.getDetails())) {
- throw new ResourceUnavailableException(answer.getDetails(), Network.class, config.getId());
- }
- }
- } catch (Exception e) {
- s_logger.warn("Failed to apply static Nat in Vsp " + e.getMessage());
+
+ HostVO nuageVspHost = getNuageVspHost(config.getPhysicalNetworkId());
+ ApplyStaticNatVspCommand.Builder cmdBuilder = new ApplyStaticNatVspCommand.Builder()
+ .networkDomainUuid(networkDomain.getUuid())
+ .networkUuid(config.getUuid())
+ .vpcOrSubnetUuid(vpcOrSubnetUuid)
+ .isL3Network(isL3Network)
+ .isVpc(vpcId != null)
+ .staticNatDetails(sourceNatDetails);
+ Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmdBuilder.build());
+ if (answer == null || !answer.getResult()) {
+ s_logger.error("ApplyStaticNatNuageVspCommand for network " + config.getUuid() + " failed on Nuage VSD " + nuageVspHost.getDetail("hostname"));
+ if ((null != answer) && (null != answer.getDetails())) {
+ throw new ResourceUnavailableException(answer.getDetails(), Network.class, config.getId());
}
- } catch (Exception e) {
- throw new ResourceUnavailableException("Failed to apply Static NAT in VSP", Network.class, config.getId(), e);
}
return true;
@@ -395,65 +510,142 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider
@Override
public boolean applyFWRules(Network network, List<? extends FirewallRule> rules) throws ResourceUnavailableException {
- s_logger.debug("Handling applyFWRules for network " + network.getName() + " with " + rules.size() + " FWRules");
- if (rules != null && rules.size() == 1 && rules.iterator().next().getType().equals(FirewallRuleType.System)) {
- s_logger.debug("Default ACL added by CS as system is ignored for network " + network.getName() + " with rule " + rules);
+ 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;
}
- return applyACLRules(network, rules, false);
+
+ s_logger.info("Applying " + rules.size() + " Firewall Rules for network " + network.getName());
+ return applyACLRules(network, rules, false, rules.iterator().next().getTrafficType().equals(FirewallRule.TrafficType.Ingress), false);
+ }
+
+ protected boolean applyACLRules(Network network, List<? extends InternalIdentity> rules, boolean isNetworkAcl, Boolean isAcsIngressAcl, boolean networkReset)
+ throws ResourceUnavailableException {
+ Domain networksDomain = _domainDao.findById(network.getDomainId());
+ NetworkOfferingVO networkOfferingVO = _ntwkOfferingDao.findById(network.getNetworkOfferingId());
+ Long vpcId = network.getVpcId();
+ String vpcOrSubnetUuid = null;
+ if (vpcId != null) {
+ Vpc vpcObj = _vpcDao.findById(vpcId);
+ vpcOrSubnetUuid = vpcObj.getUuid();
+ } else {
+ vpcOrSubnetUuid = network.getUuid();
+ }
+ boolean egressDefaultPolicy = networkOfferingVO.getEgressDefaultPolicy();
+ List<Map<String, Object>> aclRules = new ArrayList<Map<String, Object>>();
+ for (InternalIdentity acl : rules) {
+ aclRules.add(getACLRuleDetails(acl, egressDefaultPolicy));
+ }
+
+ boolean isL3Network = isL3Network(network.getNetworkOfferingId());
+ HostVO nuageVspHost = getNuageVspHost(network.getPhysicalNetworkId());
+ String preConfiguredDomainTemplateName = NuageVspUtil.getPreConfiguredDomainTemplateName(_configDao, network, networkOfferingVO);
+ ApplyAclRuleVspCommand.Builder cmdBuilder = new ApplyAclRuleVspCommand.Builder()
+ .networkAcl(isNetworkAcl)
+ .networkUuid(network.getUuid())
+ .networkDomainUuid(networksDomain.getUuid())
+ .vpcOrSubnetUuid(vpcOrSubnetUuid)
+ .networkName(network.getName())
+ .isL2Network(!isL3Network)
+ .aclRules(aclRules)
+ .networkId(network.getId())
+ .egressDefaultPolicy(networkOfferingVO.getEgressDefaultPolicy())
+ .acsIngressAcl(isAcsIngressAcl)
+ .networkReset(networkReset)
+ .domainTemplateName(preConfiguredDomainTemplateName);
+ Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmdBuilder.build());
+ if (answer == null || !answer.getResult()) {
+ s_logger.error("ApplyAclRuleNuageVspCommand for network " + network.getUuid() + " failed on Nuage VSD " + nuageVspHost.getDetail("hostname"));
+ if ((null != answer) && (null != answer.getDetails())) {
+ throw new ResourceUnavailableException(answer.getDetails(), Network.class, network.getId());
+ }
+ }
+ return true;
}
@Override
- public boolean applyNetworkACLs(Network network, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException {
+ public boolean applyNetworkACLs(Network config, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException {
if (rules == null || rules.isEmpty()) {
- s_logger.debug("No rules to apply. So, delete all the existing ACL in VSP from Subnet with uuid " + network.getUuid());
+ 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 {
- s_logger.debug("New rules has to applied. So, delete all the existing ACL in VSP from Subnet with uuid " + network.getUuid());
+ 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.debug("Handling applyNetworkACLs for network " + network.getName() + " with " + rules.size() + " Network ACLs");
- applyACLRules(network, rules, true);
+ s_logger.info("Applying " + rules.size() + " Network ACLs for network " + config.getName());
+ applyACLRules(config, rules, true, null, rules.isEmpty());
}
return true;
}
- protected boolean applyACLRules(Network network, List<? extends InternalIdentity> rules, boolean isVpc) throws ResourceUnavailableException {
- Domain networksDomain = _domainDao.findById(network.getDomainId());
- NetworkOfferingVO networkOferringVO = _ntwkOfferingDao.findById(network.getNetworkOfferingId());
- try {
- Long vpcId = network.getVpcId();
- String vpcOrSubnetUuid = null;
- if (vpcId != null) {
- Vpc vpcObj = _vpcDao.findById(vpcId);
- vpcOrSubnetUuid = vpcObj.getUuid();
- } else {
- vpcOrSubnetUuid = network.getUuid();
- }
- boolean egressDefaultPolicy = networkOferringVO.getEgressDefaultPolicy();
- List<Map<String, Object>> aclRules = new ArrayList<Map<String, Object>>();
- for (InternalIdentity acl : rules) {
- aclRules.add(getACLRuleDetails(acl, egressDefaultPolicy));
- }
+ @Override
+ public boolean implementVpc(Vpc vpc, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
+ return true;
+ }
- HostVO nuageVspHost = getNuageVspHost(network.getPhysicalNetworkId());
- ApplyAclRuleVspCommand cmd = new ApplyAclRuleVspCommand(network.getUuid(), networksDomain.getUuid(), vpcOrSubnetUuid, isL3Network(networkOferringVO.getId()), aclRules,
- isVpc, network.getId());
- ApplyAclRuleVspAnswer answer = (ApplyAclRuleVspAnswer)_agentMgr.easySend(nuageVspHost.getId(), cmd);
+ @Override
+ public boolean shutdownVpc(Vpc vpc, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
+ if (vpc.getState().equals(Vpc.State.Inactive)) {
+ Domain vpcDomain = _domainDao.findById(vpc.getDomainId());
+ HostVO nuageVspHost = getNuageVspHost(getPhysicalNetworkId(vpc.getZoneId()));
+ String preConfiguredDomainTemplateName = _configDao.getValue(NuageVspManager.NuageVspVpcDomainTemplateName.key());
+ ShutDownVpcVspCommand.Builder cmdBuilder = new ShutDownVpcVspCommand.Builder()
+ .domainUuid(vpcDomain.getUuid())
+ .vpcUuid(vpc.getUuid())
+ .domainTemplateName(preConfiguredDomainTemplateName);
+ Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmdBuilder.build());
if (answer == null || !answer.getResult()) {
- s_logger.error("ApplyAclRuleNuageVspCommand for network " + network.getUuid() + " failed");
+ s_logger.error("ShutDownVpcVspCommand for VPC " + vpc.getUuid() + " failed on Nuage VSD " + nuageVspHost.getDetail("hostname"));
if ((null != answer) && (null != answer.getDetails())) {
- throw new ResourceUnavailableException(answer.getDetails(), Network.class, network.getId());
+ throw new ResourceUnavailableException(answer.getDetails(), Vpc.class, vpc.getId());
}
}
+ }
+ return true;
+ }
- } catch (Exception e1) {
- throw new ResourceUnavailableException(e1.getMessage(), Network.class, network.getId());
+ private Long getPhysicalNetworkId(Long zoneId) {
+ Long guestPhysicalNetworkId = 0L;
+ List<PhysicalNetworkVO> physicalNetworkList = _physicalNetworkDao.listByZone(zoneId);
+ for (PhysicalNetworkVO phyNtwk : physicalNetworkList) {
+ if (phyNtwk.getIsolationMethods().contains(PhysicalNetwork.IsolationMethod.VSP.name())) {
+ 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;
}
@@ -475,7 +667,7 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider
return new DeleteHostAnswer(true);
}
- protected HostVO getNuageVspHost(Long physicalNetworkId) throws CloudException {
+ private HostVO getNuageVspHost(Long physicalNetworkId) {
HostVO nuageVspHost;
List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listByPhysicalNetwork(physicalNetworkId);
if (nuageVspDevices != null && (!nuageVspDevices.isEmpty())) {
@@ -483,7 +675,7 @@ public class NuageVspElement extends AdapterBase implements ConnectivityProvider
nuageVspHost = _hostDao.findById(config.getHostId());
_hostDao.loadDetails(nuageVspHost);
} else {
- throw new CloudException("Nuage VSD is not configured on physical network " + physicalNetworkId);
+ throw new CloudRuntimeException("There is no Nuage VSP device configured on physical network " + physicalNetworkId);
}
return nuageVspHost;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/645f8758/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
index 9bbaf40..e625121 100644
--- a/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
@@ -19,42 +19,26 @@
package com.cloud.network.guru;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.ejb.Local;
-import javax.inject.Inject;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-
import com.cloud.agent.AgentManager;
-import com.cloud.agent.api.guru.DeallocateVmVspAnswer;
+import com.cloud.agent.api.Answer;
import com.cloud.agent.api.guru.DeallocateVmVspCommand;
-import com.cloud.agent.api.guru.ImplementNetworkVspAnswer;
import com.cloud.agent.api.guru.ImplementNetworkVspCommand;
-import com.cloud.agent.api.guru.ReleaseVmVspAnswer;
-import com.cloud.agent.api.guru.ReleaseVmVspCommand;
-import com.cloud.agent.api.guru.ReserveVmInterfaceVspAnswer;
import com.cloud.agent.api.guru.ReserveVmInterfaceVspCommand;
-import com.cloud.agent.api.guru.TrashNetworkVspAnswer;
import com.cloud.agent.api.guru.TrashNetworkVspCommand;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType;
+import com.cloud.dc.VlanVO;
import com.cloud.deploy.DeployDestination;
import com.cloud.deploy.DeploymentPlan;
import com.cloud.domain.Domain;
import com.cloud.domain.DomainVO;
import com.cloud.domain.dao.DomainDao;
+import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientVirtualNetworkCapacityException;
import com.cloud.host.HostVO;
import com.cloud.host.dao.HostDao;
+import com.cloud.network.IpAddress;
import com.cloud.network.Network;
import com.cloud.network.Network.GuestType;
import com.cloud.network.Network.Service;
@@ -64,9 +48,11 @@ import com.cloud.network.Networks;
import com.cloud.network.NuageVspDeviceVO;
import com.cloud.network.PhysicalNetwork;
import com.cloud.network.PhysicalNetwork.IsolationMethod;
+import com.cloud.network.dao.IPAddressVO;
import com.cloud.network.dao.NetworkVO;
import com.cloud.network.dao.NuageVspDao;
import com.cloud.network.dao.PhysicalNetworkVO;
+import com.cloud.network.manager.NuageVspManager;
import com.cloud.network.vpc.Vpc;
import com.cloud.network.vpc.dao.VpcDao;
import com.cloud.offering.NetworkOffering;
@@ -75,13 +61,29 @@ 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.NuageVspUtil;
import com.cloud.utils.db.DB;
+import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.net.NetUtils;
import com.cloud.vm.NicProfile;
import com.cloud.vm.NicVO;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
+import com.google.common.base.Strings;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
@Local(value = NetworkGuru.class)
public class NuageVspGuestNetworkGuru extends GuestNetworkGuru {
@@ -103,6 +105,8 @@ public class NuageVspGuestNetworkGuru extends GuestNetworkGuru {
VpcDao _vpcDao;
@Inject
AgentManager _agentMgr;
+ @Inject
+ NuageVspManager _nuageVspManager;
public NuageVspGuestNetworkGuru() {
super();
@@ -114,7 +118,9 @@ public class NuageVspGuestNetworkGuru extends GuestNetworkGuru {
PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId());
DataCenter dc = _dcDao.findById(plan.getDataCenterId());
if (!canHandle(offering, dc.getNetworkType(), physnet)) {
- s_logger.debug("Refusing to design this network");
+ 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;
}
@@ -129,66 +135,111 @@ public class NuageVspGuestNetworkGuru extends GuestNetworkGuru {
@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);
+ }
+
+ NetworkVO implemented = null;
+ try {
+ if (network.getState() != State.Implementing) {
+ throw new IllegalStateException("Network " + networkId + " is not in expected state Implementing, but is in state " + network.getState());
+ }
- assert (network.getState() == State.Implementing) : "Why are we implementing " + 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.getTrafficType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated,
+ network.getDataCenterId(), physicalNetworkId, offering.getRedundantRouter());
+ if (network.getGateway() != null) {
+ implemented.setGateway(network.getGateway());
+ }
+ if (network.getCidr() != null) {
+ implemented.setCidr(network.getCidr());
+ }
+ List<String[]> ipAddressRanges = new ArrayList<String[]>();
+ String virtualRouterIp = getVirtualRouterIP(network, ipAddressRanges);
+ String networkUuid = implemented.getUuid();
+ String tenantId = context.getDomain().getName() + "-" + context.getAccount().getAccountId();
+ String broadcastUriStr = networkUuid + "/" + virtualRouterIp;
+ implemented.setBroadcastUri(Networks.BroadcastDomainType.Vsp.toUri(broadcastUriStr));
+ implemented.setBroadcastDomainType(Networks.BroadcastDomainType.Vsp);
+ //Check if the network is associated to a VPC
+ Long vpcId = network.getVpcId();
+ boolean isVpc = (vpcId != null);
+ //Check owner of the Network
+ Domain networksDomain = _domainDao.findById(network.getDomainId());
+ //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());
+ }
+ String vpcName = null;
+ String vpcUuid = null;
+ String preConfiguredDomainTemplateName = NuageVspUtil.getPreConfiguredDomainTemplateName(_configDao, network, offering);
+ boolean isSharedNetwork = offering.getGuestType() == GuestType.Shared;
+ boolean isL3Network = !isVpc && (isSharedNetwork || isL3Network(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());
- }
- NetworkVO implemented = new NetworkVO(network.getTrafficType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated,
- network.getDataCenterId(), physicalNetworkId, offering.getRedundantRouter());
- if (network.getGateway() != null) {
- implemented.setGateway(network.getGateway());
- }
- if (network.getCidr() != null) {
- implemented.setCidr(network.getCidr());
- }
- Collection<String> ipAddressRange = new ArrayList<String>();
- String virtualRouterIp = getVirtualRouterIP(network, ipAddressRange);
- String networkUuid = implemented.getUuid();
- String tenantId = context.getDomain().getName() + "-" + context.getAccount().getAccountId();
- String broadcastUriStr = networkUuid + "/" + virtualRouterIp;
- implemented.setBroadcastUri(Networks.BroadcastDomainType.Vsp.toUri(broadcastUriStr));
- implemented.setBroadcastDomainType(Networks.BroadcastDomainType.Vsp);
- //Check if the network is associated to a VPC
- Long vpcId = network.getVpcId();
- boolean isVpc = (vpcId != null);
- //Check owner of the Network
- Domain networksDomain = _domainDao.findById(network.getDomainId());
- //Get the Account details and find the type
- AccountVO networksAccount = _accountDao.findById(network.getAccountId());
- if (networksAccount.getType() == Account.ACCOUNT_TYPE_PROJECT) {
- String errorMessage = "CS project support is not yet implemented in NuageVsp";
- s_logger.debug(errorMessage);
- throw new InsufficientVirtualNetworkCapacityException(errorMessage, Account.class, network.getAccountId());
- }
- boolean isL3Network = isL3Network(offering.getId());
- String vpcName = null;
- String vpcUuid = null;
- if (isVpc) {
- Vpc vpcObj = _vpcDao.findById(vpcId);
- vpcName = vpcObj.getName();
- vpcUuid = vpcObj.getUuid();
- }
+ if (isVpc) {
+ Vpc vpcObj = _vpcDao.findById(vpcId);
+ vpcName = vpcObj.getName();
+ vpcUuid = vpcObj.getUuid();
+ }
- HostVO nuageVspHost = getNuageVspHost(physicalNetworkId);
- ImplementNetworkVspCommand cmd = new ImplementNetworkVspCommand(networksDomain.getName(), networksDomain.getPath(), networksDomain.getUuid(),
- networksAccount.getAccountName(), networksAccount.getUuid(), network.getName(), network.getCidr(), network.getGateway(), network.getUuid(), isL3Network, vpcName,
- vpcUuid, offering.getEgressDefaultPolicy(), ipAddressRange);
- ImplementNetworkVspAnswer answer = (ImplementNetworkVspAnswer)_agentMgr.easySend(nuageVspHost.getId(), cmd);
+ if (isSharedNetwork) {
+ List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(network.getId());
+ for (VlanVO vlan : vlans) {
+ boolean isIpv4 = StringUtils.isNotBlank(vlan.getIpRange());
+ String[] range = isIpv4 ? vlan.getIpRange().split("-") : vlan.getIp6Range().split("-");
+ ipAddressRanges.add(range);
+ }
+ }
- if (answer == null || !answer.getResult()) {
- s_logger.error("ImplementNetworkNuageVspCommand failed");
- if ((null != answer) && (null != answer.getDetails())) {
- s_logger.error(answer.getDetails());
+ HostVO nuageVspHost = getNuageVspHost(physicalNetworkId);
+ List<String> dnsServers = _nuageVspManager.getDnsDetails(network);
+ List<String> gatewaySystemIds = _nuageVspManager.getGatewaySystemIds();
+ ImplementNetworkVspCommand.Builder cmdBuilder = new ImplementNetworkVspCommand.Builder()
+ .networkDomainName(networksDomain.getName())
+ .networkDomainPath(networksDomain.getPath())
+ .networkDomainUuid(networksDomain.getUuid())
+ .networkAccountName(networksAccount.getAccountName())
+ .networkAccountUuid(networksAccount.getUuid())
+ .networkName(network.getName())
+ .networkCidr(network.getCidr())
+ .networkGateway(network.getGateway())
+ .networkAclId(network.getNetworkACLId())
+ .dnsServers(dnsServers)
+ .gatewaySystemIds(gatewaySystemIds)
+ .networkUuid(network.getUuid())
+ .isL3Network(isL3Network)
+ .isVpc(isVpc)
+ .isSharedNetwork(isSharedNetwork)
+ .vpcName(vpcName)
+ .vpcUuid(vpcUuid)
+ .defaultEgressPolicy(offering.getEgressDefaultPolicy())
+ .ipAddressRange(ipAddressRanges)
+ .domainTemplateName(preConfiguredDomainTemplateName);
+ Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmdBuilder.build());
+
+ if (answer == null || !answer.getResult()) {
+ s_logger.error("ImplementNetworkVspCommand for network " + network.getUuid() + " failed on Nuage VSD " + nuageVspHost.getDetail("hostname"));
+ if ((null != answer) && (null != answer.getDetails())) {
+ s_logger.error(answer.getDetails());
+ }
+ return null;
}
- return null;
+ s_logger.info("Implemented OK, network " + networkUuid + " in tenant " + tenantId + " linked to " + implemented.getBroadcastUri());
+ } finally {
+ _networkDao.releaseFromLockTable(network.getId());
}
- s_logger.info("Implemented OK, network " + networkUuid + " in tenant " + tenantId + " linked to " + implemented.getBroadcastUri().toString());
return implemented;
}
@@ -201,97 +252,131 @@ public class NuageVspGuestNetworkGuru extends GuestNetworkGuru {
@Override
public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException {
- nic.setBroadcastUri(network.getBroadcastUri());
- nic.setIsolationUri(network.getBroadcastUri());
-
- 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());
- Account networksAccount = _accountDao.findById(network.getAccountId());
- DomainVO networksDomain = _domainDao.findById(network.getDomainId());
- //Get the Account details and find the type
- long networkOwnedBy = network.getAccountId();
- AccountVO neworkAccountDetails = _accountDao.findById(networkOwnedBy);
- if (neworkAccountDetails.getType() == Account.ACCOUNT_TYPE_PROJECT) {
- throw new InsufficientVirtualNetworkCapacityException("CS project support is " + "not yet implemented in NuageVsp", DataCenter.class, dc.getId());
+ boolean lockedNetwork = lockNetworkForUserVm(network, vm);
+ if (lockedNetwork && s_logger.isDebugEnabled()) {
+ s_logger.debug("Locked network " + network.getId() + " for creation of user VM " + vm.getInstanceName());
}
- //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 nicFrmDB = _nicDao.findById(nic.getId());
- long networkOfferingId = _ntwkOfferingDao.findById(network.getNetworkOfferingId()).getId();
- boolean isL3Network = isL3Network(networkOfferingId);
- Long vpcId = network.getVpcId();
- String vpcUuid = null;
- if (vpcId != null) {
- Vpc vpcObj = _vpcDao.findById(vpcId);
- vpcUuid = vpcObj.getUuid();
- }
- HostVO nuageVspHost = getNuageVspHost(network.getPhysicalNetworkId());
- ReserveVmInterfaceVspCommand cmd = new ReserveVmInterfaceVspCommand(nicFrmDB.getUuid(), nic.getMacAddress(), network.getUuid(), isL3Network, vpcUuid,
- networksDomain.getUuid(), networksAccount.getUuid(), vm.getType().equals(VirtualMachine.Type.DomainRouter), network.getBroadcastUri().getPath().substring(1),
- vm.getInstanceName(), vm.getUuid(), networksDomain.getUuid(), networksAccount.getUuid());
- ReserveVmInterfaceVspAnswer answer = (ReserveVmInterfaceVspAnswer)_agentMgr.easySend(nuageVspHost.getId(), cmd);
-
- if (answer == null || !answer.getResult()) {
- s_logger.error("ReserveVmInterfaceNuageVspCommand failed");
- if ((null != answer) && (null != answer.getDetails())) {
- s_logger.error(answer.getDetails());
+ try {
+ 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());
+ }
+ nic.setBroadcastUri(network.getBroadcastUri());
+ nic.setIsolationUri(network.getBroadcastUri());
+ DataCenter dc = _dcDao.findById(network.getDataCenterId());
+ Account networksAccount = _accountDao.findById(network.getAccountId());
+ DomainVO networksDomain = _domainDao.findById(network.getDomainId());
+ //Get the Account details and find the type
+ long networkOwnedBy = network.getAccountId();
+ AccountVO neworkAccountDetails = _accountDao.findById(networkOwnedBy);
+ if (neworkAccountDetails.getType() == Account.ACCOUNT_TYPE_PROJECT) {
+ throw new InsufficientVirtualNetworkCapacityException("CS project support is not yet implemented in NuageVsp", DataCenter.class, dc.getId());
+ }
+
+ //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 nicFrmDB = _nicDao.findById(nic.getId());
+ NetworkOffering networkOffering = _ntwkOfferingDao.findById(network.getNetworkOfferingId());
+ boolean isDomainRouter = vm.getType().equals(VirtualMachine.Type.DomainRouter);
+ URI broadcastUri = network.getBroadcastUri();
+ if (Strings.isNullOrEmpty(broadcastUri.getPath()) || !broadcastUri.getPath().startsWith("/")) {
+ throw new IllegalStateException("The broadcast URI path " + network.getBroadcastUri() + " is empty or in an incorrect format.");
+ }
+ String domainRouterIp = network.getBroadcastUri().getPath().substring(1);
+ boolean isL3Network = isL3Network(network);
+ boolean isSharedNetwork = networkOffering.getGuestType() == GuestType.Shared;
+ Long vpcId = network.getVpcId();
+ String vpcUuid = null;
+ if (vpcId != null) {
+ Vpc vpcObj = _vpcDao.findById(vpcId);
+ vpcUuid = vpcObj.getUuid();
+ }
+ HostVO nuageVspHost = getNuageVspHost(network.getPhysicalNetworkId());
+ IPAddressVO staticNatIp = _ipAddressDao.findByVmIdAndNetworkId(network.getId(), vm.getId());
+
+ ReserveVmInterfaceVspCommand.Builder cmdBuilder = new ReserveVmInterfaceVspCommand.Builder()
+ .nicUuid(nicFrmDB.getUuid())
+ .nicMacAddress(nic.getMacAddress())
+ .networkUuid(network.getUuid())
+ .isL3Network(isL3Network)
+ .isSharedNetwork(isSharedNetwork)
+ .vpcUuid(vpcUuid)
+ .networkDomainUuid(networksDomain.getUuid())
+ .networksAccountUuid(networksAccount.getUuid())
+ .isDomainRouter(isDomainRouter)
+ .domainRouterIp(domainRouterIp)
+ .vmInstanceName(vm.getInstanceName())
+ .vmUuid(vm.getUuid())
+ .vmUserName(networksDomain.getUuid())
+ .vmUserDomainName(networksAccount.getUuid())
+ .useStaticIp(true)
+ .staticIp(nic.getIPv4Address());
+ if (staticNatIp != null) {
+ VlanVO staticNatVlan = _vlanDao.findById(staticNatIp.getVlanId());
+ cmdBuilder = cmdBuilder.staticNatIpUuid(staticNatIp.getUuid())
+ .staticNatIpAddress(staticNatIp.getAddress().addr())
+ .isStaticNatIpAllocated(staticNatIp.getState().equals(IpAddress.State.Allocated))
+ .isOneToOneNat(staticNatIp.isOneToOneNat())
+ .staticNatVlanUuid(staticNatVlan.getUuid())
+ .staticNatVlanGateway(staticNatVlan.getVlanGateway())
+ .staticNatVlanNetmask(staticNatVlan.getVlanNetmask());
+ }
+
+ Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmdBuilder.build());
+ 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 (isDomainRouter) {
+ nic.setIPv4Address(domainRouterIp);
+ }
+
+ } 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());
+ }
}
- throw new InsufficientVirtualNetworkCapacityException("Failed to reserve VM in Nuage VSP.", Network.class, network.getId());
}
- List<Map<String, String>> vmInterfacesDetails = answer.getInterfaceDetails();
- setIPGatewayMaskInfo(network, nic, vmInterfacesDetails);
}
@Override
protected boolean canHandle(NetworkOffering offering, final NetworkType networkType, final PhysicalNetwork physicalNetwork) {
- if (networkType == NetworkType.Advanced && isMyTrafficType(offering.getTrafficType()) && offering.getGuestType() == Network.GuestType.Isolated
+ if (networkType == NetworkType.Advanced && isMyTrafficType(offering.getTrafficType()) && (offering.getGuestType() == Network.GuestType.Isolated || offering.getGuestType() == Network.GuestType.Shared)
&& isMyIsolationMethod(physicalNetwork)) {
return true;
} else {
- s_logger.trace("We only take care of Guest networks of type " + GuestType.Isolated + " in zone of type " + NetworkType.Advanced);
- return false;
- }
- }
-
- @Override
- public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
- long networkId = nic.getNetworkId();
- Network network = _networkDao.findById(networkId);
- s_logger.debug("Handling release() call back, which is called when a VM is stopped or destroyed, to delete the VM with state " + vm.getVirtualMachine().getState()
- + " from netork " + network.getName());
- if (vm.getVirtualMachine().getState().equals(VirtualMachine.State.Stopping)) {
- try {
- HostVO nuageVspHost = getNuageVspHost(network.getPhysicalNetworkId());
- ReleaseVmVspCommand cmd = new ReleaseVmVspCommand(network.getUuid(), vm.getUuid(), vm.getInstanceName());
- ReleaseVmVspAnswer answer = (ReleaseVmVspAnswer)_agentMgr.easySend(nuageVspHost.getId(), cmd);
- if (answer == null || !answer.getResult()) {
- s_logger.error("ReleaseVmNuageVspCommand for VM " + vm.getUuid() + " failed");
- if ((null != answer) && (null != answer.getDetails())) {
- s_logger.error(answer.getDetails());
- }
- }
- } catch (InsufficientVirtualNetworkCapacityException e) {
- s_logger.debug("Handling release() call back. Failed to delete CS VM " + vm.getInstanceName() + " in VSP. " + e.getMessage());
+ if (s_logger.isTraceEnabled()) {
+ s_logger.trace("We only take care of Guest networks of type " + GuestType.Isolated + " in zone of type " + NetworkType.Advanced);
}
- } else {
- s_logger.debug("Handling release() call back. VM " + vm.getInstanceName() + " is in " + vm.getVirtualMachine().getState() + " state. So, the CS VM is not deleted."
- + " This could be a case where VM interface is deleted. deallocate() call back should be called later");
+ return false;
}
-
- return super.release(nic, vm, reservationId);
}
@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 {
- 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 " + vm.getVirtualMachine().getState());
+ 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 " + vm.getVirtualMachine().getState());
+ }
DomainVO networksDomain = _domainDao.findById(network.getDomainId());
NicVO nicFrmDd = _nicDao.findById(nic.getId());
- long networkOfferingId = _ntwkOfferingDao.findById(network.getNetworkOfferingId()).getId();
+ NetworkOffering networkOffering = _ntwkOfferingDao.findById(network.getNetworkOfferingId());
+ boolean isL3Network = isL3Network(network);
+ boolean isSharedNetwork = networkOffering.getGuestType() == GuestType.Shared;
+ boolean isExpunging = vm.getVirtualMachine().getState() == VirtualMachine.State.Expunging;
Long vpcId = network.getVpcId();
String vpcUuid = null;
if (vpcId != null) {
@@ -299,22 +384,49 @@ public class NuageVspGuestNetworkGuru extends GuestNetworkGuru {
vpcUuid = vpcObj.getUuid();
}
HostVO nuageVspHost = getNuageVspHost(network.getPhysicalNetworkId());
- DeallocateVmVspCommand cmd = new DeallocateVmVspCommand(network.getUuid(), nicFrmDd.getUuid(), nic.getMacAddress(), nic.getIPv4Address(),
- isL3Network(networkOfferingId), vpcUuid, networksDomain.getUuid(), vm.getInstanceName(), vm.getUuid());
- DeallocateVmVspAnswer answer = (DeallocateVmVspAnswer)_agentMgr.easySend(nuageVspHost.getId(), cmd);
+ DeallocateVmVspCommand.Builder cmdBuilder = new DeallocateVmVspCommand.Builder()
+ .networkUuid(network.getUuid())
+ .nicFromDbUuid(nicFrmDd.getUuid())
+ .nicMacAddress(nic.getMacAddress())
+ .nicIp4Address(nic.getIPv4Address())
+ .isL3Network(isL3Network)
+ .isSharedNetwork(isSharedNetwork)
+ .vpcUuid(vpcUuid)
+ .networksDomainUuid(networksDomain.getUuid())
+ .vmInstanceName(vm.getInstanceName())
+ .vmUuid(vm.getUuid())
+ .isExpungingState(isExpunging);
+ Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmdBuilder.build());
if (answer == null || !answer.getResult()) {
- s_logger.error("DeallocateVmNuageVspCommand for VM " + vm.getUuid() + " failed");
+ 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());
}
}
- } catch (InsufficientVirtualNetworkCapacityException e) {
- s_logger.error("Handling deallocate(). VM " + vm.getInstanceName() + " with NIC IP " + nic.getIPv4Address()
- + " is getting destroyed. REST API failed to update the VM state in NuageVsp", e);
+ } 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());
+ }
+ }
}
+
super.deallocate(network, nic, vm);
}
+ 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);
@@ -322,55 +434,82 @@ public class NuageVspGuestNetworkGuru extends GuestNetworkGuru {
@Override
public boolean trash(Network network, NetworkOffering offering) {
-
- s_logger.debug("Handling trash() call back to delete the network " + network.getName() + " with uuid " + network.getUuid() + " from VSP");
- long domainId = network.getDomainId();
- Domain domain = _domainDao.findById(domainId);
- Long vpcId = network.getVpcId();
- String vpcUuid = null;
- if (vpcId != null) {
- Vpc vpcObj = _vpcDao.findById(vpcId);
- vpcUuid = vpcObj.getUuid();
+ 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");
+ }
+ long domainId = network.getDomainId();
+ Domain domain = _domainDao.findById(domainId);
+ boolean isL3Network = isL3Network(network);
+ boolean isSharedNetwork = offering.getGuestType() == GuestType.Shared;
+ Long vpcId = network.getVpcId();
+ String vpcUuid = null;
+ if (vpcId != null) {
+ Vpc vpcObj = _vpcDao.findById(vpcId);
+ vpcUuid = vpcObj.getUuid();
+ }
+
+ String preConfiguredDomainTemplateName = NuageVspUtil.getPreConfiguredDomainTemplateName(_configDao, network, offering);
HostVO nuageVspHost = getNuageVspHost(network.getPhysicalNetworkId());
- TrashNetworkVspCommand cmd = new TrashNetworkVspCommand(domain.getUuid(), network.getUuid(), isL3Network(offering.getId()), vpcUuid);
- TrashNetworkVspAnswer answer = (TrashNetworkVspAnswer)_agentMgr.easySend(nuageVspHost.getId(), cmd);
+ TrashNetworkVspCommand.Builder cmdBuilder = new TrashNetworkVspCommand.Builder()
+ .domainUuid(domain.getUuid())
+ .networkUuid(network.getUuid())
+ .isL3Network(isL3Network)
+ .isSharedNetwork(isSharedNetwork)
+ .vpcUuid(vpcUuid)
+ .domainTemplateName(preConfiguredDomainTemplateName);
+ Answer answer = _agentMgr.easySend(nuageVspHost.getId(), cmdBuilder.build());
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;
}
- } catch (Exception e) {
- s_logger.warn("Failed to clean up network information in Vsp " + e.getMessage());
+ } finally {
+ _networkDao.releaseFromLockTable(network.getId());
}
-
return super.trash(network, offering);
}
- private String getVirtualRouterIP(Network network, Collection<String> addressRange) throws InsufficientVirtualNetworkCapacityException {
+ private String getVirtualRouterIP(Network network, Collection<String[]> ipAddressRanges) throws InsufficientVirtualNetworkCapacityException {
String virtualRouterIp;
+ //Check if the subnet has minimum 5 host in it.
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.");
+ }
if (allIPsInCidr.size() > 3) {
+ //get the second IP and see if it the networks GatewayIP
Iterator<Long> ipIterator = allIPsInCidr.iterator();
long vip = ipIterator.next();
if (NetUtils.ip2Long(network.getGateway()) == vip) {
- s_logger.debug("Gateway of the Network(" + network.getUuid() + ") has the first IP " + NetUtils.long2Ip(vip));
vip = ipIterator.next();
virtualRouterIp = NetUtils.long2Ip(vip);
- s_logger.debug("So, reserving the 2nd IP " + virtualRouterIp + " for the Virtual Router IP in Network(" + network.getUuid() + ")");
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("1st IP is used as gateway IP. Reserving " + virtualRouterIp + " for the Virtual Router IP for Network(" + network.getName() + ")");
+ }
} else {
virtualRouterIp = NetUtils.long2Ip(vip);
- s_logger.debug("1nd IP is not used as the gateway IP. So, reserving" + virtualRouterIp + " for the Virtual Router IP for " + "Network(" + network.getUuid() + ")");
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("1st IP is not used as the gateway IP. Reserving" + virtualRouterIp + " for the Virtual Router IP for Network(" + network.getName() + ")");
+ }
}
- addressRange.add(NetUtils.long2Ip(ipIterator.next()));
- addressRange.add(NetUtils.long2Ip((Long)allIPsInCidr.toArray()[allIPsInCidr.size() - 1]));
+ ipAddressRanges.add(new String[] {
+ NetUtils.long2Ip(ipIterator.next()),
+ NetUtils.getIpRangeEndIpFromCidr(subnet, cidrSize)
+ });
return virtualRouterIp;
}
@@ -378,30 +517,13 @@ public class NuageVspGuestNetworkGuru extends GuestNetworkGuru {
network.getId());
}
- private void setIPGatewayMaskInfo(Network network, NicProfile nic, List<Map<String, String>> vmInterfacesDetails) throws InsufficientVirtualNetworkCapacityException {
- try {
- for (Map<String, String> interfaces : vmInterfacesDetails) {
- String macFromNuage = interfaces.get("mac");
- if (StringUtils.equals(macFromNuage, nic.getMacAddress())) {
- nic.setIPv4Address(interfaces.get("ip4Address"));
- nic.setIPv4Gateway(interfaces.get("gateway"));
- nic.setIPv4Netmask(interfaces.get("netmask"));
- break;
- }
- }
- } catch (Exception e) {
- s_logger.error("Failed to parse the VM interface Json response from VSP REST API. VM interface json string is " + vmInterfacesDetails, e);
- throw new InsufficientVirtualNetworkCapacityException("Failed to parse the VM interface Json response from VSP REST API. VM interface Json " + "string is "
- + vmInterfacesDetails + ". So. failed to get IP for the VM from VSP address for network " + network, Network.class, network.getId());
- }
- }
-
- private boolean isL3Network(Long offeringId) {
- return _ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(offeringId, Service.SourceNat)
- || _ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(offeringId, Service.StaticNat);
+ private boolean isL3Network(Network network) {
+ return _ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(network.getNetworkOfferingId(), Service.SourceNat)
+ || _ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(network.getNetworkOfferingId(), Service.StaticNat)
+ || network.getGuestType() == GuestType.Shared;
}
- private HostVO getNuageVspHost(long physicalNetworkId) throws InsufficientVirtualNetworkCapacityException {
+ private HostVO getNuageVspHost(long physicalNetworkId) {
HostVO nuageVspHost;
List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listByPhysicalNetwork(physicalNetworkId);
if (nuageVspDevices != null && (!nuageVspDevices.isEmpty())) {
@@ -409,8 +531,8 @@ public class NuageVspGuestNetworkGuru extends GuestNetworkGuru {
nuageVspHost = _hostDao.findById(config.getHostId());
_hostDao.loadDetails(nuageVspHost);
} else {
- throw new InsufficientVirtualNetworkCapacityException("Nuage VSD is not configured on physical network ", PhysicalNetwork.class, physicalNetworkId);
+ throw new CloudRuntimeException("There is no Nuage VSP device configured on physical network " + physicalNetworkId);
}
return nuageVspHost;
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/645f8758/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManager.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManager.java b/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManager.java
index 2b4d2b5..0aae22c 100644
--- a/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManager.java
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManager.java
@@ -19,37 +19,66 @@
package com.cloud.network.manager;
-import java.util.List;
-
-import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.ConfigKey.Scope;
-
import com.cloud.api.commands.AddNuageVspDeviceCmd;
import com.cloud.api.commands.DeleteNuageVspDeviceCmd;
import com.cloud.api.commands.ListNuageVspDevicesCmd;
+import com.cloud.api.commands.UpdateNuageVspDeviceCmd;
import com.cloud.api.response.NuageVspDeviceResponse;
+import com.cloud.network.Network;
import com.cloud.network.NuageVspDeviceVO;
import com.cloud.utils.component.PluggableService;
+import org.apache.cloudstack.framework.config.ConfigKey;
+import org.apache.cloudstack.framework.config.ConfigKey.Scope;
+
+import java.util.List;
public interface NuageVspManager extends PluggableService {
- static final String NUAGE_VPC_OFFERING_NAME = "Default VPC offering with NuageVsp";
+ static final String nuageVspSharedNetworkOfferingWithSGServiceName = "DefaultNuageVspSharedNetworkOfferingWithSGService";
- static final String NUAGE_VPC_OFFERING_DISPLAY_TEXT = "Default VPC offering with NuageVsp";
+ static final String nuageVPCOfferingName = "Nuage VSP VPC Offering";
- static final ConfigKey<Integer> NuageVspSyncInterval = new ConfigKey<Integer>(Integer.class, "nuagevsp.sync.interval", "Advanced", "480",
- "The interval (in minutes) to wait before running the next synchronization worker to synchronize the information between CloudStack and NuageVsp", false, Scope.Global,
- 1);
+ static final String nuageVPCOfferingDisplayText = "Nuage VSP VPC Offering";
- static final ConfigKey<Integer> NuageVspSyncWorkers = new ConfigKey<Integer>(Integer.class, "nuagevsp.sync.workers", "Advanced", "1",
- "Number of workers to synchronize the information between CloudStack and NuageVsp", false, Scope.Global, 1);
+ static final 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);
+
+ static final 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);
+
+ static final 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);
+
+ static final 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);
+
+ static final 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);
+
+ static final 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);
NuageVspDeviceVO addNuageVspDevice(AddNuageVspDeviceCmd cmd);
+ NuageVspDeviceVO updateNuageVspDevice(UpdateNuageVspDeviceCmd cmd);
+
NuageVspDeviceResponse createNuageVspDeviceResponse(NuageVspDeviceVO nuageVspDeviceVO);
boolean deleteNuageVspDevice(DeleteNuageVspDeviceCmd cmd);
List<NuageVspDeviceVO> listNuageVspDevices(ListNuageVspDevicesCmd cmd);
+ List<String> getDnsDetails(Network network);
+
+ List<String> getGatewaySystemIds();
+
}