CLOUDSTACK-9450: Network Offering for VPC based on DB flag

Co-Authored-By: Raf Smeets <raf.smeets@nuagenetworks.net>
This commit is contained in:
Frank Maximus 2017-05-24 12:46:01 +02:00
parent a50a461c8e
commit d467a6b8ec
18 changed files with 252 additions and 89 deletions

View File

@ -78,6 +78,8 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
*/
Integer getMulticastRateMbps();
boolean getForVpc();
TrafficType getTrafficType();
boolean getSpecifyVlan();

View File

@ -112,6 +112,11 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
description = "true if network offering supports persistent networks; defaulted to false if not specified")
private Boolean isPersistent;
@Parameter(name = ApiConstants.FOR_VPC,
type = CommandType.BOOLEAN,
description = "true if network offering is meant to be used for VPC, false otherwise.")
private Boolean forVpc;
@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, since = "4.2.0", description = "Network offering details in key/value pairs."
+ " Supported keys are internallbprovider/publiclbprovider with service provider as a value, and"
+ " promiscuousmode/macaddresschanges/forgedtransmits with true/false as value to accept/reject the security settings if available for a nic/portgroup")
@ -196,6 +201,10 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
return isPersistent == null ? false : isPersistent;
}
public Boolean getForVpc() {
return forVpc;
}
public Boolean getEgressDefaultPolicy() {
if (egressDefaultPolicy == null) {
return true;

View File

@ -204,14 +204,14 @@ public interface ConfigurationManager {
* @param isPersistent
* ;
* @param details TODO
* @param id
* @param forVpc
* @return network offering object
*/
NetworkOfferingVO createNetworkOffering(String name, String displayText, TrafficType trafficType, String tags, boolean specifyVlan, Availability availability,
Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId,
boolean conserveMode, Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges, boolean isPersistent,
Map<NetworkOffering.Detail, String> details, boolean egressDefaultPolicy, Integer maxconn, boolean enableKeepAlive);
Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId,
boolean conserveMode, Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges, boolean isPersistent,
Map<NetworkOffering.Detail, String> details, boolean egressDefaultPolicy, Integer maxconn, boolean enableKeepAlive, Boolean forVpc);
Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, Long podId, String startIP, String endIP,
String vlanGateway, String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr)

View File

@ -446,7 +446,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
if (_networkOfferingDao.findByUniqueName(NetworkOffering.QuickCloudNoServices) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.QuickCloudNoServices, "Offering for QuickCloud with no services", TrafficType.Guest, null, true,
Availability.Optional, null, new HashMap<Network.Service, Set<Network.Provider>>(), true, Network.GuestType.Shared, false, null, true, null, true,
false, null, false, null, true);
false, null, false, null, true, false);
offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering);
}
@ -455,7 +455,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOfferingWithSGService) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks",
TrafficType.Guest, null, true, Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true,
null, true, false, null, false, null, true);
null, true, false, null, false, null, true, false);
offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering);
}
@ -464,7 +464,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true,
Availability.Optional, null, defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true, false, null, false,
null, true);
null, true, false);
offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering);
}
@ -474,7 +474,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService,
"Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Required, null,
defaultIsolatedSourceNatEnabledNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null, true, null, false, false, null, false, null,
true);
true, false);
offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering);
@ -484,7 +484,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks,
"Offering for Isolated VPC networks with Source Nat service enabled", TrafficType.Guest, null, false, Availability.Optional, null,
defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true);
offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering);
}
@ -495,7 +495,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
defaultVPCOffProviders.remove(Service.Lb);
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB,
"Offering for Isolated VPC networks with Source Nat service enabled and LB service disabled", TrafficType.Guest, null, false, Availability.Optional,
null, defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
null, defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true);
offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering);
}
@ -504,7 +504,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOffering) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service",
TrafficType.Guest, null, true, Availability.Optional, null, defaultIsolatedNetworkOfferingProviders, true, Network.GuestType.Isolated, false, null,
true, null, true, false, null, false, null, true);
true, null, true, false, null, false, null, true, false);
offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering);
}
@ -528,7 +528,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
"Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest, null, false, Availability.Optional, null, internalLbOffProviders,
true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true);
offering.setState(NetworkOffering.State.Enabled);
offering.setInternalLb(true);
offering.setPublicLb(false);
@ -560,7 +560,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedEIPandELBNetworkOffering) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedEIPandELBNetworkOffering,
"Offering for Shared networks with Elastic IP and Elastic LB capabilities", TrafficType.Guest, null, true, Availability.Optional, null,
netscalerServiceProviders, true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true);
netscalerServiceProviders, true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true, false);
offering.setState(NetworkOffering.State.Enabled);
offering.setDedicatedLB(false);
_networkOfferingDao.update(offering.getId(), offering);

View File

@ -130,6 +130,9 @@ public class NetworkOfferingVO implements NetworkOffering {
@Column(name = "is_persistent")
boolean isPersistent;
@Column(name = "for_vpc")
boolean forVpc;
@Column(name = "egress_default_policy")
boolean egressdefaultpolicy;
@ -168,6 +171,15 @@ public class NetworkOfferingVO implements NetworkOffering {
this.keepAliveEnabled = keepAliveEnabled;
}
@Override
public boolean getForVpc() {
return forVpc;
}
public void setForVpc(boolean isForVpc) {
this.forVpc = isForVpc;
}
@Override
public long getId() {
return id;
@ -309,7 +321,7 @@ public class NetworkOfferingVO implements NetworkOffering {
public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps,
Integer multicastRateMbps, boolean isDefault, Availability availability, String tags, Network.GuestType guestType, boolean conserveMode,
boolean specifyIpRanges, boolean isPersistent, boolean internalLb, boolean publicLb) {
boolean specifyIpRanges, boolean isPersistent, boolean internalLb, boolean publicLb, boolean isForVpc) {
this.name = name;
this.displayText = displayText;
this.rateMbps = rateMbps;
@ -335,12 +347,13 @@ public class NetworkOfferingVO implements NetworkOffering {
this.isPersistent = isPersistent;
this.publicLb = publicLb;
this.internalLb = internalLb;
this.forVpc = isForVpc;
}
public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps,
Integer multicastRateMbps, boolean isDefault, Availability availability, String tags, Network.GuestType guestType, boolean conserveMode, boolean dedicatedLb,
boolean sharedSourceNat, boolean redundantRouter, boolean elasticIp, boolean elasticLb, boolean specifyIpRanges, boolean inline, boolean isPersistent,
boolean associatePublicIP, boolean publicLb, boolean internalLb, boolean egressdefaultpolicy, boolean supportsStrechedL2, boolean supportsPublicAccess) {
boolean associatePublicIP, boolean publicLb, boolean internalLb, boolean isForVpc, boolean egressdefaultpolicy, boolean supportsStrechedL2, boolean supportsPublicAccess) {
this(name,
displayText,
trafficType,
@ -356,7 +369,7 @@ public class NetworkOfferingVO implements NetworkOffering {
specifyIpRanges,
isPersistent,
internalLb,
publicLb);
publicLb, isForVpc);
this.dedicatedLB = dedicatedLb;
this.sharedSourceNat = sharedSourceNat;
this.redundantRouter = redundantRouter;
@ -381,7 +394,7 @@ public class NetworkOfferingVO implements NetworkOffering {
* TODO
*/
public NetworkOfferingVO(String name, TrafficType trafficType, boolean specifyIpRanges) {
this(name, "System Offering for " + name, trafficType, true, false, 0, 0, true, Availability.Required, null, null, true, specifyIpRanges, false, false, false);
this(name, "System Offering for " + name, trafficType, true, false, 0, 0, true, Availability.Required, null, null, true, specifyIpRanges, false, false, false, false);
this.state = State.Enabled;
}
@ -401,6 +414,7 @@ public class NetworkOfferingVO implements NetworkOffering {
false,
false,
false,
false,
false);
this.state = State.Enabled;
}

View File

@ -219,7 +219,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
ConfigurationManager configMgr = (ConfigurationManager) _configService;
NetworkOfferingVO voffer = configMgr.createNetworkOffering(offeringName, offeringDisplayText,
TrafficType.Public, null, true, Availability.Optional, null, serviceProviderMap, true,
Network.GuestType.Shared, false, null, false, null, true, false, null, true, null, false);
Network.GuestType.Shared, false, null, false, null, true, false, null, true, null, false, false);
voffer.setState(NetworkOffering.State.Enabled);
long id = voffer.getId();
@ -256,7 +256,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
ConfigurationManager configMgr = (ConfigurationManager)_configService;
NetworkOfferingVO voffer =
configMgr.createNetworkOffering(offeringName, offeringDisplayText, TrafficType.Guest, null, false, Availability.Optional, null, serviceProviderMap, true,
Network.GuestType.Isolated, false, null, false, null, false, true, null, true, null, false);
Network.GuestType.Isolated, false, null, false, null, false, true, null, true, null, false, offeringName.equals(vpcRouterOfferingName));
voffer.setState(NetworkOffering.State.Enabled);
if (offeringName.equals(vpcRouterOfferingName)) {

View File

@ -976,7 +976,8 @@ public class NuageVspManagerImpl extends ManagerBase implements NuageVspManager,
if (sharedNetworkOfferingWithSG == null) {
NetworkOfferingVO defaultNuageVspSharedSGNetworkOffering =
new NetworkOfferingVO(nuageVspSharedNetworkOfferingWithSGServiceName, "Offering for NuageVsp Shared Security group enabled networks",
Networks.TrafficType.Guest, false, false, null, null, true, NetworkOffering.Availability.Optional, null, Network.GuestType.Shared, true, true, false, false, false);
Networks.TrafficType.Guest, false, false, null, null, true, NetworkOffering.Availability.Optional, null, Network.GuestType.Shared, true, true, false, false, false,
false);
defaultNuageVspSharedSGNetworkOffering.setState(NetworkOffering.State.Enabled);
defaultNuageVspSharedSGNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultNuageVspSharedSGNetworkOffering);

View File

@ -34,6 +34,8 @@ import java.util.UUID;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import com.google.common.collect.Sets;
import org.apache.cloudstack.acl.SecurityChecker;
import org.apache.cloudstack.affinity.AffinityGroup;
import org.apache.cloudstack.affinity.AffinityGroupService;
@ -361,6 +363,8 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
public static final ConfigKey<Boolean> SystemVMUseLocalStorage = new ConfigKey<Boolean>(Boolean.class, "system.vm.use.local.storage", "Advanced", "false",
"Indicates whether to use local storage pools or shared storage pools for system VMs.", false, ConfigKey.Scope.Zone, null);
private static final Set<Provider> VPC_ONLY_PROVIDERS = Sets.newHashSet(Provider.VPCVirtualRouter, Provider.JuniperContrailVpcRouter, Provider.InternalLbVm);
@Override
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
final String maxVolumeSizeInGbString = _configDao.getValue(Config.MaxVolumeSize.key());
@ -3918,6 +3922,8 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
final boolean isPersistent = cmd.getIsPersistent();
final Map<String, String> detailsStr = cmd.getDetails();
final Boolean egressDefaultPolicy = cmd.getEgressDefaultPolicy();
Boolean forVpc = cmd.getForVpc();
Integer maxconn = null;
boolean enableKeepAlive = false;
String servicePackageuuid = cmd.getServicePackageId();
@ -3988,6 +3994,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
throw new InvalidParameterValueException("Invalid service " + serviceName);
}
if (forVpc == null) {
if (service == Service.SecurityGroup || service == Service.Firewall) {
forVpc = false;
} else if (service == Service.NetworkACL) {
forVpc = true;
}
}
if (service == Service.SecurityGroup) {
// allow security group service for Shared networks only
if (guestType != GuestType.Shared) {
@ -3998,6 +4012,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
serviceProviderMap.put(Network.Service.SecurityGroup, sgProviders);
continue;
}
serviceProviderMap.put(service, defaultProviders);
}
@ -4042,6 +4057,10 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
firewallProvider = Provider.VirtualRouter;
}
if (forVpc == null && VPC_ONLY_PROVIDERS.contains(provider)) {
forVpc = true;
}
if (service == Service.Dhcp) {
dhcpProvider = provider;
}
@ -4159,8 +4178,12 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
}
}
if (forVpc == null) {
forVpc = false;
}
final NetworkOffering offering = createNetworkOffering(name, displayText, trafficType, tags, specifyVlan, availability, networkRate, serviceProviderMap, false, guestType, false,
serviceOfferingId, conserveMode, serviceCapabilityMap, specifyIpRanges, isPersistent, details, egressDefaultPolicy, maxconn, enableKeepAlive);
serviceOfferingId, conserveMode, serviceCapabilityMap, specifyIpRanges, isPersistent, details, egressDefaultPolicy, maxconn, enableKeepAlive, forVpc);
CallContext.current().setEventDetails(" Id: " + offering.getId() + " Name: " + name);
return offering;
}
@ -4289,12 +4312,15 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
}
}
}
@Override
@DB
public NetworkOfferingVO createNetworkOffering(final String name, final String displayText, final TrafficType trafficType, String tags, final boolean specifyVlan, final Availability availability,
final Integer networkRate, final Map<Service, Set<Provider>> serviceProviderMap, final boolean isDefault, final Network.GuestType type, final boolean systemOnly, final Long serviceOfferingId,
public NetworkOfferingVO createNetworkOffering(final String name, final String displayText, final TrafficType trafficType, String tags, final boolean specifyVlan,
final Availability availability,
final Integer networkRate, final Map<Service, Set<Provider>> serviceProviderMap, final boolean isDefault, final GuestType type, final boolean systemOnly,
final Long serviceOfferingId,
final boolean conserveMode, final Map<Service, Map<Capability, String>> serviceCapabilityMap, final boolean specifyIpRanges, final boolean isPersistent,
final Map<NetworkOffering.Detail, String> details, final boolean egressDefaultPolicy, final Integer maxconn, final boolean enableKeepAlive) {
final Map<Detail, String> details, final boolean egressDefaultPolicy, final Integer maxconn, final boolean enableKeepAlive, Boolean forVpc) {
String servicePackageUuid;
String spDescription = null;
@ -4458,7 +4484,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
final NetworkOfferingVO offeringFinal = new NetworkOfferingVO(name, displayText, trafficType, systemOnly, specifyVlan, networkRate, multicastRate, isDefault, availability,
tags, type, conserveMode, dedicatedLb, sharedSourceNat, redundantRouter, elasticIp, elasticLb, specifyIpRanges, inline, isPersistent, associatePublicIp, publicLb,
internalLb, egressDefaultPolicy, strechedL2Subnet, publicAccess);
internalLb, forVpc, egressDefaultPolicy, strechedL2Subnet, publicAccess);
if (serviceOfferingId != null) {
offeringFinal.setServiceOfferingId(serviceOfferingId);
@ -4809,12 +4835,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
@Override
public boolean isOfferingForVpc(final NetworkOffering offering) {
final boolean vpcProvider = _ntwkOffServiceMapDao.isProviderForNetworkOffering(offering.getId(), Provider.VPCVirtualRouter) ||
_ntwkOffServiceMapDao.isProviderForNetworkOffering(offering.getId(), Provider.JuniperContrailVpcRouter);
final boolean nuageVpcProvider = _ntwkOffServiceMapDao.getDistinctProviders(offering.getId()).contains(Provider.NuageVsp.getName())
&& offering.getIsPersistent();
return vpcProvider || nuageVpcProvider;
return offering.getForVpc();
}
@DB

View File

@ -1022,7 +1022,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
// Offering #1
NetworkOfferingVO defaultSharedSGNetworkOffering =
new NetworkOfferingVO(NetworkOffering.DefaultSharedNetworkOfferingWithSGService, "Offering for Shared Security group enabled networks",
TrafficType.Guest, false, true, null, null, true, Availability.Optional, null, Network.GuestType.Shared, true, true, false, false, false);
TrafficType.Guest, false, true, null, null, true, Availability.Optional, null, Network.GuestType.Shared, true, true, false, false, false, false);
defaultSharedSGNetworkOffering.setState(NetworkOffering.State.Enabled);
defaultSharedSGNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultSharedSGNetworkOffering);
@ -1037,7 +1037,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
// Offering #2
NetworkOfferingVO defaultSharedNetworkOffering =
new NetworkOfferingVO(NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, false, true, null, null, true,
Availability.Optional, null, Network.GuestType.Shared, true, true, false, false, false);
Availability.Optional, null, Network.GuestType.Shared, true, true, false, false, false, false);
defaultSharedNetworkOffering.setState(NetworkOffering.State.Enabled);
defaultSharedNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultSharedNetworkOffering);
@ -1053,7 +1053,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
NetworkOfferingVO defaultIsolatedSourceNatEnabledNetworkOffering =
new NetworkOfferingVO(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService,
"Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest, false, false, null, null, true, Availability.Required, null,
Network.GuestType.Isolated, true, false, false, false, true);
Network.GuestType.Isolated, true, false, false, false, true, false);
defaultIsolatedSourceNatEnabledNetworkOffering.setState(NetworkOffering.State.Enabled);
defaultIsolatedSourceNatEnabledNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultIsolatedSourceNatEnabledNetworkOffering);
@ -1069,7 +1069,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
// Offering #4
NetworkOfferingVO defaultIsolatedEnabledNetworkOffering =
new NetworkOfferingVO(NetworkOffering.DefaultIsolatedNetworkOffering, "Offering for Isolated networks with no Source Nat service", TrafficType.Guest,
false, true, null, null, true, Availability.Optional, null, Network.GuestType.Isolated, true, true, false, false, false);
false, true, null, null, true, Availability.Optional, null, Network.GuestType.Isolated, true, true, false, false, false, false);
defaultIsolatedEnabledNetworkOffering.setState(NetworkOffering.State.Enabled);
defaultIsolatedEnabledNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultIsolatedEnabledNetworkOffering);
@ -1085,7 +1085,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
NetworkOfferingVO defaultNetscalerNetworkOffering =
new NetworkOfferingVO(NetworkOffering.DefaultSharedEIPandELBNetworkOffering,
"Offering for Shared networks with Elastic IP and Elastic LB capabilities", TrafficType.Guest, false, true, null, null, true,
Availability.Optional, null, Network.GuestType.Shared, true, false, false, false, true, true, true, false, false, true, true, false, false, false, false);
Availability.Optional, null, Network.GuestType.Shared, true, false, false, false, true, true, true, false, false, true, true, false, false, false, false, false);
defaultNetscalerNetworkOffering.setState(NetworkOffering.State.Enabled);
defaultNetscalerNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultNetscalerNetworkOffering);
@ -1101,7 +1101,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
NetworkOfferingVO defaultNetworkOfferingForVpcNetworks =
new NetworkOfferingVO(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks,
"Offering for Isolated Vpc networks with Source Nat service enabled", TrafficType.Guest, false, false, null, null, true, Availability.Optional,
null, Network.GuestType.Isolated, false, false, false, false, true);
null, Network.GuestType.Isolated, false, false, false, false, true, true);
defaultNetworkOfferingForVpcNetworks.setState(NetworkOffering.State.Enabled);
defaultNetworkOfferingForVpcNetworks = _networkOfferingDao.persistDefaultNetworkOffering(defaultNetworkOfferingForVpcNetworks);
@ -1129,7 +1129,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
NetworkOfferingVO defaultNetworkOfferingForVpcNetworksNoLB =
new NetworkOfferingVO(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB,
"Offering for Isolated Vpc networks with Source Nat service enabled and LB service Disabled", TrafficType.Guest, false, false, null, null, true,
Availability.Optional, null, Network.GuestType.Isolated, false, false, false, false, false);
Availability.Optional, null, Network.GuestType.Isolated, false, false, false, false, false, true);
defaultNetworkOfferingForVpcNetworksNoLB.setState(NetworkOffering.State.Enabled);
defaultNetworkOfferingForVpcNetworksNoLB = _networkOfferingDao.persistDefaultNetworkOffering(defaultNetworkOfferingForVpcNetworksNoLB);
@ -1156,7 +1156,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
NetworkOfferingVO internalLbOff =
new NetworkOfferingVO(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
"Offering for Isolated Vpc networks with Internal LB support", TrafficType.Guest, false, false, null, null, true, Availability.Optional, null,
Network.GuestType.Isolated, false, false, false, true, false);
Network.GuestType.Isolated, false, false, false, true, false, true);
internalLbOff.setState(NetworkOffering.State.Enabled);
internalLbOff = _networkOfferingDao.persistDefaultNetworkOffering(internalLbOff);

View File

@ -490,20 +490,10 @@ public class ConfigurationManagerTest {
@Test
public void searchForNetworkOfferingsTest() {
final NetworkOfferingVO off1 = new NetworkOfferingVO("off1", "off1", Networks.TrafficType.Guest, false, false, null, null, false,
NetworkOffering.Availability.Optional, null, Network.GuestType.Isolated, true, false, false, false,
false);
final NetworkOfferingVO off2 = new NetworkOfferingVO("off2", "off2", Networks.TrafficType.Guest, false, false, null, null, false,
NetworkOffering.Availability.Optional, null, Network.GuestType.Isolated, true, false, false, false,
false);
final NetworkOfferingVO off3 = new NetworkOfferingVO("off3", "off3", Networks.TrafficType.Guest, false, false, null, null, false,
NetworkOffering.Availability.Optional, null, Network.GuestType.Isolated, true, false, false, false,
false);
List<NetworkOfferingVO> offerings = Arrays.asList(
off1,
off2,
off3
new NetworkOfferingVO("off1", "off1", Networks.TrafficType.Guest, false, false, null, null, false, NetworkOffering.Availability.Optional, null, Network.GuestType.Isolated, true, false, false, false, false, false),
new NetworkOfferingVO("off2", "off2", Networks.TrafficType.Guest, false, false, null, null, false, NetworkOffering.Availability.Optional, null, Network.GuestType.Isolated, true, false, false, false, false, false),
new NetworkOfferingVO("off3", "off3", Networks.TrafficType.Guest, false, false, null, null, false, NetworkOffering.Availability.Optional, null, Network.GuestType.Isolated, true, false, false, false, false, true)
);
Mockito.when(_networkOfferingDao.createSearchCriteria()).thenReturn(Mockito.mock(SearchCriteria.class));
@ -514,12 +504,8 @@ public class ConfigurationManagerTest {
assertThat(configurationMgr.searchForNetworkOfferings(cmd).second(), is(3));
ConfigurationManagerImpl spy = Mockito.spy(configurationMgr);
Mockito.doReturn(false).when(spy).isOfferingForVpc(off1);
Mockito.doReturn(false).when(spy).isOfferingForVpc(off2);
Mockito.doReturn(true).when(spy).isOfferingForVpc(off3);
Mockito.when(cmd.getForVpc()).thenReturn(Boolean.FALSE);
assertThat(spy.searchForNetworkOfferings(cmd).second(), is(2));
assertThat(configurationMgr.searchForNetworkOfferings(cmd).second(), is(2));
}
@Test

View File

@ -17,19 +17,12 @@
package com.cloud.network;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.when;
import junit.framework.Assert;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import junit.framework.Assert;
import org.apache.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
@ -64,6 +57,13 @@ import com.cloud.utils.db.DB;
import com.cloud.utils.db.TransactionLegacy;
import com.cloud.utils.exception.CloudRuntimeException;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.when;
//@Ignore("Requires database to be set up")
public class CreatePrivateNetworkTest {
@ -103,7 +103,7 @@ public class CreatePrivateNetworkTest {
NetworkOfferingVO ntwkOff =
new NetworkOfferingVO("offer", "fakeOffer", TrafficType.Guest, true, true, null, null, false, null, null, GuestType.Isolated, false, false, false, false,
false, false, false, false, false, false, false, false, false, false, false);
false, false, false, false, false, false, false, false, false, false, false, false);
when(networkService._networkOfferingDao.findById(anyLong())).thenReturn(ntwkOff);
List<NetworkOfferingVO> netofferlist = new ArrayList<NetworkOfferingVO>();
netofferlist.add(ntwkOff);

View File

@ -428,9 +428,9 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
*/
@Override
public NetworkOfferingVO createNetworkOffering(String name, String displayText, TrafficType trafficType, String tags, boolean specifyVlan, Availability availability,
Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, GuestType type, boolean systemOnly, Long serviceOfferingId,
boolean conserveMode, Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges, boolean isPersistent,
Map<NetworkOffering.Detail, String> details, boolean egressDefaultPolicy, Integer maxconn, boolean enableKeepAlive) {
Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, GuestType type, boolean systemOnly, Long serviceOfferingId,
boolean conserveMode, Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges, boolean isPersistent,
Map<NetworkOffering.Detail, String> details, boolean egressDefaultPolicy, Integer maxconn, boolean enableKeepAlive, Boolean forVpc) {
// TODO Auto-generated method stub
return null;
}

View File

@ -98,33 +98,33 @@ public class MockNetworkOfferingDaoImpl extends NetworkOfferingDaoImpl implement
//network offering valid for vpc
vo =
new NetworkOfferingVO("vpc", "vpc", TrafficType.Guest, false, true, null, null, false, Availability.Optional, null, Network.GuestType.Isolated, false,
false, false, false, false);
false, false, false, false, true);
} else if (id.longValue() == 2) {
//invalid offering - source nat is not included
vo =
new NetworkOfferingVO("vpc", "vpc", TrafficType.Guest, false, true, null, null, false, Availability.Optional, null, Network.GuestType.Isolated, false,
false, false, false, false);
false, false, false, false, true);
} else if (id.longValue() == 3) {
//network offering invalid for vpc (conserve mode off)
vo =
new NetworkOfferingVO("non vpc", "non vpc", TrafficType.Guest, false, true, null, null, false, Availability.Optional, null, Network.GuestType.Isolated,
true, false, false, false, false);
true, false, false, false, false, false);
} else if (id.longValue() == 4) {
//network offering invalid for vpc (Shared)
vo =
new NetworkOfferingVO("non vpc", "non vpc", TrafficType.Guest, false, true, null, null, false, Availability.Optional, null, Network.GuestType.Shared,
false, false, false, false, false);
false, false, false, false, false, false);
} else if (id.longValue() == 5) {
//network offering invalid for vpc (has redundant router)
vo =
new NetworkOfferingVO("vpc", "vpc", TrafficType.Guest, false, true, null, null, false, Availability.Optional, null, Network.GuestType.Isolated, false,
false, false, false, false);
false, false, false, false, true);
vo.setRedundantRouter(true);
} else if (id.longValue() == 6) {
//network offering invalid for vpc (has lb service)
vo =
new NetworkOfferingVO("vpc", "vpc", TrafficType.Guest, false, true, null, null, false, Availability.Optional, null, Network.GuestType.Isolated, false,
false, false, false, false);
false, false, false, false, true);
}
if (vo != null) {

View File

@ -125,7 +125,7 @@ public class CreateNetworkOfferingTest extends TestCase {
public void createSharedNtwkOffWithVlan() {
NetworkOfferingVO off =
configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, true, Availability.Optional, 200, null, false, Network.GuestType.Shared, false,
null, false, null, true, false, null, false, null, true);
null, false, null, true, false, null, false, null, true, false);
assertNotNull("Shared network offering with specifyVlan=true failed to create ", off);
}
@ -133,7 +133,7 @@ public class CreateNetworkOfferingTest extends TestCase {
public void createSharedNtwkOffWithNoVlan() {
NetworkOfferingVO off =
configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, false, Availability.Optional, 200, null, false, Network.GuestType.Shared,
false, null, false, null, true, false, null, false, null, true);
false, null, false, null, true, false, null, false, null, true, false);
assertNull("Shared network offering with specifyVlan=false was created", off);
}
@ -141,7 +141,7 @@ public class CreateNetworkOfferingTest extends TestCase {
public void createSharedNtwkOffWithSpecifyIpRanges() {
NetworkOfferingVO off =
configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, true, Availability.Optional, 200, null, false, Network.GuestType.Shared, false,
null, false, null, true, false, null, false, null, true);
null, false, null, true, false, null, false, null, true, false);
assertNotNull("Shared network offering with specifyIpRanges=true failed to create ", off);
}
@ -150,7 +150,7 @@ public class CreateNetworkOfferingTest extends TestCase {
public void createSharedNtwkOffWithoutSpecifyIpRanges() {
NetworkOfferingVO off =
configMgr.createNetworkOffering("shared", "shared", TrafficType.Guest, null, true, Availability.Optional, 200, null, false, Network.GuestType.Shared,
false, null, false, null, false, false, null, false, null, true);
false, null, false, null, false, false, null, false, null, true, false);
assertNull("Shared network offering with specifyIpRanges=false was created", off);
}
@ -163,7 +163,7 @@ public class CreateNetworkOfferingTest extends TestCase {
serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
NetworkOfferingVO off =
configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, false, Availability.Optional, 200, serviceProviderMap, false,
Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, false);
assertNotNull("Isolated network offering with specifyIpRanges=false failed to create ", off);
}
@ -176,7 +176,7 @@ public class CreateNetworkOfferingTest extends TestCase {
serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
NetworkOfferingVO off =
configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true, Availability.Optional, 200, serviceProviderMap, false,
Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, false);
assertNotNull("Isolated network offering with specifyVlan=true wasn't created", off);
}
@ -189,7 +189,7 @@ public class CreateNetworkOfferingTest extends TestCase {
serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
NetworkOfferingVO off =
configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, false, Availability.Optional, 200, serviceProviderMap, false,
Network.GuestType.Isolated, false, null, false, null, true, false, null, false, null, true);
Network.GuestType.Isolated, false, null, false, null, true, false, null, false, null, true, false);
assertNull("Isolated network offering with specifyIpRanges=true and source nat service enabled, was created", off);
}
@ -200,7 +200,7 @@ public class CreateNetworkOfferingTest extends TestCase {
Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();
NetworkOfferingVO off =
configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, false, Availability.Optional, 200, serviceProviderMap, false,
Network.GuestType.Isolated, false, null, false, null, true, false, null, false, null, true);
Network.GuestType.Isolated, false, null, false, null, true, false, null, false, null, true, false);
assertNotNull("Isolated network offering with specifyIpRanges=true and with no sourceNatService, failed to create", off);
}
@ -218,7 +218,7 @@ public class CreateNetworkOfferingTest extends TestCase {
serviceProviderMap.put(Network.Service.Lb, vrProvider);
NetworkOfferingVO off =
configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true, Availability.Optional, 200, serviceProviderMap, false,
Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true);
// System.out.println("Creating Vpc Network Offering");
assertNotNull("Vpc Isolated network offering with Vpc provider ", off);
}
@ -238,7 +238,7 @@ public class CreateNetworkOfferingTest extends TestCase {
serviceProviderMap.put(Network.Service.Lb, lbProvider);
NetworkOfferingVO off =
configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true, Availability.Optional, 200, serviceProviderMap, false,
Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true);
Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true);
// System.out.println("Creating Vpc Network Offering");
assertNotNull("Vpc Isolated network offering with Vpc and Netscaler provider ", off);
}

View File

@ -19,6 +19,22 @@
-- Schema upgrade from 4.10.0.0 to 4.11.0.0
--;
-- Add For VPC flag
ALTER TABLE cloud.network_offerings ADD COLUMN for_vpc INT(1) NOT NULL DEFAULT 0;
UPDATE cloud.network_offerings o
SET for_vpc = 1
where
o.conserve_mode = 0
and o.guest_type = 'Isolated'
and exists(
SELECT id
from cloud.ntwk_offering_service_map
where network_offering_id = o.id and (
provider in ('VpcVirtualRouter', 'InternalLbVm', 'JuniperContrailVpcRouter')
or service in ('NetworkACL')
)
);
--Alter view template_view
DROP VIEW IF EXISTS `cloud`.`template_view`;

View File

@ -466,6 +466,18 @@ class TestNuageStaticNat(nuageTestCase):
net_off_5 = self.create_NetworkOffering(network_offering)
self.validate_NetworkOffering(net_off_5, state="Enabled")
self.debug("Creating persistent Nuage VSP Isolated Network offering "
"without VR so no userData and Dns...")
network_offering = copy.deepcopy(
self.test_data["nuagevsp"]["isolated_network_offering"])
network_offering["ispersistent"] = "True"
network_offering["supportedservices"] = \
'Dhcp,SourceNat,Connectivity,StaticNat,Firewall'
del network_offering["serviceProviderList"]["UserData"]
del network_offering["serviceProviderList"]["Dns"]
net_off_6 = self.create_NetworkOffering(network_offering)
self.validate_NetworkOffering(net_off_6, state="Enabled")
# Creating Isolated networks, and deploying VMs
self.debug("Creating an Isolated network with Static NAT service "
"provider as NuageVsp...")
@ -720,6 +732,57 @@ class TestNuageStaticNat(nuageTestCase):
"successfully released in CloudStack")
self.delete_VM(vm_5)
self.debug("Creating a persistent Isolated network with Static NAT "
"service without UserData Dns, so without VR")
network_6 = self.create_Network(net_off_6, gateway='10.6.1.1')
self.validate_Network(network_6, state="Implemented")
self.debug("Deploying a VM in the created Isolated network...")
vm_6 = self.create_VM(network_6)
self.validate_Network(network_6, state="Implemented")
with self.assertRaises(Exception):
self.get_Router(network_6)
# VSD verification
self.verify_vsd_network(self.domain.id, network_6)
self.verify_vsd_vm(vm_6)
# Creating Static NAT rule
self.debug("Creating Static NAT rule in the created Isolated network "
"with its deployed VM...")
public_ip = self.acquire_PublicIPAddress(network_6)
self.validate_PublicIPAddress(public_ip, network_6)
self.create_StaticNatRule_For_VM(vm_6, public_ip, network_6)
# VSD verification for Static NAT functionality
self.verify_vsd_floating_ip(network_6, vm_6, public_ip.ipaddress)
# Deleting Static NAT Rule
self.debug("Deleting Static NAT Rule for the deployed VM...")
self.delete_StaticNatRule_For_VM(public_ip)
with self.assertRaises(Exception):
self.validate_PublicIPAddress(
public_ip, network_6, static_nat=True, vm=vm_6)
self.debug("Static NAT Rule for the deployed VM successfully deleted "
"in CloudStack")
# VSD verification
with self.assertRaises(Exception):
self.verify_vsd_floating_ip(network_6, vm_6, public_ip.ipaddress)
self.debug("Floating IP for the deployed VM successfully deleted in "
"VSD")
# Releasing acquired public IP
self.debug("Releasing the acquired public IP in the created Isolated "
"network...")
public_ip.delete(self.api_client)
with self.assertRaises(Exception):
self.validate_PublicIPAddress(public_ip, network_6)
self.debug("Acquired public IP in the created Isolated network "
"successfully released in CloudStack")
self.delete_VM(vm_6)
@attr(tags=["advanced", "nuagevsp"], required_hardware="false")
def test_04_nuage_StaticNAT_vpc_networks(self):
"""Test Nuage VSP VPC networks with different combinations of Static
@ -1006,23 +1069,47 @@ class TestNuageStaticNat(nuageTestCase):
self.test_data["nuagevsp"]["isolated_network_offering"])
self.validate_NetworkOffering(net_off, state="Enabled")
self.debug("Creating persistent Nuage VSP Isolated Network offering "
"without VR so no userData and Dns...")
network_offering = copy.deepcopy(
self.test_data["nuagevsp"]["isolated_network_offering"])
network_offering["ispersistent"] = "True"
network_offering["supportedservices"] = \
'Dhcp,SourceNat,Connectivity,StaticNat,Firewall'
del network_offering["serviceProviderList"]["UserData"]
del network_offering["serviceProviderList"]["Dns"]
net_off_2 = self.create_NetworkOffering(network_offering)
self.validate_NetworkOffering(net_off_2, state="Enabled")
# Creating Isolated network, deploying VMs, and verifying Static NAT
# traffic
self.debug("Creating an Isolated network with Static NAT service...")
network = self.create_Network(net_off, gateway='10.1.1.1')
self.validate_Network(network, state="Allocated")
self.debug("Creating a persistent Isolated network with Static NAT "
"service without UserData Dns, so without VR")
network_2 = self.create_Network(net_off_2, gateway='10.2.1.1')
self.validate_Network(network_2, state="Implemented")
self.debug("Deploying a VM in the created Isolated network...")
vm_1 = self.create_VM(network)
self.validate_Network(network, state="Implemented")
vr = self.get_Router(network)
self.check_Router_state(vr, state="Running")
self.check_VM_state(vm_1, state="Running")
vm_21 = self.create_VM(network_2)
self.validate_Network(network_2, state="Implemented")
with self.assertRaises(Exception):
self.get_Router(network_2)
# VSD verification
self.verify_vsd_network(self.domain.id, network)
self.verify_vsd_router(vr)
self.verify_vsd_vm(vm_1)
self.verify_vsd_network(self.domain.id, network_2)
self.verify_vsd_vm(vm_21)
# Creating Static NAT rule
self.debug("Creating Static NAT rule for the deployed VM in the "
@ -1032,23 +1119,34 @@ class TestNuageStaticNat(nuageTestCase):
self.create_StaticNatRule_For_VM(vm_1, public_ip_1, network)
self.validate_PublicIPAddress(
public_ip_1, network, static_nat=True, vm=vm_1)
public_ip_21 = self.acquire_PublicIPAddress(network_2)
self.validate_PublicIPAddress(public_ip_21, network_2)
self.create_StaticNatRule_For_VM(vm_21, public_ip_21, network_2)
self.validate_PublicIPAddress(
public_ip_21, network_2, static_nat=True, vm=vm_21)
# VSD verification for Static NAT functionality
self.verify_vsd_floating_ip(network, vm_1, public_ip_1.ipaddress)
self.verify_vsd_floating_ip(network_2, vm_21, public_ip_21.ipaddress)
# Verifying Static NAT traffic
self.verify_StaticNAT_traffic(network, public_ip_1)
self.verify_StaticNAT_traffic(network_2, public_ip_21)
# Verifying Static NAT traffic (wget www.google.com) to the Internet
# from the deployed VM
self.verify_StaticNAT_Internet_traffic(vm_1, network, public_ip_1)
self.verify_StaticNAT_Internet_traffic(vm_21, network_2, public_ip_21)
self.debug("Deploying another VM in the created Isolated network...")
vm_2 = self.create_VM(network)
self.check_VM_state(vm_2, state="Running")
vm_22 = self.create_VM(network_2)
self.check_VM_state(vm_22, state="Running")
# VSD verification
self.verify_vsd_vm(vm_2)
self.verify_vsd_vm(vm_22)
# Creating Static NAT rule
self.debug("Creating Static NAT rule for the deployed VM in the "
@ -1059,15 +1157,24 @@ class TestNuageStaticNat(nuageTestCase):
self.validate_PublicIPAddress(
public_ip_2, network, static_nat=True, vm=vm_2)
public_ip_22 = self.acquire_PublicIPAddress(network_2)
self.validate_PublicIPAddress(public_ip_22, network_2)
self.create_StaticNatRule_For_VM(vm_22, public_ip_22, network_2)
self.validate_PublicIPAddress(
public_ip_22, network_2, static_nat=True, vm=vm_22)
# VSD verification for Static NAT functionality
self.verify_vsd_floating_ip(network, vm_2, public_ip_2.ipaddress)
self.verify_vsd_floating_ip(network_2, vm_22, public_ip_22.ipaddress)
# Verifying Static NAT traffic
self.verify_StaticNAT_traffic(network, public_ip_2)
self.verify_StaticNAT_traffic(network_2, public_ip_22)
# Verifying Static NAT traffic (wget www.google.com) to the Internet
# from the deployed VM
self.verify_StaticNAT_Internet_traffic(vm_2, network, public_ip_2)
self.verify_StaticNAT_Internet_traffic(vm_22, network_2, public_ip_22)
@attr(tags=["advanced", "nuagevsp"], required_hardware="true")
def test_06_nuage_StaticNAT_vpc_network_traffic(self):

View File

@ -2209,7 +2209,7 @@ class NetworkOffering:
cmd.traffictype = services["traffictype"]
if "useVpc" in services:
cmd.useVpc = services["useVpc"]
cmd.forvpc = (services["useVpc"] == "on")
cmd.serviceproviderlist = []
if "serviceProviderList" in services:
for service, provider in services["serviceProviderList"].items():

View File

@ -3296,9 +3296,11 @@
serviceCapabilityIndex++;
}
} else if (value != '') { // normal data (serviceData.length ==1), e.g. "name", "displayText", "networkRate", "guestIpType", "lbType" (unwanted), "availability" (unwated when value is "Optional"), "egressdefaultpolicy", "state" (unwanted), "status" (unwanted), "allocationstate" (unwanted)
if (!(key == "lbType" || (key == "availability" && value == "Optional") || key == "state" || key == "status" || key == "allocationstate" || key == "useVpc" )) {
inputData[key] = value;
}
if (key == "useVpc") {
inputData['forvpc'] = value;
} else if (!(key == "lbType" || (key == "availability" && value == "Optional") || key == "state" || key == "status" || key == "allocationstate" || key == "useVpc" )) {
inputData[key] = value;
}
}
});
@ -3370,6 +3372,11 @@
}
}
if (inputData['forvpc'] == 'on') {
inputData['forvpc'] = true;
} else {
delete inputData.forvpc; //if forVpc checkbox is unchecked, do not pass forVpc parameter to API call since we need to keep API call's size as small as possible (p.s. forVpc is defaulted as false at server-side)
}
if (inputData['conservemode'] == 'on') {
delete inputData.conservemode; //if ConserveMode checkbox is checked, do not pass conservemode parameter to API call since we need to keep API call's size as small as possible (p.s. conservemode is defaulted as true at server-side)