mirror of https://github.com/apache/cloudstack.git
NSX: Add Step for Adding Public traffic network for NSX
This commit is contained in:
parent
5ec455228d
commit
2aadd328cb
|
|
@ -1054,6 +1054,8 @@ public class ApiConstants {
|
|||
public static final String SOURCE_NAT_IP_ID = "sourcenatipaddressid";
|
||||
public static final String HAS_RULES = "hasrules";
|
||||
|
||||
public static final String nsxDetail = "forNsx";
|
||||
|
||||
/**
|
||||
* This enum specifies IO Drivers, each option controls specific policies on I/O.
|
||||
* Qemu guests support "threads" and "native" options Since 0.8.8 ; "io_uring" is supported Since 6.3.0 (QEMU 5.0).
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import com.cloud.user.Account;
|
|||
|
||||
@APICommand(name = "createVlanIpRange", description = "Creates a VLAN IP range.", responseObject = VlanIpRangeResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class CreateVlanIpRangeCmd extends BaseCmd {
|
||||
public class CreateVlanIpRangeCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateVlanIpRangeCmd.class.getName());
|
||||
|
||||
|
||||
|
|
@ -114,6 +114,9 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
|
|||
@Parameter(name = ApiConstants.FOR_SYSTEM_VMS, type = CommandType.BOOLEAN, description = "true if IP range is set to system vms, false if not")
|
||||
private Boolean forSystemVms;
|
||||
|
||||
@Parameter(name = ApiConstants.FOR_NSX, type = CommandType.BOOLEAN, description = "true if the IP range is used for NSX resource", since = "4.20.0")
|
||||
private boolean forNsx;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -154,8 +157,12 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
|
|||
return startIp;
|
||||
}
|
||||
|
||||
public boolean isForNsx() {
|
||||
return forNsx;
|
||||
}
|
||||
|
||||
public String getVlan() {
|
||||
if (vlan == null || vlan.isEmpty()) {
|
||||
if ((vlan == null || vlan.isEmpty()) && !forNsx) {
|
||||
vlan = "untagged";
|
||||
}
|
||||
return vlan;
|
||||
|
|
|
|||
|
|
@ -123,6 +123,10 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
|
|||
@Param(description = "indicates whether VLAN IP range is dedicated to system vms or not")
|
||||
private Boolean forSystemVms;
|
||||
|
||||
@SerializedName(ApiConstants.FOR_NSX)
|
||||
@Param(description = "indicates whether IP range is dedicated to NSX resources or not")
|
||||
private Boolean forNsx;
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
|
@ -235,4 +239,8 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit
|
|||
public void setIp6Cidr(String ip6Cidr) {
|
||||
this.ip6Cidr = ip6Cidr;
|
||||
}
|
||||
|
||||
public void setForNsx(Boolean forNsx) {
|
||||
this.forNsx = forNsx;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ public interface ConfigurationManager {
|
|||
Boolean forTungsten, Boolean forNsx, 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)
|
||||
String vlanGateway, String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr, boolean forNsx)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException;
|
||||
|
||||
void createDefaultSystemNetworks(long zoneId) throws ConcurrentOperationException;
|
||||
|
|
|
|||
|
|
@ -285,3 +285,5 @@ GROUP BY
|
|||
|
||||
-- Set removed state for all removed accounts
|
||||
UPDATE `cloud`.`account` SET state='removed' WHERE `removed` IS NOT NULL;
|
||||
|
||||
--
|
||||
|
|
@ -31,6 +31,7 @@ import java.util.HashSet;
|
|||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.function.Consumer;
|
||||
|
|
@ -38,6 +39,8 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.dc.VlanDetailsVO;
|
||||
import com.cloud.dc.dao.VlanDetailsDao;
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||
|
|
@ -467,6 +470,8 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
FirewallRulesDao firewallRulesDao;
|
||||
@Inject
|
||||
UserDataDao userDataDao;
|
||||
@Inject
|
||||
VlanDetailsDao vlanDetailsDao;
|
||||
|
||||
@Override
|
||||
public UserResponse createUserResponse(User user) {
|
||||
|
|
@ -926,6 +931,8 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
}
|
||||
}
|
||||
vlanResponse.setForSystemVms(isForSystemVms(vlan.getId()));
|
||||
VlanDetailsVO vlanDetail = vlanDetailsDao.findDetail(vlan.getId(), ApiConstants.nsxDetail);
|
||||
vlanResponse.setForNsx(Objects.nonNull(vlanDetail) && vlanDetail.getValue().equals("true"));
|
||||
vlanResponse.setObjectName("vlan");
|
||||
return vlanResponse;
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ import javax.inject.Inject;
|
|||
import javax.naming.ConfigurationException;
|
||||
|
||||
|
||||
import com.cloud.dc.VlanDetailsVO;
|
||||
import com.cloud.dc.dao.VlanDetailsDao;
|
||||
import com.cloud.hypervisor.HypervisorGuru;
|
||||
import com.cloud.network.dao.NsxProviderDao;
|
||||
import com.cloud.network.element.NsxProviderVO;
|
||||
|
|
@ -347,6 +349,8 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
@Inject
|
||||
VlanDao _vlanDao;
|
||||
@Inject
|
||||
VlanDetailsDao vlanDetailsDao;
|
||||
@Inject
|
||||
IPAddressDao _publicIpAddressDao;
|
||||
@Inject
|
||||
DataCenterIpAddressDao _privateIpAddressDao;
|
||||
|
|
@ -4451,7 +4455,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
} else {
|
||||
network = _networkModel.getNetworkWithSecurityGroupEnabled(zoneId);
|
||||
if (network == null) {
|
||||
throw new InvalidParameterValueException("Nework id is required for Direct vlan creation ");
|
||||
throw new InvalidParameterValueException("Network id is required for Direct vlan creation ");
|
||||
}
|
||||
networkId = network.getId();
|
||||
zoneId = network.getDataCenterId();
|
||||
|
|
@ -4516,12 +4520,12 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
|
||||
return commitVlan(zoneId, podId, startIP, endIP, newVlanGateway, newVlanNetmask, vlanId, forVirtualNetwork, forSystemVms, networkId, physicalNetworkId, startIPv6, endIPv6, ip6Gateway,
|
||||
ip6Cidr, domain, vlanOwner, network, sameSubnet);
|
||||
ip6Cidr, domain, vlanOwner, network, sameSubnet, cmd.isForNsx());
|
||||
}
|
||||
|
||||
private Vlan commitVlan(final Long zoneId, final Long podId, final String startIP, final String endIP, final String newVlanGatewayFinal, final String newVlanNetmaskFinal,
|
||||
final String vlanId, final Boolean forVirtualNetwork, final Boolean forSystemVms, final Long networkId, final Long physicalNetworkId, final String startIPv6, final String endIPv6,
|
||||
final String ip6Gateway, final String ip6Cidr, final Domain domain, final Account vlanOwner, final Network network, final Pair<Boolean, Pair<String, String>> sameSubnet) {
|
||||
final String ip6Gateway, final String ip6Cidr, final Domain domain, final Account vlanOwner, final Network network, final Pair<Boolean, Pair<String, String>> sameSubnet, boolean forNsx) {
|
||||
final GlobalLock commitVlanLock = GlobalLock.getInternLock("CommitVlan");
|
||||
commitVlanLock.lock(5);
|
||||
s_logger.debug("Acquiring lock for committing vlan");
|
||||
|
|
@ -4549,7 +4553,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
newVlanNetmask = sameSubnet.second().second();
|
||||
}
|
||||
final Vlan vlan = createVlanAndPublicIpRange(zoneId, networkId, physicalNetworkId, forVirtualNetwork, forSystemVms, podId, startIP, endIP, newVlanGateway, newVlanNetmask, vlanId,
|
||||
false, domain, vlanOwner, startIPv6, endIPv6, ip6Gateway, ip6Cidr);
|
||||
false, domain, vlanOwner, startIPv6, endIPv6, ip6Gateway, ip6Cidr, forNsx);
|
||||
// create an entry in the nic_secondary table. This will be the new
|
||||
// gateway that will be configured on the corresponding routervm.
|
||||
return vlan;
|
||||
|
|
@ -4673,7 +4677,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
@Override
|
||||
@DB
|
||||
public Vlan createVlanAndPublicIpRange(final long zoneId, final long networkId, final long physicalNetworkId, final boolean forVirtualNetwork, final boolean forSystemVms, final Long podId, final String startIP, final String endIP,
|
||||
final String vlanGateway, final String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, final Account vlanOwner, final String startIPv6, final String endIPv6, final String vlanIp6Gateway, final String vlanIp6Cidr) {
|
||||
final String vlanGateway, final String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, final Account vlanOwner, final String startIPv6, final String endIPv6, final String vlanIp6Gateway, final String vlanIp6Cidr, boolean forNsx) {
|
||||
final Network network = _networkModel.getNetwork(networkId);
|
||||
|
||||
boolean ipv4 = false, ipv6 = false;
|
||||
|
|
@ -4755,11 +4759,11 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
} else {
|
||||
vlanId = networkVlanId;
|
||||
}
|
||||
} else if (network.getTrafficType() == TrafficType.Public && vlanId == null) {
|
||||
} else if (network.getTrafficType() == TrafficType.Public && vlanId == null && !forNsx) {
|
||||
throw new InvalidParameterValueException("Unable to determine vlan id or untagged vlan for public network");
|
||||
}
|
||||
|
||||
if (vlanId == null) {
|
||||
if (vlanId == null && !forNsx) {
|
||||
vlanId = Vlan.UNTAGGED;
|
||||
}
|
||||
|
||||
|
|
@ -4856,7 +4860,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
if (isSharedNetworkWithoutSpecifyVlan) {
|
||||
bypassVlanOverlapCheck = true;
|
||||
}
|
||||
if (!bypassVlanOverlapCheck && _zoneDao.findVnet(zoneId, physicalNetworkId, BroadcastDomainType.getValue(BroadcastDomainType.fromString(vlanId))).size() > 0) {
|
||||
if (!bypassVlanOverlapCheck && !forNsx && _zoneDao.findVnet(zoneId, physicalNetworkId, BroadcastDomainType.getValue(BroadcastDomainType.fromString(vlanId))).size() > 0) {
|
||||
throw new InvalidParameterValueException("The VLAN tag " + vlanId + " is already being used for dynamic vlan allocation for the guest network in zone "
|
||||
+ zone.getName());
|
||||
}
|
||||
|
|
@ -4872,7 +4876,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
|
||||
// Everything was fine, so persist the VLAN
|
||||
final VlanVO vlan = commitVlanAndIpRange(zoneId, networkId, physicalNetworkId, podId, startIP, endIP, vlanGateway, vlanNetmask, vlanId, domain, vlanOwner, vlanIp6Gateway, vlanIp6Cidr,
|
||||
ipv4, zone, vlanType, ipv6Range, ipRange, forSystemVms);
|
||||
ipv4, zone, vlanType, ipv6Range, ipRange, forSystemVms, forNsx);
|
||||
|
||||
return vlan;
|
||||
}
|
||||
|
|
@ -4894,9 +4898,11 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
continue;
|
||||
}
|
||||
// from here, subnet overlaps
|
||||
if (vlanId.toLowerCase().contains(Vlan.UNTAGGED) || UriUtils.checkVlanUriOverlap(
|
||||
VlanDetailsVO vlanDetail = vlanDetailsDao.findDetail(vlan.getId(), ApiConstants.nsxDetail);
|
||||
if ((Objects.isNull(vlanId) && Objects.nonNull(vlanDetail) && vlanDetail.getValue().equals("true")) || Objects.nonNull(vlanId) &&
|
||||
(vlanId.toLowerCase().contains(Vlan.UNTAGGED) || UriUtils.checkVlanUriOverlap(
|
||||
BroadcastDomainType.getValue(BroadcastDomainType.fromString(vlanId)),
|
||||
BroadcastDomainType.getValue(BroadcastDomainType.fromString(vlan.getVlanTag())))) {
|
||||
BroadcastDomainType.getValue(BroadcastDomainType.fromString(vlan.getVlanTag()))))) {
|
||||
// For untagged VLAN Id and overlapping URIs we need to expand and verify IP ranges
|
||||
final String[] otherVlanIpRange = vlan.getIpRange().split("\\-");
|
||||
final String otherVlanStartIP = otherVlanIpRange[0];
|
||||
|
|
@ -4941,13 +4947,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
|
||||
private VlanVO commitVlanAndIpRange(final long zoneId, final long networkId, final long physicalNetworkId, final Long podId, final String startIP, final String endIP,
|
||||
final String vlanGateway, final String vlanNetmask, final String vlanId, final Domain domain, final Account vlanOwner, final String vlanIp6Gateway, final String vlanIp6Cidr,
|
||||
final boolean ipv4, final DataCenterVO zone, final VlanType vlanType, final String ipv6Range, final String ipRange, final boolean forSystemVms) {
|
||||
final boolean ipv4, final DataCenterVO zone, final VlanType vlanType, final String ipv6Range, final String ipRange, final boolean forSystemVms, final boolean forNsx) {
|
||||
return Transaction.execute(new TransactionCallback<VlanVO>() {
|
||||
@Override
|
||||
public VlanVO doInTransaction(final TransactionStatus status) {
|
||||
VlanVO vlan = new VlanVO(vlanType, vlanId, vlanGateway, vlanNetmask, zone.getId(), ipRange, networkId, physicalNetworkId, vlanIp6Gateway, vlanIp6Cidr, ipv6Range);
|
||||
s_logger.debug("Saving vlan range " + vlan);
|
||||
vlan = _vlanDao.persist(vlan);
|
||||
vlanDetailsDao.addDetail(vlan.getId(), ApiConstants.nsxDetail, String.valueOf(forNsx), true);
|
||||
|
||||
// IPv6 use a used ip map, is different from ipv4, no need to save
|
||||
// public ip range
|
||||
|
|
|
|||
|
|
@ -2122,7 +2122,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
|
|||
if (createVlan && network != null) {
|
||||
// Create vlan ip range
|
||||
_configMgr.createVlanAndPublicIpRange(pNtwk.getDataCenterId(), network.getId(), physicalNetworkId, false, false, null, startIP, endIP, gateway, netmask, vlanId,
|
||||
bypassVlanOverlapCheck, null, null, startIPv6, endIPv6, ip6Gateway, ip6Cidr);
|
||||
bypassVlanOverlapCheck, null, null, startIPv6, endIPv6, ip6Gateway, ip6Cidr, ntwkOff.isForNsx());
|
||||
}
|
||||
if (associatedNetwork != null) {
|
||||
_networkDetailsDao.persist(new NetworkDetailVO(network.getId(), Network.AssociatedNetworkId, String.valueOf(associatedNetwork.getId()), true));
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import java.util.Comparator;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
|
@ -789,7 +790,10 @@ public class CommandSetupHelper {
|
|||
// vlan1, then all ip addresses of vlan2, etc..
|
||||
final Map<String, ArrayList<PublicIpAddress>> vlanIpMap = new HashMap<String, ArrayList<PublicIpAddress>>();
|
||||
for (final PublicIpAddress ipAddress : ips) {
|
||||
final String vlanTag = ipAddress.getVlanTag();
|
||||
String vlanTag = ipAddress.getVlanTag();
|
||||
if (Objects.isNull(vlanTag)) {
|
||||
vlanTag = "nsx-"+ipAddress.getAddress().addr();
|
||||
}
|
||||
ArrayList<PublicIpAddress> ipList = vlanIpMap.get(vlanTag);
|
||||
if (ipList == null) {
|
||||
ipList = new ArrayList<PublicIpAddress>();
|
||||
|
|
@ -840,10 +844,18 @@ public class CommandSetupHelper {
|
|||
|
||||
for (final PublicIpAddress ipAddr : ipAddrList) {
|
||||
final boolean add = ipAddr.getState() == IpAddress.State.Releasing ? false : true;
|
||||
String vlanTag = ipAddr.getVlanTag();
|
||||
String key = null;
|
||||
if (Objects.isNull(vlanTag)) {
|
||||
key = "nsx-" + ipAddr.getAddress().addr();
|
||||
} else {
|
||||
key = BroadcastDomainType.getValue(BroadcastDomainType.fromString(ipAddr.getVlanTag()));
|
||||
}
|
||||
|
||||
final String macAddress = vlanMacAddress.get(BroadcastDomainType.getValue(BroadcastDomainType.fromString(ipAddr.getVlanTag())));
|
||||
final String macAddress = vlanMacAddress.get(key);
|
||||
|
||||
final IpAddressTO ip = new IpAddressTO(ipAddr.getAccountId(), ipAddr.getAddress().addr(), add, firstIP, ipAddr.isSourceNat(), BroadcastDomainType.fromString(ipAddr.getVlanTag()).toString(), ipAddr.getGateway(),
|
||||
final IpAddressTO ip = new IpAddressTO(ipAddr.getAccountId(), ipAddr.getAddress().addr(), add, firstIP, ipAddr.isSourceNat(),
|
||||
Objects.isNull(vlanTag) ? null : BroadcastDomainType.fromString(ipAddr.getVlanTag()).toString(), ipAddr.getGateway(),
|
||||
ipAddr.getNetmask(), macAddress, networkRate, ipAddr.isOneToOneNat());
|
||||
setIpAddressNetworkParams(ip, network, router);
|
||||
if (network.getPublicMtu() != null) {
|
||||
|
|
@ -1047,6 +1059,9 @@ public class CommandSetupHelper {
|
|||
}
|
||||
for (IPAddressVO ip : userIps) {
|
||||
String vlanTag = _vlanDao.findById(ip.getVlanId()).getVlanTag();
|
||||
if (Objects.isNull(vlanTag)) {
|
||||
vlanTag = "nsx-" + ip.getAddress().addr();
|
||||
}
|
||||
Boolean lastIp = vlanLastIpMap.get(vlanTag);
|
||||
if (lastIp != null && !lastIp) {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -711,8 +711,8 @@ public class NetworkHelperImpl implements NetworkHelper {
|
|||
defaultNic.setIsolationUri(BroadcastDomainType.Vxlan.toUri(sourceNatIp.getVlanTag()));
|
||||
} else {
|
||||
defaultNic.setBroadcastType(BroadcastDomainType.Vlan);
|
||||
defaultNic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(sourceNatIp.getVlanTag()));
|
||||
defaultNic.setIsolationUri(IsolationType.Vlan.toUri(sourceNatIp.getVlanTag()));
|
||||
defaultNic.setBroadcastUri(sourceNatIp.getVlanTag() != null ? BroadcastDomainType.Vlan.toUri(sourceNatIp.getVlanTag()) : null);
|
||||
defaultNic.setIsolationUri(sourceNatIp.getVlanTag() != null ? IsolationType.Vlan.toUri(sourceNatIp.getVlanTag()) : null);
|
||||
}
|
||||
|
||||
//If guest nic has already been added we will have 2 devices in the list.
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ public class VpcNetworkHelperImpl extends NetworkHelperImpl {
|
|||
final TreeSet<String> publicVlans = new TreeSet<String>();
|
||||
if (vpcRouterDeploymentDefinition.isPublicNetwork()) {
|
||||
publicVlans.add(vpcRouterDeploymentDefinition.getSourceNatIP()
|
||||
.getVlanTag());
|
||||
.getVlanTag()+"");
|
||||
}
|
||||
|
||||
//1) allocate nic for control and source nat public ip
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
|
@ -351,7 +352,12 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||
} else if (network.getTrafficType() == TrafficType.Public) {
|
||||
final Pair<Nic, Network> publicNic = new Pair<Nic, Network>(routerNic, network);
|
||||
publicNics.add(publicNic);
|
||||
final String vlanTag = BroadcastDomainType.getValue(routerNic.getBroadcastUri());
|
||||
String vlanTag = null;
|
||||
if (Objects.nonNull(routerNic.getBroadcastUri())) {
|
||||
vlanTag = BroadcastDomainType.getValue(routerNic.getBroadcastUri());
|
||||
} else {
|
||||
vlanTag = "nsx-"+routerNic.getIPv4Address();
|
||||
}
|
||||
vlanMacAddress.put(vlanTag, routerNic.getMacAddress());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -556,7 +556,7 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
|
|||
*/
|
||||
@Override
|
||||
public 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 vlanGatewayv6, String vlanCidrv6)
|
||||
String vlanGateway, String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, Account vlanOwner, String startIPv6, String endIPv6, String vlanGatewayv6, String vlanCidrv6, boolean forNsx)
|
||||
throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -1555,6 +1555,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",
|
||||
|
|
@ -1969,7 +1970,9 @@
|
|||
"label.systemvm": "System VM",
|
||||
"label.systemvmtype": "System VM type",
|
||||
"label.tag": "Tag",
|
||||
"label.tag.nsx": "nsx",
|
||||
"label.tag.key": "Tag key",
|
||||
"label.tag.systemvm": "systemvm",
|
||||
"label.tag.value": "Tag value",
|
||||
"label.tagged": "Tagged",
|
||||
"label.tags": "Tags",
|
||||
|
|
|
|||
|
|
@ -31,9 +31,15 @@
|
|||
:pagination="false"
|
||||
style="margin-bottom: 24px; width: 100%" >
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'gateway'">
|
||||
<div> {{ record.gateway }}</div>
|
||||
<div v-if="record.fornsx"> <a-tag color="processing"> {{ $t('label.tag.nsx') }} </a-tag> </div>
|
||||
<div v-else-if="isNsxZone"> <a-tag color="processing"> {{ $t('label.tag.systemvm') }} </a-tag> </div>
|
||||
</template>
|
||||
<template v-if="column.key === 'actions'">
|
||||
<tooltip-button
|
||||
:tooltip="$t('label.delete')"
|
||||
:disabled="(record.fornsx && !forNsx) || (!record.fornsx && forNsx)"
|
||||
type="primary"
|
||||
:danger="true"
|
||||
icon="delete-outlined"
|
||||
|
|
@ -70,6 +76,7 @@
|
|||
<a-form-item name="vlan" ref="vlan">
|
||||
<a-input
|
||||
v-model:value="form.vlan"
|
||||
:disabled="forNsx"
|
||||
:placeholder="$t('label.vlan')"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
|
@ -160,6 +167,14 @@ export default {
|
|||
isFixError: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
forNsx: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isNsxZone: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
|
|
@ -170,6 +185,7 @@ export default {
|
|||
ipRanges: [],
|
||||
columns: [
|
||||
{
|
||||
key: 'gateway',
|
||||
title: this.$t('label.gateway'),
|
||||
dataIndex: 'gateway',
|
||||
width: 140
|
||||
|
|
@ -210,6 +226,7 @@ export default {
|
|||
const prefilledIpRangesKey = this.traffic + '-ipranges'
|
||||
if (this.prefillContent[prefilledIpRangesKey]) {
|
||||
this.ipRanges = this.prefillContent[prefilledIpRangesKey]
|
||||
console.log(this.ipRanges)
|
||||
}
|
||||
},
|
||||
created () {
|
||||
|
|
@ -251,7 +268,9 @@ export default {
|
|||
netmask: values.netmask,
|
||||
vlan: values.vlan,
|
||||
startIp: values.startIp,
|
||||
endIp: values.endIp
|
||||
endIp: values.endIp,
|
||||
fornsx: this.forNsx,
|
||||
forsystemvms: this.isNsxZone && !this.forNsx
|
||||
})
|
||||
this.formRef.value.resetFields()
|
||||
}).catch(error => {
|
||||
|
|
|
|||
|
|
@ -905,6 +905,8 @@ export default {
|
|||
|
||||
let stopNow = false
|
||||
this.stepData.returnedPublicTraffic = this.stepData?.returnedPublicTraffic || []
|
||||
console.log(this.prefillContent['public-ipranges'])
|
||||
console.log('pir')
|
||||
for (let index = 0; index < this.prefillContent['public-ipranges'].length; index++) {
|
||||
const publicVlanIpRange = this.prefillContent['public-ipranges'][index]
|
||||
let isExisting = false
|
||||
|
|
@ -927,6 +929,8 @@ export default {
|
|||
params.zoneId = this.stepData.zoneReturned.id
|
||||
if (publicVlanIpRange.vlan && publicVlanIpRange.vlan.length > 0) {
|
||||
params.vlan = publicVlanIpRange.vlan
|
||||
} else if (publicVlanIpRange.fornsx) {
|
||||
params.vlan = null
|
||||
} else {
|
||||
params.vlan = 'untagged'
|
||||
}
|
||||
|
|
@ -934,6 +938,8 @@ export default {
|
|||
params.netmask = publicVlanIpRange.netmask
|
||||
params.startip = publicVlanIpRange.startIp
|
||||
params.endip = publicVlanIpRange.endIp
|
||||
params.fornsx = publicVlanIpRange.fornsx
|
||||
params.forsystemvms = publicVlanIpRange.forsystemvms
|
||||
|
||||
if (this.isBasicZone) {
|
||||
params.forVirtualNetwork = true
|
||||
|
|
@ -947,9 +953,10 @@ export default {
|
|||
|
||||
try {
|
||||
console.log('is nsx zone: ', this.stepData.isNsxZone)
|
||||
console.log('value of this.stepData.stepMove.includes(createPublicVlanIpRange)', this.stepData.stepMove.includes('createPublicVlanIpRange' + index))
|
||||
// for not add vlan ; next phase add the check: && this.stepData.isNsxZone
|
||||
if (!this.stepData.stepMove.includes('createPublicVlanIpRange' + index)) {
|
||||
console.log('create vlan ip range:')
|
||||
console.log(params)
|
||||
const vlanIpRangeItem = await this.createVlanIpRange(params)
|
||||
this.stepData.returnedPublicTraffic.push(vlanIpRangeItem)
|
||||
console.log('create public vlan ip range')
|
||||
|
|
@ -2065,6 +2072,8 @@ export default {
|
|||
createVlanIpRange (args) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let message = ''
|
||||
console.log('args:')
|
||||
console.log(args)
|
||||
|
||||
api('createVlanIpRange', args).then(json => {
|
||||
const item = json.createvlaniprangeresponse.vlan
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
:isFixError="isFixError"
|
||||
/>
|
||||
<ip-address-range-form
|
||||
v-if="steps && steps[currentStep].formKey === 'publicTraffic'"
|
||||
v-if="steps && ['publicTraffic', 'nsxPublicTraffic'].includes(steps[currentStep].formKey)"
|
||||
@nextPressed="nextPressed"
|
||||
@backPressed="handleBack"
|
||||
@fieldsChanged="fieldsChanged"
|
||||
|
|
@ -60,6 +60,8 @@
|
|||
:description="publicTrafficDescription[zoneType.toLowerCase()]"
|
||||
:prefillContent="prefillContent"
|
||||
:isFixError="isFixError"
|
||||
:forNsx="steps[currentStep].formKey === 'nsxPublicTraffic'"
|
||||
:isNsxZone="isNsxZone"
|
||||
/>
|
||||
|
||||
<static-inputs-form
|
||||
|
|
@ -242,6 +244,13 @@ export default {
|
|||
formKey: 'publicTraffic',
|
||||
trafficType: 'public'
|
||||
})
|
||||
if (this.isNsxZone) {
|
||||
steps.push({
|
||||
title: 'label.public.traffic.nsx',
|
||||
formKey: 'nsxPublicTraffic',
|
||||
trafficType: 'public'
|
||||
})
|
||||
}
|
||||
steps.push({
|
||||
title: 'label.pod',
|
||||
formKey: 'pod'
|
||||
|
|
@ -544,7 +553,6 @@ export default {
|
|||
created () {
|
||||
this.physicalNetworks = this.prefillContent.physicalNetworks
|
||||
this.steps = this.filteredSteps()
|
||||
console.log(this.isNsxZone)
|
||||
this.currentStep = this.prefillContent?.networkStep || 0
|
||||
if (this.stepChild && this.stepChild !== '') {
|
||||
this.currentStep = this.steps.findIndex(item => item.formKey === this.stepChild)
|
||||
|
|
|
|||
Loading…
Reference in New Issue