mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Netris: Fix Netris provider parameter name and response (#11377)
* Fix Netris url param name and allow cidr size for routed mode vpcs * rename response parameter name
This commit is contained in:
parent
9de77e1cc1
commit
db63d2428b
@ -1272,6 +1272,7 @@ public class ApiConstants {
|
|||||||
public static final String NETRIS_DETAIL_KEY = "forNetris";
|
public static final String NETRIS_DETAIL_KEY = "forNetris";
|
||||||
public static final String NETRIS_TAG = "netristag";
|
public static final String NETRIS_TAG = "netristag";
|
||||||
public static final String NETRIS_VXLAN_ID = "netrisvxlanid";
|
public static final String NETRIS_VXLAN_ID = "netrisvxlanid";
|
||||||
|
public static final String NETRIS_URL = "netrisurl";
|
||||||
public static final String DISK_PATH = "diskpath";
|
public static final String DISK_PATH = "diskpath";
|
||||||
public static final String IMPORT_SOURCE = "importsource";
|
public static final String IMPORT_SOURCE = "importsource";
|
||||||
public static final String TEMP_PATH = "temppath";
|
public static final String TEMP_PATH = "temppath";
|
||||||
|
|||||||
@ -158,7 +158,7 @@ public interface RoutedIpv4Manager extends PluggableService, Configurable {
|
|||||||
|
|
||||||
boolean isRoutedVpc(Vpc vpc);
|
boolean isRoutedVpc(Vpc vpc);
|
||||||
|
|
||||||
boolean isVpcVirtualRouterGateway(VpcOffering vpcOffering);
|
boolean isValidGateway(VpcOffering vpcOffering);
|
||||||
|
|
||||||
BgpPeer createBgpPeer(CreateBgpPeerCmd createBgpPeerCmd);
|
BgpPeer createBgpPeer(CreateBgpPeerCmd createBgpPeerCmd);
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,7 @@ public class AddNetrisProviderCmd extends BaseCmd {
|
|||||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Netris provider name")
|
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "Netris provider name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "Netris provider URL")
|
@Parameter(name = ApiConstants.NETRIS_URL, type = CommandType.STRING, required = true, description = "Netris provider URL")
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
@Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "Username to login into Netris")
|
@Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "Username to login into Netris")
|
||||||
|
|||||||
@ -41,13 +41,9 @@ public class NetrisProviderResponse extends BaseResponse {
|
|||||||
@Param(description = "Zone name to which the Netris Provider is associated with")
|
@Param(description = "Zone name to which the Netris Provider is associated with")
|
||||||
private String zoneName;
|
private String zoneName;
|
||||||
|
|
||||||
@SerializedName(ApiConstants.HOST_NAME)
|
@SerializedName(ApiConstants.NETRIS_URL)
|
||||||
@Param(description = "Netris Provider hostname or IP address")
|
@Param(description = "Netris Provider URL")
|
||||||
private String hostname;
|
private String netrisUrl;
|
||||||
|
|
||||||
@SerializedName(ApiConstants.PORT)
|
|
||||||
@Param(description = "Netris Provider port")
|
|
||||||
private String port;
|
|
||||||
|
|
||||||
@SerializedName(ApiConstants.SITE_NAME)
|
@SerializedName(ApiConstants.SITE_NAME)
|
||||||
@Param(description = "Netris Provider site")
|
@Param(description = "Netris Provider site")
|
||||||
@ -93,20 +89,12 @@ public class NetrisProviderResponse extends BaseResponse {
|
|||||||
this.zoneName = zoneName;
|
this.zoneName = zoneName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHostname() {
|
public String getNetrisUrl() {
|
||||||
return hostname;
|
return netrisUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHostname(String hostname) {
|
public void setNetrisUrl(String netrisUrl) {
|
||||||
this.hostname = hostname;
|
this.netrisUrl = netrisUrl;
|
||||||
}
|
|
||||||
|
|
||||||
public String getPort() {
|
|
||||||
return port;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPort(String port) {
|
|
||||||
this.port = port;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSiteName() {
|
public String getSiteName() {
|
||||||
|
|||||||
@ -184,7 +184,7 @@ public class NetrisProviderServiceImpl implements NetrisProviderService {
|
|||||||
NetrisProviderResponse response = new NetrisProviderResponse();
|
NetrisProviderResponse response = new NetrisProviderResponse();
|
||||||
response.setName(provider.getName());
|
response.setName(provider.getName());
|
||||||
response.setUuid(provider.getUuid());
|
response.setUuid(provider.getUuid());
|
||||||
response.setHostname(provider.getUrl());
|
response.setNetrisUrl(provider.getUrl());
|
||||||
response.setZoneId(zone.getUuid());
|
response.setZoneId(zone.getUuid());
|
||||||
response.setZoneName(zone.getName());
|
response.setZoneName(zone.getName());
|
||||||
response.setSiteName(provider.getSiteName());
|
response.setSiteName(provider.getSiteName());
|
||||||
|
|||||||
@ -1345,7 +1345,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||||||
if (ObjectUtils.allNotNull(cidr, cidrSize)) {
|
if (ObjectUtils.allNotNull(cidr, cidrSize)) {
|
||||||
throw new InvalidParameterValueException("VPC cidr and cidr size are mutually exclusive");
|
throw new InvalidParameterValueException("VPC cidr and cidr size are mutually exclusive");
|
||||||
}
|
}
|
||||||
if (routedIpv4Manager.isVpcVirtualRouterGateway(vpcOffering)) {
|
if (routedIpv4Manager.isValidGateway(vpcOffering)) {
|
||||||
if (cidr != null) {
|
if (cidr != null) {
|
||||||
if (!_accountMgr.isRootAdmin(caller.getId())) {
|
if (!_accountMgr.isRootAdmin(caller.getId())) {
|
||||||
throw new InvalidParameterValueException("Only root admin can set the gateway/netmask of VPC with ROUTED mode");
|
throw new InvalidParameterValueException("Only root admin can set the gateway/netmask of VPC with ROUTED mode");
|
||||||
|
|||||||
@ -1021,9 +1021,10 @@ public class RoutedIpv4ManagerImpl extends ComponentLifecycleBase implements Rou
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVpcVirtualRouterGateway(VpcOffering vpcOffering) {
|
public boolean isValidGateway(VpcOffering vpcOffering) {
|
||||||
return NetworkOffering.NetworkMode.ROUTED.equals(vpcOffering.getNetworkMode())
|
return NetworkOffering.NetworkMode.ROUTED.equals(vpcOffering.getNetworkMode())
|
||||||
&& vpcOfferingServiceMapDao.findByServiceProviderAndOfferingId(Service.Gateway.getName(), Provider.VPCVirtualRouter.getName(), vpcOffering.getId()) != null;
|
&& (vpcOfferingServiceMapDao.findByServiceProviderAndOfferingId(Service.Gateway.getName(), Provider.VPCVirtualRouter.getName(), vpcOffering.getId()) != null
|
||||||
|
|| vpcOfferingServiceMapDao.findByServiceProviderAndOfferingId(Service.Gateway.getName(), Provider.Netris.getName(), vpcOffering.getId()) != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -551,7 +551,7 @@ public class VpcManagerImplTest {
|
|||||||
Mockito.when(vpcDao.persist(any(), anyMap())).thenReturn(vpc);
|
Mockito.when(vpcDao.persist(any(), anyMap())).thenReturn(vpc);
|
||||||
Mockito.when(vpc.getUuid()).thenReturn("uuid");
|
Mockito.when(vpc.getUuid()).thenReturn("uuid");
|
||||||
doReturn(true).when(routedIpv4Manager).isRoutedVpc(any());
|
doReturn(true).when(routedIpv4Manager).isRoutedVpc(any());
|
||||||
doReturn(true).when(routedIpv4Manager).isVpcVirtualRouterGateway(vpcOfferingVO);
|
doReturn(true).when(routedIpv4Manager).isValidGateway(vpcOfferingVO);
|
||||||
doReturn(true).when(routedIpv4Manager).isDynamicRoutedVpc(vpcOfferingVO);
|
doReturn(true).when(routedIpv4Manager).isDynamicRoutedVpc(vpcOfferingVO);
|
||||||
Ipv4GuestSubnetNetworkMap ipv4GuestSubnetNetworkMap = Mockito.mock(Ipv4GuestSubnetNetworkMap.class);
|
Ipv4GuestSubnetNetworkMap ipv4GuestSubnetNetworkMap = Mockito.mock(Ipv4GuestSubnetNetworkMap.class);
|
||||||
doReturn(ipv4GuestSubnetNetworkMap).when(routedIpv4Manager).getOrCreateIpv4SubnetForVpc(any(), anyInt());
|
doReturn(ipv4GuestSubnetNetworkMap).when(routedIpv4Manager).getOrCreateIpv4SubnetForVpc(any(), anyInt());
|
||||||
|
|||||||
@ -1611,6 +1611,7 @@
|
|||||||
"label.netmask": "Netmask",
|
"label.netmask": "Netmask",
|
||||||
"label.netris": "Netris",
|
"label.netris": "Netris",
|
||||||
"label.netristag": "Netris tag",
|
"label.netristag": "Netris tag",
|
||||||
|
"label.netrisurl": "Netris URL",
|
||||||
"label.netris.provider": "Netris Provider",
|
"label.netris.provider": "Netris Provider",
|
||||||
"label.netris.provider.name": "Netris provider name",
|
"label.netris.provider.name": "Netris provider name",
|
||||||
"label.netris.provider.username": "Netris provider username",
|
"label.netris.provider.username": "Netris provider username",
|
||||||
|
|||||||
@ -1169,7 +1169,7 @@ export default {
|
|||||||
value: (record) => { return record.zoneid }
|
value: (record) => { return record.zoneid }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
columns: ['name', 'hostname', 'port', 'site', 'tenantname', 'netristag']
|
columns: ['name', 'netrisurl', 'site', 'tenantname', 'netristag']
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1133,7 +1133,7 @@ export default {
|
|||||||
if (!this.stepData.stepMove.includes('addNetrisProvider')) {
|
if (!this.stepData.stepMove.includes('addNetrisProvider')) {
|
||||||
const providerParams = {}
|
const providerParams = {}
|
||||||
providerParams.name = this.prefillContent?.netrisName || ''
|
providerParams.name = this.prefillContent?.netrisName || ''
|
||||||
providerParams.url = this.prefillContent?.url || ''
|
providerParams.netrisurl = this.prefillContent?.netrisurl || ''
|
||||||
providerParams.username = this.prefillContent?.username || ''
|
providerParams.username = this.prefillContent?.username || ''
|
||||||
providerParams.password = this.prefillContent?.password || ''
|
providerParams.password = this.prefillContent?.password || ''
|
||||||
providerParams.zoneid = this.stepData.zoneReturned.id
|
providerParams.zoneid = this.stepData.zoneReturned.id
|
||||||
|
|||||||
@ -485,7 +485,7 @@ export default {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'label.netris.provider.url',
|
title: 'label.netris.provider.url',
|
||||||
key: 'url',
|
key: 'netrisurl',
|
||||||
placeHolder: 'message.installwizard.tooltip.netris.provider.url',
|
placeHolder: 'message.installwizard.tooltip.netris.provider.url',
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user