adding service capabities to network offering response

This commit is contained in:
Murali Reddy 2011-11-16 13:43:09 -08:00
parent 8f9a06fb41
commit cbc72f3ef7

View File

@ -2337,10 +2337,7 @@ public class ApiResponseHelper implements ResponseGenerator {
response.setIsDefault(offering.isDefault());
response.setSpecifyVlan(offering.getSpecifyVlan());
response.setAvailability(offering.getAvailability().toString());
response.setNetworkRate(ApiDBUtils.getNetworkRate(offering.getId()));
response.setIsLBShared(!offering.getDedicatedLB());
response.setIsSourceNatShared(offering.getSharedSourceNat());
response.setIsRedundantRouter(offering.getRedundantRouter());
response.setNetworkRate(ApiDBUtils.getNetworkRate(offering.getId()));
if (offering.getGuestType() != null) {
response.setGuestIpType(offering.getGuestType().toString());
}
@ -2359,6 +2356,30 @@ public class ApiResponseHelper implements ResponseGenerator {
providers.add(providerRsp);
}
svcRsp.setProviders(providers);
if (Service.Lb.getName().equalsIgnoreCase(service)) {
List<CapabilityResponse> lbCapResponse = new ArrayList<CapabilityResponse>();
CapabilityResponse lbIsoaltion = new CapabilityResponse();
lbIsoaltion.setName(Capability.SupportedLBIsolation.getName());
lbIsoaltion.setValue(offering.getDedicatedLB()?"dedicated":"shared");
lbCapResponse.add(lbIsoaltion);
svcRsp.setCapabilities(lbCapResponse);
} else if (Service.Firewall.getName().equalsIgnoreCase(service)) {
List<CapabilityResponse> fwCapResponse = new ArrayList<CapabilityResponse>();
CapabilityResponse sharedSourceNat = new CapabilityResponse();
sharedSourceNat.setName(Capability.SupportedLBIsolation.getName());
sharedSourceNat.setValue(offering.getSharedSourceNat()?"perzone":"peraccount");
fwCapResponse.add(sharedSourceNat);
svcRsp.setCapabilities(fwCapResponse);
} else if (Service.Gateway.getName().equalsIgnoreCase(service)) {
List<CapabilityResponse> gatewayCapResponse = new ArrayList<CapabilityResponse>();
CapabilityResponse redundantRouter = new CapabilityResponse();
redundantRouter.setName(Capability.RedundantRouter.getName());
redundantRouter.setValue(offering.getRedundantRouter()?"true":"false");
gatewayCapResponse.add(redundantRouter);
svcRsp.setCapabilities(gatewayCapResponse);
}
serviceResponses.add(svcRsp);
}
response.setServices(serviceResponses);