specify which network service capabilities can be choosed as part of network offering

This commit is contained in:
Murali Reddy 2011-12-05 17:59:54 -08:00
parent d836699209
commit bc88d2eee3
3 changed files with 20 additions and 1 deletions

View File

@ -281,6 +281,7 @@ public class ApiConstants {
public static final String ACCOUNT_DETAILS = "accountdetails";
public static final String SERVICE_PROVIDER_LIST = "serviceproviderlist";
public static final String SERVICE_CAPABILITY_LIST = "servicecapabilitylist";
public static final String CAN_CHOOSE_SERVICE_CAPABILITY = "canchooseservicecapability";
public static final String PROVIDER = "provider";
public static final String NETWORK_SPEED = "networkspeed";
public static final String BROADCAST_DOMAIN_RANGE = "broadcastdomainrange";

View File

@ -29,6 +29,9 @@ public class CapabilityResponse extends BaseResponse {
@SerializedName(ApiConstants.VALUE) @Param(description="the capability value")
private String value;
@SerializedName(ApiConstants.CAN_CHOOSE_SERVICE_CAPABILITY) @Param(description="can this service capability value can be choosable while creatine network offerings")
private boolean canChoose;
public String getName() {
return name;
}
@ -44,4 +47,12 @@ public class CapabilityResponse extends BaseResponse {
public void setValue(String value) {
this.value = value;
}
public boolean getCanChoose() {
return canChoose;
}
public void setCanChoose(boolean choosable) {
this.canChoose = choosable;
}
}

View File

@ -2606,7 +2606,7 @@ public class ApiResponseHelper implements ResponseGenerator {
} else if (Service.Firewall.getName().equalsIgnoreCase(service)) {
List<CapabilityResponse> fwCapResponse = new ArrayList<CapabilityResponse>();
CapabilityResponse sharedSourceNat = new CapabilityResponse();
sharedSourceNat.setName(Capability.SupportedLBIsolation.getName());
sharedSourceNat.setName(Capability.SupportedSourceNatTypes.getName());
sharedSourceNat.setValue(offering.getSharedSourceNat()?"perzone":"peraccount");
fwCapResponse.add(sharedSourceNat);
svcRsp.setCapabilities(fwCapResponse);
@ -3074,6 +3074,13 @@ public class ApiResponseHelper implements ResponseGenerator {
CapabilityResponse capabilityResponse = new CapabilityResponse();
capabilityResponse.setName(cap.getName());
capabilityResponse.setObjectName("capability");
if (cap.getName().equals(Capability.SupportedLBIsolation.getName()) ||
cap.getName().equals(Capability.SupportedSourceNatTypes.getName()) ||
cap.getName().equals(Capability.RedundantRouter.getName()) ) {
capabilityResponse.setCanChoose(true);
} else {
capabilityResponse.setCanChoose(false);
}
capabilityResponses.add(capabilityResponse);
}
response.setCapabilities(capabilityResponses);