You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/08/18 13:29:15 UTC
[GitHub] [cloudstack] ravening commented on a change in pull request #3804: Display capability info in listNetwork response
ravening commented on a change in pull request #3804:
URL: https://github.com/apache/cloudstack/pull/3804#discussion_r691238421
##########
File path: server/src/main/java/com/cloud/api/ApiResponseHelper.java
##########
@@ -2213,13 +2214,75 @@ public NetworkResponse createNetworkResponse(ResponseView view, Network network)
CapabilityResponse capabilityResponse = new CapabilityResponse();
String capabilityValue = ser_cap_entries.getValue();
capabilityResponse.setName(capability.getName());
- capabilityResponse.setValue(capabilityValue);
+ if (Service.Lb == service && capability.getName().equals(Capability.SupportedLBIsolation.getName())) {
+ capabilityResponse.setValue(networkOffering.isDedicatedLB() ? "dedicated" : "shared");
+ } else {
+ capabilityResponse.setValue(capabilityValue);
+ }
+ if (capability.getName().equals(Capability.SupportedLBIsolation.getName()) || capability.getName().equals(Capability.SupportedSourceNatTypes.getName())
+ || capability.getName().equals(Capability.RedundantRouter.getName())) {
+ capabilityResponse.setCanChoose(true);
+ } else {
+ capabilityResponse.setCanChoose(false);
+ }
capabilityResponse.setObjectName("capability");
capabilityResponses.add(capabilityResponse);
}
- serviceResponse.setCapabilities(capabilityResponses);
}
+ if (Service.SourceNat == service) {
+ // overwrite
+ capabilityResponses = new ArrayList<CapabilityResponse>();
+ CapabilityResponse sharedSourceNat = new CapabilityResponse();
+ sharedSourceNat.setName(Capability.SupportedSourceNatTypes.getName());
+ sharedSourceNat.setValue(networkOffering.isSharedSourceNat() ? "perzone" : "peraccount");
+ sharedSourceNat.setCanChoose(true);
+ capabilityResponses.add(sharedSourceNat);
+
+ CapabilityResponse redundantRouter = new CapabilityResponse();
+ redundantRouter.setName(Capability.RedundantRouter.getName());
+ redundantRouter.setValue(networkOffering.isRedundantRouter() ? "true" : "false");
+ redundantRouter.setCanChoose(true);
+ capabilityResponses.add(redundantRouter);
+
+ } else if (service == Service.StaticNat) {
+ CapabilityResponse eIp = new CapabilityResponse();
+ eIp.setName(Capability.ElasticIp.getName());
+ eIp.setValue(networkOffering.isElasticIp() ? "true" : "false");
+ eIp.setCanChoose(false);
+ capabilityResponses.add(eIp);
+
+ CapabilityResponse associatePublicIp = new CapabilityResponse();
+ associatePublicIp.setName(Capability.AssociatePublicIP.getName());
+ associatePublicIp.setValue(networkOffering.isAssociatePublicIP() ? "true" : "false");
+ associatePublicIp.setCanChoose(false);
+ capabilityResponses.add(associatePublicIp);
+
+ } else if (Service.Lb == service) {
+ CapabilityResponse eLb = new CapabilityResponse();
+ eLb.setName(Capability.ElasticLb.getName());
+ eLb.setValue(networkOffering.isElasticLb() ? "true" : "false");
+ eLb.setCanChoose(false);
+ capabilityResponses.add(eLb);
+
+ CapabilityResponse inline = new CapabilityResponse();
+ inline.setName(Capability.InlineMode.getName());
+ inline.setValue(networkOffering.isInline() ? "true" : "false");
+ inline.setCanChoose(false);
+ capabilityResponses.add(inline);
Review comment:
@GabrielBrascher please review it again. made some changes to the code
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org