mirror of https://github.com/apache/cloudstack.git
Merge 907cb0e396 into 9bbd32a8ef
This commit is contained in:
commit
403257458c
|
|
@ -225,8 +225,8 @@ public interface NetworkService {
|
|||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceAllocationException
|
||||
*/
|
||||
Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String broadcastUri, String startIp, String endIP, String gateway,
|
||||
String netmask, long networkOwnerId, Long vpcId, Boolean sourceNat, Long networkOfferingId, Boolean bypassVlanOverlapCheck, Long associatedNetworkId) throws ResourceAllocationException, ConcurrentOperationException,
|
||||
Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String broadcastUri, String startIp, String endIP, String gateway, String netmask, String description,
|
||||
long networkOwnerId, Long vpcId, Boolean sourceNat, Long networkOfferingId, Boolean bypassVlanOverlapCheck, Long associatedNetworkId) throws ResourceAllocationException, ConcurrentOperationException,
|
||||
InsufficientCapacityException;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ public class StaticRouteProfile implements StaticRoute {
|
|||
String vlanTag;
|
||||
String gateway;
|
||||
String netmask;
|
||||
String description;
|
||||
String ipAddress;
|
||||
|
||||
public StaticRouteProfile(StaticRoute staticRoute, VpcGateway gateway) {
|
||||
|
|
@ -44,6 +45,7 @@ public class StaticRouteProfile implements StaticRoute {
|
|||
vlanTag = gateway.getBroadcastUri();
|
||||
this.gateway = gateway.getGateway();
|
||||
netmask = gateway.getNetmask();
|
||||
description = gateway.getDescription();
|
||||
ipAddress = gateway.getIp4Address();
|
||||
}
|
||||
|
||||
|
|
@ -120,6 +122,10 @@ public class StaticRouteProfile implements StaticRoute {
|
|||
return netmask;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getEntityType() {
|
||||
return StaticRoute.class;
|
||||
|
|
|
|||
|
|
@ -64,6 +64,11 @@ public interface VpcGateway extends Identity, ControlledEntity, InternalIdentity
|
|||
*/
|
||||
String getNetmask();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
String getDescription();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -61,6 +61,9 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd implements UserC
|
|||
@Parameter(name = ApiConstants.GATEWAY, type = CommandType.STRING, required = true, description = "The Gateway of the Private Gateway")
|
||||
private String gateway;
|
||||
|
||||
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, required = false, description = "the description of the Private Gateway")
|
||||
private String description;
|
||||
|
||||
@Parameter(name = ApiConstants.NETMASK, type = CommandType.STRING, required = true, description = "The Netmask of the Private Gateway")
|
||||
private String netmask;
|
||||
|
||||
|
|
@ -102,6 +105,10 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd implements UserC
|
|||
return gateway;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getNetmask() {
|
||||
return netmask;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@ public class ListPrivateGatewaysCmd extends BaseListProjectAndAccountResourcesCm
|
|||
@Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "List gateways by state")
|
||||
private String state;
|
||||
|
||||
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "the description of the Private Gateway")
|
||||
private String description;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -82,6 +85,10 @@ public class ListPrivateGatewaysCmd extends BaseListProjectAndAccountResourcesCm
|
|||
return state;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ public class PrivateGatewayResponse extends BaseResponseWithAssociatedNetwork im
|
|||
@Param(description = "The private gateway's netmask")
|
||||
private String netmask;
|
||||
|
||||
@SerializedName(ApiConstants.DESCRIPTION)
|
||||
@Param(description = "the private gateway's description")
|
||||
private String description;
|
||||
|
||||
@SerializedName(ApiConstants.IP_ADDRESS)
|
||||
@Param(description = "The private gateway's IP address")
|
||||
private String address;
|
||||
|
|
@ -126,6 +130,10 @@ public class PrivateGatewayResponse extends BaseResponseWithAssociatedNetwork im
|
|||
this.netmask = netmask;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setZoneId(String zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,6 +182,9 @@ public class NetworkVO implements Network {
|
|||
@Column(name = "external_id")
|
||||
String externalId;
|
||||
|
||||
@Column(name = "description")
|
||||
String description;
|
||||
|
||||
@Transient
|
||||
String routerIp;
|
||||
|
||||
|
|
@ -709,6 +712,14 @@ public class NetworkVO implements Network {
|
|||
this.externalId = externalId;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getVlanIdAsUUID() {
|
||||
return vlanIdAsUUID;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ public class VpcGatewayVO implements VpcGateway {
|
|||
@Column(name = "netmask")
|
||||
String netmask;
|
||||
|
||||
@Column(name = "description")
|
||||
String description;
|
||||
|
||||
@Column(name = "vlan_tag")
|
||||
String broadcastUri;
|
||||
|
||||
|
|
@ -107,9 +110,10 @@ public class VpcGatewayVO implements VpcGateway {
|
|||
* @param domainId TODO
|
||||
* @param account_id
|
||||
* @param sourceNat
|
||||
* @param description
|
||||
*/
|
||||
public VpcGatewayVO(String ip4Address, Type type, long vpcId, long zoneId, long networkId, String broadcastUri, String gateway, String netmask, long accountId,
|
||||
long domainId, boolean sourceNat, long networkACLId) {
|
||||
long domainId, boolean sourceNat, long networkACLId, String description) {
|
||||
this.ip4Address = ip4Address;
|
||||
this.type = type;
|
||||
this.vpcId = vpcId;
|
||||
|
|
@ -124,7 +128,7 @@ public class VpcGatewayVO implements VpcGateway {
|
|||
state = State.Creating;
|
||||
this.sourceNat = sourceNat;
|
||||
this.networkACLId = networkACLId;
|
||||
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -230,4 +234,13 @@ public class VpcGatewayVO implements VpcGateway {
|
|||
public void setVpcId(Long vpcId) {
|
||||
this.vpcId = vpcId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,3 +18,7 @@
|
|||
--;
|
||||
-- Schema upgrade from 4.8.0 to 4.8.1;
|
||||
--;
|
||||
|
||||
-- Add description
|
||||
alter table `cloud`.`vpc_gateways` add column `description` varchar(255) default '';
|
||||
alter table `cloud`.`networks` add column `description` varchar(255) default '';
|
||||
|
|
|
|||
|
|
@ -3645,6 +3645,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
populateDomain(response, result.getDomainId());
|
||||
response.setState(result.getState().toString());
|
||||
response.setSourceNat(result.getSourceNat());
|
||||
response.setDescription(result.getDescription());
|
||||
|
||||
NetworkACL acl = ApiDBUtils.findByNetworkACLId(result.getNetworkACLId());
|
||||
if (acl != null) {
|
||||
|
|
|
|||
|
|
@ -5821,7 +5821,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
|
|||
@Override
|
||||
@DB
|
||||
public Network createPrivateNetwork(final String networkName, final String displayText, long physicalNetworkId, String broadcastUriString, final String startIp, String endIp, final String gateway,
|
||||
String netmask, final long networkOwnerId, final Long vpcId, final Boolean sourceNat, final Long networkOfferingId, final Boolean bypassVlanOverlapCheck, final Long associatedNetworkId)
|
||||
String netmask, final String description, final long networkOwnerId, final Long vpcId, final Boolean sourceNat, final Long networkOfferingId, final Boolean bypassVlanOverlapCheck, final Long associatedNetworkId)
|
||||
throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
|
||||
|
||||
final Account caller = CallContext.current().getCallingAccount();
|
||||
|
|
|
|||
|
|
@ -81,6 +81,11 @@ public class PrivateGatewayProfile implements PrivateGateway {
|
|||
return vpcGateway.getNetmask();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return vpcGateway.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPhysicalNetworkId() {
|
||||
return physicalNetworkId;
|
||||
|
|
|
|||
|
|
@ -2501,6 +2501,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||
String ipAddress = command.getIpAddress();
|
||||
String gateway = command.getGateway();
|
||||
String netmask = command.getNetmask();
|
||||
String description = command.getDescription();
|
||||
long gatewayOwnerId = command.getEntityOwnerId();
|
||||
Long networkOfferingId = command.getNetworkOfferingId();
|
||||
Boolean isSourceNat = command.getIsSourceNat();
|
||||
|
|
@ -2511,13 +2512,13 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||
Long physicalNetworkId = ((CreatePrivateGatewayByAdminCmd)command).getPhysicalNetworkId();
|
||||
String broadcastUri = ((CreatePrivateGatewayByAdminCmd)command).getBroadcastUri();
|
||||
Boolean bypassVlanOverlapCheck = ((CreatePrivateGatewayByAdminCmd)command).getBypassVlanOverlapCheck();
|
||||
return createVpcPrivateGateway(vpcId, physicalNetworkId, broadcastUri, ipAddress, gateway, netmask, gatewayOwnerId, networkOfferingId, isSourceNat, aclId, bypassVlanOverlapCheck, associatedNetworkId);
|
||||
return createVpcPrivateGateway(vpcId, physicalNetworkId, broadcastUri, ipAddress, gateway, netmask, description, gatewayOwnerId, networkOfferingId, isSourceNat, aclId, bypassVlanOverlapCheck, associatedNetworkId);
|
||||
}
|
||||
return createVpcPrivateGateway(vpcId, null, null, ipAddress, gateway, netmask, gatewayOwnerId, networkOfferingId, isSourceNat, aclId, false, associatedNetworkId);
|
||||
return createVpcPrivateGateway(vpcId, null, null, ipAddress, gateway, netmask, description, gatewayOwnerId, networkOfferingId, isSourceNat, aclId, false, associatedNetworkId);
|
||||
}
|
||||
|
||||
private PrivateGateway createVpcPrivateGateway(final long vpcId, Long physicalNetworkId, final String broadcastUri, final String ipAddress, final String gateway,
|
||||
final String netmask, final long gatewayOwnerId, final Long networkOfferingIdPassed, final Boolean isSourceNat, final Long aclId, final Boolean bypassVlanOverlapCheck, final Long associatedNetworkId) throws ResourceAllocationException,
|
||||
final String netmask, final String description, final long gatewayOwnerId, final Long networkOfferingIdPassed, final Boolean isSourceNat, final Long aclId, final Boolean bypassVlanOverlapCheck, final Long associatedNetworkId) throws ResourceAllocationException,
|
||||
ConcurrentOperationException, InsufficientCapacityException {
|
||||
|
||||
// Validate parameters
|
||||
|
|
@ -2558,7 +2559,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||
logger.info("creating new network for vpc {} using broadcast uri: {} and associated network: {}", vpc, broadcastUri, _ntwkDao.findById(associatedNetworkId));
|
||||
final String networkName = "vpc-" + vpc.getName() + "-privateNetwork";
|
||||
privateNtwk = _ntwkSvc.createPrivateNetwork(networkName, networkName, physicalNetworkIdFinal, broadcastUri, ipAddress, null, gateway, netmask,
|
||||
gatewayOwnerId, vpcId, isSourceNat, networkOfferingId, bypassVlanOverlapCheck, associatedNetworkId);
|
||||
description, gatewayOwnerId, vpcId, isSourceNat, networkOfferingId, bypassVlanOverlapCheck, associatedNetworkId);
|
||||
} else { // create the nic/ip as createPrivateNetwork
|
||||
// doesn''t do that work for us now
|
||||
logger.info("found and using existing network for vpc " + vpc + ": " + broadcastUri);
|
||||
|
|
@ -2600,7 +2601,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||
|
||||
// 2) create gateway entry
|
||||
gatewayVO = new VpcGatewayVO(ipAddress, VpcGateway.Type.Private, vpcId, privateNtwk.getDataCenterId(), privateNtwk.getId(), privateNtwk.getBroadcastUri().toString(),
|
||||
gateway, netmask, vpc.getAccountId(), vpc.getDomainId(), isSourceNat, networkAclId);
|
||||
gateway, netmask, vpc.getAccountId(), vpc.getDomainId(), isSourceNat, networkAclId, description);
|
||||
_vpcGatewayDao.persist(gatewayVO);
|
||||
|
||||
logger.debug("Created vpc gateway entry " + gatewayVO);
|
||||
|
|
|
|||
|
|
@ -153,21 +153,21 @@ public class CreatePrivateNetworkTest {
|
|||
/* Network nw; */
|
||||
try {
|
||||
/* nw = */
|
||||
networkService.createPrivateNetwork("bla", "fake", 1L, "vlan:1", "10.1.1.2", null, "10.1.1.1", "255.255.255.0", 1L, 1L, true, 1L, false, null);
|
||||
networkService.createPrivateNetwork("bla", "fake", 1L, "vlan:1", "10.1.1.2", null, "10.1.1.1", "255.255.255.0", "bla vlan:1", 1L, 1L, true, 1L, false, null);
|
||||
/* nw = */
|
||||
networkService.createPrivateNetwork("bla", "fake", 1L, "lswitch:3", "10.1.1.2", null, "10.1.1.1", "255.255.255.0", 1L, 1L, false, 1L, false, null);
|
||||
networkService.createPrivateNetwork("bla", "fake", 1L, "lswitch:3", "10.1.1.2", null, "10.1.1.1", "255.255.255.0", "bla lswitch:3", 1L, 1L, false, 1L, false, null);
|
||||
boolean invalid = false;
|
||||
boolean unsupported = false;
|
||||
try {
|
||||
/* nw = */
|
||||
networkService.createPrivateNetwork("bla", "fake", 1, "bla:2", "10.1.1.2", null, "10.1.1.1", "255.255.255.0", 1, 1L, true, 1L, false, null);
|
||||
networkService.createPrivateNetwork("bla", "fake", 1, "bla:2", "10.1.1.2", null, "10.1.1.1", "255.255.255.0", "bla bla:2", 1, 1L, true, 1L, false, null);
|
||||
} catch (CloudRuntimeException e) {
|
||||
Assert.assertEquals("unexpected parameter exception", "string 'bla:2' has an unknown BroadcastDomainType.", e.getMessage());
|
||||
invalid = true;
|
||||
}
|
||||
try {
|
||||
/* nw = */
|
||||
networkService.createPrivateNetwork("bla", "fake", 1, "mido://4", "10.1.1.2", null, "10.1.1.1", "255.255.255.0", 1, 1L, false, 1L, false, null);
|
||||
networkService.createPrivateNetwork("bla", "fake", 1, "mido://4", "10.1.1.2", null, "10.1.1.1", "255.255.255.0", "bla mido://4", 1, 1L, false, 1L, false, null);
|
||||
} catch (InvalidParameterValueException e) {
|
||||
Assert.assertEquals("unexpected parameter exception", "unsupported type of broadcastUri specified: mido://4", e.getMessage());
|
||||
unsupported = true;
|
||||
|
|
|
|||
|
|
@ -557,8 +557,8 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkOrches
|
|||
* @see com.cloud.network.NetworkService#createPrivateNetwork(java.lang.String, java.lang.String, long, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, long, java.lang.Long)
|
||||
*/
|
||||
@Override
|
||||
public Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String vlan, String startIp, String endIP, String gateway,
|
||||
String netmask, long networkOwnerId, Long vpcId, Boolean sourceNat, Long networkOfferingId, Boolean bypassVlanOverlapCheck, Long associatedNetworkId) throws ResourceAllocationException, ConcurrentOperationException,
|
||||
public Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String vlan, String startIp, String endIP, String gateway, String netmask, String description,
|
||||
long networkOwnerId, Long vpcId, Boolean sourceNat, Long networkOfferingId, Boolean bypassVlanOverlapCheck, Long associatedNetworkId) throws ResourceAllocationException, ConcurrentOperationException,
|
||||
InsufficientCapacityException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -939,8 +939,8 @@ export default {
|
|||
icon: 'gateway-outlined',
|
||||
hidden: true,
|
||||
permission: ['listPrivateGateways'],
|
||||
columns: ['ipaddress', 'state', 'gateway', 'netmask', 'account', 'domain'],
|
||||
details: ['ipaddress', 'gateway', 'netmask', 'vlan', 'sourcenatsupported', 'aclname', 'account', 'domain', 'zone', 'associatednetwork', 'associatednetworkid'],
|
||||
columns: ['ipaddress', 'state', 'gateway', 'netmask', 'description', 'account', 'domain'],
|
||||
details: ['ipaddress', 'gateway', 'netmask', 'description', 'vlan', 'sourcenatsupported', 'aclname', 'account', 'domain', 'zone', 'associatednetwork', 'associatednetworkid'],
|
||||
tabs: [{
|
||||
name: 'details',
|
||||
component: shallowRef(defineAsyncComponent(() => import('@/components/view/DetailsTab.vue')))
|
||||
|
|
@ -957,7 +957,7 @@ export default {
|
|||
docHelp: 'adminguide/networking_and_traffic.html#adding-a-private-gateway-to-a-vpc',
|
||||
listView: true,
|
||||
args: (record, store) => {
|
||||
var fields = ['vpcid', 'physicalnetworkid', 'vlan', 'ipaddress', 'gateway', 'netmask', 'sourcenatsupported', 'aclid']
|
||||
var fields = ['vpcid', 'physicalnetworkid', 'vlan', 'ipaddress', 'gateway', 'netmask', 'description', 'sourcenatsupported', 'aclid']
|
||||
if (store.apis.createPrivateGateway.params.filter(x => x.name === 'bypassvlanoverlapcheck').length > 0) {
|
||||
fields.push('bypassvlanoverlapcheck')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,6 +221,12 @@
|
|||
v-model:value="form.gateway"
|
||||
></a-input>
|
||||
</a-form-item>
|
||||
<a-form-item :label="$t('label.description')" ref="description" name="description">
|
||||
<a-input
|
||||
:placeholder="placeholders.description"
|
||||
v-model:value="form.description"
|
||||
></a-input>
|
||||
</a-form-item>
|
||||
<a-form-item :label="$t('label.netmask')" ref="netmask" name="netmask">
|
||||
<a-input
|
||||
:placeholder="placeholders.netmask"
|
||||
|
|
@ -505,6 +511,10 @@ export default {
|
|||
title: this.$t('label.netmask'),
|
||||
dataIndex: 'netmask'
|
||||
},
|
||||
{
|
||||
title: this.$t('label.description'),
|
||||
dataIndex: 'description'
|
||||
},
|
||||
{
|
||||
title: this.$t('label.vlan'),
|
||||
dataIndex: 'vlan'
|
||||
|
|
@ -823,6 +833,7 @@ export default {
|
|||
ipaddress: data.ipaddress,
|
||||
gateway: data.gateway,
|
||||
netmask: data.netmask,
|
||||
description: data.description,
|
||||
aclid: data.acl
|
||||
}
|
||||
if (data.bypassvlanoverlapcheck) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue