Removed unused values from the networkOffering response

This commit is contained in:
Alena Prokharchyk 2011-12-06 14:43:56 -08:00
parent 9092765183
commit cabb02f944
5 changed files with 29 additions and 39 deletions

View File

@ -81,7 +81,7 @@ public class CreateNetworkCmd extends BaseCmd {
@Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="network domain")
private String networkDomain;
@Parameter(name=ApiConstants.ACL_TYPE, type=CommandType.STRING, description="Access control type; supported values are account and domain. If not specified, defaulted to Account in Adavnce zone, and to Domain in Basic zone. Account means that only the account owner can use the network, domain - all accouns in the domain can use the network")
@Parameter(name=ApiConstants.ACL_TYPE, type=CommandType.STRING, description="Access control type; supported values are account and domain. In 3.0 all shared networks should have aclType=Domain, and all Isolated networks - Account. Account means that only the account owner can use the network, domain - all accouns in the domain can use the network")
private String aclType;
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="account who will own the network")

View File

@ -88,7 +88,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
private Map serviceProviderList;
@Parameter(name = ApiConstants.SERVICE_CAPABILITY_LIST, type = CommandType.MAP, description = "desired service capabilities as part of network offering")
private Map serviceCapabilistList;
private Map serviceCapabilitystList;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -173,9 +173,9 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
public Map<Capability, String> getServiceCapabilities(Service service) {
Map<Capability, String> capabilityMap = null;
if (serviceCapabilistList != null && !serviceCapabilistList.isEmpty()) {
if (serviceCapabilitystList != null && !serviceCapabilitystList.isEmpty()) {
capabilityMap = new HashMap <Capability, String>();
Collection serviceCapabilityCollection = serviceCapabilistList.values();
Collection serviceCapabilityCollection = serviceCapabilitystList.values();
Iterator iter = serviceCapabilityCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> svcCapabilityMap = (HashMap<String, String>) iter.next();

View File

@ -73,15 +73,6 @@ public class NetworkOfferingResponse extends BaseResponse{
@SerializedName(ApiConstants.SERVICE) @Param(description="the list of supported services", responseObject = ServiceResponse.class)
private List<ServiceResponse> services;
@SerializedName(ApiConstants.IS_LB_SHARED) @Param(description="true if load balncer service offered is shared by multiple networks", responseObject = ServiceResponse.class)
private Boolean isLbShared;
@SerializedName(ApiConstants.IS_SOURCE_NAT_SHARED) @Param(description="true if soruce NAT service offered is shared by multiple networks", responseObject = ServiceResponse.class)
private Boolean isSourceNatShared;
@SerializedName(ApiConstants.REDUNDANT_ROUTER) @Param(description="true if gateway service offered redundant router", responseObject = ServiceResponse.class)
private Boolean isRedundantRouter;
public void setId(Long id) {
this.id.setValue(id);
}
@ -142,18 +133,6 @@ public class NetworkOfferingResponse extends BaseResponse{
this.guestIpType = type;
}
public void setIsLBShared(boolean isLbSared) {
this.isLbShared = isLbSared;
}
public void setIsSourceNatShared(boolean isSourceNatShared) {
this.isSourceNatShared = isSourceNatShared;
}
public void setIsRedundantRouter(Boolean isRedundantRouter) {
this.isRedundantRouter = isRedundantRouter;
}
public void setServiceOfferingId(Long serviceOfferingId) {
this.serviceOfferingId.setValue(serviceOfferingId);
}

View File

@ -2604,21 +2604,20 @@ public class ApiResponseHelper implements ResponseGenerator {
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>();
} else if (Service.SourceNat.getName().equalsIgnoreCase(service)) {
List<CapabilityResponse> capabilities = new ArrayList<CapabilityResponse>();
CapabilityResponse sharedSourceNat = new CapabilityResponse();
sharedSourceNat.setName(Capability.SupportedSourceNatTypes.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>();
capabilities.add(sharedSourceNat);
CapabilityResponse redundantRouter = new CapabilityResponse();
redundantRouter.setName(Capability.RedundantRouter.getName());
redundantRouter.setValue(offering.getRedundantRouter()?"true":"false");
gatewayCapResponse.add(redundantRouter);
svcRsp.setCapabilities(gatewayCapResponse);
}
capabilities.add(redundantRouter);
svcRsp.setCapabilities(capabilities);
}
serviceResponses.add(svcRsp);
}

View File

@ -1765,11 +1765,23 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
} else {
throw new InvalidParameterValueException("Incorrect aclType specified. Check the API documentation for supported types");
}
} else if (zone.getNetworkType() == NetworkType.Advanced){
aclType = ACLType.Account;
} else if (zone.getNetworkType() == NetworkType.Basic){
aclType = ACLType.Domain;
}
//In 3.0 all Shared networks should have aclType == Domain, all Isolated networks aclType==Account
if (networkOffering.getGuestType() == GuestType.Isolated) {
if (aclType != ACLType.Account) {
throw new InvalidParameterValueException("AclType should be " + ACLType.Account + " for network of type " + Network.GuestType.Isolated);
}
} else if (networkOffering.getGuestType() == GuestType.Shared) {
if (aclType != ACLType.Domain) {
throw new InvalidParameterValueException("AclType should be " + ACLType.Domain + " for network of type " + Network.GuestType.Shared);
}
}
} else {
if (networkOffering.getGuestType() == GuestType.Isolated) {
aclType = ACLType.Account;
} else if (networkOffering.getGuestType() == GuestType.Shared) {
aclType = ACLType.Domain;
}
}
// Check if the network is domain specific
if (aclType == ACLType.Domain) {