Merge branch 'nsx-integration' of https://github.com/apache/cloudstack into nsx-static-nat

This commit is contained in:
Pearl Dsilva 2023-10-23 12:08:20 -04:00
commit 8ca64541b1
32 changed files with 778 additions and 183 deletions

View File

@ -29,7 +29,8 @@ public interface VpcOffering extends InternalIdentity, Identity {
public static final String defaultVPCOfferingName = "Default VPC offering";
public static final String defaultVPCNSOfferingName = "Default VPC offering with Netscaler";
public static final String redundantVPCOfferingName = "Redundant VPC offering";
public static final String DEFAULT_VPC_NSX_OFFERING_NAME = "VPC offering with NSX";
public static final String DEFAULT_VPC_NAT_NSX_OFFERING_NAME = "VPC offering with NSX - NAT Mode";
public static final String DEFAULT_VPC_ROUTE_NSX_OFFERING_NAME = "VPC offering with NSX - Route Mode";
/**
*
@ -54,6 +55,10 @@ public interface VpcOffering extends InternalIdentity, Identity {
*/
boolean isDefault();
boolean isForNsx();
String getNsxMode();
/**
* @return service offering id used by VPC virtual router
*/

View File

@ -36,7 +36,8 @@ public interface VpcProvisioningService {
VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices,
Map<String, List<String>> serviceProviders,
Map serviceCapabilitystList, NetUtils.InternetProtocol internetProtocol,
Long serviceOfferingId, List<Long> domainIds, List<Long> zoneIds, VpcOffering.State state);
Long serviceOfferingId, Boolean forNsx, String mode,
List<Long> domainIds, List<Long> zoneIds, VpcOffering.State state);
Pair<List<? extends VpcOffering>,Integer> listVpcOfferings(ListVPCOfferingsCmd cmd);

View File

@ -43,6 +43,11 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
InternalLbProvider, PublicLbProvider, servicepackageuuid, servicepackagedescription, PromiscuousMode, MacAddressChanges, ForgedTransmits, MacLearning, RelatedNetworkOffering, domainid, zoneid, pvlanType, internetProtocol
}
public enum NsxMode {
NATTED,
ROUTED
}
public final static String SystemPublicNetwork = "System-Public-Network";
public final static String SystemControlNetwork = "System-Control-Network";
public final static String SystemManagementNetwork = "System-Management-Network";
@ -52,7 +57,8 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
public final static String DefaultSharedNetworkOfferingWithSGService = "DefaultSharedNetworkOfferingWithSGService";
public static final String DEFAULT_TUNGSTEN_SHARED_NETWORK_OFFERING_WITH_SGSERVICE = "DefaultTungstenSharedNetworkOfferingWithSGService";
public static final String DEFAULT_NSX_OFFERING = "DefaultNSXNetworkOffering";
public static final String DEFAULT_NAT_NSX_OFFERING = "DefaultNATNSXNetworkOffering";
public static final String DEFAULT_ROUTER_NSX_OFFERING = "DefaultRouteNSXNetworkOffering";
public final static String QuickCloudNoServices = "QuickCloudNoServices";
public final static String DefaultIsolatedNetworkOfferingWithSourceNatService = "DefaultIsolatedNetworkOfferingWithSourceNatService";
public final static String OvsIsolatedNetworkOfferingWithSourceNatService = "OvsIsolatedNetworkOfferingWithSourceNatService";
@ -93,6 +99,8 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
boolean isForNsx();
String getNsxMode();
TrafficType getTrafficType();
boolean isSpecifyVlan();

View File

@ -294,6 +294,7 @@ public class ApiConstants {
public static final String MIGRATION_TYPE = "migrationtype";
public static final String MEMORY = "memory";
public static final String MODE = "mode";
public static final String NSX_MODE = "nsxmode";
public static final String NAME = "name";
public static final String METHOD_NAME = "methodname";
public static final String NETWORK_DOMAIN = "networkdomain";

View File

@ -24,7 +24,10 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import com.cloud.network.Network;
import com.cloud.network.VirtualRouterProvider;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.commons.collections.CollectionUtils;
@ -47,6 +50,15 @@ import com.cloud.offering.NetworkOffering;
import com.cloud.offering.NetworkOffering.Availability;
import com.cloud.user.Account;
import static com.cloud.network.Network.Service.Dhcp;
import static com.cloud.network.Network.Service.Dns;
import static com.cloud.network.Network.Service.Lb;
import static com.cloud.network.Network.Service.StaticNat;
import static com.cloud.network.Network.Service.SourceNat;
import static com.cloud.network.Network.Service.PortForwarding;
import static com.cloud.network.Network.Service.NetworkACL;
import static com.cloud.network.Network.Service.UserData;
@APICommand(name = "createNetworkOffering", description = "Creates a network offering.", responseObject = NetworkOfferingResponse.class, since = "3.0.0",
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateNetworkOfferingCmd extends BaseCmd {
@ -127,6 +139,18 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
description = "true if network offering is meant to be used for VPC, false otherwise.")
private Boolean forVpc;
@Parameter(name = ApiConstants.FOR_NSX,
type = CommandType.BOOLEAN,
description = "true if network offering is meant to be used for NSX, false otherwise.",
since = "4.20.0")
private Boolean forNsx;
@Parameter(name = ApiConstants.NSX_MODE,
type = CommandType.STRING,
description = "Indicates the mode with which the network will operate. Valid option: NATTED or ROUTED",
since = "4.20.0")
private String nsxMode;
@Parameter(name = ApiConstants.FOR_TUNGSTEN,
type = CommandType.BOOLEAN,
description = "true if network offering is meant to be used for Tungsten-Fabric, false otherwise.")
@ -211,7 +235,24 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
}
public List<String> getSupportedServices() {
return supportedServices == null ? new ArrayList<String>() : supportedServices;
if (!forNsx) {
return supportedServices == null ? new ArrayList<String>() : supportedServices;
} else {
List<String> services = new ArrayList<>(List.of(
Dhcp.getName(),
Dns.getName(),
StaticNat.getName(),
SourceNat.getName(),
PortForwarding.getName(),
UserData.getName(),
Lb.getName()
));
if (Boolean.TRUE.equals(forVpc)) {
services.add(NetworkACL.getName());
return services;
}
return services;
}
}
public String getGuestIpType() {
@ -241,6 +282,14 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
return forVpc;
}
public Boolean isForNsx() {
return forNsx;
}
public String getNsxMode() {
return nsxMode;
}
public Boolean getForTungsten() {
return forTungsten;
}
@ -261,9 +310,8 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
}
public Map<String, List<String>> getServiceProviders() {
Map<String, List<String>> serviceProviderMap = null;
if (serviceProviderList != null && !serviceProviderList.isEmpty()) {
serviceProviderMap = new HashMap<String, List<String>>();
Map<String, List<String>> serviceProviderMap = new HashMap<String, List<String>>();
if (serviceProviderList != null && !serviceProviderList.isEmpty() && !isForNsx()) {
Collection servicesCollection = serviceProviderList.values();
Iterator iter = servicesCollection.iterator();
while (iter.hasNext()) {
@ -279,11 +327,29 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
providerList.add(provider);
serviceProviderMap.put(service, providerList);
}
} else if (Boolean.TRUE.equals(forNsx)) {
getServiceProviderMapForNsx(serviceProviderMap);
}
return serviceProviderMap;
}
private void getServiceProviderMapForNsx(Map<String, List<String>> serviceProviderMap) {
String routerProvider = Boolean.TRUE.equals(getForVpc()) ? VirtualRouterProvider.Type.VPCVirtualRouter.name() :
VirtualRouterProvider.Type.VirtualRouter.name();
List<String> unsupportedServices = List.of("Vpn", "SecurityGroup", "Connectivity",
"Gateway", "Firewall", "BaremetalPxeService");
List<String> routerSupported = List.of("Dhcp", "Dns", "UserData");
List<String> allServices = Service.listAllServices().stream().map(Service::getName).collect(Collectors.toList());
for (String service : allServices) {
if (unsupportedServices.contains(service))
continue;
if (routerSupported.contains(service))
serviceProviderMap.put(service, List.of(routerProvider));
else
serviceProviderMap.put(service, List.of(Network.Provider.Nsx.getName()));
}
}
public Map<Capability, String> getServiceCapabilities(Service service) {
Map<Capability, String> capabilityMap = null;

View File

@ -23,8 +23,13 @@ import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.Network;
import com.cloud.network.VirtualRouterProvider;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.commons.collections.CollectionUtils;
@ -45,6 +50,15 @@ import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.vpc.VpcOffering;
import com.cloud.user.Account;
import static com.cloud.network.Network.Service.Dhcp;
import static com.cloud.network.Network.Service.Dns;
import static com.cloud.network.Network.Service.Lb;
import static com.cloud.network.Network.Service.StaticNat;
import static com.cloud.network.Network.Service.SourceNat;
import static com.cloud.network.Network.Service.PortForwarding;
import static com.cloud.network.Network.Service.NetworkACL;
import static com.cloud.network.Network.Service.UserData;
@APICommand(name = "createVPCOffering", description = "Creates VPC offering", responseObject = VpcOfferingResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
@ -62,7 +76,6 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
@Parameter(name = ApiConstants.SUPPORTED_SERVICES,
type = CommandType.LIST,
required = true,
collectionType = CommandType.STRING,
description = "services supported by the vpc offering")
private List<String> supportedServices;
@ -101,6 +114,18 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
since = "4.13")
private List<Long> zoneIds;
@Parameter(name = ApiConstants.FOR_NSX,
type = CommandType.BOOLEAN,
description = "true if network offering is meant to be used for NSX, false otherwise.",
since = "4.20.0")
private Boolean forNsx;
@Parameter(name = ApiConstants.NSX_MODE,
type = CommandType.STRING,
description = "Indicates the mode with which the network will operate. Valid option: NATTED or ROUTED",
since = "4.20.0")
private String nsxMode;
@Parameter(name = ApiConstants.ENABLE,
type = CommandType.BOOLEAN,
description = "set to true if the offering is to be enabled during creation. Default is false",
@ -120,13 +145,35 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
}
public List<String> getSupportedServices() {
if (!forNsx && CollectionUtils.isEmpty(supportedServices)) {
throw new InvalidParameterValueException("Supported services needs to be provided");
}
if (forNsx) {
return List.of(
Dhcp.getName(),
Dns.getName(),
Lb.getName(),
StaticNat.getName(),
SourceNat.getName(),
NetworkACL.getName(),
PortForwarding.getName(),
UserData.getName()
);
}
return supportedServices;
}
public Boolean isForNsx() {
return !Objects.isNull(forNsx) && forNsx;
}
public String getNsxMode() {
return nsxMode;
}
public Map<String, List<String>> getServiceProviders() {
Map<String, List<String>> serviceProviderMap = null;
if (serviceProviderList != null && !serviceProviderList.isEmpty()) {
serviceProviderMap = new HashMap<String, List<String>>();
Map<String, List<String>> serviceProviderMap = new HashMap<String, List<String>>();;
if (serviceProviderList != null && !serviceProviderList.isEmpty() && !isForNsx()) {
Collection<? extends Map<String, String>> servicesCollection = serviceProviderList.values();
Iterator<? extends Map<String, String>> iter = servicesCollection.iterator();
while (iter.hasNext()) {
@ -134,7 +181,7 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
if (s_logger.isTraceEnabled()) {
s_logger.trace("service provider entry specified: " + obj);
}
HashMap<String, String> services = (HashMap<String, String>)obj;
HashMap<String, String> services = (HashMap<String, String>) obj;
String service = services.get("service");
String provider = services.get("provider");
List<String> providerList = null;
@ -146,11 +193,28 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
providerList.add(provider);
serviceProviderMap.put(service, providerList);
}
} else if (Boolean.TRUE.equals(forNsx)) {
getServiceProviderMapForNsx(serviceProviderMap);
}
return serviceProviderMap;
}
private void getServiceProviderMapForNsx(Map<String, List<String>> serviceProviderMap) {
List<String> unsupportedServices = List.of("Vpn", "BaremetalPxeService", "SecurityGroup", "Connectivity",
"Gateway", "Firewall");
List<String> routerSupported = List.of("Dhcp", "Dns", "UserData");
List<String> allServices = Network.Service.listAllServices().stream().map(Network.Service::getName).collect(Collectors.toList());
for (String service : allServices) {
if (unsupportedServices.contains(service))
continue;
if (routerSupported.contains(service))
serviceProviderMap.put(service, List.of(VirtualRouterProvider.Type.VPCVirtualRouter.name()));
else
serviceProviderMap.put(service, List.of(Network.Provider.Nsx.getName()));
}
}
public Map<String, List<String>> getServiceCapabilityList() {
return serviceCapabilityList;
}

View File

@ -107,6 +107,10 @@ public class NetworkOfferingResponse extends BaseResponseWithAnnotations {
@Param(description = "true if network offering can be used by Tungsten-Fabric networks only")
private Boolean forTungsten;
@SerializedName(ApiConstants.NSX_MODE)
@Param(description = "Mode in which the network will operate. This parameter is only relevant for NSX offerings")
private String nsxMode;
@SerializedName(ApiConstants.IS_PERSISTENT)
@Param(description = "true if network offering supports persistent networks, false otherwise")
private Boolean isPersistent;
@ -227,6 +231,10 @@ public class NetworkOfferingResponse extends BaseResponseWithAnnotations {
this.forTungsten = forTungsten;
}
public void setNsxMode(String nsxMode) {
this.nsxMode = nsxMode;
}
public void setIsPersistent(Boolean isPersistent) {
this.isPersistent = isPersistent;
}

View File

@ -63,9 +63,17 @@ public class VpcOfferingResponse extends BaseResponse {
private Boolean supportsDistributedRouter;
@SerializedName((ApiConstants.SUPPORTS_REGION_LEVEL_VPC))
@Param(description = " indicated if the offering can support region level vpc", since = "4.4")
@Param(description = "indicated if the offering can support region level vpc", since = "4.4")
private Boolean supportsRegionLevelVpc;
@SerializedName(ApiConstants.FOR_NSX)
@Param(description = "true if vpc offering can be used by NSX networks only")
private Boolean forNsx;
@SerializedName(ApiConstants.NSX_MODE)
@Param(description = "Mode in which the network will operate. This parameter is only relevant for NSX offerings")
private String nsxMode;
@SerializedName(ApiConstants.DOMAIN_ID)
@Param(description = "the domain ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.")
private String domainId;
@ -138,6 +146,14 @@ public class VpcOfferingResponse extends BaseResponse {
this.domain = domain;
}
public void setForNsx(Boolean forNsx) {
this.forNsx = forNsx;
}
public void setNsxMode(String nsxMode) {
this.nsxMode = nsxMode;
}
public String getZoneId() {
return zoneId;
}

View File

@ -52,15 +52,15 @@ public class CreateVPCOfferingCmdTest {
IllegalAccessException {
CreateVPCOfferingCmd cmd = new CreateVPCOfferingCmd();
ApiCmdTestUtil.set(cmd, ApiConstants.SERVICE_PROVIDER_LIST, new HashMap<String, Map<String, String>>());
Assert.assertNull(cmd.getServiceProviders());
Assert.assertTrue(cmd.getServiceProviders().isEmpty());
}
@Test
public void getDetailsNull() throws IllegalArgumentException,
public void getDetailsEmpty() throws IllegalArgumentException,
IllegalAccessException {
CreateVPCOfferingCmd cmd = new CreateVPCOfferingCmd();
ApiCmdTestUtil.set(cmd, ApiConstants.SERVICE_PROVIDER_LIST, null);
Assert.assertNull(cmd.getServiceProviders());
Assert.assertTrue(cmd.getServiceProviders().isEmpty());
}
@Test

View File

@ -225,7 +225,7 @@ public interface ConfigurationManager {
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,
Boolean forTungsten, Boolean forNsx, List<Long> domainIds, List<Long> zoneIds, boolean enableOffering, final NetUtils.InternetProtocol internetProtocol);
Boolean forTungsten, Boolean forNsx, String mode, List<Long> domainIds, List<Long> zoneIds, boolean enableOffering, final NetUtils.InternetProtocol internetProtocol);
Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, boolean forSystemVms, 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

@ -540,27 +540,27 @@ 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, false, false, null, null, true, null);
false, null, false, null, true, false, false, false, null, null, null, true, null);
}
//#2 - SG enabled network offering
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, false, false, false, null, null, true, null);
null, true, false, null, false, null, true, false, false, false, null, null, null, true, null);
}
//#3 - shared network offering with no SG service
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, false, false, false, null, null, true, null);
null, true, false, false, false, null,null, null, true, null);
}
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DEFAULT_TUNGSTEN_SHARED_NETWORK_OFFERING_WITH_SGSERVICE) == null) {
offering = _configMgr.createNetworkOffering(NetworkOffering.DEFAULT_TUNGSTEN_SHARED_NETWORK_OFFERING_WITH_SGSERVICE, "Offering for Tungsten Shared Security group enabled networks",
TrafficType.Guest, null, true, Availability.Optional, null, defaultTungstenSharedSGEnabledNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true,
null, true, false, null, false, null, true, false, true, false, null, null, true, null);
null, true, false, null, false, null, true, false, true, false, null, null,null, true, null);
offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering);
}
@ -570,14 +570,14 @@ 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, false, false, false, null, null, true, null);
true, false, false, false, null, null,null, true, null);
}
//#5 - default vpc offering with LB service
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, true, false, false, null, null, true, null);
defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, null, null, null,true, null);
}
//#6 - default vpc offering with no LB service
@ -586,14 +586,14 @@ 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, true, false, false, null, null, true, null);
null, defaultVPCOffProviders, true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, null, null, null,true, null);
}
//#7 - isolated offering with source nat disabled
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, false, false, false, null, null, true, null);
true, null, true, false, null, false, null, true, false, false, false, null, null, null, true, null);
}
//#8 - network offering with internal lb service
@ -615,7 +615,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, false, false, null, null, true, null);
true, Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, null, null, null, true, null);
offering.setInternalLb(true);
offering.setPublicLb(false);
_networkOfferingDao.update(offering.getId(), offering);
@ -646,7 +646,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, false, false, false, null, null, true, null);
netscalerServiceProviders, true, Network.GuestType.Shared, false, null, true, serviceCapabilityMap, true, false, null, false, null, true, false, false, false, null, null, null, true, null);
offering.setDedicatedLB(false);
_networkOfferingDao.update(offering.getId(), offering);
}

View File

@ -58,6 +58,12 @@ public class VpcOfferingVO implements VpcOffering {
@Column(name = "default")
boolean isDefault = false;
@Column(name = "for_nsx")
boolean forNsx = false;
@Column(name = "nsx_mode")
String nsxMode;
@Column(name = GenericDao.REMOVED_COLUMN)
Date removed;
@ -144,6 +150,22 @@ public class VpcOfferingVO implements VpcOffering {
return isDefault;
}
public boolean isForNsx() {
return forNsx;
}
public void setForNsx(boolean forNsx) {
this.forNsx = forNsx;
}
public String getNsxMode() {
return nsxMode;
}
public void setNsxMode(String nsxMode) {
this.nsxMode = nsxMode;
}
public void setUniqueName(String uniqueName) {
this.uniqueName = uniqueName;
}

View File

@ -139,6 +139,9 @@ public class NetworkOfferingVO implements NetworkOffering {
@Column(name = "for_nsx")
boolean forNsx = false;
@Column(name = "nsx_mode")
String nsxMode;
@Column(name = "egress_default_policy")
boolean egressdefaultpolicy;
@ -207,6 +210,15 @@ public class NetworkOfferingVO implements NetworkOffering {
this.forNsx = forNsx;
}
@Override
public String getNsxMode() {
return nsxMode;
}
public void setNsxMode(String nsxMode) {
this.nsxMode = nsxMode;
}
@Override
public long getId() {
return id;

View File

@ -214,8 +214,11 @@ BEGIN
-- NSX Plugin --
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.network_offerings','for_nsx', 'int(1) unsigned DEFAULT "0" COMMENT "is nsx enabled for the resource"');
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.network_offerings','nsx_mode', 'varchar(32) COMMENT "mode in which the network would route traffic"');
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vpc_offerings','for_nsx', 'int(1) unsigned DEFAULT "0" COMMENT "is nsx enabled for the resource"');
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vpc_offerings','nsx_mode', 'varchar(32) COMMENT "mode in which the network would route traffic"');
-- Network offering with multi-domains and multi-zones
-- Network offering with NSX related columns
DROP VIEW IF EXISTS `cloud`.`network_offering_view`;
CREATE VIEW `cloud`.`network_offering_view` AS
SELECT
@ -259,6 +262,7 @@ SELECT
`network_offerings`.`for_vpc` AS `for_vpc`,
`network_offerings`.`for_tungsten` AS `for_tungsten`,
`network_offerings`.`for_nsx` AS `for_nsx`,
`network_offerings`.`nsx_mode` AS `nsx_mode`,
`network_offerings`.`service_package_id` AS `service_package_id`,
GROUP_CONCAT(DISTINCT(domain.id)) AS domain_id,
GROUP_CONCAT(DISTINCT(domain.uuid)) AS domain_uuid,
@ -398,3 +402,46 @@ CREATE VIEW `cloud`.`snapshot_view` AS
OR (`snapshot_zone_ref`.`zone_id` = `data_center`.`id`))))
LEFT JOIN `resource_tags` ON ((`resource_tags`.`resource_id` = `snapshots`.`id`)
AND (`resource_tags`.`resource_type` = 'Snapshot')));
-- VPC offering with NSX related columns
DROP VIEW IF EXISTS `cloud`.`vpc_offering_view`;
CREATE VIEW `cloud`.`vpc_offering_view` AS
SELECT
`vpc_offerings`.`id` AS `id`,
`vpc_offerings`.`uuid` AS `uuid`,
`vpc_offerings`.`name` AS `name`,
`vpc_offerings`.`unique_name` AS `unique_name`,
`vpc_offerings`.`display_text` AS `display_text`,
`vpc_offerings`.`state` AS `state`,
`vpc_offerings`.`default` AS `default`,
`vpc_offerings`.`for_nsx` AS `for_nsx`,
`vpc_offerings`.`nsx_mode` AS `nsx_mode`,
`vpc_offerings`.`created` AS `created`,
`vpc_offerings`.`removed` AS `removed`,
`vpc_offerings`.`service_offering_id` AS `service_offering_id`,
`vpc_offerings`.`supports_distributed_router` AS `supports_distributed_router`,
`vpc_offerings`.`supports_region_level_vpc` AS `supports_region_level_vpc`,
`vpc_offerings`.`redundant_router_service` AS `redundant_router_service`,
`vpc_offerings`.`sort_key` AS `sort_key`,
GROUP_CONCAT(DISTINCT(domain.id)) AS domain_id,
GROUP_CONCAT(DISTINCT(domain.uuid)) AS domain_uuid,
GROUP_CONCAT(DISTINCT(domain.name)) AS domain_name,
GROUP_CONCAT(DISTINCT(domain.path)) AS domain_path,
GROUP_CONCAT(DISTINCT(zone.id)) AS zone_id,
GROUP_CONCAT(DISTINCT(zone.uuid)) AS zone_uuid,
GROUP_CONCAT(DISTINCT(zone.name)) AS zone_name,
`offering_details`.value AS internet_protocol
FROM
`cloud`.`vpc_offerings`
LEFT JOIN
`cloud`.`vpc_offering_details` AS `domain_details` ON `domain_details`.`offering_id` = `vpc_offerings`.`id` AND `domain_details`.`name`='domainid'
LEFT JOIN
`cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`)
LEFT JOIN
`cloud`.`vpc_offering_details` AS `zone_details` ON `zone_details`.`offering_id` = `vpc_offerings`.`id` AND `zone_details`.`name`='zoneid'
LEFT JOIN
`cloud`.`data_center` AS `zone` ON FIND_IN_SET(`zone`.`id`, `zone_details`.`value`)
LEFT JOIN
`cloud`.`vpc_offering_details` AS `offering_details` ON `offering_details`.`offering_id` = `vpc_offerings`.`id` AND `offering_details`.`name`='internetprotocol'
GROUP BY
`vpc_offerings`.`id`;

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, false, false, false, null, null, true, null);
Network.GuestType.Shared, false, null, false, null, true, false, null, true, null, false, false, false, false, null, null, null, true, null);
long id = voffer.getId();
_networkOfferingDao.update(id, voffer);
return _networkOfferingDao.findById(id);
@ -254,7 +254,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, offeringName.equals(vpcRouterOfferingName), false, false, null, null, true, null);
Network.GuestType.Isolated, false, null, false, null, false, true, null, true, null, false, offeringName.equals(vpcRouterOfferingName), false, false, null, null, null, true, null);
if (offeringName.equals(vpcRouterOfferingName)) {
voffer.setInternalLb(true);
}
@ -295,7 +295,7 @@ public class ContrailManagerImpl extends ManagerBase implements ContrailManager
}
serviceProviderMap.put(svc, providerSet);
}
vpcOffer = _vpcProvSvc.createVpcOffering(juniperVPCOfferingName, juniperVPCOfferingDisplayText, services, serviceProviderMap, null, null, null, null, null, VpcOffering.State.Enabled);
vpcOffer = _vpcProvSvc.createVpcOffering(juniperVPCOfferingName, juniperVPCOfferingDisplayText, services, serviceProviderMap, null, null, null, false, null, null, null, VpcOffering.State.Enabled);
long id = vpcOffer.getId();
_vpcOffDao.update(id, (VpcOfferingVO)vpcOffer);
return _vpcOffDao.findById(id);

View File

@ -118,7 +118,9 @@ public class NsxElement extends AdapterBase implements DhcpServiceProvider, DnsS
capabilities.put(Network.Service.Dns, dnsCapabilities);
capabilities.put(Network.Service.StaticNat, null);
capabilities.put(Network.Service.Lb, null);
capabilities.put(Network.Service.PortForwarding, null);
capabilities.put(Network.Service.NetworkACL, null);
Map<Network.Capability, String> sourceNatCapabilities = new HashMap<>();
sourceNatCapabilities.put(Network.Capability.RedundantRouter, "true");
sourceNatCapabilities.put(Network.Capability.SupportedSourceNatTypes, "peraccount");
@ -226,7 +228,7 @@ public class NsxElement extends AdapterBase implements DhcpServiceProvider, DnsS
@Override
public boolean verifyServicesCombination(Set<Network.Service> services) {
return false;
return true;
}
@Override

View File

@ -50,6 +50,7 @@ import org.apache.cloudstack.NsxAnswer;
import org.apache.cloudstack.agent.api.CreateNsxDhcpRelayConfigCommand;
import org.apache.cloudstack.agent.api.CreateNsxSegmentCommand;
import org.apache.cloudstack.utils.NsxControllerUtils;
import org.apache.cloudstack.utils.NsxHelper;
import org.apache.log4j.Logger;

View File

@ -2332,6 +2332,7 @@ public class ApiResponseHelper implements ResponseGenerator {
response.setForVpc(_configMgr.isOfferingForVpc(offering));
response.setForTungsten(offering.isForTungsten());
response.setForNsx(offering.isForNsx());
response.setNsxMode(offering.getNsxMode());
response.setServices(serviceResponses);
//set network offering details
Map<Detail, String> details = _ntwkModel.getNtwkOffDetails(offering.getId());

View File

@ -72,6 +72,8 @@ public class VpcOfferingJoinDaoImpl extends GenericDaoBase<VpcOfferingJoinVO, Lo
offeringResponse.setDomain(offeringJoinVO.getDomainPath());
offeringResponse.setZoneId(offeringJoinVO.getZoneUuid());
offeringResponse.setZone(offeringJoinVO.getZoneName());
offeringResponse.setForNsx(offeringJoinVO.isForNsx());
offeringResponse.setNsxMode(offeringJoinVO.getNsxMode());
String protocol = offeringJoinVO.getInternetProtocol();
if (StringUtils.isEmpty(protocol)) {
protocol = NetUtils.InternetProtocol.IPv4.toString();

View File

@ -159,6 +159,10 @@ public class NetworkOfferingJoinVO extends BaseViewVO implements NetworkOffering
@Column(name = "for_nsx")
boolean forNsx;
@Column(name = "nsx_mode")
String nsxMode;
@Column(name = "service_package_id")
private String servicePackageUuid = null;
@ -360,6 +364,15 @@ public class NetworkOfferingJoinVO extends BaseViewVO implements NetworkOffering
this.forNsx = forNsx;
}
@Override
public String getNsxMode() {
return nsxMode;
}
public void setNsxMode(String nsxMode) {
this.nsxMode = nsxMode;
}
public String getServicePackage() {
return servicePackageUuid;
}

View File

@ -77,6 +77,12 @@ public class VpcOfferingJoinVO implements VpcOffering {
@Column(name = "sort_key")
int sortKey;
@Column(name = "for_nsx")
boolean forNsx = false;
@Column(name = "nsx_mode")
String nsxMode;
@Column(name = "domain_id")
private String domainId;
@ -138,6 +144,16 @@ public class VpcOfferingJoinVO implements VpcOffering {
return isDefault;
}
@Override
public boolean isForNsx() {
return forNsx;
}
@Override
public String getNsxMode() {
return nsxMode;
}
@Override
public Date getRemoved() {
return removed;

View File

@ -132,6 +132,7 @@ import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
@ -5926,7 +5927,9 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
final Map<String, String> detailsStr = cmd.getDetails();
final Boolean egressDefaultPolicy = cmd.getEgressDefaultPolicy();
Boolean forVpc = cmd.getForVpc();
Boolean forNsx = cmd.isForNsx();
Boolean forTungsten = cmd.getForTungsten();
String nsxMode = cmd.getNsxMode();
Integer maxconn = null;
boolean enableKeepAlive = false;
String servicePackageuuid = cmd.getServicePackageId();
@ -5960,6 +5963,26 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
}
}
if (Boolean.TRUE.equals(forNsx) && Boolean.TRUE.equals(forTungsten)) {
throw new InvalidParameterValueException("Network Offering cannot be for both Tungsten-Fabric and NSX");
}
if (Boolean.TRUE.equals(forNsx)) {
if (Objects.isNull(nsxMode)) {
throw new InvalidParameterValueException("Mode for an NSX offering needs to be specified. Valid values: " + Arrays.toString(NetworkOffering.NsxMode.values()));
}
if (!EnumUtils.isValidEnum(NetworkOffering.NsxMode.class, nsxMode)) {
throw new InvalidParameterValueException("Invalid mode passed. Valid values: " + Arrays.toString(NetworkOffering.NsxMode.values()));
}
} else {
if (Objects.nonNull(nsxMode)) {
if (s_logger.isTraceEnabled()) {
s_logger.trace("nsxMode has is ignored for non-NSX enabled zones");
}
nsxMode = null;
}
}
// Verify traffic type
for (final TrafficType tType : TrafficType.values()) {
if (tType.name().equalsIgnoreCase(trafficTypeString)) {
@ -6224,7 +6247,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
}
final NetworkOfferingVO offering = createNetworkOffering(name, displayText, trafficType, tags, specifyVlan, availability, networkRate, serviceProviderMap, false, guestType, false,
serviceOfferingId, conserveMode, serviceCapabilityMap, specifyIpRanges, isPersistent, details, egressDefaultPolicy, maxconn, enableKeepAlive, forVpc, forTungsten, false, domainIds, zoneIds, enable, internetProtocol);
serviceOfferingId, conserveMode, serviceCapabilityMap, specifyIpRanges, isPersistent, details, egressDefaultPolicy, maxconn, enableKeepAlive, forVpc, forTungsten, forNsx, nsxMode, domainIds, zoneIds, enable, internetProtocol);
CallContext.current().setEventDetails(" Id: " + offering.getId() + " Name: " + name);
CallContext.current().putContextParameter(NetworkOffering.class, offering.getId());
return offering;
@ -6369,7 +6392,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
final Long serviceOfferingId,
final boolean conserveMode, final Map<Service, Map<Capability, String>> serviceCapabilityMap, final boolean specifyIpRanges, final boolean isPersistent,
final Map<Detail, String> details, final boolean egressDefaultPolicy, final Integer maxconn, final boolean enableKeepAlive, Boolean forVpc,
Boolean forTungsten, Boolean forNsx, final List<Long> domainIds, final List<Long> zoneIds, final boolean enableOffering, final NetUtils.InternetProtocol internetProtocol) {
Boolean forTungsten, Boolean forNsx, String mode, final List<Long> domainIds, final List<Long> zoneIds, final boolean enableOffering, final NetUtils.InternetProtocol internetProtocol) {
String servicePackageUuid;
String spDescription = null;
@ -6595,7 +6618,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
s_logger.trace("Added service for the network offering: " + offService + " with provider " + provider.getName());
}
if (vpcOff) {
if (vpcOff && !forNsx) {
final List<Service> supportedSvcs = new ArrayList<Service>();
supportedSvcs.addAll(serviceProviderMap.keySet());
_vpcMgr.validateNtwkOffForVpc(offering, supportedSvcs);

View File

@ -62,6 +62,7 @@ import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
import org.apache.cloudstack.query.QueryService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.log4j.Logger;
import org.jetbrains.annotations.Nullable;
@ -325,7 +326,9 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
svcProviderMap.put(svc, defaultProviders);
}
}
createVpcOffering(VpcOffering.defaultVPCOfferingName, VpcOffering.defaultVPCOfferingName, svcProviderMap, true, State.Enabled, null, false, false, false);
createVpcOffering(VpcOffering.defaultVPCOfferingName, VpcOffering.defaultVPCOfferingName, svcProviderMap,
true, State.Enabled, null, false,
false, false, false, null);
}
// configure default vpc offering with Netscaler as LB Provider
@ -344,7 +347,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
svcProviderMap.put(svc, defaultProviders);
}
}
createVpcOffering(VpcOffering.defaultVPCNSOfferingName, VpcOffering.defaultVPCNSOfferingName, svcProviderMap, false, State.Enabled, null, false, false, false);
createVpcOffering(VpcOffering.defaultVPCNSOfferingName, VpcOffering.defaultVPCNSOfferingName, svcProviderMap, false, State.Enabled, null, false, false, false, false, null);
}
@ -364,12 +367,13 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
svcProviderMap.put(svc, defaultProviders);
}
}
createVpcOffering(VpcOffering.redundantVPCOfferingName, VpcOffering.redundantVPCOfferingName, svcProviderMap, true, State.Enabled, null, false, false, true);
createVpcOffering(VpcOffering.redundantVPCOfferingName, VpcOffering.redundantVPCOfferingName, svcProviderMap, true, State.Enabled,
null, false, false, true, false, null);
}
// configure default vpc offering with NSX as network service provider
if (_vpcOffDao.findByUniqueName(VpcOffering.DEFAULT_VPC_NSX_OFFERING_NAME) == null) {
s_logger.debug("Creating default VPC offering with NSX as network service provider" + VpcOffering.DEFAULT_VPC_NSX_OFFERING_NAME);
// configure default vpc offering with NSX as network service provider in NAT mode
if (_vpcOffDao.findByUniqueName(VpcOffering.DEFAULT_VPC_NAT_NSX_OFFERING_NAME) == null) {
s_logger.debug("Creating default VPC offering with NSX as network service provider" + VpcOffering.DEFAULT_VPC_NAT_NSX_OFFERING_NAME);
final Map<Service, Set<Provider>> svcProviderMap = new HashMap<Service, Set<Provider>>();
final Set<Provider> defaultProviders = Set.of(Provider.Nsx);
for (final Service svc : getSupportedServices()) {
@ -380,7 +384,26 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
svcProviderMap.put(svc, defaultProviders);
}
}
createVpcOffering(VpcOffering.DEFAULT_VPC_NSX_OFFERING_NAME, VpcOffering.DEFAULT_VPC_NSX_OFFERING_NAME, svcProviderMap, false, State.Enabled, null, false, false, false);
createVpcOffering(VpcOffering.DEFAULT_VPC_NAT_NSX_OFFERING_NAME, VpcOffering.DEFAULT_VPC_NAT_NSX_OFFERING_NAME, svcProviderMap, false,
State.Enabled, null, false, false, false, true, NetworkOffering.NsxMode.NATTED.name());
}
// configure default vpc offering with NSX as network service provider in Route mode
if (_vpcOffDao.findByUniqueName(VpcOffering.DEFAULT_VPC_ROUTE_NSX_OFFERING_NAME) == null) {
s_logger.debug("Creating default VPC offering with NSX as network service provider" + VpcOffering.DEFAULT_VPC_ROUTE_NSX_OFFERING_NAME);
final Map<Service, Set<Provider>> svcProviderMap = new HashMap<Service, Set<Provider>>();
final Set<Provider> defaultProviders = Set.of(Provider.Nsx);
for (final Service svc : getSupportedServices()) {
if (List.of(Service.UserData, Service.Dhcp, Service.Dns).contains(svc)) {
final Set<Provider> userDataProvider = Set.of(Provider.VPCVirtualRouter);
svcProviderMap.put(svc, userDataProvider);
} else {
svcProviderMap.put(svc, defaultProviders);
}
}
createVpcOffering(VpcOffering.DEFAULT_VPC_ROUTE_NSX_OFFERING_NAME, VpcOffering.DEFAULT_VPC_ROUTE_NSX_OFFERING_NAME, svcProviderMap, false,
State.Enabled, null, false, false, false, true, NetworkOffering.NsxMode.ROUTED.name());
}
}
@ -440,7 +463,25 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
final Long serviceOfferingId = cmd.getServiceOfferingId();
final List<Long> domainIds = cmd.getDomainIds();
final List<Long> zoneIds = cmd.getZoneIds();
final Boolean forNsx = cmd.isForNsx();
String nsxMode = cmd.getNsxMode();
final boolean enable = cmd.getEnable();
if (Boolean.TRUE.equals(forNsx)) {
if (Objects.isNull(nsxMode)) {
throw new InvalidParameterValueException("Mode for an NSX offering needs to be specified.Valid values: " + Arrays.toString(NetworkOffering.NsxMode.values()));
}
if (!EnumUtils.isValidEnum(NetworkOffering.NsxMode.class, nsxMode)) {
throw new InvalidParameterValueException("Invalid mode passed. Valid values: " + Arrays.toString(NetworkOffering.NsxMode.values()));
}
} else {
if (Objects.nonNull(nsxMode)) {
if (s_logger.isTraceEnabled()) {
s_logger.trace("nsxMode has is ignored for non-NSX enabled zones");
}
nsxMode = null;
}
}
// check if valid domain
if (CollectionUtils.isNotEmpty(cmd.getDomainIds())) {
for (final Long domainId: cmd.getDomainIds()) {
@ -463,14 +504,15 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
}
return createVpcOffering(vpcOfferingName, displayText, supportedServices,
serviceProviderList, serviceCapabilityList, internetProtocol, serviceOfferingId,
serviceProviderList, serviceCapabilityList, internetProtocol, serviceOfferingId, forNsx, nsxMode,
domainIds, zoneIds, (enable ? State.Enabled : State.Disabled));
}
@Override
@ActionEvent(eventType = EventTypes.EVENT_VPC_OFFERING_CREATE, eventDescription = "creating vpc offering", create = true)
public VpcOffering createVpcOffering(final String name, final String displayText, final List<String> supportedServices, final Map<String, List<String>> serviceProviders,
final Map serviceCapabilityList, final NetUtils.InternetProtocol internetProtocol, final Long serviceOfferingId, List<Long> domainIds, List<Long> zoneIds, State state) {
final Map serviceCapabilityList, final NetUtils.InternetProtocol internetProtocol, final Long serviceOfferingId,
final Boolean forNsx, final String mode, List<Long> domainIds, List<Long> zoneIds, State state) {
if (!Ipv6Service.Ipv6OfferingCreationEnabled.value() && !(internetProtocol == null || NetUtils.InternetProtocol.IPv4.equals(internetProtocol))) {
throw new InvalidParameterValueException(String.format("Configuration %s needs to be enabled for creating IPv6 supported VPC offering", Ipv6Service.Ipv6OfferingCreationEnabled.key()));
@ -555,7 +597,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
final boolean offersRegionLevelVPC = isVpcOfferingForRegionLevelVpc(serviceCapabilityList);
final boolean redundantRouter = isVpcOfferingRedundantRouter(serviceCapabilityList);
final VpcOfferingVO offering = createVpcOffering(name, displayText, svcProviderMap, false, state, serviceOfferingId, supportsDistributedRouter, offersRegionLevelVPC,
redundantRouter);
redundantRouter, forNsx, mode);
if (offering != null) {
List<VpcOfferingDetailsVO> detailsVO = new ArrayList<>();
@ -583,7 +625,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
@DB
protected VpcOfferingVO createVpcOffering(final String name, final String displayText, final Map<Network.Service, Set<Network.Provider>> svcProviderMap,
final boolean isDefault, final State state, final Long serviceOfferingId, final boolean supportsDistributedRouter, final boolean offersRegionLevelVPC,
final boolean redundantRouter) {
final boolean redundantRouter, Boolean forNsx, String mode) {
return Transaction.execute(new TransactionCallback<VpcOfferingVO>() {
@Override
@ -594,6 +636,8 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
if (state != null) {
offering.setState(state);
}
offering.setForNsx(forNsx);
offering.setMode(mode);
s_logger.debug("Adding vpc offering " + offering);
offering = _vpcOffDao.persist(offering);
// populate services and providers

View File

@ -1206,17 +1206,34 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
}
_networkOfferingDao.persistDefaultL2NetworkOfferings();
// Offering #9 - network offering for nsx provider
NetworkOfferingVO defaultNSXNetworkOffering =
new NetworkOfferingVO(NetworkOffering.DEFAULT_NSX_OFFERING, "Offering for NSX enabled networks",
// Offering #9 - network offering for nsx provider - NATTED mode
NetworkOfferingVO defaultNatNSXNetworkOffering =
new NetworkOfferingVO(NetworkOffering.DEFAULT_NAT_NSX_OFFERING, "Offering for NSX enabled networks - NAT mode",
TrafficType.Guest, false, false, null, null, true, Availability.Optional, null, GuestType.Isolated, false, false, false, false, false, true);
defaultNSXNetworkOffering.setForNsx(true);
defaultNSXNetworkOffering.setState(NetworkOffering.State.Enabled);
defaultNSXNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultNSXNetworkOffering);
defaultNatNSXNetworkOffering.setForNsx(true);
defaultNatNSXNetworkOffering.setNsxMode(NetworkOffering.NsxMode.NATTED.name());
defaultNatNSXNetworkOffering.setState(NetworkOffering.State.Enabled);
defaultNatNSXNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultNatNSXNetworkOffering);
for (Map.Entry<Network.Service, Network.Provider> service : defaultNSXNetworkOfferingProviders.entrySet()) {
NetworkOfferingServiceMapVO offService =
new NetworkOfferingServiceMapVO(defaultNSXNetworkOffering.getId(), service.getKey(), service.getValue());
new NetworkOfferingServiceMapVO(defaultNatNSXNetworkOffering.getId(), service.getKey(), service.getValue());
_ntwkOfferingServiceMapDao.persist(offService);
s_logger.trace("Added service for the network offering: " + offService);
}
// Offering #10 - network offering for nsx provider - ROUTED mode
NetworkOfferingVO defaultRouteNSXNetworkOffering =
new NetworkOfferingVO(NetworkOffering.DEFAULT_NAT_NSX_OFFERING, "Offering for NSX enabled networks - NAT mode",
TrafficType.Guest, false, false, null, null, true, Availability.Optional, null, GuestType.Isolated, false, false, false, false, false, true);
defaultRouteNSXNetworkOffering.setForNsx(true);
defaultRouteNSXNetworkOffering.setNsxMode(NetworkOffering.NsxMode.ROUTED.name());
defaultRouteNSXNetworkOffering.setState(NetworkOffering.State.Enabled);
defaultRouteNSXNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultRouteNSXNetworkOffering);
for (Map.Entry<Network.Service, Network.Provider> service : defaultNSXNetworkOfferingProviders.entrySet()) {
NetworkOfferingServiceMapVO offService =
new NetworkOfferingServiceMapVO(defaultRouteNSXNetworkOffering.getId(), service.getKey(), service.getValue());
_ntwkOfferingServiceMapDao.persist(offService);
s_logger.trace("Added service for the network offering: " + offService);
}

View File

@ -546,7 +546,7 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
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,
Boolean forTungsten, Boolean forNsx, List<Long> domainIds, List<Long> zoneIds, boolean enableOffering, NetUtils.InternetProtocol internetProtocol) {
Boolean forTungsten, Boolean forNsx, String mode, List<Long> domainIds, List<Long> zoneIds, boolean enableOffering, NetUtils.InternetProtocol internetProtocol) {
// TODO Auto-generated method stub
return null;
}

View File

@ -129,7 +129,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, false, false, false, null, null, false, null);
null, false, null, true, false, null, false, null, true, false, false, false, null,null, null, false, null);
assertNotNull("Shared network offering with specifyVlan=true failed to create ", off);
}
@ -137,7 +137,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, false, false, null, null, false, null);
false, null, false, null, true, false, null, false, null, true, false, false, false, null, null,null, false, null);
assertNotNull("Shared network offering with specifyVlan=false was created", off);
}
@ -145,7 +145,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, false, false, false, null, null, false, null);
null, false, null, true, false, null, false, null, true, false, false, false, null,null, null, false, null);
assertNotNull("Shared network offering with specifyIpRanges=true failed to create ", off);
}
@ -154,7 +154,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, false, false, null, null, false, null);
false, null, false, null, false, false, null, false, null, true, false, false, false, null,null, null, false, null);
assertNull("Shared network offering with specifyIpRanges=false was created", off);
}
@ -167,7 +167,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, false, false, false, null, null, false, null);
Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, false, false, false, null, null, null, false, null);
assertNotNull("Isolated network offering with specifyIpRanges=false failed to create ", off);
}
@ -180,7 +180,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, false, false, false, null, null, false, null);
Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, false, false, false, null,null, null, false, null);
assertNotNull("Isolated network offering with specifyVlan=true wasn't created", off);
}
@ -193,7 +193,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, false, false, false, null, null, false, null);
Network.GuestType.Isolated, false, null, false, null, true, false, null, false, null, true, false, false, false, null,null, null, false, null);
assertNull("Isolated network offering with specifyIpRanges=true and source nat service enabled, was created", off);
}
@ -204,7 +204,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, false, false, false, null, null, false, null);
Network.GuestType.Isolated, false, null, false, null, true, false, null, false, null, true, false, false, false, null,null, null, false, null);
assertNotNull("Isolated network offering with specifyIpRanges=true and with no sourceNatService, failed to create", off);
}
@ -222,7 +222,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, true, false, false, null, null, false, null);
Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, null, null, null, false, null);
// System.out.println("Creating Vpc Network Offering");
assertNotNull("Vpc Isolated network offering with Vpc provider ", off);
}
@ -242,7 +242,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, true, false, false, null, null, false, null);
Network.GuestType.Isolated, false, null, false, null, false, false, null, false, null, true, true, false, false, null, null, null, false, null);
// System.out.println("Creating Vpc Network Offering");
assertNotNull("Vpc Isolated network offering with Vpc and Netscaler provider ", off);
}

View File

@ -876,6 +876,7 @@
"label.forceencap": "Force UDP encapsulation of ESP packets",
"label.forgedtransmits": "Forged transmits",
"label.format": "Format",
"label.fornsx": "NSX",
"label.free": "Free",
"label.french.azerty.keyboard": "French AZERTY keyboard",
"label.friday": "Friday",
@ -1289,6 +1290,7 @@
"label.minorsequence": "Minor Sequence",
"label.minsize": "Minimum size",
"label.minute.past.hour": "minute(s) past the hour",
"label.mode": "Mode",
"label.monday": "Monday",
"label.monitor": "Monitor",
"label.monitor.expected.code": "Expected HTTP Status Code",
@ -1383,6 +1385,8 @@
"label.not.found": "Not found",
"label.not.suitable": "Not suitable",
"label.notifications": "Notifications",
"label.nsx": "NSX",
"label.nsx.mode": "NSX Mode",
"label.nsx.provider": "NSX Provider",
"label.nsx.provider.name": "NSX provider name",
"label.nsx.provider.hostname": "NSX provider hostname",
@ -1561,6 +1565,7 @@
"label.public.ips": "Public IP addresses",
"label.public.lb": "Public LB",
"label.public.traffic": "Public traffic",
"label.public.traffic.nsx": "NSX Public traffic",
"label.publicinterface": "Public interface",
"label.publicip": "IP address",
"label.publicipid": "IP address ID",

View File

@ -21,6 +21,7 @@
<a-col :md="24" :lg="layout === 'horizontal' ? 10 : 24">
<a-checkbox
:checked="checked"
:disabled="forNsx"
@change="handleCheckChange">
{{ checkBoxLabel }}
</a-checkbox>
@ -30,7 +31,8 @@
v-if="reversed !== checked"
:label="selectLabel">
<a-select
v-model:value="selectedOption"
v-model:value="selected"
:disabled="forNsx"
showSearch
optionFilterProp="label"
:filterOption="(input, option) => {
@ -83,6 +85,10 @@ export default {
reversed: {
type: Boolean,
default: false
},
forNsx: {
type: Boolean,
default: false
}
},
data () {
@ -112,6 +118,15 @@ export default {
}
return option
})
},
selected () {
return this.option || this.selectedOption
},
option () {
if (this.forNsx) {
return this.selectOptions[0]?.name || null
}
return null
}
},
methods: {

View File

@ -38,7 +38,7 @@
<br/>
<div v-if="Array.isArray(dataResource[item]) && item === 'service'">
<div v-for="(service, idx) in dataResource[item]" :key="idx">
{{ service.name }} : {{ service.provider[0].name }}
{{ service.name }} : {{ service.provider?.[0]?.name }}
</div>
</div>
<div v-else-if="$route.meta.name === 'backup' && item === 'volumes'">

View File

@ -262,7 +262,7 @@ export default {
docHelp: 'adminguide/networking.html#network-offerings',
permission: ['listNetworkOfferings'],
columns: ['name', 'state', 'guestiptype', 'traffictype', 'networkrate', 'domain', 'zone', 'order'],
details: ['name', 'id', 'displaytext', 'guestiptype', 'traffictype', 'internetprotocol', 'networkrate', 'ispersistent', 'egressdefaultpolicy', 'availability', 'conservemode', 'specifyvlan', 'specifyipranges', 'supportspublicaccess', 'supportsstrechedl2subnet', 'service', 'tags', 'domain', 'zone'],
details: ['name', 'id', 'displaytext', 'guestiptype', 'traffictype', 'internetprotocol', 'networkrate', 'ispersistent', 'egressdefaultpolicy', 'availability', 'conservemode', 'specifyvlan', 'specifyipranges', 'supportspublicaccess', 'supportsstrechedl2subnet', 'forvpc', 'fornsx', 'nsxmode', 'service', 'tags', 'domain', 'zone'],
resourceType: 'NetworkOffering',
tabs: [
{
@ -355,7 +355,7 @@ export default {
permission: ['listVPCOfferings'],
resourceType: 'VpcOffering',
columns: ['name', 'state', 'displaytext', 'domain', 'zone', 'order'],
details: ['name', 'id', 'displaytext', 'internetprotocol', 'distributedvpcrouter', 'tags', 'service', 'domain', 'zone', 'created'],
details: ['name', 'id', 'displaytext', 'internetprotocol', 'distributedvpcrouter', 'tags', 'service', 'fornsx', 'nsxmode', 'domain', 'zone', 'created'],
related: [{
name: 'vpc',
title: 'label.vpc',

View File

@ -41,7 +41,7 @@
v-model:value="form.displaytext"
:placeholder="apiParams.displaytext.description"/>
</a-form-item>
<a-form-item name="networkrate" ref="networkrate">
<a-form-item name="networkrate" ref="networkrate" v-if="!forNsx">
<template #label>
<tooltip-label :title="$t('label.networkrate')" :tooltip="apiParams.networkrate.description"/>
</template>
@ -60,10 +60,10 @@
<a-radio-button value="isolated">
{{ $t('label.isolated') }}
</a-radio-button>
<a-radio-button value="l2">
<a-radio-button value="l2" v-if="!forNsx">
{{ $t('label.l2') }}
</a-radio-button>
<a-radio-button value="shared">
<a-radio-button value="shared" v-if="!forNsx">
{{ $t('label.shared') }}
</a-radio-button>
</a-radio-group>
@ -93,7 +93,7 @@
</a-radio-button>
</a-radio-group>
</a-form-item>
<a-row :gutter="12">
<a-row :gutter="12" v-if="!forNsx">
<a-col :md="12" :lg="12">
<a-form-item name="specifyvlan" ref="specifyvlan">
<template #label>
@ -111,18 +111,47 @@
</a-form-item>
</a-col>
</a-row>
<a-form-item name="forvpc" ref="forvpc" v-if="guestType === 'isolated'">
<a-row :gutter="12">
<a-col :md="12" :lg="12">
<a-form-item name="forvpc" ref="forvpc" v-if="guestType === 'isolated'">
<template #label>
<tooltip-label :title="$t('label.vpc')" :tooltip="apiParams.forvpc.description"/>
</template>
<a-switch v-model:checked="form.forvpc" @change="val => { handleForVpcChange(val) }" />
</a-form-item>
</a-col>
<a-col :md="12" :lg="12">
<a-form-item name="fornsx" ref="fornsx" v-if="guestType === 'isolated'">
<template #label>
<tooltip-label :title="$t('label.nsx')" :tooltip="apiParams.fornsx.description"/>
</template>
<a-switch v-model:checked="form.fornsx" @change="val => { handleForNsxChange(val) }" />
</a-form-item>
</a-col>
</a-row>
<a-form-item name="nsxmode" ref="nsxmode" v-if="forNsx">
<template #label>
<tooltip-label :title="$t('label.vpc')" :tooltip="apiParams.forvpc.description"/>
<tooltip-label :title="$t('label.nsx.mode')" :tooltip="apiParams.nsxmode.description"/>
</template>
<a-switch v-model:checked="form.forvpc" @change="val => { handleForVpcChange(val) }" />
<a-select
v-if="showMode"
optionFilterProp="label"
v-model:value="form.nsxmode"
:filterOption="(input, option) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
}"
:placeholder="apiParams.nsxmode.description">
<a-select-option v-for="(opt) in modes" :key="opt.name" :label="opt.name">
{{ opt.name }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item name="userdatal2" ref="userdatal2" :label="$t('label.userdatal2')" v-if="guestType === 'l2'">
<a-switch v-model:checked="form.userdatal2" />
</a-form-item>
<a-row :gutter="12">
<a-col :md="12" :lg="12">
<a-form-item name="promiscuousmode" ref="promiscuousmode">
<a-form-item name="promiscuousmode" ref="promiscuousmode" v-if="!forNsx">
<template #label>
<tooltip-label :title="$t('label.promiscuousmode')" :tooltip="$t('message.network.offering.promiscuous.mode')"/>
</template>
@ -140,7 +169,7 @@
</a-radio-button>
</a-radio-group>
</a-form-item>
<a-form-item name="macaddresschanges" ref="macaddresschanges">
<a-form-item name="macaddresschanges" ref="macaddresschanges" v-if="!forNsx">
<template #label>
<tooltip-label :title="$t('label.macaddresschanges')" :tooltip="$t('message.network.offering.mac.address.changes')"/>
</template>
@ -160,7 +189,7 @@
</a-form-item>
</a-col>
<a-col :md="12" :lg="12">
<a-form-item name="forgedtransmits" ref="forgedtransmits">
<a-form-item name="forgedtransmits" ref="forgedtransmits" v-if="!forNsx">
<template #label>
<tooltip-label :title="$t('label.forgedtransmits')" :tooltip="$t('message.network.offering.forged.transmits')"/>
</template>
@ -178,7 +207,7 @@
</a-radio-button>
</a-radio-group>
</a-form-item>
<a-form-item name="maclearning" ref="maclearning">
<a-form-item name="maclearning" ref="maclearning" v-if="!forNsx">
<template #label>
<tooltip-label :title="$t('label.maclearning')" :tooltip="$t('message.network.offering.mac.learning')"/>
</template>
@ -217,6 +246,8 @@
<CheckBoxSelectPair
:resourceKey="item.name"
:checkBoxLabel="item.description"
:forNsx="forNsx"
:defaultCheckBoxValue="forNsx"
:selectOptions="!supportedServiceLoading ? item.provider: []"
@handle-checkselectpair-change="handleSupportedServiceChange"/>
</a-list-item>
@ -377,7 +408,7 @@
<a-form-item
name="conservemode"
ref="conservemode"
v-if="(guestType === 'shared' || guestType === 'isolated') && !isVpcVirtualRouterForAtLeastOneService">
v-if="(guestType === 'shared' || guestType === 'isolated') && !isVpcVirtualRouterForAtLeastOneService && !forNsx">
<template #label>
<tooltip-label :title="$t('label.conservemode')" :tooltip="apiParams.conservemode.description"/>
</template>
@ -512,6 +543,8 @@ export default {
selectedDomains: [],
selectedZones: [],
forVpc: false,
forNsx: false,
showMode: false,
lbType: 'publicLb',
macLearningValue: '',
supportedServices: [],
@ -538,7 +571,33 @@ export default {
zones: [],
zoneLoading: false,
ipv6NetworkOfferingEnabled: false,
loading: false
loading: false,
modes: [
{
id: 0,
name: 'NATTED'
},
{
id: 1,
name: 'ROUTED'
}
],
VPCVR: {
name: 'VPCVirtualRouter',
description: 'VPCVirtualRouter',
enabled: true
},
VR: {
name: 'VirtualRouter',
description: 'VirtualRouter',
enabled: true
},
NSX: {
name: 'Nsx',
description: 'Nsx',
enabled: true
},
nsxSupportedServicesMap: {}
}
},
beforeCreate () {
@ -761,34 +820,65 @@ export default {
this.supportedServiceLoading = true
var supportedServices = this.supportedServices
var self = this
supportedServices.forEach(function (svc, index) {
if (svc.name !== 'Connectivity') {
var providers = svc.provider
providers.forEach(function (provider, providerIndex) {
if (self.forVpc) { // *** vpc ***
var enabledProviders = ['VpcVirtualRouter', 'Netscaler', 'BigSwitchBcf', 'ConfigDrive']
if (self.lbType === 'internalLb') {
enabledProviders.push('InternalLbVm')
if (!this.forNsx) {
supportedServices.forEach(function (svc, index) {
if (svc.name !== 'Connectivity') {
var providers = svc.provider
providers.forEach(function (provider, providerIndex) {
if (self.forVpc) { // *** vpc ***
var enabledProviders = ['VpcVirtualRouter', 'Netscaler', 'BigSwitchBcf', 'ConfigDrive']
if (self.lbType === 'internalLb') {
enabledProviders.push('InternalLbVm')
}
provider.enabled = enabledProviders.includes(provider.name)
} else { // *** non-vpc ***
provider.enabled = !['InternalLbVm', 'VpcVirtualRouter', 'Nsx'].includes(provider.name)
}
provider.enabled = enabledProviders.includes(provider.name)
} else { // *** non-vpc ***
provider.enabled = !['InternalLbVm', 'VpcVirtualRouter'].includes(provider.name)
}
providers[providerIndex] = provider
})
svc.provider = providers
providers[providerIndex] = provider
})
svc.provider = providers
supportedServices[index] = svc
}
})
setTimeout(() => {
self.supportedServices = supportedServices
self.supportedServiceLoading = false
}, 50)
} else {
supportedServices = supportedServices.filter(svc => {
return Object.keys(this.nsxSupportedServicesMap).includes(svc.name)
})
supportedServices.forEach(function (svc, index) {
svc.provider = [self.nsxSupportedServicesMap[svc.name]]
supportedServices[index] = svc
}
})
setTimeout(() => {
})
self.supportedServices = supportedServices
self.supportedServiceLoading = false
}, 50)
}
},
handleForVpcChange (forVpc) {
this.forVpc = forVpc
if (this.forNsx) {
this.nsxSupportedServicesMap = {
Dhcp: this.forVpc ? this.VPCVR : this.VR,
Dns: this.forVpc ? this.VPCVR : this.VR,
UserData: this.forVpc ? this.VPCVR : this.VR,
SourceNat: this.NSX
}
}
this.updateSupportedServices()
},
async handleForNsxChange (forNsx) {
this.forNsx = forNsx
this.showMode = forNsx
this.nsxSupportedServicesMap = {
Dhcp: this.forVpc ? this.VPCVR : this.VR,
Dns: this.forVpc ? this.VPCVR : this.VR,
UserData: this.forVpc ? this.VPCVR : this.VR,
SourceNat: this.NSX
}
this.fetchSupportedServiceData()
},
handleLbTypeChange (lbType) {
this.lbType = lbType
this.updateSupportedServices()
@ -895,6 +985,10 @@ export default {
if (values.forvpc === true) {
params.forvpc = true
}
if (values.fornsx === true) {
params.fornsx = true
params.nsxmode = values.nsxmode
}
if (values.guestiptype === 'shared' || values.guestiptype === 'isolated') {
if (values.conservemode !== true) {
params.conservemode = false

View File

@ -67,6 +67,33 @@
</a-radio-button>
</a-radio-group>
</a-form-item>
<a-row :gutter="12">
<a-col :md="12" :lg="12">
<a-form-item name="fornsx" ref="fornsx">
<template #label>
<tooltip-label :title="$t('label.nsx')" :tooltip="apiParams.fornsx.description"/>
</template>
<a-switch v-model:checked="form.fornsx" @change="val => { handleForNsxChange(val) }" />
</a-form-item>
</a-col>
</a-row>
<a-form-item name="nsxmode" ref="nsxmode" v-if="forNsx">
<template #label>
<tooltip-label :title="$t('label.nsx.mode')" :tooltip="apiParams.nsxmode.description"/>
</template>
<a-select
v-if="showMode"
optionFilterProp="label"
v-model:value="form.nsxmode"
:filterOption="(input, option) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
}"
:placeholder="apiParams.nsxmode.description">
<a-select-option v-for="(opt) in modes" :key="opt.name" :label="opt.name">
{{ opt.name }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item>
<template #label>
<tooltip-label :title="$t('label.supportedservices')" :tooltip="apiParams.supportedservices.description"/>
@ -78,6 +105,8 @@
<CheckBoxSelectPair
:resourceKey="item.name"
:checkBoxLabel="item.description"
:forNsx="forNsx"
:defaultCheckBoxValue="forNsx"
:selectOptions="item.provider"
@handle-checkselectpair-change="handleSupportedServiceChange"/>
</a-list-item>
@ -209,6 +238,8 @@ export default {
domainLoading: false,
zones: [],
zoneLoading: false,
forNsx: false,
showMode: false,
loading: false,
supportedServices: [],
supportedServiceLoading: false,
@ -218,7 +249,28 @@ export default {
connectivityServiceChecked: false,
sourceNatServiceChecked: false,
selectedServiceProviderMap: {},
ipv6NetworkOfferingEnabled: false
ipv6NetworkOfferingEnabled: false,
modes: [
{
id: 0,
name: 'NATTED'
},
{
id: 1,
name: 'ROUTED'
}
],
VPCVR: {
name: 'VPCVirtualRouter',
description: 'VPCVirtualRouter',
enabled: true
},
NSX: {
name: 'Nsx',
description: 'Nsx',
enabled: true
},
nsxSupportedServicesMap: {}
}
},
beforeCreate () {
@ -299,85 +351,138 @@ export default {
})
},
fetchSupportedServiceData () {
this.supportedServices = []
this.supportedServices.push({
name: 'Dhcp',
provider: [
{ name: 'VpcVirtualRouter' }
]
})
this.supportedServices.push({
name: 'Dns',
provider: [{ name: 'VpcVirtualRouter' }]
})
this.supportedServices.push({
name: 'Lb',
provider: [
{ name: 'VpcVirtualRouter' },
{ name: 'InternalLbVm' }
]
})
this.supportedServices.push({
name: 'Gateway',
provider: [
{ name: 'VpcVirtualRouter' },
{ name: 'BigSwitchBcf' }
]
})
this.supportedServices.push({
name: 'StaticNat',
provider: [
{ name: 'VpcVirtualRouter' },
{ name: 'BigSwitchBcf' }
]
})
this.supportedServices.push({
name: 'SourceNat',
provider: [
{ name: 'VpcVirtualRouter' },
{ name: 'BigSwitchBcf' }
]
})
this.supportedServices.push({
name: 'NetworkACL',
provider: [
{ name: 'VpcVirtualRouter' },
{ name: 'BigSwitchBcf' }
]
})
this.supportedServices.push({
name: 'PortForwarding',
provider: [{ name: 'VpcVirtualRouter' }]
})
this.supportedServices.push({
name: 'UserData',
provider: [
{ name: 'VpcVirtualRouter' },
{ name: 'ConfigDrive' }
]
})
this.supportedServices.push({
name: 'Vpn',
provider: [
{ name: 'VpcVirtualRouter' },
{ name: 'BigSwitchBcf' }
]
})
this.supportedServices.push({
name: 'Connectivity',
provider: [
{ name: 'BigSwitchBcf' },
{ name: 'NiciraNvp' },
{ name: 'Ovs' },
{ name: 'JuniperContrailVpcRouter' }
]
})
for (var i in this.supportedServices) {
var serviceName = this.supportedServices[i].name
var serviceDisplayName = serviceName
// Sanitize names
this.supportedServices[i].description = serviceDisplayName
var services = []
if (this.forNsx) {
services.push({
name: 'Dhcp',
enabled: true,
provider: [
{ name: 'VpcVirtualRouter' }
]
})
services.push({
name: 'Dns',
enabled: true,
provider: [{ name: 'VpcVirtualRouter' }]
})
services.push({
name: 'Lb',
enabled: true,
provider: [{ name: 'Nsx' }]
})
services.push({
name: 'StaticNat',
enabled: true,
provider: [{ name: 'Nsx' }]
})
services.push({
name: 'SourceNat',
enabled: true,
provider: [{ name: 'Nsx' }]
})
services.push({
name: 'NetworkACL',
enabled: true,
provider: [{ name: 'Nsx' }]
})
services.push({
name: 'PortForwarding',
enabled: true,
provider: [{ name: 'Nsx' }]
})
services.push({
name: 'UserData',
enabled: true,
provider: [{ name: 'VpcVirtualRouter' }]
})
} else {
services.push({
name: 'Dhcp',
provider: [
{ name: 'VpcVirtualRouter' }
]
})
services.push({
name: 'Dns',
provider: [{ name: 'VpcVirtualRouter' }]
})
services.push({
name: 'Lb',
provider: [
{ name: 'VpcVirtualRouter' },
{ name: 'InternalLbVm' }
]
})
services.push({
name: 'Gateway',
provider: [
{ name: 'VpcVirtualRouter' },
{ name: 'BigSwitchBcf' }
]
})
services.push({
name: 'StaticNat',
provider: [
{ name: 'VpcVirtualRouter' },
{ name: 'BigSwitchBcf' }
]
})
services.push({
name: 'SourceNat',
provider: [
{ name: 'VpcVirtualRouter' },
{ name: 'BigSwitchBcf' }
]
})
services.push({
name: 'NetworkACL',
provider: [
{ name: 'VpcVirtualRouter' },
{ name: 'BigSwitchBcf' }
]
})
services.push({
name: 'PortForwarding',
provider: [{ name: 'VpcVirtualRouter' }]
})
services.push({
name: 'UserData',
provider: [
{ name: 'VpcVirtualRouter' },
{ name: 'ConfigDrive' }
]
})
services.push({
name: 'Vpn',
provider: [
{ name: 'VpcVirtualRouter' },
{ name: 'BigSwitchBcf' }
]
})
services.push({
name: 'Connectivity',
provider: [
{ name: 'BigSwitchBcf' },
{ name: 'NiciraNvp' },
{ name: 'Ovs' },
{ name: 'JuniperContrailVpcRouter' }
]
})
}
this.supportedServices = []
for (var i in services) {
services[i].description = services[i].name
}
var self = this
setTimeout(() => {
self.supportedServices = services
self.supportedServiceLoading = false
}, 50)
},
async handleForNsxChange (forNsx) {
this.forNsx = forNsx
this.showMode = forNsx
this.fetchSupportedServiceData()
},
handleSupportedServiceChange (service, checked, provider) {
if (service === 'Connectivity') {
@ -453,9 +558,16 @@ export default {
if (values.internetprotocol) {
params.internetprotocol = values.internetprotocol
}
if (values.fornsx === true) {
params.fornsx = true
params.nsxmode = values.nsxmode
}
if (this.selectedServiceProviderMap != null) {
var supportedServices = Object.keys(this.selectedServiceProviderMap)
params.supportedservices = supportedServices.join(',')
params.supportedservices = []
if (!this.forNsx) {
params.supportedservices = supportedServices.join(',')
}
for (var k in supportedServices) {
params['serviceProviderList[' + k + '].service'] = supportedServices[k]
params['serviceProviderList[' + k + '].provider'] = this.selectedServiceProviderMap[supportedServices[k]]
@ -485,7 +597,7 @@ export default {
params.serviceofferingid = values.serviceofferingid
}
} else {
params.supportedservices = ''
params.supportedservices = []
}
if (values.enable) {
params.enable = values.enable